Skip to contentSkip to conversation

arch/powerpc: Resolve backlight include dependencies

PATCH In review Thomas Zimmermann 2 participants 6 messages Mar 6, 2024 – Mar 7, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover arch/powerpc: Resolve backlight include dependencies

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.

v3:
* add Fixes tag and fix typos in patch 3
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(-)
Signature · 1 line
2.44.0
#1 lore raw

PATCH v3 1/3 fbdev/chipsfb: Include <linux/backlight.h>

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

---
 drivers/video/fbdev/chipsfb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/video/fbdev/chipsfb.c +1 -0
index b80711f13df8a..b16a905588fed 100644
@@ -15,6 +15,7 @@
  */
 
 #include <linux/aperture.h>
+#include <linux/backlight.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
Signature · 1 line
2.44.0
#2 lore raw

PATCH v3 2/3 macintosh/via-pmu-backlight: Include <linux/backlight.h>

In reply to 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.

---
 drivers/macintosh/via-pmu-backlight.c | 1 +
 1 file changed, 1 insertion(+)
drivers/macintosh/via-pmu-backlight.c +1 -0
index c2d87e7fa85be..89450645c2305 100644
@@ -10,6 +10,7 @@
 
 #include <asm/ptrace.h>
 #include <linux/adb.h>
+#include <linux/backlight.h>
 #include <linux/pmu.h>
 #include <asm/backlight.h>
 
Signature · 1 line
2.44.0
#3 lore raw

PATCH v3 3/3 arch/powerpc: Remove <linux/fb.h> from backlight code

In reply to Thomas Zimmermann

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

v3:
* Add Fixes tag (Christophe)
* fix typos in commit message (Jani)

Fixes d565dd3b0824 ("[PATCH] powerpc: More via-pmu backlight fixes")
---
 arch/powerpc/include/asm/backlight.h        |  5 ++--
 arch/powerpc/platforms/powermac/backlight.c | 26 ---------------------
 2 files changed, 2 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/backlight.h +2 -3
index 1b5eab62ed047..061a910d74929 100644
@@ -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);
arch/powerpc/platforms/powermac/backlight.c +0 -26
index aeb79a8b3e109..12bc01353bd3c 100644
@@ -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))
Signature · 1 line
2.44.0
reviewer Acked-by on v3 3/3
#4 lore raw

Re: [PATCH v3 3/3] arch/powerpc: Remove <linux/fb.h> from backlight code

Quoted 9 lines · Thomas Zimmermann

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

v3:
* Add Fixes tag (Christophe)
* fix typos in commit message (Jani)

Quoted 7 lines
Fixes d565dd3b0824 ("[PATCH] powerpc: More via-pmu backlight fixes")
---
 arch/powerpc/include/asm/backlight.h        |  5 ++--
 arch/powerpc/platforms/powermac/backlight.c | 26 ---------------------
 2 files changed, 2 insertions(+), 29 deletions(-)

cheers

#5 lore raw
In reply to Thomas Zimmermann

If there are no further comments, I'm going to merge this patchset in time for today's PR of drm-misc-next-fixes.

Am 06.03.24 um 13:28 schrieb Thomas Zimmermann:

Quoted 27 lines

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.

v3:
* add Fixes tag and fix typos in patch 3
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(-)
Signature · 7 lines
--
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)