Re: [PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device
Hi Am 06.06.23 um 09:49 schrieb Dan Carpenter: On Tue, Jun 06, 2023 at 09:24:48AM +0200, Thomas Zimmermann wrote: Hi Am 05.06.23 um 22:19 schrieb Ruhl, Michael J: -Original Message- From: dri-devel On Behalf Of Thomas Zimmermann Sent: Monday, June 5, 2023 10:48 AM To: dan...@ffwll.ch; javi...@redhat.com; s...@ravnborg.org; del...@gmx.de; geert+rene...@glider.be; l...@kernel.org; daniel.thomp...@linaro.org; jingooh...@gmail.com Cc: linux-fb...@vger.kernel.org; Rich Felker ; linux- s...@vger.kernel.org; linux-stag...@lists.linux.dev; dri- de...@lists.freedesktop.org; Thomas Zimmermann ; John Paul Adrian Glaubitz ; linux-o...@vger.kernel.org Subject: [PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device Struct gpio_backlight_platform_data refers to a platform device within the Linux device hierarchy. The test in gpio_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device. Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional. I only see a rename from fbdev to dev... Is there missing code? As Sam said, the compare operation used the wrong device from fb_info. I also changed the naming of a few fields in these backlight drivers. I could move these renames into a separate patch if that makes things easier for reviewers. Would a fixes: be useful? That would be commit 8b770e3c9824 ("backlight: Add GPIO-based backlight driver") from 2013. Maybe a bit old already, but I can surely add it. Don't add the Fixes tag to this one because it doesn't fix anything, it just renames stuff. The real fix is later? To be honest, it was kind of difficult to see where the actual fix was. Fixes tags for old code is fine... I like to know why bugs are introduced. Was it adding a feature or part of fix for something else or a cleanup? You're not the first to complain about the renaming. I'll split each backlight patch into a bug-fix and a rename patch then. The bugfix will get the Fixes tag. Best regards Thomas regards, dan carpenter -- 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) OpenPGP_signature Description: OpenPGP digital signature
Re: [PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device
On Tue, Jun 06, 2023 at 09:24:48AM +0200, Thomas Zimmermann wrote: > Hi > > Am 05.06.23 um 22:19 schrieb Ruhl, Michael J: > > > -Original Message- > > > From: dri-devel On Behalf Of > > > Thomas Zimmermann > > > Sent: Monday, June 5, 2023 10:48 AM > > > To: dan...@ffwll.ch; javi...@redhat.com; s...@ravnborg.org; > > > del...@gmx.de; geert+rene...@glider.be; l...@kernel.org; > > > daniel.thomp...@linaro.org; jingooh...@gmail.com > > > Cc: linux-fb...@vger.kernel.org; Rich Felker ; linux- > > > s...@vger.kernel.org; linux-stag...@lists.linux.dev; dri- > > > de...@lists.freedesktop.org; Thomas Zimmermann > > > ; John Paul Adrian Glaubitz > > berlin.de>; linux-o...@vger.kernel.org > > > Subject: [PATCH 02/30] backlight/gpio_backlight: Compare against struct > > > fb_info.device > > > > > > Struct gpio_backlight_platform_data refers to a platform device within > > > the Linux device hierarchy. The test in gpio_backlight_check_fb() > > > compares it against the fbdev device in struct fb_info.dev, which > > > is different. Fix the test by comparing to struct fb_info.device. > > > > > > Fixes a bug in the backlight driver and prepares fbdev for making > > > struct fb_info.dev optional. > > > > I only see a rename from fbdev to dev... > > > > Is there missing code? > > As Sam said, the compare operation used the wrong device from fb_info. > > I also changed the naming of a few fields in these backlight drivers. I > could move these renames into a separate patch if that makes things easier > for reviewers. > > > > > Would a fixes: be useful? > > That would be commit 8b770e3c9824 ("backlight: Add GPIO-based backlight > driver") from 2013. Maybe a bit old already, but I can surely add it. Don't add the Fixes tag to this one because it doesn't fix anything, it just renames stuff. The real fix is later? To be honest, it was kind of difficult to see where the actual fix was. Fixes tags for old code is fine... I like to know why bugs are introduced. Was it adding a feature or part of fix for something else or a cleanup? regards, dan carpenter
Re: [PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device
Hi Am 05.06.23 um 22:19 schrieb Ruhl, Michael J: -Original Message- From: dri-devel On Behalf Of Thomas Zimmermann Sent: Monday, June 5, 2023 10:48 AM To: dan...@ffwll.ch; javi...@redhat.com; s...@ravnborg.org; del...@gmx.de; geert+rene...@glider.be; l...@kernel.org; daniel.thomp...@linaro.org; jingooh...@gmail.com Cc: linux-fb...@vger.kernel.org; Rich Felker ; linux- s...@vger.kernel.org; linux-stag...@lists.linux.dev; dri- de...@lists.freedesktop.org; Thomas Zimmermann ; John Paul Adrian Glaubitz ; linux-o...@vger.kernel.org Subject: [PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device Struct gpio_backlight_platform_data refers to a platform device within the Linux device hierarchy. The test in gpio_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device. Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional. I only see a rename from fbdev to dev... Is there missing code? As Sam said, the compare operation used the wrong device from fb_info. I also changed the naming of a few fields in these backlight drivers. I could move these renames into a separate patch if that makes things easier for reviewers. Would a fixes: be useful? That would be commit 8b770e3c9824 ("backlight: Add GPIO-based backlight driver") from 2013. Maybe a bit old already, but I can surely add it. Best regards Thomas M Signed-off-by: Thomas Zimmermann Cc: Rich Felker Cc: John Paul Adrian Glaubitz Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: linux...@vger.kernel.org --- arch/sh/boards/mach-ecovec24/setup.c | 2 +- drivers/video/backlight/gpio_backlight.c | 6 +++--- include/linux/platform_data/gpio_backlight.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach- ecovec24/setup.c index 674da7ebd8b7..310513646c9b 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -386,7 +386,7 @@ static struct property_entry gpio_backlight_props[] = { }; static struct gpio_backlight_platform_data gpio_backlight_data = { - .fbdev = _device.dev, + .dev = _device.dev, }; static const struct platform_device_info gpio_backlight_device_info = { diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 6f78d928f054..d3bea42407f1 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -17,7 +17,7 @@ #include struct gpio_backlight { - struct device *fbdev; + struct device *dev; struct gpio_desc *gpiod; }; @@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struct backlight_device *bl, { struct gpio_backlight *gbl = bl_get_data(bl); - return gbl->fbdev == NULL || gbl->fbdev == info->dev; + return !gbl->dev || gbl->dev == info->device; } static const struct backlight_ops gpio_backlight_ops = { @@ -59,7 +59,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) return -ENOMEM; if (pdata) - gbl->fbdev = pdata->fbdev; + gbl->dev = pdata->dev; def_value = device_property_read_bool(dev, "default-on"); diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h index 1a8b5b1946fe..323fbf5f7613 100644 --- a/include/linux/platform_data/gpio_backlight.h +++ b/include/linux/platform_data/gpio_backlight.h @@ -8,7 +8,7 @@ struct device; struct gpio_backlight_platform_data { - struct device *fbdev; + struct device *dev; }; #endif -- 2.40.1 -- 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) OpenPGP_signature Description: OpenPGP digital signature
RE: [PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device
>-Original Message- >From: Sam Ravnborg >Sent: Monday, June 5, 2023 4:23 PM >To: Ruhl, Michael J >Cc: Thomas Zimmermann ; dan...@ffwll.ch; >javi...@redhat.com; del...@gmx.de; geert+rene...@glider.be; >l...@kernel.org; daniel.thomp...@linaro.org; jingooh...@gmail.com; linux- >fb...@vger.kernel.org; Rich Felker ; linux- >s...@vger.kernel.org; linux-stag...@lists.linux.dev; dri- >de...@lists.freedesktop.org; John Paul Adrian Glaubitz berlin.de>; linux-o...@vger.kernel.org >Subject: Re: [PATCH 02/30] backlight/gpio_backlight: Compare against struct >fb_info.device > >Hi Michael. > >> > >> >Fixes a bug in the backlight driver and prepares fbdev for making >> >struct fb_info.dev optional. >> >> I only see a rename from fbdev to dev... >> >> Is there missing code? >> >> Would a fixes: be useful? >> >> M >> >> >@@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struct >> >backlight_device *bl, >> > { >> >struct gpio_backlight *gbl = bl_get_data(bl); >> > >> >- return gbl->fbdev == NULL || gbl->fbdev == info->dev; >> >+ return !gbl->dev || gbl->dev == info->device; >> > } > >The real change is here where info->dev is replaced by info->device. Yeah, after a few patches, I was getting the idea that the name was the bug. Thanks, M > Sam
Re: [PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device
Hi Michael. > > > >Fixes a bug in the backlight driver and prepares fbdev for making > >struct fb_info.dev optional. > > I only see a rename from fbdev to dev... > > Is there missing code? > > Would a fixes: be useful? > > M > > >@@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struct > >backlight_device *bl, > > { > > struct gpio_backlight *gbl = bl_get_data(bl); > > > >-return gbl->fbdev == NULL || gbl->fbdev == info->dev; > >+return !gbl->dev || gbl->dev == info->device; > > } The real change is here where info->dev is replaced by info->device. Sam
RE: [PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device
>-Original Message- >From: dri-devel On Behalf Of >Thomas Zimmermann >Sent: Monday, June 5, 2023 10:48 AM >To: dan...@ffwll.ch; javi...@redhat.com; s...@ravnborg.org; >del...@gmx.de; geert+rene...@glider.be; l...@kernel.org; >daniel.thomp...@linaro.org; jingooh...@gmail.com >Cc: linux-fb...@vger.kernel.org; Rich Felker ; linux- >s...@vger.kernel.org; linux-stag...@lists.linux.dev; dri- >de...@lists.freedesktop.org; Thomas Zimmermann >; John Paul Adrian Glaubitz berlin.de>; linux-o...@vger.kernel.org >Subject: [PATCH 02/30] backlight/gpio_backlight: Compare against struct >fb_info.device > >Struct gpio_backlight_platform_data refers to a platform device within >the Linux device hierarchy. The test in gpio_backlight_check_fb() >compares it against the fbdev device in struct fb_info.dev, which >is different. Fix the test by comparing to struct fb_info.device. > >Fixes a bug in the backlight driver and prepares fbdev for making >struct fb_info.dev optional. I only see a rename from fbdev to dev... Is there missing code? Would a fixes: be useful? M >Signed-off-by: Thomas Zimmermann >Cc: Rich Felker >Cc: John Paul Adrian Glaubitz >Cc: Lee Jones >Cc: Daniel Thompson >Cc: Jingoo Han >Cc: linux...@vger.kernel.org >--- > arch/sh/boards/mach-ecovec24/setup.c | 2 +- > drivers/video/backlight/gpio_backlight.c | 6 +++--- > include/linux/platform_data/gpio_backlight.h | 2 +- > 3 files changed, 5 insertions(+), 5 deletions(-) > >diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach- >ecovec24/setup.c >index 674da7ebd8b7..310513646c9b 100644 >--- a/arch/sh/boards/mach-ecovec24/setup.c >+++ b/arch/sh/boards/mach-ecovec24/setup.c >@@ -386,7 +386,7 @@ static struct property_entry gpio_backlight_props[] = { > }; > > static struct gpio_backlight_platform_data gpio_backlight_data = { >- .fbdev = _device.dev, >+ .dev = _device.dev, > }; > > static const struct platform_device_info gpio_backlight_device_info = { >diff --git a/drivers/video/backlight/gpio_backlight.c >b/drivers/video/backlight/gpio_backlight.c >index 6f78d928f054..d3bea42407f1 100644 >--- a/drivers/video/backlight/gpio_backlight.c >+++ b/drivers/video/backlight/gpio_backlight.c >@@ -17,7 +17,7 @@ > #include > > struct gpio_backlight { >- struct device *fbdev; >+ struct device *dev; > struct gpio_desc *gpiod; > }; > >@@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struct >backlight_device *bl, > { > struct gpio_backlight *gbl = bl_get_data(bl); > >- return gbl->fbdev == NULL || gbl->fbdev == info->dev; >+ return !gbl->dev || gbl->dev == info->device; > } > > static const struct backlight_ops gpio_backlight_ops = { >@@ -59,7 +59,7 @@ static int gpio_backlight_probe(struct platform_device >*pdev) > return -ENOMEM; > > if (pdata) >- gbl->fbdev = pdata->fbdev; >+ gbl->dev = pdata->dev; > > def_value = device_property_read_bool(dev, "default-on"); > >diff --git a/include/linux/platform_data/gpio_backlight.h >b/include/linux/platform_data/gpio_backlight.h >index 1a8b5b1946fe..323fbf5f7613 100644 >--- a/include/linux/platform_data/gpio_backlight.h >+++ b/include/linux/platform_data/gpio_backlight.h >@@ -8,7 +8,7 @@ > struct device; > > struct gpio_backlight_platform_data { >- struct device *fbdev; >+ struct device *dev; > }; > > #endif >-- >2.40.1
[PATCH 02/30] backlight/gpio_backlight: Compare against struct fb_info.device
Struct gpio_backlight_platform_data refers to a platform device within the Linux device hierarchy. The test in gpio_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device. Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional. Signed-off-by: Thomas Zimmermann Cc: Rich Felker Cc: John Paul Adrian Glaubitz Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: linux...@vger.kernel.org --- arch/sh/boards/mach-ecovec24/setup.c | 2 +- drivers/video/backlight/gpio_backlight.c | 6 +++--- include/linux/platform_data/gpio_backlight.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index 674da7ebd8b7..310513646c9b 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c @@ -386,7 +386,7 @@ static struct property_entry gpio_backlight_props[] = { }; static struct gpio_backlight_platform_data gpio_backlight_data = { - .fbdev = _device.dev, + .dev = _device.dev, }; static const struct platform_device_info gpio_backlight_device_info = { diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 6f78d928f054..d3bea42407f1 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -17,7 +17,7 @@ #include struct gpio_backlight { - struct device *fbdev; + struct device *dev; struct gpio_desc *gpiod; }; @@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struct backlight_device *bl, { struct gpio_backlight *gbl = bl_get_data(bl); - return gbl->fbdev == NULL || gbl->fbdev == info->dev; + return !gbl->dev || gbl->dev == info->device; } static const struct backlight_ops gpio_backlight_ops = { @@ -59,7 +59,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) return -ENOMEM; if (pdata) - gbl->fbdev = pdata->fbdev; + gbl->dev = pdata->dev; def_value = device_property_read_bool(dev, "default-on"); diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h index 1a8b5b1946fe..323fbf5f7613 100644 --- a/include/linux/platform_data/gpio_backlight.h +++ b/include/linux/platform_data/gpio_backlight.h @@ -8,7 +8,7 @@ struct device; struct gpio_backlight_platform_data { - struct device *fbdev; + struct device *dev; }; #endif -- 2.40.1