All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] leds: Ensure hardware blinking turns off when requested
@ 2022-05-20 17:11 Eddie James
  2022-09-06 20:47 ` Eddie James
  2023-04-05 16:25 ` Eddie James
  0 siblings, 2 replies; 4+ messages in thread
From: Eddie James @ 2022-05-20 17:11 UTC (permalink / raw)
  To: pavel; +Cc: linux-leds, linux-kernel, eajames

If an LED is blinking through the hardware and the trigger is deactivated,
the driver will set the brightness to 0 to disable blinking. However, if
the LED driver doesn't support non-blocking operations, the request for
setting brightness to 0 will get queued. Then if a user requests a new
non-zero brightness before the request for 0 brightness is executed, the
LED blinking will not get disabled since the brightness will simply be
updated.
Fix this by flushing the workqueue before updating the requested
brightness.

Fixes: 4d71a4a12b13 ("leds: Add support for setting brightness in a synchronous way")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
 drivers/leds/led-class.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 6a8ea94834fa..861a1cb5df5b 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -55,6 +55,8 @@ static ssize_t brightness_store(struct device *dev,
 
 	if (state == LED_OFF)
 		led_trigger_remove(led_cdev);
+	/* flush out any request to disable blinking */
+	flush_work(&led_cdev->set_brightness_work);
 	led_set_brightness(led_cdev, state);
 	flush_work(&led_cdev->set_brightness_work);
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: Ensure hardware blinking turns off when requested
  2022-05-20 17:11 [PATCH] leds: Ensure hardware blinking turns off when requested Eddie James
@ 2022-09-06 20:47 ` Eddie James
  2023-04-05 16:25 ` Eddie James
  1 sibling, 0 replies; 4+ messages in thread
From: Eddie James @ 2022-09-06 20:47 UTC (permalink / raw)
  To: pavel; +Cc: linux-leds, linux-kernel

Any update on this?


Thanks,

Eddie


On 5/20/22 12:11, Eddie James wrote:
> If an LED is blinking through the hardware and the trigger is deactivated,
> the driver will set the brightness to 0 to disable blinking. However, if
> the LED driver doesn't support non-blocking operations, the request for
> setting brightness to 0 will get queued. Then if a user requests a new
> non-zero brightness before the request for 0 brightness is executed, the
> LED blinking will not get disabled since the brightness will simply be
> updated.
> Fix this by flushing the workqueue before updating the requested
> brightness.
>
> Fixes: 4d71a4a12b13 ("leds: Add support for setting brightness in a synchronous way")
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
>   drivers/leds/led-class.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 6a8ea94834fa..861a1cb5df5b 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -55,6 +55,8 @@ static ssize_t brightness_store(struct device *dev,
>   
>   	if (state == LED_OFF)
>   		led_trigger_remove(led_cdev);
> +	/* flush out any request to disable blinking */
> +	flush_work(&led_cdev->set_brightness_work);
>   	led_set_brightness(led_cdev, state);
>   	flush_work(&led_cdev->set_brightness_work);
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: Ensure hardware blinking turns off when requested
  2022-05-20 17:11 [PATCH] leds: Ensure hardware blinking turns off when requested Eddie James
  2022-09-06 20:47 ` Eddie James
@ 2023-04-05 16:25 ` Eddie James
  2023-04-05 16:44   ` Lee Jones
  1 sibling, 1 reply; 4+ messages in thread
From: Eddie James @ 2023-04-05 16:25 UTC (permalink / raw)
  To: pavel; +Cc: linux-leds, linux-kernel


On 5/20/22 12:11, Eddie James wrote:
> If an LED is blinking through the hardware and the trigger is deactivated,
> the driver will set the brightness to 0 to disable blinking. However, if
> the LED driver doesn't support non-blocking operations, the request for
> setting brightness to 0 will get queued. Then if a user requests a new
> non-zero brightness before the request for 0 brightness is executed, the
> LED blinking will not get disabled since the brightness will simply be
> updated.
> Fix this by flushing the workqueue before updating the requested
> brightness.


I just realized this never made it anywhere. Pavel, any thoughts?


Thanks,

Eddie


>
> Fixes: 4d71a4a12b13 ("leds: Add support for setting brightness in a synchronous way")
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
>   drivers/leds/led-class.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 6a8ea94834fa..861a1cb5df5b 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -55,6 +55,8 @@ static ssize_t brightness_store(struct device *dev,
>   
>   	if (state == LED_OFF)
>   		led_trigger_remove(led_cdev);
> +	/* flush out any request to disable blinking */
> +	flush_work(&led_cdev->set_brightness_work);
>   	led_set_brightness(led_cdev, state);
>   	flush_work(&led_cdev->set_brightness_work);
>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] leds: Ensure hardware blinking turns off when requested
  2023-04-05 16:25 ` Eddie James
@ 2023-04-05 16:44   ` Lee Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2023-04-05 16:44 UTC (permalink / raw)
  To: Eddie James; +Cc: pavel, linux-leds, linux-kernel

Apologies for any chaos this may cause, I'm replying from Gmail since
this doesn't appear to be in my inbox.

On Wed, 5 Apr 2023 at 17:26, Eddie James <eajames@linux.ibm.com> wrote:
>
>
> On 5/20/22 12:11, Eddie James wrote:
> > If an LED is blinking through the hardware and the trigger is deactivated,
> > the driver will set the brightness to 0 to disable blinking. However, if
> > the LED driver doesn't support non-blocking operations, the request for
> > setting brightness to 0 will get queued. Then if a user requests a new
> > non-zero brightness before the request for 0 brightness is executed, the
> > LED blinking will not get disabled since the brightness will simply be
> > updated.
> > Fix this by flushing the workqueue before updating the requested
> > brightness.
>
>
> I just realized this never made it anywhere. Pavel, any thoughts?

Submit a [RESEND] please.

Also, please ensure you re-run get_maintainer.pl before doing so.

> > Fixes: 4d71a4a12b13 ("leds: Add support for setting brightness in a synchronous way")
> > Signed-off-by: Eddie James <eajames@linux.ibm.com>
> > ---
> >   drivers/leds/led-class.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> > index 6a8ea94834fa..861a1cb5df5b 100644
> > --- a/drivers/leds/led-class.c
> > +++ b/drivers/leds/led-class.c
> > @@ -55,6 +55,8 @@ static ssize_t brightness_store(struct device *dev,
> >
> >       if (state == LED_OFF)
> >               led_trigger_remove(led_cdev);
> > +     /* flush out any request to disable blinking */
> > +     flush_work(&led_cdev->set_brightness_work);
> >       led_set_brightness(led_cdev, state);
> >       flush_work(&led_cdev->set_brightness_work);
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-05 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 17:11 [PATCH] leds: Ensure hardware blinking turns off when requested Eddie James
2022-09-06 20:47 ` Eddie James
2023-04-05 16:25 ` Eddie James
2023-04-05 16:44   ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.