Re: [PATCH v2 01/38] backlight/bd6107: Compare against struct fb_info.device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

Am 12.06.23 um 17:17 schrieb Ruhl, Michael J:
[...]

Thomas,

Looking at the fb.h file I see:

	struct device *device;		/* This is the parent */
	struct device *dev;		/* This is this fb device */

Is this documentation "correct"?  If so, how does that match what you are doing here?

The comments are correct. Let's go through what's happening here.

The field 'device' is the Linux device (platform_device, pci_dev, etc.) and 'dev' is the fbdev character device that is /dev/fb*.

We set 'device' where we allocate the fb_info in framebuffer_alloc()

https://elixir.bootlin.com/linux/v6.3/source/drivers/video/fbdev/core/fbsysfs.c#L57

and we set 'dev' when we register the chrdev within register_framebuffer().

https://elixir.bootlin.com/linux/v6.3/source/drivers/video/fbdev/core/fbmem.c#L1555

(And the point of this patch series is to make the chrdev optional.)

The problem with bd6107 is that is misses the part where it registers the platform device. The driver appears to be unused.

But gpio_backlight from patches 3 and 4 works. The architecture code sets the 'fbdev' field from a platform-device structure at

https://elixir.bootlin.com/linux/v6.3/source/arch/sh/boards/mach-ecovec24/setup.c#L389

and later creates the platform device as part of

https://elixir.bootlin.com/linux/v6.3/source/arch/sh/boards/mach-ecovec24/setup.c#L1483

It will be used with the sh-mobile fbdev driver and become the 'device' field there.

In the backlight code, the gpio_backlight driver copies the fbdev field at

https://elixir.bootlin.com/linux/v6.3/source/drivers/video/backlight/gpio_backlight.c#L62

to later use it incorrectly in .check_fb. Hence, the helper has to compare the platform device to the 'device' field, not the 'dev' field; which is being fixed by this patchset.

The two other drivers, bd6107 and lv5207lp, have the same bug.

Best regards
Thomas



Thanks,

M

}

static const struct backlight_ops bd6107_backlight_ops = {
--
2.41.0


--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux