[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK5ve-LY1iw7CanrMSZ0PtK=Fk9Au9tXnmaOuZ5P7vnP+5VAgA@mail.gmail.com>
Date: Wed, 25 Jul 2012 14:11:30 +0800
From: Bryan Wu <bryan.wu@...onical.com>
To: Colin Cross <ccross@...roid.com>
Cc: linux-kernel@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>,
Henrique de Moraes Holschuh <hmh@....eng.br>,
Richard Purdie <rpurdie@...ys.net>, linux-leds@...r.kernel.org
Subject: Re: [PATCH] leds: triggers: send uevent when changing triggers
On Wed, Jul 25, 2012 at 8:32 AM, Colin Cross <ccross@...roid.com> wrote:
> Some triggers create sysfs files when they are enabled. Send a uevent
> "change" notification whenever the trigger is changed to allow userspace
> processes such as udev to modify permissions on the new files.
>
This looks like an workaround only for led trigger, can we fix this in
sysfs level?
Thanks,
-Bryan
> Signed-off-by: Colin Cross <ccross@...roid.com>
> ---
> drivers/leds/led-triggers.c | 13 +++++++++++++
> 1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
> index 46b4c76..a85ce09 100644
> --- a/drivers/leds/led-triggers.c
> +++ b/drivers/leds/led-triggers.c
> @@ -102,6 +102,12 @@ ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr,
> void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger)
> {
> unsigned long flags;
> + char *event = NULL;
> + char *envp[2];
> + const char *name;
> +
> + name = trigger ? trigger->name : "none";
> + event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);
>
> /* Remove any existing trigger */
> if (led_cdev->trigger) {
> @@ -122,6 +128,13 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger)
> if (trigger->activate)
> trigger->activate(led_cdev);
> }
> +
> + if (event) {
> + envp[0] = event;
> + envp[1] = NULL;
> + kobject_uevent_env(&led_cdev->dev->kobj, KOBJ_CHANGE, envp);
> + kfree(event);
> + }
> }
> EXPORT_SYMBOL_GPL(led_trigger_set);
>
> --
> 1.7.7.3
>
--
Bryan Wu <bryan.wu@...onical.com>
Kernel Developer +86.186-168-78255 Mobile
Canonical Ltd. www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists