Signed-off-by: Dmitry Baryshkov <[email protected]>
---
drivers/leds/led-triggers.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 0f242b3..f910eaf 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -111,16 +111,17 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger)
flags);
if (led_cdev->trigger->deactivate)
led_cdev->trigger->deactivate(led_cdev);
+ led_cdev->trigger = NULL;
led_set_brightness(led_cdev, LED_OFF);
}
if (trigger) {
write_lock_irqsave(&trigger->leddev_list_lock, flags);
list_add_tail(&led_cdev->trig_list, &trigger->led_cdevs);
write_unlock_irqrestore(&trigger->leddev_list_lock, flags);
+ led_cdev->trigger = trigger;
if (trigger->activate)
trigger->activate(led_cdev);
}
- led_cdev->trigger = trigger;
}
EXPORT_SYMBOL_GPL(led_trigger_set);
--
1.5.5.3
--
With best wishes
Dmitry
Hi,
On Thu, Jun 19, 2008 at 03:48:47PM +0400, Dmitry Baryshkov wrote:
> Signed-off-by: Dmitry Baryshkov <[email protected]>
> ---
> drivers/leds/led-triggers.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
Any comments about this?
--
With best wishes
Dmitry
On Thu, 19 Jun 2008 15:48:47 +0400
Dmitry Baryshkov <[email protected]> wrote:
> Signed-off-by: Dmitry Baryshkov <[email protected]>
> ---
> drivers/leds/led-triggers.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
> index 0f242b3..f910eaf 100644
> --- a/drivers/leds/led-triggers.c
> +++ b/drivers/leds/led-triggers.c
> @@ -111,16 +111,17 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger)
> flags);
> if (led_cdev->trigger->deactivate)
> led_cdev->trigger->deactivate(led_cdev);
> + led_cdev->trigger = NULL;
> led_set_brightness(led_cdev, LED_OFF);
> }
> if (trigger) {
> write_lock_irqsave(&trigger->leddev_list_lock, flags);
> list_add_tail(&led_cdev->trig_list, &trigger->led_cdevs);
> write_unlock_irqrestore(&trigger->leddev_list_lock, flags);
> + led_cdev->trigger = trigger;
> if (trigger->activate)
> trigger->activate(led_cdev);
> }
> - led_cdev->trigger = trigger;
> }
> EXPORT_SYMBOL_GPL(led_trigger_set);
>
The changelog tells us what the patch does, but it doesn't tell us
why it does it.
This matters. For a start, there is no way in which I (at least)
am able to determine whether this change is needed in 2.6.26 nor
in 2.6.25.x.
On Tue, Jun 24, 2008 at 02:02:35PM -0700, Andrew Morton wrote:
>
> The changelog tells us what the patch does, but it doesn't tell us
> why it does it.
>
> This matters. For a start, there is no way in which I (at least)
> am able to determine whether this change is needed in 2.6.26 nor
> in 2.6.25.x.
I hope this is better. This isn't an 2.6.25.x material. And probably not
an 2.6.26.
>From 4ce3598c6ce5e6b529a05432b18996a99cc5bf0d Mon Sep 17 00:00:00 2001
From: Dmitry Baryshkov <[email protected]>
Date: Wed, 25 Jun 2008 13:48:07 +0400
Subject: [PATCH] leds: make sure led->trigger is valid before calling trigger->activate
This is necessary if one wants to use the led->trigger field during
trigger activation for a led (e.g. to set up the state of the led).
No current drivers depend on this.
Signed-off-by: Dmitry Baryshkov <[email protected]>
---
drivers/leds/led-triggers.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 0f242b3..f910eaf 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -111,16 +111,17 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger)
flags);
if (led_cdev->trigger->deactivate)
led_cdev->trigger->deactivate(led_cdev);
+ led_cdev->trigger = NULL;
led_set_brightness(led_cdev, LED_OFF);
}
if (trigger) {
write_lock_irqsave(&trigger->leddev_list_lock, flags);
list_add_tail(&led_cdev->trig_list, &trigger->led_cdevs);
write_unlock_irqrestore(&trigger->leddev_list_lock, flags);
+ led_cdev->trigger = trigger;
if (trigger->activate)
trigger->activate(led_cdev);
}
- led_cdev->trigger = trigger;
}
EXPORT_SYMBOL_GPL(led_trigger_set);
--
1.5.5.4
--
With best wishes
Dmitry
On Wed, 2008-06-25 at 13:50 +0400, Dmitry Baryshkov wrote:
> On Tue, Jun 24, 2008 at 02:02:35PM -0700, Andrew Morton wrote:
> >
> > The changelog tells us what the patch does, but it doesn't tell us
> > why it does it.
> >
> > This matters. For a start, there is no way in which I (at least)
> > am able to determine whether this change is needed in 2.6.26 nor
> > in 2.6.25.x.
>
> I hope this is better. This isn't an 2.6.25.x material. And probably not
> an 2.6.26.
>
> From 4ce3598c6ce5e6b529a05432b18996a99cc5bf0d Mon Sep 17 00:00:00 2001
> From: Dmitry Baryshkov <[email protected]>
> Date: Wed, 25 Jun 2008 13:48:07 +0400
> Subject: [PATCH] leds: make sure led->trigger is valid before calling trigger->activate
>
> This is necessary if one wants to use the led->trigger field during
> trigger activation for a led (e.g. to set up the state of the led).
> No current drivers depend on this.
I seem to remember actively making the code work the way it does when I
originally wrote it, what I can't remember is why I did that :/.
Anyhow, I have no objections to the change and will probably queue it
for the next merge window, its post 2.6.26 material.
Cheers,
Richard