Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH] Staging: sm750fb: Change camelCase to snake_case
From: Michail Tatas @ 2026-05-24 23:13 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: sudipm.mukherjee, teddy.wang, gregkh, linux-fbdev, linux-staging,
	linux-kernel
In-Reply-To: <ag_ucCZEOnZuJOCz@stanley.mountain>

On Fri, May 22, 2026 at 08:49:36AM +0300, Dan Carpenter wrote:
> On Fri, May 22, 2026 at 02:39:01AM +0300, Michail Tatas wrote:
> > Change variable names from camelCase to snake_case
> > as per the Linux Kernel standards.
> > 
> > These changes remove 9 CHECK messages from checkpatch.pl
> > regarding sm750.c, sm750.h and sm750_hw.c
> > 
> > Tested changes by building the module sm750fb/
> 
> Don't put this kind of meta comment in the commit message.  Put it
> under the --- cur off line.
> 
> Please wait a day between resends.
> 
> I don't think you're working against the correct staging-next
> tree.
> 
> regards,
> dan carpenter
> 

Thanks a lot for the quick replies, much appreciated!

Dan you are correct thanks for noticing, I was 
working on the main branch.

Some variables have not yet been converted, so
I will send them on a separate patch series as a v2

^ permalink raw reply

* [PATCH v2 0/2] Staging: sm750fb: Change camelCase to snake_case
From: Michail Tatas @ 2026-05-24 23:15 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, linux-staging, linux-kernel, Michail Tatas

Change variable names from camelCase to snake_case
as per the Linux Kernel standards.

Michail Tatas (2):
  staging: sm750fb: rename setAllEngOff to set_all_eng_off
  staging: sm750fb: rename pvReg to pv_reg

 drivers/staging/sm750fb/sm750.c    |  6 +++---
 drivers/staging/sm750fb/sm750.h    |  4 ++--
 drivers/staging/sm750fb/sm750_hw.c | 12 ++++++------
 3 files changed, 11 insertions(+), 11 deletions(-)

--
 
2.43.0


^ permalink raw reply

* [PATCH v2 1/2] staging: sm750fb: rename setAllEngOff to set_all_eng_off
From: Michail Tatas @ 2026-05-24 23:15 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, linux-staging, linux-kernel, Michail Tatas
In-Reply-To: <cover.1779661132.git.michail.tatas@gmail.com>

Rename variable setAllEngOff to set_all_eng_off as
per the Linux coding standards

Signed-off-by: Michail Tatas <michail.tatas@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 2 +-
 drivers/staging/sm750fb/sm750.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 89c811e0806c..00c293430a7d 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -848,7 +848,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
 	sm750_dev->init_parm.mem_clk = 0;
 	sm750_dev->init_parm.master_clk = 0;
 	sm750_dev->init_parm.power_mode = 0;
-	sm750_dev->init_parm.setAllEngOff = 0;
+	sm750_dev->init_parm.set_all_eng_off = 0;
 	sm750_dev->init_parm.reset_memory = 1;
 
 	/* defaultly turn g_hwcursor on for both view */
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index d2c522e67f26..589ae51444f8 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -44,7 +44,7 @@ struct init_status {
 	ushort chip_clk;
 	ushort mem_clk;
 	ushort master_clk;
-	ushort setAllEngOff;
+	ushort set_all_eng_off;
 	ushort reset_memory;
 };
 
-- 
2.43.0


^ permalink raw reply related

* [PATCH v2 2/2] staging: sm750fb: rename pvReg to pv_reg
From: Michail Tatas @ 2026-05-24 23:15 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, linux-staging, linux-kernel, Michail Tatas
In-Reply-To: <cover.1779661132.git.michail.tatas@gmail.com>

Rename variable pvReg to pv_reg as per
the Linux coding standards

Signed-off-by: Michail Tatas <michail.tatas@gmail.com>
---
 drivers/staging/sm750fb/sm750.c    |  4 ++--
 drivers/staging/sm750fb/sm750.h    |  2 +-
 drivers/staging/sm750fb/sm750_hw.c | 12 ++++++------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 00c293430a7d..716a8935f58d 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -743,7 +743,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 	 * must be set after crtc member initialized
 	 */
 	crtc->cursor.offset = crtc->o_screen + crtc->vidmem_size - 1024;
-	crtc->cursor.mmio = sm750_dev->pvReg +
+	crtc->cursor.mmio = sm750_dev->pv_reg +
 		0x800f0 + (int)crtc->channel * 0x140;
 
 	crtc->cursor.max_h = 64;
@@ -1047,7 +1047,7 @@ static void lynxfb_pci_remove(struct pci_dev *pdev)
 	sm750fb_framebuffer_release(sm750_dev);
 	arch_phys_wc_del(sm750_dev->mtrr.vram);
 
-	iounmap(sm750_dev->pvReg);
+	iounmap(sm750_dev->pv_reg);
 	iounmap(sm750_dev->vmem);
 	pci_release_region(pdev, 1);
 	kfree(g_settings);
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 589ae51444f8..e8885133da2e 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -97,7 +97,7 @@ struct sm750_dev {
 	unsigned long vidreg_start;
 	__u32 vidmem_size;
 	__u32 vidreg_size;
-	void __iomem *pvReg;
+	void __iomem *pv_reg;
 	unsigned char __iomem *vmem;
 	/* locks*/
 	spinlock_t slock;
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index 34a837fb4b64..95f797e5776a 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -23,18 +23,18 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
 	}
 
 	/* now map mmio and vidmem */
-	sm750_dev->pvReg =
+	sm750_dev->pv_reg =
 		ioremap(sm750_dev->vidreg_start, sm750_dev->vidreg_size);
