From: Andy Shevchenko <andy@kernel.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Pavel Machek" <pavel@ucw.cz>, "Lee Jones" <lee@kernel.org>,
"Kate Hsuan" <hpa@redhat.com>,
"Sebastian Reichel" <sre@kernel.org>,
platform-driver-x86@vger.kernel.org,
"André Apitzsch" <git@apitzsch.eu>,
linux-leds@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 3/3] power: supply: power-supply-leds: Add activate() callback to triggers
Date: Fri, 10 May 2024 23:07:30 +0300 [thread overview]
Message-ID: <Zj5-gmaS4-IglyW4@smile.fi.intel.com> (raw)
In-Reply-To: <20240510194012.138192-4-hdegoede@redhat.com>
On Fri, May 10, 2024 at 09:40:12PM +0200, Hans de Goede wrote:
> Add an activate() callback to the power-supply LED triggers so that
> the LED being activated will properly reflect the current power-supply
> state for power-supply devices which are already fully registered
> when the trigger gets activated.
>
> This fixes e.g. wrong LED state (1) when the LED gets registered
> after the power-supply device.
>
> 1) Until the psy driver has a reason to call power_supply_changed()
> which may take quite a while
...
> +static int power_supply_led_trigger_activate(struct led_classdev *led_cdev)
> +{
> + struct power_supply_led_trigger *psy_trig =
> + container_of(led_cdev->trigger, struct power_supply_led_trigger, trig);
Second time same container_of(), perhaps a helper [macro]?
> + /* Sync current power-supply state to LED being activated */
> + power_supply_update_leds(psy_trig->psy);
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-05-10 20:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 19:40 [PATCH 0/3] power: supply: power-supply-leds: Add activate() callback to triggers Hans de Goede
2024-05-10 19:40 ` [PATCH 1/3] power: supply: power-supply-leds: Add power_supply_[un]register_led_trigger() Hans de Goede
2024-05-10 20:04 ` Andy Shevchenko
2024-05-31 12:25 ` Hans de Goede
2024-05-10 19:40 ` [PATCH 2/3] power: supply: power-supply-leds: Share trig pointer for online and charging_full Hans de Goede
2024-05-10 19:40 ` [PATCH 3/3] power: supply: power-supply-leds: Add activate() callback to triggers Hans de Goede
2024-05-10 20:07 ` Andy Shevchenko [this message]
2024-05-31 13:21 ` Hans de Goede
2024-05-27 21:37 ` [PATCH 0/3] " Sebastian Reichel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zj5-gmaS4-IglyW4@smile.fi.intel.com \
--to=andy@kernel.org \
--cc=git@apitzsch.eu \
--cc=hdegoede@redhat.com \
--cc=hpa@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).