Thread (59 messages) read the whole thread 59 messages, 9 authors, 2008-08-29

Re: [PATCH v3] leds: implement OpenFirmare GPIO LED driver

From: Grant Likely <hidden>
Date: 2008-07-17 04:15:47
Also in: lkml

On Wed, Jul 16, 2008 at 04:18:52PM -0700, Trent Piepho wrote:
On Tue, 15 Jul 2008, Anton Vorontsov wrote:
quoted
Despite leds-gpio and leds-openfirmware-gpio similar purposes, there
is not much code can be shared between the two drivers (both are mostly
driver bindings anyway).
Why can't this driver use the existing gpio-led driver?  Basically, do
something like this:

of_gpio_leds_probe(...)
{
 	gpio = of_get_gpio(np, 0);
 	label = of_get_property(np, "label", NULL);

 	struct gpio_led led = {
 		.name = label,
 		.gpio = gpio,
 	};

 	pdev = platform_device_register_simple("leds-gpio", 0, NULL, 0);
 	platform_device_add_data(pdev, &led, sizeof(led));
}
Ugh; that means registering *2* 'struct device' with the kernel instead of
one.  One as a platform device and one as an of_platform device.
It's bad enough that the LED scheme we're using for OF bindings has a
separate registration for every single LED.

Now that it comes to it, I worry that this driver takes the wrong
approach.  The number of resources dedicated per LED in this driver
seems pretty loony to me (one of_platform device per LED).  The fact
that the binding specifies one node per LED makes of_platform not a very
efficient solution.

I think it would be better to have a module that scans the device tree
for LED nodes and registers a single leds-gpio platform device for the
whole lot.

Thoughts?

g.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help