-	if (!sm750_dev->pvReg) {
+	if (!sm750_dev->pv_reg) {
 		dev_err(&pdev->dev, "mmio failed\n");
 		ret = -EFAULT;
 		goto err_release_region;
 	}
 
-	sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
-	sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
+	sm750_dev->accel.dpr_base = sm750_dev->pv_reg + DE_BASE_ADDR_TYPE1;
+	sm750_dev->accel.dp_port_base = sm750_dev->pv_reg + DE_PORT_ADDR_TYPE1;
 
-	mmio750 = sm750_dev->pvReg;
+	mmio750 = sm750_dev->pv_reg;
 	sm750_set_chip_type(sm750_dev->devid, sm750_dev->revid);
 
 	sm750_dev->vidmem_start = pci_resource_start(pdev, 0);
@@ -58,7 +58,7 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
 	return 0;
 
 err_unmap_reg:
-	iounmap(sm750_dev->pvReg);
+	iounmap(sm750_dev->pv_reg);
 err_release_region:
 	pci_release_region(pdev, 1);
 	return ret;
-- 
2.43.0


^ permalink raw reply related

* Re: [PATCH 5/5] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
From: Dan Carpenter @ 2026-05-25  8:01 UTC (permalink / raw)
  To: Ahmet Sezgin Duran; +Cc: gregkh, linux-fbdev, linux-staging, linux-kernel
In-Reply-To: <20260523051509.166152-6-ahmet@sezginduran.net>

I was waiting to see if anyone had other comments bout this patchset
to decide if I should mention these minor nits.  But then I was
confused about v2 so I think there might end up being comments... :P

On Sat, May 23, 2026 at 05:15:09AM +0000, Ahmet Sezgin Duran wrote:
> @@ -388,18 +388,18 @@ static int __maybe_unused lynxfb_suspend(struct device *dev)
>  {
>  	struct fb_info *info;
>  	struct sm750_dev *sm750_dev;
> +	int i;
>  
>  	sm750_dev = dev_get_drvdata(dev);
>  
>  	console_lock();
> -	info = sm750_dev->fbinfo[0];
> -	if (info)
> -		/* 1 means do suspend */
> -		fb_set_suspend(info, 1);
> -	info = sm750_dev->fbinfo[1];
> -	if (info)
> -		/* 1 means do suspend */
> -		fb_set_suspend(info, 1);
> +
> +	for (i = 0; i < sm750_dev->fb_count; i++) {
> +		info = sm750_dev->fbinfo[i];
> +		if (info)
> +			/* 1 means do suspend */
> +			fb_set_suspend(info, 1);

You didn't introduce this, but the rule is the multi-line indents get
curly braces for readabilitly even if they're not required.

> +	}
>  
>  	console_unlock();
>  	return 0;
> @@ -414,6 +414,7 @@ static int __maybe_unused lynxfb_resume(struct device *dev)
>  	struct lynxfb_par *par;
>  	struct lynxfb_crtc *crtc;
>  	struct lynx_cursor *cursor;
> +	int i;
>  
>  	sm750_dev = pci_get_drvdata(pdev);
>  
> @@ -421,21 +422,12 @@ static int __maybe_unused lynxfb_resume(struct device *dev)
>  
>  	hw_sm750_inithw(sm750_dev, pdev);
>  
> -	info = sm750_dev->fbinfo[0];
> -
> -	if (info) {
> -		par = info->par;
> -		crtc = &par->crtc;
> -		cursor = &crtc->cursor;
> -		memset_io(cursor->vstart, 0x0, cursor->size);
> -		memset_io(crtc->v_screen, 0x0, crtc->vidmem_size);
> -		lynxfb_ops_set_par(info);
> -		fb_set_suspend(info, 0);
> -	}
> +	for (i = 0; i < sm750_dev->fb_count; i++) {
> +		info = sm750_dev->fbinfo[i];
>  

Better to delete this blank line so the NULL check is next to the
assignment.

regards,
dan carpenter

> -	info = sm750_dev->fbinfo[1];
> +		if (!info)
> +			continue;
>  
> -	if (info) {
>  		par = info->par;
>  		crtc = &par->crtc;
>  		cursor = &crtc->cursor;


^ permalink raw reply

* Re: [PATCH 5/5] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
From: Ahmet Sezgin Duran @ 2026-05-25  8:23 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, linux-fbdev, linux-staging, linux-kernel
In-Reply-To: <ahQB8C1gTr7LF0FO@stanley.mountain>

On 5/25/26 11:01 AM, Dan Carpenter wrote:
> I was waiting to see if anyone had other comments bout this patchset
> to decide if I should mention these minor nits.  But then I was
> confused about v2 so I think there might end up being comments... :P

v2 was only about dropping another patch from series, no change for this 
patch. (would be better to talk this in v2 mails, but I guess it's no 
big deal.)
>> +
>> +	for (i = 0; i < sm750_dev->fb_count; i++) {
>> +		info = sm750_dev->fbinfo[i];
>> +		if (info)
>> +			/* 1 means do suspend */
>> +			fb_set_suspend(info, 1);
> 
> You didn't introduce this, but the rule is the multi-line indents get
> curly braces for readabilitly even if they're not required.

Oh ok, just tried your suggestion, checkpatch didn't generate a warning. 
Got it.
>> -	}
>> +	for (i = 0; i < sm750_dev->fb_count; i++) {
>> +		info = sm750_dev->fbinfo[i];
>>   
> 
> Better to delete this blank line so the NULL check is next to the
> assignment.

Got it.

I'll send v3, thanks for the review.

Regards,
Ahmet Sezgin Duran

^ permalink raw reply

* [PATCH 7.0] fbdev: fbcon: fix memory leak in error path of fbcon_do_set_font()
From: w15303746062 @ 2026-05-25  8:27 UTC (permalink / raw)
  To: simona, deller
  Cc: tzimmermann, ville.syrjala, sam, kees, yanquanmin1, syoshida,
	linux-fbdev, dri-devel, linux-kernel, Mingyu Wang

From: Mingyu Wang <25181214217@stu.xidian.edu.cn>

[ Note: This issue was discovered on the 7.0 kernel. While the current
  mainline has already been refactored to use `font_data_t` (which 
  inadvertently resolved this bug), this vulnerability still actively 
  affects the 7.0 branch and older stable trees that rely on the legacy 
  userfont logic. This patch provides a targeted fix for these stable 
  branches. ]

When fbcon_do_set_font() fails (e.g., due to a vc_resize() failure under
fault injection), it jumps to the `err_out` label to roll back the
console state.

However, the restoration of the previous font state (`p->userfont =
old_userfont`) is erroneously placed inside the `if (userfont)` block.
If the failed operation was attempting to set the default builtin font
(`userfont == 0`), the restoration is completely skipped.

This causes a state machine corruption where `p->userfont` remains `0`
while `p->fontdata` still points to the previously allocated user font
memory. Later, when the console is destroyed (e.g., via VT_DISALLOCATE),
fbcon_free_font() fails to free this memory because its `if (p->userfont)`
check fails, resulting in a memory leak caught by kmemleak:

  unreferenced object 0xffff888127ea0000 (size 33296):
    comm "syz.0.8726", pid 33224, jiffies 4297754643
    hex dump (first 32 bytes):
      a6 e4 f9 dd 00 00 00 00 00 82 00 00 01 00 00 00  ................
      d2 09 6c bf 52 8a 7d d4 ef 1d 59 16 51 86 32 bf  ..l.R.}...Y.Q.2.
    backtrace (crc 4a0a57dd):
      ___kmalloc_large_node+0xe7/0x180 mm/slub.c:5214
      __kmalloc_large_node_noprof+0x29/0x130 mm/slub.c:5232
      __do_kmalloc_node mm/slub.c:5248 [inline]
      __kmalloc_noprof+0x5fc/0x7c0 mm/slub.c:5272
      kmalloc_noprof include/linux/slab.h:954 [inline]
      fbcon_set_font+0x431/0xa60 drivers/video/fbdev/core/fbcon.c:2525
      con_font_set drivers/tty/vt/vt.c:4918 [inline]
      con_font_op+0x94d/0xe80 drivers/tty/vt/vt.c:4958
      vt_k_ioctl drivers/tty/vt/vt_ioctl.c:472 [inline]
      vt_ioctl+0x63c/0x2ee0 drivers/tty/vt/vt_ioctl.c:743

Fix this by moving the `p->userfont = old_userfont` assignment outside
the `if (userfont)` block so that the terminal state is unconditionally
and correctly restored regardless of which font setting triggered the
error.

Fixes: a5a923038d70 ("fbdev: fbcon: Properly revert changes when vc_resize() failed")
Signed-off-by: Mingyu Wang <25181214217@stu.xidian.edu.cn>
---
 drivers/video/fbdev/core/fbcon.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 666261ae59d8..a38545dc8416 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -2461,8 +2461,10 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount,
 	p->fontdata = old_data;
 	vc->vc_font.data = old_data;
 
+	/* Unconditionally restore the previous userfont state */
+	p->userfont = old_userfont;
+
 	if (userfont) {
-		p->userfont = old_userfont;
 		if (--REFCOUNT(data) == 0)
 			kfree(data - FONT_EXTRA_WORDS * sizeof(int));
 	}
-- 
2.34.1


^ permalink raw reply related

* [PATCH v3 0/4] staging: sm750fb: various code cleanups
From: Ahmet Sezgin Duran @ 2026-05-25  8:58 UTC (permalink / raw)
  To: gregkh
  Cc: error27, linux-fbdev, linux-staging, linux-kernel,
	Ahmet Sezgin Duran

This series performs several cleanups on the sm750fb staging driver
to improve code readability and remove redundancy.

The changes include:
- Removing a block of commented-out forward declarations.
- Removing redundant variable initializations.
- Removing unused struct fields.
- Deduplicating per-index fbinfo handling in suspend/resume using
  a loop.

No functional changes are intended.

Changes since v2:
- Add braces around the multi-line if (info) body in the
  suspend loop per Dan Carpenter's review.
- Remove a stray blank line left behind in lynxfb_resume()
  after the dedup.
  Link: <https://lore.kernel.org/linux-staging/ahQB8C1gTr7LF0FO@stanley.mountain/>

Changes since v1:
- Dropped "staging: sm750fb: use ARRAY_SIZE macro in fb_find_mode
  loop" per Dan Carpenter's review.
  Link: <https://lore.kernel.org/linux-staging/ahF8dacOkX0tdxGf@stanley.mountain/>

v2: <https://lore.kernel.org/linux-staging/20260523153459.177488-1-ahmet@sezginduran.net/>
v1: <https://lore.kernel.org/linux-staging/20260512164124.188210-1-ahmet@sezginduran.net/>

Ahmet Sezgin Duran (4):
  staging: sm750fb: remove commented-out forward declarations
  staging: sm750fb: remove unnecessary initializations
  staging: sm750fb: remove unused struct fields
  staging: sm750fb: deduplicate fbinfo loop in suspend/resume

 drivers/staging/sm750fb/sm750.c | 47 ++++++++++-----------------------
 drivers/staging/sm750fb/sm750.h |  3 ---
 2 files changed, 14 insertions(+), 36 deletions(-)

-- 
2.54.0


^ permalink raw reply

* [PATCH v3 1/4] staging: sm750fb: remove commented-out forward declarations
From: Ahmet Sezgin Duran @ 2026-05-25  8:58 UTC (permalink / raw)
  To: gregkh
  Cc: error27, linux-fbdev, linux-staging, linux-kernel,
	Ahmet Sezgin Duran
In-Reply-To: <20260525085808.171974-1-ahmet@sezginduran.net>

The block at the top of sm750.c declares lynxfb_ops_write() and
lynxfb_ops_read() inside a commented-out #ifdef __BIG_ENDIAN guard.
Neither function is defined anywhere in the driver, so the block
is dead. Remove it.

Signed-off-by: Ahmet Sezgin Duran <ahmet@sezginduran.net>
---
v3: No changes.
v2: No changes.

 drivers/staging/sm750fb/sm750.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 89c811e0806c..02db1418476b 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -8,15 +8,6 @@
 #include "sm750_accel.h"
 #include "sm750_cursor.h"
 
-/*
- * #ifdef __BIG_ENDIAN
- * ssize_t lynxfb_ops_write(struct fb_info *info, const char __user *buf,
- * size_t count, loff_t *ppos);
- * ssize_t lynxfb_ops_read(struct fb_info *info, char __user *buf,
- * size_t count, loff_t *ppos);
- * #endif
- */
-
 /* common var for all device */
 static int g_hwcursor = 1;
 static int g_noaccel __ro_after_init;
-- 
2.54.0


^ permalink raw reply related

* [PATCH v3 2/4] staging: sm750fb: remove unnecessary initializations
From: Ahmet Sezgin Duran @ 2026-05-25  8:58 UTC (permalink / raw)
  To: gregkh
  Cc: error27, linux-fbdev, linux-staging, linux-kernel,
	Ahmet Sezgin Duran
In-Reply-To: <20260525085808.171974-1-ahmet@sezginduran.net>

Remove two instances of `ret = 0` initializations since the
variable is overridden unconditionally before being used.

Signed-off-by: Ahmet Sezgin Duran <ahmet@sezginduran.net>
---
v3: No changes.
v2: No changes.

 drivers/staging/sm750fb/sm750.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 02db1418476b..fff9c35ee7b0 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -343,7 +343,6 @@ static int lynxfb_ops_set_par(struct fb_info *info)
 	if (!info)
 		return -EINVAL;
 
-	ret = 0;
 	par = info->par;
 	crtc = &par->crtc;
 	output = &par->output;
@@ -463,7 +462,6 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
 	if (!var->pixclock)
 		return -EINVAL;
 
-	ret = 0;
 	par = info->par;
 	crtc = &par->crtc;
 
-- 
2.54.0


^ permalink raw reply related

* [PATCH v3 3/4] staging: sm750fb: remove unused struct fields
From: Ahmet Sezgin Duran @ 2026-05-25  8:58 UTC (permalink / raw)
  To: gregkh
  Cc: error27, linux-fbdev, linux-staging, linux-kernel,
	Ahmet Sezgin Duran
In-Reply-To: <20260525085808.171974-1-ahmet@sezginduran.net>

Remove `void *priv` pointer field in following struct definitions:

- `struct lynxfb_crtc`
- `struct lynxfb_output`

Verified that no other code references them.

No functional changes.

Signed-off-by: Ahmet Sezgin Duran <ahmet@sezginduran.net>
---
v3: No changes.
v2: No changes.

 drivers/staging/sm750fb/sm750.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index d2c522e67f26..56d7e1fa4557 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -145,8 +145,6 @@ struct lynxfb_crtc {
 	u16 ypanstep;
 	u16 ywrapstep;
 
-	void *priv;
-
 	/* cursor information */
 	struct lynx_cursor cursor;
 };
@@ -168,7 +166,6 @@ struct lynxfb_output {
 	 * *channel=1 means secondary channel
 	 * output->channel ==> &crtc->channel
 	 */
-	void *priv;
 };
 
 struct lynxfb_par {
-- 
2.54.0


^ permalink raw reply related

* [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
From: Ahmet Sezgin Duran @ 2026-05-25  8:58 UTC (permalink / raw)
  To: gregkh
  Cc: error27, linux-fbdev, linux-staging, linux-kernel,
	Ahmet Sezgin Duran
In-Reply-To: <20260525085808.171974-1-ahmet@sezginduran.net>

lynxfb_suspend() and lynxfb_resume() both walk sm750_dev->fbinfo[]
via duplicated per-index blocks for fbinfo[0] and fbinfo[1].

Replace each pair of blocks with a for-loop bounded by
sm750_dev->fb_count, the number of successfully registered
framebuffers.

No functional changes intended.

Signed-off-by: Ahmet Sezgin Duran <ahmet@sezginduran.net>
---
v3: Add braces around the multi-line if (info) body in the
    suspend loop per Dan Carpenter's review.
    Remove a stray blank line left behind in lynxfb_resume()
    after the dedup.
    Link: <https://lore.kernel.org/linux-staging/ahQB8C1gTr7LF0FO@stanley.mountain/>
v2: No changes.

 drivers/staging/sm750fb/sm750.c | 36 +++++++++++++--------------------
 1 file changed, 14 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index fff9c35ee7b0..1f6f92473c80 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -388,18 +388,19 @@ static int __maybe_unused lynxfb_suspend(struct device *dev)
 {
 	struct fb_info *info;
 	struct sm750_dev *sm750_dev;
+	int i;
 
 	sm750_dev = dev_get_drvdata(dev);
 
 	console_lock();
-	info = sm750_dev->fbinfo[0];
-	if (info)
-		/* 1 means do suspend */
-		fb_set_suspend(info, 1);
-	info = sm750_dev->fbinfo[1];
-	if (info)
-		/* 1 means do suspend */
-		fb_set_suspend(info, 1);
+
+	for (i = 0; i < sm750_dev->fb_count; i++) {
+		info = sm750_dev->fbinfo[i];
+		if (info) {
+			/* 1 means do suspend */
+			fb_set_suspend(info, 1);
+		}
+	}
 
 	console_unlock();
 	return 0;
@@ -414,6 +415,7 @@ static int __maybe_unused lynxfb_resume(struct device *dev)
 	struct lynxfb_par *par;
 	struct lynxfb_crtc *crtc;
 	struct lynx_cursor *cursor;
+	int i;
 
 	sm750_dev = pci_get_drvdata(pdev);
 
@@ -421,21 +423,11 @@ static int __maybe_unused lynxfb_resume(struct device *dev)
 
 	hw_sm750_inithw(sm750_dev, pdev);
 
-	info = sm750_dev->fbinfo[0];
-
-	if (info) {
-		par = info->par;
-		crtc = &par->crtc;
-		cursor = &crtc->cursor;
-		memset_io(cursor->vstart, 0x0, cursor->size);
-		memset_io(crtc->v_screen, 0x0, crtc->vidmem_size);
-		lynxfb_ops_set_par(info);
-		fb_set_suspend(info, 0);
-	}
-
-	info = sm750_dev->fbinfo[1];
+	for (i = 0; i < sm750_dev->fb_count; i++) {
+		info = sm750_dev->fbinfo[i];
+		if (!info)
+			continue;
 
-	if (info) {
 		par = info->par;
 		crtc = &par->crtc;
 		cursor = &crtc->cursor;
-- 
2.54.0


^ permalink raw reply related

* Re: [PATCH v2 3/4] fbdev: Wrap fbcon updates from vga-switcheroo in helper
From: Geert Uytterhoeven @ 2026-05-25  9:31 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: deller, simona, airlied, lukas, maddy, mpe, npiggin, chleroy,
	dri-devel, linux-fbdev, linuxppc-dev
In-Reply-To: <20260522123019.211059-4-tzimmermann@suse.de>

Hi Thomas,

On Fri, 22 May 2026 at 15:11, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Handle console remapping in fbcon in fb_switch_output(). Vga-switcheroo
> invokes this functionality before switching physical outputs to a new
> graphics device. Open-coding fbcon state in vga-switcheroo exposed fbdev
> implementation details.
>
> Vga-switcheroo is used for switching physical outputs among graphics
> hardware. This functionality is only supported by DRM drivers. A later
> update will further move fb_switch_output() into DRM's fbdev emulation;
> thus fully decoupling vga-switcheroo from fbdev.
>
> v2:
> - use '#if defined' (Helge)
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for your patch, which is now commit 91458b3f2a84bc7b ("fbdev:
Wrap fbcon updates from vga-switcheroo in helper") in fbdev/for-next.

> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c
> @@ -31,11 +31,9 @@
>  #define pr_fmt(fmt) "vga_switcheroo: " fmt
>
>  #include <linux/apple-gmux.h>
> -#include <linux/console.h>
>  #include <linux/debugfs.h>
>  #include <linux/fb.h>
>  #include <linux/fs.h>
> -#include <linux/fbcon.h>
>  #include <linux/module.h>
>  #include <linux/pci.h>
>  #include <linux/pm_domain.h>
> @@ -735,8 +733,10 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
>         if (!active->driver_power_control)
>                 set_audio_state(active->id, VGA_SWITCHEROO_OFF);
>
> +#if defined(CONFIG_FB)
>         if (new_client->fb_info)
> -               fbcon_remap_all(new_client->fb_info);
> +               fb_switch_outputs(new_client->fb_info);
> +#endif

What if CONFIG_FB is modular?
CONFIG_VGA_SWITCHEROO is bool.

>
>         mutex_lock(&vgasr_priv.mux_hw_lock);
>         ret = vgasr_priv.handler->switchto(new_client->id);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* Re: [PATCH 5/5] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
From: Dan Carpenter @ 2026-05-25 16:13 UTC (permalink / raw)
  To: Ahmet Sezgin Duran; +Cc: gregkh, linux-fbdev, linux-staging, linux-kernel
In-Reply-To: <86216e7d-7867-4041-892b-aafeb39781b8@sezginduran.net>

On Mon, May 25, 2026 at 11:23:43AM +0300, Ahmet Sezgin Duran wrote:
> On 5/25/26 11:01 AM, Dan Carpenter wrote:
> > I was waiting to see if anyone had other comments bout this patchset
> > to decide if I should mention these minor nits.  But then I was
> > confused about v2 so I think there might end up being comments... :P
> 
> v2 was only about dropping another patch from series, no change for this
> patch. (would be better to talk this in v2 mails, but I guess it's no big
> deal.)

I thought you were going to to abandon the ARRAY_SIZE(cdb) in v2.

regards,
dan carpenter


^ permalink raw reply

* Re: [PATCH 5/5] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
From: Ahmet Sezgin Duran @ 2026-05-25 16:31 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: gregkh, linux-fbdev, linux-staging, linux-kernel
In-Reply-To: <ahR1O_dF9XyVEmPo@stanley.mountain>

On 5/25/26 7:13 PM, Dan Carpenter wrote:

> 
> I thought you were going to to abandon the ARRAY_SIZE(cdb) in v2.
> 
> regards,
> dan carpenter
> 

Which, I did:

(v2 link): 
https://lore.kernel.org/linux-staging/20260523153459.177488-1-ahmet@sezginduran.net/

Then, per this review, I sent v3:

(v3 link): 
https://lore.kernel.org/linux-staging/20260525085808.171974-1-ahmet@sezginduran.net/

Please let me know if I misunderstood anything or made a mistake.

Regards,
Ahmet Sezgin Duran

^ permalink raw reply

* Re: [PATCH 5/5] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
From: Dan Carpenter @ 2026-05-25 17:59 UTC (permalink / raw)
  To: Ahmet Sezgin Duran; +Cc: gregkh, linux-fbdev, linux-staging, linux-kernel
In-Reply-To: <6a5de920-b246-4568-8c32-626a696c670a@sezginduran.net>

On Mon, May 25, 2026 at 07:31:33PM +0300, Ahmet Sezgin Duran wrote:
> On 5/25/26 7:13 PM, Dan Carpenter wrote:
> 
> > 
> > I thought you were going to to abandon the ARRAY_SIZE(cdb) in v2.
> > 
> > regards,
> > dan carpenter
> > 
> 
> Which, I did:
> 
> (v2 link): https://lore.kernel.org/linux-staging/20260523153459.177488-1-ahmet@sezginduran.net/
> 

Ah, right.  Fair enough.

regards,
dan carpenter


^ permalink raw reply

* Re: [PATCH v2 3/4] fbdev: Wrap fbcon updates from vga-switcheroo in helper
From: Thomas Zimmermann @ 2026-05-26  7:25 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: deller, simona, airlied, lukas, maddy, mpe, npiggin, chleroy,
	dri-devel, linux-fbdev, linuxppc-dev
In-Reply-To: <CAMuHMdXKF=fSZLqQiOuxDvygBDVSZKD+CQ3Rj+R4E_rYrz-WtA@mail.gmail.com>

Hi Geert

Am 25.05.26 um 11:31 schrieb Geert Uytterhoeven:
> Hi Thomas,
>
> On Fri, 22 May 2026 at 15:11, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Handle console remapping in fbcon in fb_switch_output(). Vga-switcheroo
>> invokes this functionality before switching physical outputs to a new
>> graphics device. Open-coding fbcon state in vga-switcheroo exposed fbdev
>> implementation details.
>>
>> Vga-switcheroo is used for switching physical outputs among graphics
>> hardware. This functionality is only supported by DRM drivers. A later
>> update will further move fb_switch_output() into DRM's fbdev emulation;
>> thus fully decoupling vga-switcheroo from fbdev.
>>
>> v2:
>> - use '#if defined' (Helge)
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Thanks for your patch, which is now commit 91458b3f2a84bc7b ("fbdev:
> Wrap fbcon updates from vga-switcheroo in helper") in fbdev/for-next.
>
>> --- a/drivers/gpu/vga/vga_switcheroo.c
>> +++ b/drivers/gpu/vga/vga_switcheroo.c
>> @@ -31,11 +31,9 @@
>>   #define pr_fmt(fmt) "vga_switcheroo: " fmt
>>
>>   #include <linux/apple-gmux.h>
>> -#include <linux/console.h>
>>   #include <linux/debugfs.h>
>>   #include <linux/fb.h>
>>   #include <linux/fs.h>
>> -#include <linux/fbcon.h>
>>   #include <linux/module.h>
>>   #include <linux/pci.h>
>>   #include <linux/pm_domain.h>
>> @@ -735,8 +733,10 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
>>          if (!active->driver_power_control)
>>                  set_audio_state(active->id, VGA_SWITCHEROO_OFF);
>>
>> +#if defined(CONFIG_FB)
>>          if (new_client->fb_info)
>> -               fbcon_remap_all(new_client->fb_info);
>> +               fb_switch_outputs(new_client->fb_info);
>> +#endif
> What if CONFIG_FB is modular?
> CONFIG_VGA_SWITCHEROO is bool.

Good point. Fbcon is currently linked into fb.ko, which is build with 
CONFIG_FB.  Kconfig covers this dependency at [1]. For now, I think we 
could make it 'depends on FB=y'.  As I mentioned elsewhere, this 
fb-related logic is only relevant for DRM and supposed to be moved there 
soon.  That will also resolve any such config issues.

Let me prepare an update for this.

Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v7.0.9/source/drivers/gpu/vga/Kconfig#L7

>
>>          mutex_lock(&vgasr_priv.mux_hw_lock);
>>          ret = vgasr_priv.handler->switchto(new_client->id);
> Gr{oetje,eeting}s,
>
>                          Geert
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)



^ permalink raw reply

* [PATCH] fbdev:modedb: fix a possible UAF in fb_find_mode()
From: Tuo Li @ 2026-05-26  9:15 UTC (permalink / raw)
  To: simona, deller, kees, tzimmermann
  Cc: linux-fbdev, dri-devel, linux-kernel, Tuo Li

If mode_option is NULL, it is assigned from mode_option_buf:

  if (!mode_option) {
    fb_get_options(NULL, &mode_option_buf);
    mode_option = mode_option_buf;
  }

Later, name is assigned from mode_option:

  const char *name = mode_option;

However, mode_option_buf is freed before name is no longer used:

  kfree(mode_option_buf);

while name is still accessed by:

  if ((name_matches(db[i], name, namelen) ||

Since name aliases mode_option_buf, this may result in a
use-after-free.

Fix this by moving the kfree(mode_option_buf) call behind the access, and
add corresponding cleanup before early returns.

Signed-off-by: Tuo Li <islituo@gmail.com>
---
 drivers/video/fbdev/core/modedb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c
index 703d0b7aec32..91f6c78f9e19 100644
--- a/drivers/video/fbdev/core/modedb.c
+++ b/drivers/video/fbdev/core/modedb.c
@@ -724,7 +724,6 @@ int fb_find_mode(struct fb_var_screeninfo *var,
 			res_specified = 1;
 		}
 done:
-		kfree(mode_option_buf);
 		if (cvt) {
 			struct fb_videomode cvt_mode;
 			int ret;
@@ -749,6 +748,7 @@ int fb_find_mode(struct fb_var_screeninfo *var,
 
 			if (!ret && !fb_try_mode(var, info, &cvt_mode, bpp)) {
 				DPRINTK("modedb CVT: CVT mode ok\n");
+				kfree(mode_option_buf);
 				return 1;
 			}
 
@@ -793,8 +793,10 @@ int fb_find_mode(struct fb_var_screeninfo *var,
 				if (!interlace_specified ||
 				    db_interlace == interlace)
 					if (refresh_specified &&
-					    db[i].refresh == refresh)
+					    db[i].refresh == refresh) {
+						kfree(mode_option_buf);
 						return 1;
+					}
 
 				if (score < diff) {
 					diff = score;
@@ -802,6 +804,8 @@ int fb_find_mode(struct fb_var_screeninfo *var,
 				}
 			}
 		}
+
+		kfree(mode_option_buf);
 		if (best != -1) {
 			fb_try_mode(var, info, &db[best], bpp);
 			return (refresh_specified) ? 2 : 1;
-- 
2.43.0


^ permalink raw reply related

* [PATCH v2] staging: sm750fb: fix CamelCase variables name in sm750
From: Emmanuel Arias @ 2026-05-26 13:16 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, linux-staging, linux-kernel, Emmanuel Arias,
	kernel test robot

Replace CamelCase variable name with snake_case:
- pvReg -> pv_reg
- setAllEngOff -> set_all_eng_off

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202605171049.KbaBnrJV-lkp@intel.com/
Signed-off-by: Emmanuel Arias <eamanu@riseup.net>
---
 drivers/staging/sm750fb/sm750.c    |  6 +++---
 drivers/staging/sm750fb/sm750.h    |  4 ++--
 drivers/staging/sm750fb/sm750_hw.c | 12 ++++++------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 996a586a3727..9b30627a19d0 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -755,7 +755,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 	 * must be set after crtc member initialized
 	 */
 	crtc->cursor.offset = crtc->o_screen + crtc->vidmem_size - 1024;
-	crtc->cursor.mmio = sm750_dev->pvReg +
+	crtc->cursor.mmio = sm750_dev->pv_reg +
 		0x800f0 + (int)crtc->channel * 0x140;
 
 	crtc->cursor.max_h = 64;
@@ -860,7 +860,7 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
 	sm750_dev->init_parm.mem_clk = 0;
 	sm750_dev->init_parm.master_clk = 0;
 	sm750_dev->init_parm.power_mode = 0;
-	sm750_dev->init_parm.setAllEngOff = 0;
+	sm750_dev->init_parm.set_all_eng_off = 0;
 	sm750_dev->init_parm.reset_memory = 1;
 
 	/* defaultly turn g_hwcursor on for both view */
@@ -1059,7 +1059,7 @@ static void lynxfb_pci_remove(struct pci_dev *pdev)
 	sm750fb_framebuffer_release(sm750_dev);
 	arch_phys_wc_del(sm750_dev->mtrr.vram);
 
-	iounmap(sm750_dev->pvReg);
+	iounmap(sm750_dev->pv_reg);
 	iounmap(sm750_dev->vmem);
 	pci_release_region(pdev, 1);
 	kfree(g_settings);
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index d2c522e67f26..e8885133da2e 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -44,7 +44,7 @@ struct init_status {
 	ushort chip_clk;
 	ushort mem_clk;
 	ushort master_clk;
-	ushort setAllEngOff;
+	ushort set_all_eng_off;
 	ushort reset_memory;
 };
 
@@ -97,7 +97,7 @@ struct sm750_dev {
 	unsigned long vidreg_start;
 	__u32 vidmem_size;
 	__u32 vidreg_size;
-	void __iomem *pvReg;
+	void __iomem *pv_reg;
 	unsigned char __iomem *vmem;
 	/* locks*/
 	spinlock_t slock;
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index 6f7c354a34a1..2e2c7cffddab 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -40,18 +40,18 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
 	}
 
 	/* now map mmio and vidmem */
-	sm750_dev->pvReg =
+	sm750_dev->pv_reg =
 		ioremap(sm750_dev->vidreg_start, sm750_dev->vidreg_size);
-	if (!sm750_dev->pvReg) {
+	if (!sm750_dev->pv_reg) {
 		dev_err(&pdev->dev, "mmio failed\n");
 		ret = -EFAULT;
 		goto err_release_region;
 	}
 
-	sm750_dev->accel.dpr_base = sm750_dev->pvReg + DE_BASE_ADDR_TYPE1;
-	sm750_dev->accel.dp_port_base = sm750_dev->pvReg + DE_PORT_ADDR_TYPE1;
+	sm750_dev->accel.dpr_base = sm750_dev->pv_reg + DE_BASE_ADDR_TYPE1;
+	sm750_dev->accel.dp_port_base = sm750_dev->pv_reg + DE_PORT_ADDR_TYPE1;
 
-	mmio750 = sm750_dev->pvReg;
+	mmio750 = sm750_dev->pv_reg;
 	sm750_set_chip_type(sm750_dev->devid, sm750_dev->revid);
 
 	sm750_dev->vidmem_start = pci_resource_start(pdev, 0);
@@ -75,7 +75,7 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
 	return 0;
 
 err_unmap_reg:
-	iounmap(sm750_dev->pvReg);
+	iounmap(sm750_dev->pv_reg);
 err_release_region:
 	pci_release_region(pdev, 1);
 	return ret;
-- 
2.53.0


^ permalink raw reply related

* [PATCH v1 0/8] zorro: Improve handling of pointers in zorro_device_id::driver_data
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-26 14:17 UTC (permalink / raw)
  To: Geert Uytterhoeven, Damien Le Moal, Niklas Cassel,
	James E.J. Bottomley, Martin K. Petersen, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Thomas Gleixner, Ingo Molnar, Max Staudt, Andi Shyti,
	Helge Deller
  Cc: linux-ide, linux-m68k, linux-kernel, linux-scsi, netdev,
	linux-i2c, linux-fbdev, dri-devel, Christian A. Ehrhardt,
	Christian A. Ehrhardt

Hello,

this series is about improving the handling of pointers in struct
zorro_device_id's driver_data.

While it's ok on all current Linux platforms to store a pointer in an
unsigned long variable, it involves casting that loses type information.
This can be nicely seen in patch #7 where after profiting from patch #6
the compiler notices a missing const.

Preparing for that change, all zorro_device_ids are converted to use
named initializers, which is also a nice cleanup that could stand for
itself, as it improves readability for humans. (That is necessary
because an anonymous union can be initialized by name, but not using a
list initializer.)

My motivation for this series is the CHERI hardware extension. With that
pointers are bigger than longs and thus you cannot store pointers in
zorro_device_id::driver_data. So this series is also about getting
support for CHERI into the mainline, but I hope the clean up effects
mentioned above are justification enough to accept this series.

The dependencies in this series are as follows:

 - Patch #5 depends on #1, #2
 - Patches #7 and #8 depend on patch #6.

So if the ata maintainers agreed to merge their patch #1 via scsi, and
Geert agrees to patch #5 and that it's also merged via scsi, patches #1,
#2, #6 and #7 can go in without further coordination.

Patches #3, #4 and #5 are only about using the same initialization style
for all zorro_device_id and can go in without coordination.

Best regards
Uwe

Uwe Kleine-König (The Capable Hub) (8):
  ata: pata_budda: Use named initializer for zorro_device_id
  scsi: Use named initializer for zorro_device_id
  net: Use named initializer for zorro_device_id arrays
  i2c: icy: Use named initializer for zorro_device_id arrays
  video: fm2fb: Use named initializer for zorro_device_id array
  zorro: Simplify storing pointers in device id struct
  scsi: zorro7xx: Make use of struct zorro_device_id::driver_data_ptr
  video: cirrusfb: Make use of struct zorro_device_id::driver_data_ptr

 drivers/ata/pata_buddha.c             |  8 ++++----
 drivers/i2c/busses/i2c-icy.c          |  4 ++--
 drivers/net/ethernet/8390/hydra.c     |  4 ++--
 drivers/net/ethernet/8390/xsurf100.c  |  4 ++--
 drivers/net/ethernet/8390/zorro8390.c |  6 +++---
 drivers/net/ethernet/amd/a2065.c      |  8 ++++----
 drivers/net/ethernet/amd/ariadne.c    |  4 ++--
 drivers/scsi/a2091.c                  |  6 +++---
 drivers/scsi/gvp11.c                  | 17 ++++++++--------
 drivers/scsi/zorro7xx.c               | 16 +++++++--------
 drivers/scsi/zorro_esp.c              |  2 +-
 drivers/video/fbdev/cirrusfb.c        | 28 +++++++++++++--------------
 drivers/video/fbdev/fm2fb.c           |  6 +++---
 include/linux/mod_devicetable.h       |  6 +++++-
 14 files changed, 62 insertions(+), 57 deletions(-)


base-commit: d387b06f7c15b4639244ad66b4b0900c6a02b430
-- 
2.47.3


^ permalink raw reply

* [PATCH v1 5/8] video: fm2fb: Use named initializer for zorro_device_id array
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-26 14:17 UTC (permalink / raw)
  To: Geert Uytterhoeven, Helge Deller
  Cc: linux-fbdev, dri-devel, linux-m68k, linux-kernel,
	Christian A. Ehrhardt, Christian A. Ehrhardt
In-Reply-To: <cover.1779803053.git.u.kleine-koenig@baylibre.com>

Using named initializers is more explicit and thus easier to parse for a
human.

While touching this array, drop the explicit zero from the list terminator.

This change doesn't introduce changes to the compiled zorro_device_id
array.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/video/fbdev/fm2fb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/fm2fb.c b/drivers/video/fbdev/fm2fb.c
index 25d2e716edf2..a62c8d86bf69 100644
--- a/drivers/video/fbdev/fm2fb.c
+++ b/drivers/video/fbdev/fm2fb.c
@@ -212,9 +212,9 @@ static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
 static int fm2fb_probe(struct zorro_dev *z, const struct zorro_device_id *id);
 
 static const struct zorro_device_id fm2fb_devices[] = {
-	{ ZORRO_PROD_BSC_FRAMEMASTER_II },
-	{ ZORRO_PROD_HELFRICH_RAINBOW_II },
-	{ 0 }
+	{ .id = ZORRO_PROD_BSC_FRAMEMASTER_II },
+	{ .id = ZORRO_PROD_HELFRICH_RAINBOW_II },
+	{ }
 };
 MODULE_DEVICE_TABLE(zorro, fm2fb_devices);
 
-- 
2.47.3


^ permalink raw reply related

* [PATCH v1 6/8] zorro: Simplify storing pointers in device id struct
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-26 14:17 UTC (permalink / raw)
  To: Geert Uytterhoeven, Damien Le Moal, Niklas Cassel,
	James E.J. Bottomley, Martin K. Petersen, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Thomas Gleixner, Ingo Molnar, Max Staudt, Andi Shyti,
	Helge Deller
  Cc: linux-m68k, linux-kernel, Christian A. Ehrhardt,
	Christian A. Ehrhardt, linux-ide, linux-scsi, netdev, linux-i2c,
	linux-fbdev, dri-devel
In-Reply-To: <cover.1779803053.git.u.kleine-koenig@baylibre.com>

Technically it is fine (on all current Linux architectures) to store a
pointer in an unsigned long variable. However this needs explicit
casting which is an easy source for type mismatches.

By replacing the plain unsigned long .driver_data in struct
zorro_device_id by an anonymous union, most of the casting can be
dropped. There is still some implicit casting involved (between a void *
and a driver specific pointer type), but that's better than the approach
to store a pointer in an unsigned long variable as this doesn't lose the
information that the data being pointed to is const.

All users of struct zorro_device_id are initialized in a way that is
compatible with the new definition, so no adaptions are needed there.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 include/linux/mod_devicetable.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 3b0c9a251a2e..2673a1bd82c4 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -640,7 +640,11 @@ struct mdio_device_id {
 
 struct zorro_device_id {
 	__u32 id;			/* Device ID or ZORRO_WILDCARD */
-	kernel_ulong_t driver_data;	/* Data private to the driver */
+	union {
+		/* Data private to the driver */
+		kernel_ulong_t driver_data;
+		const void *driver_data_ptr;
+	};
 };
 
 #define ZORRO_WILDCARD			(0xffffffff)	/* not official */
-- 
2.47.3


^ permalink raw reply related

* [PATCH v1 8/8] video: cirrusfb: Make use of struct zorro_device_id::driver_data_ptr
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-26 14:17 UTC (permalink / raw)
  To: Geert Uytterhoeven, Helge Deller
  Cc: linux-fbdev, dri-devel, linux-m68k, linux-kernel,
	Christian A. Ehrhardt, Christian A. Ehrhardt
In-Reply-To: <cover.1779803053.git.u.kleine-koenig@baylibre.com>

Usage of .driver_data_ptr allows to drop several casts and so make the
driver a bit more type safe.

While touching the zorro_device_id array, drop an unneeded explicit zero
in the list terminator.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 drivers/video/fbdev/cirrusfb.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c
index 2693b5cc053f..7e07e775b393 100644
--- a/drivers/video/fbdev/cirrusfb.c
+++ b/drivers/video/fbdev/cirrusfb.c
@@ -321,25 +321,25 @@ static const struct zorrocl zcl_picasso4_z2 = {
 
 static const struct zorro_device_id cirrusfb_zorro_table[] = {
 	{
-		.id		= ZORRO_PROD_HELFRICH_SD64_REG,
-		.driver_data	= (unsigned long)&zcl_sd64,
+		.id = ZORRO_PROD_HELFRICH_SD64_REG,
+		.driver_data_ptr = &zcl_sd64,
 	}, {
-		.id		= ZORRO_PROD_HELFRICH_PICCOLO_REG,
-		.driver_data	= (unsigned long)&zcl_piccolo,
+		.id = ZORRO_PROD_HELFRICH_PICCOLO_REG,
+		.driver_data_ptr = &zcl_piccolo,
 	}, {
-		.id	= ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG,
-		.driver_data	= (unsigned long)&zcl_picasso,
+		.id = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG,
+		.driver_data_ptr = &zcl_picasso,
 	}, {
-		.id		= ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG,
-		.driver_data	= (unsigned long)&zcl_spectrum,
+		.id = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG,
+		.driver_data_ptr = &zcl_spectrum,
 	}, {
-		.id		= ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3,
-		.driver_data	= (unsigned long)&zcl_picasso4_z3,
+		.id = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3,
+		.driver_data_ptr = &zcl_picasso4_z3,
 	}, {
-		.id		= ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG,
-		.driver_data	= (unsigned long)&zcl_picasso4_z2,
+		.id = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG,
+		.driver_data_ptr = &zcl_picasso4_z2,
 	},
-	{ 0 }
+	{ }
 };
 MODULE_DEVICE_TABLE(zorro, cirrusfb_zorro_table);
 #endif /* CONFIG_ZORRO */
@@ -2208,7 +2208,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
 	if (!info)
 		return -ENOMEM;
 
-	zcl = (const struct zorrocl *)ent->driver_data;
+	zcl = ent->driver_data_ptr;
 	btype = zcl->type;
 	regbase = zorro_resource_start(z) + zcl->regoffset;
 	ramsize = zcl->ramsize;
-- 
2.47.3


^ permalink raw reply related

* Re: [PATCH v1 0/8] zorro: Improve handling of pointers in zorro_device_id::driver_data
From: Geert Uytterhoeven @ 2026-05-26 15:01 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Damien Le Moal, Niklas Cassel, James E.J. Bottomley,
	Martin K. Petersen, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Thomas Gleixner, Ingo Molnar,
	Max Staudt, Andi Shyti, Helge Deller, linux-ide, linux-m68k,
	linux-kernel, linux-scsi, netdev, linux-i2c, linux-fbdev,
	dri-devel, Christian A. Ehrhardt, Christian A. Ehrhardt
In-Reply-To: <cover.1779803053.git.u.kleine-koenig@baylibre.com>

Hi Uwe,

On Tue, 26 May 2026 at 16:17, Uwe Kleine-König (The Capable Hub)
<u.kleine-koenig@baylibre.com> wrote:
> this series is about improving the handling of pointers in struct
> zorro_device_id's driver_data.
>
> While it's ok on all current Linux platforms to store a pointer in an
> unsigned long variable, it involves casting that loses type information.
> This can be nicely seen in patch #7 where after profiting from patch #6
> the compiler notices a missing const.
>
> Preparing for that change, all zorro_device_ids are converted to use
> named initializers, which is also a nice cleanup that could stand for
> itself, as it improves readability for humans. (That is necessary
> because an anonymous union can be initialized by name, but not using a
> list initializer.)
>
> My motivation for this series is the CHERI hardware extension. With that
> pointers are bigger than longs and thus you cannot store pointers in
> zorro_device_id::driver_data. So this series is also about getting
> support for CHERI into the mainline, but I hope the clean up effects
> mentioned above are justification enough to accept this series.

Thanks for your series!

> The dependencies in this series are as follows:
>
>  - Patch #5 depends on #1, #2

s/5/6/?

>  - Patches #7 and #8 depend on patch #6.
>
> So if the ata maintainers agreed to merge their patch #1 via scsi, and
> Geert agrees to patch #5 and that it's also merged via scsi, patches #1,

s/5/6/?

> #2, #6 and #7 can go in without further coordination.
>
> Patches #3, #4 and #5 are only about using the same initialization style
> for all zorro_device_id and can go in without coordination.
>
> Best regards
> Uwe
>
> Uwe Kleine-König (The Capable Hub) (8):
>   ata: pata_budda: Use named initializer for zorro_device_id
>   scsi: Use named initializer for zorro_device_id
>   net: Use named initializer for zorro_device_id arrays
>   i2c: icy: Use named initializer for zorro_device_id arrays
>   video: fm2fb: Use named initializer for zorro_device_id array
>   zorro: Simplify storing pointers in device id struct
>   scsi: zorro7xx: Make use of struct zorro_device_id::driver_data_ptr
>   video: cirrusfb: Make use of struct zorro_device_id::driver_data_ptr

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* Re: [PATCH v2] staging: sm750fb: fix CamelCase variables name in sm750
From: Greg KH @ 2026-05-26 16:20 UTC (permalink / raw)
  To: Emmanuel Arias
  Cc: sudipm.mukherjee, teddy.wang, linux-fbdev, linux-staging,
	linux-kernel, kernel test robot
In-Reply-To: <20260526131631.1237672-1-eamanu@riseup.net>

On Tue, May 26, 2026 at 10:16:31AM -0300, Emmanuel Arias wrote:
> Replace CamelCase variable name with snake_case:
> - pvReg -> pv_reg

Why are you keeping the "pv_"?  What does that mean?

> - setAllEngOff -> set_all_eng_off
> 
> Reported-by: kernel test robot <lkp@intel.com>

The test robot told you to make this change?

> Closes: https://lore.kernel.org/oe-kbuild-all/202605171049.KbaBnrJV-lkp@intel.com/
> Signed-off-by: Emmanuel Arias <eamanu@riseup.net>
> ---
>  drivers/staging/sm750fb/sm750.c    |  6 +++---
>  drivers/staging/sm750fb/sm750.h    |  4 ++--
>  drivers/staging/sm750fb/sm750_hw.c | 12 ++++++------
>  3 files changed, 11 insertions(+), 11 deletions(-)

What changed from v1?

thanks,

greg k-h

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox