[PATCH 3/6] fbcon: Set rotate_font callback with related callbacks

Thomas Zimmermann posted 6 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH 3/6] fbcon: Set rotate_font callback with related callbacks
Posted by Thomas Zimmermann 1 month, 2 weeks ago
The field struct fbcon.rotate_font points to fbcon_rotate_font() if
the console is rotated. Set the callback in the same place as the other
callbacks. Prepares for declaring all fbcon callbacks in a dedicated
struct type.

If not rotated, fbcon_set_bitops() still clears the callback to NULL.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fbcon_ccw.c    | 1 +
 drivers/video/fbdev/core/fbcon_cw.c     | 1 +
 drivers/video/fbdev/core/fbcon_rotate.c | 4 +---
 drivers/video/fbdev/core/fbcon_rotate.h | 2 ++
 drivers/video/fbdev/core/fbcon_ud.c     | 1 +
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c
index 0f47eb4a792d..4c1a40864e84 100644
--- a/drivers/video/fbdev/core/fbcon_ccw.c
+++ b/drivers/video/fbdev/core/fbcon_ccw.c
@@ -398,4 +398,5 @@ void fbcon_rotate_ccw(struct fbcon *confb)
 	confb->clear_margins = ccw_clear_margins;
 	confb->cursor = ccw_cursor;
 	confb->update_start = ccw_update_start;
+	confb->rotate_font = fbcon_rotate_font;
 }
diff --git a/drivers/video/fbdev/core/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c
index 9d9cd316b74f..ac3af039fe4a 100644
--- a/drivers/video/fbdev/core/fbcon_cw.c
+++ b/drivers/video/fbdev/core/fbcon_cw.c
@@ -381,4 +381,5 @@ void fbcon_rotate_cw(struct fbcon *confb)
 	confb->clear_margins = cw_clear_margins;
 	confb->cursor = cw_cursor;
 	confb->update_start = cw_update_start;
+	confb->rotate_font = fbcon_rotate_font;
 }
diff --git a/drivers/video/fbdev/core/fbcon_rotate.c b/drivers/video/fbdev/core/fbcon_rotate.c
index acf8e72ae00b..8100d6f28e70 100644
--- a/drivers/video/fbdev/core/fbcon_rotate.c
+++ b/drivers/video/fbdev/core/fbcon_rotate.c
@@ -18,7 +18,7 @@
 #include "fbcon.h"
 #include "fbcon_rotate.h"
 
-static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc)
+int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc)
 {
 	struct fbcon *confb = info->fbcon_par;
 	int len, err = 0;
@@ -95,8 +95,6 @@ static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc)
 
 void fbcon_set_rotate(struct fbcon *confb)
 {
-	confb->rotate_font = fbcon_rotate_font;
-
 	switch (confb->rotate) {
 	case FB_ROTATE_CW:
 		fbcon_rotate_cw(confb);
diff --git a/drivers/video/fbdev/core/fbcon_rotate.h b/drivers/video/fbdev/core/fbcon_rotate.h
index 5909513bd7b4..c378687dd09d 100644
--- a/drivers/video/fbdev/core/fbcon_rotate.h
+++ b/drivers/video/fbdev/core/fbcon_rotate.h
@@ -90,6 +90,8 @@ static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height)
 	}
 }
 
+int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc);
+
 extern void fbcon_rotate_cw(struct fbcon *confb);
 extern void fbcon_rotate_ud(struct fbcon *confb);
 extern void fbcon_rotate_ccw(struct fbcon *confb);
diff --git a/drivers/video/fbdev/core/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c
index b0ab9babf639..74e1331fae33 100644
--- a/drivers/video/fbdev/core/fbcon_ud.c
+++ b/drivers/video/fbdev/core/fbcon_ud.c
@@ -425,4 +425,5 @@ void fbcon_rotate_ud(struct fbcon *confb)
 	confb->clear_margins = ud_clear_margins;
 	confb->cursor = ud_cursor;
 	confb->update_start = ud_update_start;
+	confb->rotate_font = fbcon_rotate_font;
 }
-- 
2.50.1
Re: [PATCH 3/6] fbcon: Set rotate_font callback with related callbacks
Posted by Sam Ravnborg 4 weeks ago
On Mon, Aug 18, 2025 at 12:36:38PM +0200, Thomas Zimmermann wrote:
> The field struct fbcon.rotate_font points to fbcon_rotate_font() if
> the console is rotated. Set the callback in the same place as the other
> callbacks. Prepares for declaring all fbcon callbacks in a dedicated
> struct type.
> 
> If not rotated, fbcon_set_bitops() still clears the callback to NULL.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>