[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120910135535.GA2405@vandijck-laurijssen.be>
Date: Mon, 10 Sep 2012 15:55:35 +0200
From: Kurt Van Dijck <kurt.van.dijck@....be>
To: Fabio Baltieri <fabio.baltieri@...il.com>
CC: <linux-leds@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Richard Purdie <rpurdie@...ys.net>,
Bryan Wu <bryan.wu@...onical.com>
Subject: Re: [PATCH] leds: add led_trigger_rename function
Hey Fabio,
On Sun, Sep 09, 2012 at 05:27:54PM +0200, Fabio Baltieri wrote:
> Implements a led_trigger_rename() function to rename a trigger with
> proper locking.
This is the way to go.
Maybe add 'default_trigger' tests? In a later phase?
>
> This also implies that "name" in "struct led_trigger" is not const
> anymore.
IMHO, this is wrong. This forces all other led_triggers
to put their name in non-const storage.
I see 2 options here:
* let 'name' be a 'const char *', and do a typecast.
This works as long as led_trigger_rename is called only on led_triggers
with non-const 'name' storage.
* put the storage of trigger name inside struct led_trigger conditionally
(like can_dev does with their echo_skb), and when calling
led_trigger_rename(), test if 'name' points to that storage.
Maybe there are other possibilities.
The latter is the safe way to do, but takes a bit more code.
The first way is a quick one ...
Kind regards,
Kurt
--
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