Re: Backlight and LCD module patches [1]

From: Andrew Zabolotny
Date: Fri Jun 18 2004 - 00:59:02 EST


On Thu, 17 Jun 2004 15:05:10 -0700
Greg KH <greg@xxxxxxxxx> wrote:

> That function should be:
> struct lcd_device lcd_device_register(const char *name, void *devdata,
> struct lcd_properties *lp);
> instead. Then return an ERR_PTR() if you have an error.

Okay, that was the easy part. Fixed.

> > extern struct lcd_device *lcd_device_find(const char *name);
> >
> > It needs a char* argument because there's no other easy way to find the
> > correspondence between framebuffer devices and lcd/backlight devices
> > corresponding to that framebuffer device.
> Then you need to have a way to corrispond those devices together,
> becides just a name. Use the pointer that you have provided to link
> them together some way.

There's no place to stuff that pointer into, because the load order of the
framebuffer and lcd/backlight modules are not important (that's the reason for
the notification chain), and at the time l/b modules are loaded there can be
even no corresponding platform device (on my PDA for example, where platform
device is also registered from a module).

How about passing a pointer to struct dev, and a pointer to struct fbinfo to
every l/b driver and asking them if they are for this device or not? The
lcd/backlight device then could check anything they like inside the structs
and make their decision - they are bound to this fb device or not. This way,
the class_find_device() patch would not be needed anymore, and
lcd_find_device replaced instead by something like this:

struct lcd_device *lcd_device_find (struct device *ld, struct fbinfo *fb)
{
struct class_device *class_dev;
struct lcd_device *found = NULL;

down_read (&lcd_class->subsys.rwsem);
list_for_each_entry (class_dev, &lcd_class->children, node) {
struct lcd_device *ld = to_lcd_device (class_dev);
if (ld->props && (ld->props->check_device (ld, fb) == 0)) {
found = lcd_device_get (ld);
break;
}
}
up_read (&lcd_class->subsys.rwsem);

return found;
}

--
Greetings,
Andrew
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/