LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] arch/powerpc: Resolve backlight include dependencies
@ 2024-03-05  9:00 Thomas Zimmermann
  2024-03-05  9:00 ` [PATCH v2 1/3] fbdev/chipsfb: Include <linux/backlight.h> Thomas Zimmermann
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2024-03-05  9:00 UTC (permalink / raw
  To: mpe, jani.nikula, naresh.kamboju, deller, npiggin,
	christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: dri-devel, linux-fbdev, lkft-triage, linux-kernel, linuxppc-dev,
	Thomas Zimmermann

After cleaning up <linux/fb.h> in commit 11b4eedfc87d ("fbdev: Do
not include <linux/backlight.h> in header"), building with
CONFIG_PMAC_BACKLIGHT=y returns errors about missing declarations.
Patches 1 and 2 resolve the errors. Patch 1 has been reviewed at [1].
Patch 3 removes another dependency between backlight and fbdev code.

Compile tested with ppc6xx_defconfig.

v2:
	* via-pmu-backlight: fix build errors
	* powerpc: resolve dependency between fbdev and backlight

[1] https://patchwork.freedesktop.org/series/130661/

Thomas Zimmermann (3):
  fbdev/chipsfb: Include <linux/backlight.h>
  macintosh/via-pmu-backlight: Include <linux/backlight.h>
  arch/powerpc: Remove <linux/fb.h> from backlight code

 arch/powerpc/include/asm/backlight.h        |  5 ++--
 arch/powerpc/platforms/powermac/backlight.c | 26 ---------------------
 drivers/macintosh/via-pmu-backlight.c       |  1 +
 drivers/video/fbdev/chipsfb.c               |  1 +
 4 files changed, 4 insertions(+), 29 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/3] fbdev/chipsfb: Include <linux/backlight.h>
  2024-03-05  9:00 [PATCH v2 0/3] arch/powerpc: Resolve backlight include dependencies Thomas Zimmermann
@ 2024-03-05  9:00 ` Thomas Zimmermann
  2024-03-05  9:00 ` [PATCH v2 2/3] macintosh/via-pmu-backlight: " Thomas Zimmermann
  2024-03-05  9:01 ` [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code Thomas Zimmermann
  2 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2024-03-05  9:00 UTC (permalink / raw
  To: mpe, jani.nikula, naresh.kamboju, deller, npiggin,
	christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: dri-devel, linux-fbdev, lkft-triage, linux-kernel, linuxppc-dev,
	Thomas Zimmermann

Fix builds with CONFIG_PMAC_BACKLIGHT=y. The include statement for
the backlight header has recently been removed from <linux/fb.h>.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Closes: https://lore.kernel.org/dri-devel/CA+G9fYsAk5TbqqxFC2W4oHLGA0CbTHMxbeq8QayFXTU75YiueA@mail.gmail.com/
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 11b4eedfc87d ("fbdev: Do not include <linux/backlight.h> in header")
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/chipsfb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/fbdev/chipsfb.c b/drivers/video/fbdev/chipsfb.c
index b80711f13df8a..b16a905588fed 100644
--- a/drivers/video/fbdev/chipsfb.c
+++ b/drivers/video/fbdev/chipsfb.c
@@ -15,6 +15,7 @@
  */
 
 #include <linux/aperture.h>
+#include <linux/backlight.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] macintosh/via-pmu-backlight: Include <linux/backlight.h>
  2024-03-05  9:00 [PATCH v2 0/3] arch/powerpc: Resolve backlight include dependencies Thomas Zimmermann
  2024-03-05  9:00 ` [PATCH v2 1/3] fbdev/chipsfb: Include <linux/backlight.h> Thomas Zimmermann
@ 2024-03-05  9:00 ` Thomas Zimmermann
  2024-03-05  9:13   ` Jani Nikula
  2024-03-05  9:01 ` [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code Thomas Zimmermann
  2 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2024-03-05  9:00 UTC (permalink / raw
  To: mpe, jani.nikula, naresh.kamboju, deller, npiggin,
	christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: dri-devel, linux-fbdev, lkft-triage, linux-kernel, linuxppc-dev,
	Thomas Zimmermann

Fix builds with CONFIG_PMAC_BACKLIGHT=y. The include statement for the
backlight header has recently been removed from <linux/fb.h>. Add it to
via-pmu-backlight.c to get the necessary symbols.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Closes: https://lore.kernel.org/dri-devel/CA+G9fYsAk5TbqqxFC2W4oHLGA0CbTHMxbeq8QayFXTU75YiueA@mail.gmail.com/
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: 11b4eedfc87d ("fbdev: Do not include <linux/backlight.h> in header")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/macintosh/via-pmu-backlight.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
index c2d87e7fa85be..89450645c2305 100644
--- a/drivers/macintosh/via-pmu-backlight.c
+++ b/drivers/macintosh/via-pmu-backlight.c
@@ -10,6 +10,7 @@
 
 #include <asm/ptrace.h>
 #include <linux/adb.h>
+#include <linux/backlight.h>
 #include <linux/pmu.h>
 #include <asm/backlight.h>
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code
  2024-03-05  9:00 [PATCH v2 0/3] arch/powerpc: Resolve backlight include dependencies Thomas Zimmermann
  2024-03-05  9:00 ` [PATCH v2 1/3] fbdev/chipsfb: Include <linux/backlight.h> Thomas Zimmermann
  2024-03-05  9:00 ` [PATCH v2 2/3] macintosh/via-pmu-backlight: " Thomas Zimmermann
@ 2024-03-05  9:01 ` Thomas Zimmermann
  2024-03-05  9:15   ` Jani Nikula
  2024-03-05  9:25   ` Christophe Leroy
  2 siblings, 2 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2024-03-05  9:01 UTC (permalink / raw
  To: mpe, jani.nikula, naresh.kamboju, deller, npiggin,
	christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: dri-devel, linux-fbdev, lkft-triage, linux-kernel, linuxppc-dev,
	Thomas Zimmermann

Replace <linux/fb.h> with a forward declaration in <asm/backlight.h> to
resolves an unnecessary dependency. Remove pmac_backlight_curve_lookup()
and struct fb_info from source and header files. The function and the
framebuffer struct is unused. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 arch/powerpc/include/asm/backlight.h        |  5 ++--
 arch/powerpc/platforms/powermac/backlight.c | 26 ---------------------
 2 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/include/asm/backlight.h b/arch/powerpc/include/asm/backlight.h
index 1b5eab62ed047..061a910d74929 100644
--- a/arch/powerpc/include/asm/backlight.h
+++ b/arch/powerpc/include/asm/backlight.h
@@ -10,15 +10,14 @@
 #define __ASM_POWERPC_BACKLIGHT_H
 #ifdef __KERNEL__
 
-#include <linux/fb.h>
 #include <linux/mutex.h>
 
+struct backlight_device;
+
 /* For locking instructions, see the implementation file */
 extern struct backlight_device *pmac_backlight;
 extern struct mutex pmac_backlight_mutex;
 
-extern int pmac_backlight_curve_lookup(struct fb_info *info, int value);
-
 extern int pmac_has_backlight_type(const char *type);
 
 extern void pmac_backlight_key(int direction);
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
index aeb79a8b3e109..12bc01353bd3c 100644
--- a/arch/powerpc/platforms/powermac/backlight.c
+++ b/arch/powerpc/platforms/powermac/backlight.c
@@ -9,7 +9,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/fb.h>
 #include <linux/backlight.h>
 #include <linux/adb.h>
 #include <linux/pmu.h>
@@ -72,31 +71,6 @@ int pmac_has_backlight_type(const char *type)
 	return 0;
 }
 
-int pmac_backlight_curve_lookup(struct fb_info *info, int value)
-{
-	int level = (FB_BACKLIGHT_LEVELS - 1);
-
-	if (info && info->bl_dev) {
-		int i, max = 0;
-
-		/* Look for biggest value */
-		for (i = 0; i < FB_BACKLIGHT_LEVELS; i++)
-			max = max((int)info->bl_curve[i], max);
-
-		/* Look for nearest value */
-		for (i = 0; i < FB_BACKLIGHT_LEVELS; i++) {
-			int diff = abs(info->bl_curve[i] - value);
-			if (diff < max) {
-				max = diff;
-				level = i;
-			}
-		}
-
-	}
-
-	return level;
-}
-
 static void pmac_backlight_key_worker(struct work_struct *work)
 {
 	if (atomic_read(&kernel_backlight_disabled))
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/3] macintosh/via-pmu-backlight: Include <linux/backlight.h>
  2024-03-05  9:00 ` [PATCH v2 2/3] macintosh/via-pmu-backlight: " Thomas Zimmermann
@ 2024-03-05  9:13   ` Jani Nikula
  0 siblings, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2024-03-05  9:13 UTC (permalink / raw
  To: Thomas Zimmermann, mpe, naresh.kamboju, deller, npiggin,
	christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: dri-devel, linux-fbdev, lkft-triage, linux-kernel, linuxppc-dev,
	Thomas Zimmermann

On Tue, 05 Mar 2024, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Fix builds with CONFIG_PMAC_BACKLIGHT=y. The include statement for the
> backlight header has recently been removed from <linux/fb.h>. Add it to
> via-pmu-backlight.c to get the necessary symbols.
>
> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
> Closes: https://lore.kernel.org/dri-devel/CA+G9fYsAk5TbqqxFC2W4oHLGA0CbTHMxbeq8QayFXTU75YiueA@mail.gmail.com/
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: 11b4eedfc87d ("fbdev: Do not include <linux/backlight.h> in header")
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: linux-fbdev@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/macintosh/via-pmu-backlight.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
> index c2d87e7fa85be..89450645c2305 100644
> --- a/drivers/macintosh/via-pmu-backlight.c
> +++ b/drivers/macintosh/via-pmu-backlight.c
> @@ -10,6 +10,7 @@
>  
>  #include <asm/ptrace.h>
>  #include <linux/adb.h>
> +#include <linux/backlight.h>
>  #include <linux/pmu.h>
>  #include <asm/backlight.h>

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code
  2024-03-05  9:01 ` [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code Thomas Zimmermann
@ 2024-03-05  9:15   ` Jani Nikula
  2024-03-05  9:25   ` Christophe Leroy
  1 sibling, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2024-03-05  9:15 UTC (permalink / raw
  To: Thomas Zimmermann, mpe, naresh.kamboju, deller, npiggin,
	christophe.leroy, aneesh.kumar, naveen.n.rao
  Cc: dri-devel, linux-fbdev, lkft-triage, linux-kernel, linuxppc-dev,
	Thomas Zimmermann

On Tue, 05 Mar 2024, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Replace <linux/fb.h> with a forward declaration in <asm/backlight.h> to
> resolves an unnecessary dependency. Remove pmac_backlight_curve_lookup()

*resolve

> and struct fb_info from source and header files. The function and the
> framebuffer struct is unused. No functional changes.

*are

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  arch/powerpc/include/asm/backlight.h        |  5 ++--
>  arch/powerpc/platforms/powermac/backlight.c | 26 ---------------------
>  2 files changed, 2 insertions(+), 29 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/backlight.h b/arch/powerpc/include/asm/backlight.h
> index 1b5eab62ed047..061a910d74929 100644
> --- a/arch/powerpc/include/asm/backlight.h
> +++ b/arch/powerpc/include/asm/backlight.h
> @@ -10,15 +10,14 @@
>  #define __ASM_POWERPC_BACKLIGHT_H
>  #ifdef __KERNEL__
>  
> -#include <linux/fb.h>
>  #include <linux/mutex.h>
>  
> +struct backlight_device;
> +
>  /* For locking instructions, see the implementation file */
>  extern struct backlight_device *pmac_backlight;
>  extern struct mutex pmac_backlight_mutex;
>  
> -extern int pmac_backlight_curve_lookup(struct fb_info *info, int value);
> -
>  extern int pmac_has_backlight_type(const char *type);
>  
>  extern void pmac_backlight_key(int direction);
> diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
> index aeb79a8b3e109..12bc01353bd3c 100644
> --- a/arch/powerpc/platforms/powermac/backlight.c
> +++ b/arch/powerpc/platforms/powermac/backlight.c
> @@ -9,7 +9,6 @@
>   */
>  
>  #include <linux/kernel.h>
> -#include <linux/fb.h>
>  #include <linux/backlight.h>
>  #include <linux/adb.h>
>  #include <linux/pmu.h>
> @@ -72,31 +71,6 @@ int pmac_has_backlight_type(const char *type)
>  	return 0;
>  }
>  
> -int pmac_backlight_curve_lookup(struct fb_info *info, int value)
> -{
> -	int level = (FB_BACKLIGHT_LEVELS - 1);
> -
> -	if (info && info->bl_dev) {
> -		int i, max = 0;
> -
> -		/* Look for biggest value */
> -		for (i = 0; i < FB_BACKLIGHT_LEVELS; i++)
> -			max = max((int)info->bl_curve[i], max);
> -
> -		/* Look for nearest value */
> -		for (i = 0; i < FB_BACKLIGHT_LEVELS; i++) {
> -			int diff = abs(info->bl_curve[i] - value);
> -			if (diff < max) {
> -				max = diff;
> -				level = i;
> -			}
> -		}
> -
> -	}
> -
> -	return level;
> -}
> -
>  static void pmac_backlight_key_worker(struct work_struct *work)
>  {
>  	if (atomic_read(&kernel_backlight_disabled))

-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code
  2024-03-05  9:01 ` [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code Thomas Zimmermann
  2024-03-05  9:15   ` Jani Nikula
@ 2024-03-05  9:25   ` Christophe Leroy
  2024-03-05 10:04     ` Thomas Zimmermann
  1 sibling, 1 reply; 9+ messages in thread
From: Christophe Leroy @ 2024-03-05  9:25 UTC (permalink / raw
  To: Thomas Zimmermann, mpe@ellerman.id.au, jani.nikula@intel.com,
	naresh.kamboju@linaro.org, deller@gmx.de, npiggin@gmail.com,
	aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com
  Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	lkft-triage@lists.linaro.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org



Le 05/03/2024 à 10:01, Thomas Zimmermann a écrit :
> Replace <linux/fb.h> with a forward declaration in <asm/backlight.h> to
> resolves an unnecessary dependency. Remove pmac_backlight_curve_lookup()
> and struct fb_info from source and header files. The function and the
> framebuffer struct is unused. No functional changes.

When you remove pmac_backlight_curve_lookup() prototype you'll then get 
a warning/error about missing prototype when building 
arch/powerpc/platforms/powermac/backlight.c

The fonction is not used outside of that file so it should be static. 
And then it is not used in that file either so it should be removed 
completely. Indeed last use of that function was removed by commit 
d565dd3b0824 ("[PATCH] powerpc: More via-pmu backlight fixes") so the 
function can safely be removed.

Christophe

> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>   arch/powerpc/include/asm/backlight.h        |  5 ++--
>   arch/powerpc/platforms/powermac/backlight.c | 26 ---------------------
>   2 files changed, 2 insertions(+), 29 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/backlight.h b/arch/powerpc/include/asm/backlight.h
> index 1b5eab62ed047..061a910d74929 100644
> --- a/arch/powerpc/include/asm/backlight.h
> +++ b/arch/powerpc/include/asm/backlight.h
> @@ -10,15 +10,14 @@
>   #define __ASM_POWERPC_BACKLIGHT_H
>   #ifdef __KERNEL__
>   
> -#include <linux/fb.h>
>   #include <linux/mutex.h>
>   
> +struct backlight_device;
> +
>   /* For locking instructions, see the implementation file */
>   extern struct backlight_device *pmac_backlight;
>   extern struct mutex pmac_backlight_mutex;
>   
> -extern int pmac_backlight_curve_lookup(struct fb_info *info, int value);
> -
>   extern int pmac_has_backlight_type(const char *type);
>   
>   extern void pmac_backlight_key(int direction);
> diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
> index aeb79a8b3e109..12bc01353bd3c 100644
> --- a/arch/powerpc/platforms/powermac/backlight.c
> +++ b/arch/powerpc/platforms/powermac/backlight.c
> @@ -9,7 +9,6 @@
>    */
>   
>   #include <linux/kernel.h>
> -#include <linux/fb.h>
>   #include <linux/backlight.h>
>   #include <linux/adb.h>
>   #include <linux/pmu.h>
> @@ -72,31 +71,6 @@ int pmac_has_backlight_type(const char *type)
>   	return 0;
>   }
>   
> -int pmac_backlight_curve_lookup(struct fb_info *info, int value)
> -{
> -	int level = (FB_BACKLIGHT_LEVELS - 1);
> -
> -	if (info && info->bl_dev) {
> -		int i, max = 0;
> -
> -		/* Look for biggest value */
> -		for (i = 0; i < FB_BACKLIGHT_LEVELS; i++)
> -			max = max((int)info->bl_curve[i], max);
> -
> -		/* Look for nearest value */
> -		for (i = 0; i < FB_BACKLIGHT_LEVELS; i++) {
> -			int diff = abs(info->bl_curve[i] - value);
> -			if (diff < max) {
> -				max = diff;
> -				level = i;
> -			}
> -		}
> -
> -	}
> -
> -	return level;
> -}
> -
>   static void pmac_backlight_key_worker(struct work_struct *work)
>   {
>   	if (atomic_read(&kernel_backlight_disabled))

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code
  2024-03-05  9:25   ` Christophe Leroy
@ 2024-03-05 10:04     ` Thomas Zimmermann
  2024-03-05 10:06       ` Christophe Leroy
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2024-03-05 10:04 UTC (permalink / raw
  To: Christophe Leroy, mpe@ellerman.id.au, jani.nikula@intel.com,
	naresh.kamboju@linaro.org, deller@gmx.de, npiggin@gmail.com,
	aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com
  Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	lkft-triage@lists.linaro.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org

Hi

Am 05.03.24 um 10:25 schrieb Christophe Leroy:
>
> Le 05/03/2024 à 10:01, Thomas Zimmermann a écrit :
>> Replace <linux/fb.h> with a forward declaration in <asm/backlight.h> to
>> resolves an unnecessary dependency. Remove pmac_backlight_curve_lookup()
>> and struct fb_info from source and header files. The function and the
>> framebuffer struct is unused. No functional changes.
> When you remove pmac_backlight_curve_lookup() prototype you'll then get
> a warning/error about missing prototype when building
> arch/powerpc/platforms/powermac/backlight.c
>
> The fonction is not used outside of that file so it should be static.
> And then it is not used in that file either so it should be removed
> completely. Indeed last use of that function was removed by commit
> d565dd3b0824 ("[PATCH] powerpc: More via-pmu backlight fixes") so the
> function can safely be removed.

Isn't that what my patch is doing? I have no callers of the function in 
my tree (drm-tip), so I removed it entirely. Should I add a Fixes tag 
against commit d565dd3b0824? Best regards Thomas
>
> Christophe
>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
>>    arch/powerpc/include/asm/backlight.h        |  5 ++--
>>    arch/powerpc/platforms/powermac/backlight.c | 26 ---------------------
>>    2 files changed, 2 insertions(+), 29 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/backlight.h b/arch/powerpc/include/asm/backlight.h
>> index 1b5eab62ed047..061a910d74929 100644
>> --- a/arch/powerpc/include/asm/backlight.h
>> +++ b/arch/powerpc/include/asm/backlight.h
>> @@ -10,15 +10,14 @@
>>    #define __ASM_POWERPC_BACKLIGHT_H
>>    #ifdef __KERNEL__
>>    
>> -#include <linux/fb.h>
>>    #include <linux/mutex.h>
>>    
>> +struct backlight_device;
>> +
>>    /* For locking instructions, see the implementation file */
>>    extern struct backlight_device *pmac_backlight;
>>    extern struct mutex pmac_backlight_mutex;
>>    
>> -extern int pmac_backlight_curve_lookup(struct fb_info *info, int value);
>> -
>>    extern int pmac_has_backlight_type(const char *type);
>>    
>>    extern void pmac_backlight_key(int direction);
>> diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
>> index aeb79a8b3e109..12bc01353bd3c 100644
>> --- a/arch/powerpc/platforms/powermac/backlight.c
>> +++ b/arch/powerpc/platforms/powermac/backlight.c
>> @@ -9,7 +9,6 @@
>>     */
>>    
>>    #include <linux/kernel.h>
>> -#include <linux/fb.h>
>>    #include <linux/backlight.h>
>>    #include <linux/adb.h>
>>    #include <linux/pmu.h>
>> @@ -72,31 +71,6 @@ int pmac_has_backlight_type(const char *type)
>>    	return 0;
>>    }
>>    
>> -int pmac_backlight_curve_lookup(struct fb_info *info, int value)
>> -{
>> -	int level = (FB_BACKLIGHT_LEVELS - 1);
>> -
>> -	if (info && info->bl_dev) {
>> -		int i, max = 0;
>> -
>> -		/* Look for biggest value */
>> -		for (i = 0; i < FB_BACKLIGHT_LEVELS; i++)
>> -			max = max((int)info->bl_curve[i], max);
>> -
>> -		/* Look for nearest value */
>> -		for (i = 0; i < FB_BACKLIGHT_LEVELS; i++) {
>> -			int diff = abs(info->bl_curve[i] - value);
>> -			if (diff < max) {
>> -				max = diff;
>> -				level = i;
>> -			}
>> -		}
>> -
>> -	}
>> -
>> -	return level;
>> -}
>> -
>>    static void pmac_backlight_key_worker(struct work_struct *work)
>>    {
>>    	if (atomic_read(&kernel_backlight_disabled))

-- 
--
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)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code
  2024-03-05 10:04     ` Thomas Zimmermann
@ 2024-03-05 10:06       ` Christophe Leroy
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe Leroy @ 2024-03-05 10:06 UTC (permalink / raw
  To: Thomas Zimmermann, mpe@ellerman.id.au, jani.nikula@intel.com,
	naresh.kamboju@linaro.org, deller@gmx.de, npiggin@gmail.com,
	aneesh.kumar@kernel.org, naveen.n.rao@linux.ibm.com
  Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	lkft-triage@lists.linaro.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org



Le 05/03/2024 à 11:04, Thomas Zimmermann a écrit :
> Hi
> 
> Am 05.03.24 um 10:25 schrieb Christophe Leroy:
>>
>> Le 05/03/2024 à 10:01, Thomas Zimmermann a écrit :
>>> Replace <linux/fb.h> with a forward declaration in <asm/backlight.h> to
>>> resolves an unnecessary dependency. Remove pmac_backlight_curve_lookup()
>>> and struct fb_info from source and header files. The function and the
>>> framebuffer struct is unused. No functional changes.
>> When you remove pmac_backlight_curve_lookup() prototype you'll then get
>> a warning/error about missing prototype when building
>> arch/powerpc/platforms/powermac/backlight.c
>>
>> The fonction is not used outside of that file so it should be static.
>> And then it is not used in that file either so it should be removed
>> completely. Indeed last use of that function was removed by commit
>> d565dd3b0824 ("[PATCH] powerpc: More via-pmu backlight fixes") so the
>> function can safely be removed.
> 
> Isn't that what my patch is doing? I have no callers of the function in 
> my tree (drm-tip), so I removed it entirely. Should I add a Fixes tag 
> against commit d565dd3b0824? Best regards Thomas

Sorry I overlooked your patch and focussed on the removal of the 
prototype and missed the removal of the function.

Christophe

>>
>> Christophe
>>
>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> ---
>>>    arch/powerpc/include/asm/backlight.h        |  5 ++--
>>>    arch/powerpc/platforms/powermac/backlight.c | 26 
>>> ---------------------
>>>    2 files changed, 2 insertions(+), 29 deletions(-)
>>>
>>> diff --git a/arch/powerpc/include/asm/backlight.h 
>>> b/arch/powerpc/include/asm/backlight.h
>>> index 1b5eab62ed047..061a910d74929 100644
>>> --- a/arch/powerpc/include/asm/backlight.h
>>> +++ b/arch/powerpc/include/asm/backlight.h
>>> @@ -10,15 +10,14 @@
>>>    #define __ASM_POWERPC_BACKLIGHT_H
>>>    #ifdef __KERNEL__
>>> -#include <linux/fb.h>
>>>    #include <linux/mutex.h>
>>> +struct backlight_device;
>>> +
>>>    /* For locking instructions, see the implementation file */
>>>    extern struct backlight_device *pmac_backlight;
>>>    extern struct mutex pmac_backlight_mutex;
>>> -extern int pmac_backlight_curve_lookup(struct fb_info *info, int 
>>> value);
>>> -
>>>    extern int pmac_has_backlight_type(const char *type);
>>>    extern void pmac_backlight_key(int direction);
>>> diff --git a/arch/powerpc/platforms/powermac/backlight.c 
>>> b/arch/powerpc/platforms/powermac/backlight.c
>>> index aeb79a8b3e109..12bc01353bd3c 100644
>>> --- a/arch/powerpc/platforms/powermac/backlight.c
>>> +++ b/arch/powerpc/platforms/powermac/backlight.c
>>> @@ -9,7 +9,6 @@
>>>     */
>>>    #include <linux/kernel.h>
>>> -#include <linux/fb.h>
>>>    #include <linux/backlight.h>
>>>    #include <linux/adb.h>
>>>    #include <linux/pmu.h>
>>> @@ -72,31 +71,6 @@ int pmac_has_backlight_type(const char *type)
>>>        return 0;
>>>    }
>>> -int pmac_backlight_curve_lookup(struct fb_info *info, int value)
>>> -{
>>> -    int level = (FB_BACKLIGHT_LEVELS - 1);
>>> -
>>> -    if (info && info->bl_dev) {
>>> -        int i, max = 0;
>>> -
>>> -        /* Look for biggest value */
>>> -        for (i = 0; i < FB_BACKLIGHT_LEVELS; i++)
>>> -            max = max((int)info->bl_curve[i], max);
>>> -
>>> -        /* Look for nearest value */
>>> -        for (i = 0; i < FB_BACKLIGHT_LEVELS; i++) {
>>> -            int diff = abs(info->bl_curve[i] - value);
>>> -            if (diff < max) {
>>> -                max = diff;
>>> -                level = i;
>>> -            }
>>> -        }
>>> -
>>> -    }
>>> -
>>> -    return level;
>>> -}
>>> -
>>>    static void pmac_backlight_key_worker(struct work_struct *work)
>>>    {
>>>        if (atomic_read(&kernel_backlight_disabled))
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-05 10:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05  9:00 [PATCH v2 0/3] arch/powerpc: Resolve backlight include dependencies Thomas Zimmermann
2024-03-05  9:00 ` [PATCH v2 1/3] fbdev/chipsfb: Include <linux/backlight.h> Thomas Zimmermann
2024-03-05  9:00 ` [PATCH v2 2/3] macintosh/via-pmu-backlight: " Thomas Zimmermann
2024-03-05  9:13   ` Jani Nikula
2024-03-05  9:01 ` [PATCH v2 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code Thomas Zimmermann
2024-03-05  9:15   ` Jani Nikula
2024-03-05  9:25   ` Christophe Leroy
2024-03-05 10:04     ` Thomas Zimmermann
2024-03-05 10:06       ` Christophe Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).