* private field in led_classdev?
@ 2010-03-07 14:31 Samuel Thibault
2010-03-10 2:54 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2010-03-07 14:31 UTC (permalink / raw)
To: linux-kernel, lenz, rpurdie
Hello,
Would there be an objection to adding a void *private field to the
led_classdev struct? It would be a lot less burden for the input
key board leds support for finding out the keyboard device from the
brightness_set callback, as each device may have a long series of leds,
not just a fixed number of them.
Samuel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: private field in led_classdev?
2010-03-07 14:31 private field in led_classdev? Samuel Thibault
@ 2010-03-10 2:54 ` Greg KH
2010-03-10 9:44 ` Samuel Thibault
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2010-03-10 2:54 UTC (permalink / raw)
To: Samuel Thibault, linux-kernel, lenz, rpurdie
On Sun, Mar 07, 2010 at 03:31:12PM +0100, Samuel Thibault wrote:
> Hello,
>
> Would there be an objection to adding a void *private field to the
> led_classdev struct? It would be a lot less burden for the input
> key board leds support for finding out the keyboard device from the
> brightness_set callback, as each device may have a long series of leds,
> not just a fixed number of them.
What's wrong with using the private pointer in the struct device
instead? That's what it is there for.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: private field in led_classdev?
2010-03-10 2:54 ` Greg KH
@ 2010-03-10 9:44 ` Samuel Thibault
2010-03-10 11:01 ` Samuel Thibault
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2010-03-10 9:44 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel, lenz, rpurdie
Greg KH, le Tue 09 Mar 2010 18:54:11 -0800, a écrit :
> On Sun, Mar 07, 2010 at 03:31:12PM +0100, Samuel Thibault wrote:
> > Would there be an objection to adding a void *private field to the
> > led_classdev struct? It would be a lot less burden for the input
> > key board leds support for finding out the keyboard device from the
> > brightness_set callback, as each device may have a long series of leds,
> > not just a fixed number of them.
>
> What's wrong with using the private pointer in the struct device
> instead?
Ah, right. In my case there is a struct device corresponding to the
actual input device. I hadn't realized that since registering a led
creates a new device, I have another private pointer which I can use.
Samuel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: private field in led_classdev?
2010-03-10 9:44 ` Samuel Thibault
@ 2010-03-10 11:01 ` Samuel Thibault
2010-03-17 12:48 ` Richard Purdie
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2010-03-10 11:01 UTC (permalink / raw)
To: Greg KH, linux-kernel, lenz, rpurdie
Samuel Thibault, le Wed 10 Mar 2010 10:44:52 +0100, a écrit :
> Greg KH, le Tue 09 Mar 2010 18:54:11 -0800, a écrit :
> > On Sun, Mar 07, 2010 at 03:31:12PM +0100, Samuel Thibault wrote:
> > > Would there be an objection to adding a void *private field to the
> > > led_classdev struct? It would be a lot less burden for the input
> > > key board leds support for finding out the keyboard device from the
> > > brightness_set callback, as each device may have a long series of leds,
> > > not just a fixed number of them.
> >
> > What's wrong with using the private pointer in the struct device
> > instead?
>
> Ah, right. In my case there is a struct device corresponding to the
> actual input device. I hadn't realized that since registering a led
> creates a new device, I have another private pointer which I can use.
One issue, however, is that led_classdev_register() calls
led_trigger_set_default(), which eventually calls the brightness_set
hook, but the private field (platform_data) still hasn't been
initialized, so the brightness_set hook has to abort setting the initial
state. In my case, after led_classdev_register and setting
platform_data, I can call the low level function by hand, it's just not
very pretty...
Samuel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: private field in led_classdev?
2010-03-10 11:01 ` Samuel Thibault
@ 2010-03-17 12:48 ` Richard Purdie
0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2010-03-17 12:48 UTC (permalink / raw)
To: Samuel Thibault; +Cc: Greg KH, linux-kernel, lenz, rpurdie
On Wed, 2010-03-10 at 12:01 +0100, Samuel Thibault wrote:
> Samuel Thibault, le Wed 10 Mar 2010 10:44:52 +0100, a écrit :
> > Greg KH, le Tue 09 Mar 2010 18:54:11 -0800, a écrit :
> > > What's wrong with using the private pointer in the struct device
> > > instead?
> >
> > Ah, right. In my case there is a struct device corresponding to the
> > actual input device. I hadn't realized that since registering a led
> > creates a new device, I have another private pointer which I can use.
>
> One issue, however, is that led_classdev_register() calls
> led_trigger_set_default(), which eventually calls the brightness_set
> hook, but the private field (platform_data) still hasn't been
> initialized, so the brightness_set hook has to abort setting the initial
> state. In my case, after led_classdev_register and setting
> platform_data, I can call the low level function by hand, it's just not
> very pretty...
That is a bit ugly :/.
It would probably make sense to pass that parameter to
led_classdev_register() but changing references to that function
everywhere will be a pain.
I'm tempted to make led_classdev_register() a wrapper around a
led_classdev_register_drvdata() function which takes an extra parameter.
I agree using the private pointer makes sense though.
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-03-17 12:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-07 14:31 private field in led_classdev? Samuel Thibault
2010-03-10 2:54 ` Greg KH
2010-03-10 9:44 ` Samuel Thibault
2010-03-10 11:01 ` Samuel Thibault
2010-03-17 12:48 ` Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox