Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH] fbdev: pvr2fb: correct user pointer annotation and sentinel initializer
From: Helge Deller @ 2026-07-18 19:33 UTC (permalink / raw)
  To: Florian Fuchs, John Paul Adrian Glaubitz
  Cc: Uwe Kleine-König, linux-fbdev, dri-devel, linux-kernel,
	kernel test robot
In-Reply-To: <20260713101638.600333-1-fuchsfl@gmail.com>

On 7/13/26 12:16, Florian Fuchs wrote:
> Add __user annotation to buf, as it is passed as a user pointer in
> pin_user_pages_fast(). Use an empty initializer for the sentinel
> board-table entry to avoid initializing a function pointer with an
> integer literal.
> 
> Fixes: 5f566c0ac51c ("fbdev: pvr2fb: Fix leftover reference to ONCHIP_NR_DMA_CHANNELS")

I think this Fixes tag is wrong.
The problem has been there forever.

> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202607131247.fpQ6eTc7-lkp@intel.com/
> Signed-off-by: Florian Fuchs <fuchsfl@gmail.com>
> ---
> Not sure, if we do such changes, but as I received a test robot email, I
> leave it up to you all :) (I also compiled and tested the change)
> 
>   drivers/video/fbdev/pvr2fb.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
Patch applied to fbdev git tree.

Thanks for fixing!
Helge

^ permalink raw reply

* [PATCH] fonts: fixup font.h kernel-doc warnings
From: Randy Dunlap @ 2026-07-18 19:13 UTC (permalink / raw)
  To: dri-devel; +Cc: Randy Dunlap, Helge Deller, Thomas Zimmermann, linux-fbdev

Use the typedef keyword when describing a typedef.
Add the missing function return value for font_glyph_size().

Warning: include/linux/font.h:84 cannot understand function prototype:
  'typedef const unsigned char font_data_t;'
Warning: include/linux/font.h:53 No description found for return value
  of 'font_glyph_size'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
---
Cc: Helge Deller <deller@gmx.de>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: linux-fbdev@vger.kernel.org

 include/linux/font.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- linux-next-20260717.orig/include/linux/font.h
+++ linux-next-20260717/include/linux/font.h
@@ -49,6 +49,8 @@ static inline unsigned int font_glyph_pi
  * scanlines, which is usually the glyph's height in scanlines. Fonts
  * coming from user space can sometimes have a different vertical pitch
  * with empty scanlines between two adjacent glyphs.
+ *
+ * Returns: the number of bytes per glyph
  */
 static inline unsigned int font_glyph_size(unsigned int width, unsigned int vpitch)
 {
@@ -60,7 +62,7 @@ static inline unsigned int font_glyph_si
  */
 
 /**
- * font_data_t - Raw font data
+ * typedef font_data_t - Raw font data
  *
  * Values of type font_data_t store a pointer to raw font data. The format
  * is monochrome. Each bit sets a pixel of a stored glyph. Font data does

^ permalink raw reply

* Re: [PATCH v2 0/7] vga_switcheroo, drm: Push fbcon handling into DRM clients
From: Helge Deller @ 2026-07-18 19:08 UTC (permalink / raw)
  To: Thomas Zimmermann; +Cc: dri-devel, linux-fbdev
In-Reply-To: <20260709092215.168172-1-tzimmermann@suse.de>

Hi Thomas,

On 7/9/26 11:15, Thomas Zimmermann wrote:
> Vga_switcheroo currently invokes fb_switch_outputs() to inform fbcon
> about switching of the physical outputs among framebuffer devices. But
> new DRM clients to not use fbdev/fbcon and might require their own
> vga_switcheroo support. Let's strictly separate them from each other.
> 
> Remove fbdev/fbcon from vga_switcheroo. Introduce a pre_switch callback
> for vga_switcheroo clients to do the fbcon update. Allows for removing
> all direct interactions between vga_switcheroo and fbdev/fbcon.
> 
> There are only four drivers that support vga_switcheroo: amdgpu,
> radeon, i915 and nouveau. Update each of them with the new callback.
> When vga_switcheroo now invokes pre_switch, each DRM driver forwards
> to aquire_outputs and lets the DRM clients handle the new outputs.
> 
> At the same time, push the fbcon update into DRM's client for fbdev
> emulation. Do this with the new DRM client callback acquire_outputs,
> so that other clients can have their own handling of vga_switcheroo.
> 
> Also replace the existing reprobe hook with post_switch for symetry.
> For nouveau, this is merely a rename of the helper function. The other
> drivers dor not implement reprobe.
> 
> Tested with radeon on a notebook with Radeon HD 4225 and HD 5430.
> 
> v2:
> - implement all of pre_switch in a single commit to avoid possible
>    deadlock in intermediate state (Sashiko)
> - fix erroneous docs (Sashiko)
> 
> Thomas Zimmermann (7):
>    drm/edid: Include <linux/fb.h>
>    drm/client: Add acquire_outputs callback; implement for fbdev
>      emulation
>    vga_switcheroo: Add pre_switch callback to client ops
>    vga_switcheroo: Add post_switch callback to client ops
>    drm: Implement struct vga_switcheroo_client_ops.pre_switch
>    drm: Implement vga_switcheroo_client_ops.post_switch
>    vga-switcheroo: Remove unused interfaces
> 
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  9 ++++-
>   drivers/gpu/drm/clients/drm_fbdev_client.c | 23 ++++++++----
>   drivers/gpu/drm/drm_client_event.c         | 18 ++++++++++
>   drivers/gpu/drm/drm_edid.c                 |  1 +
>   drivers/gpu/drm/i915/i915_switcheroo.c     | 11 +++++-
>   drivers/gpu/drm/nouveau/nouveau_vga.c      | 28 +++++++++------
>   drivers/gpu/drm/radeon/radeon_device.c     |  9 ++++-
>   drivers/gpu/vga/vga_switcheroo.c           | 41 +++++-----------------
>   drivers/video/fbdev/core/fbcon.c           |  8 -----
>   include/drm/drm_client.h                   | 14 ++++++++
>   include/drm/drm_client_event.h             |  3 ++
>   include/linux/vga_switcheroo.h             | 29 ++++++++-------
>   12 files changed, 121 insertions(+), 73 deletions(-)
You may add a
Acked-by: Helge Deller <deller@gmx.de>
to the series.

Just in case you want me to take the series through the fbdev git tree,
please let me know.

Helge

^ permalink raw reply

* Re: [PATCH] fbdev: udlfb: validate vendor descriptor items
From: Helge Deller @ 2026-07-18 18:59 UTC (permalink / raw)
  To: Pengpeng Hou, Bernie Thompson; +Cc: linux-fbdev, dri-devel, linux-kernel
In-Reply-To: <db0698e3-9f45-4123-8b6d-ff59bcdcf25f@gmx.de>

On 7/18/26 20:26, Helge Deller wrote:
> On 7/6/26 11:30, Pengpeng Hou wrote:
>> dlfb_parse_vendor_descriptor() walks key-length-value items inside the
>> DisplayLink vendor descriptor.
>>
>> Require each item to contain its key, length and declared value bytes
>> before reading item-specific fields such as max_area.
>>
>> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
>> ---
>>   drivers/video/fbdev/udlfb.c | 22 ++++++++++++++++------
>>   1 file changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c
>> index fdbb8671a810..e78d6f95c9c5 100644
>> --- a/drivers/video/fbdev/udlfb.c
>> +++ b/drivers/video/fbdev/udlfb.c
>> @@ -1586,19 +1586,29 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb,
>>           desc += 5; /* the fixed header we've already parsed */
>>           while (desc < desc_end) {
>> +            char *value;
>>               u8 length;
>>               u16 key;
>> -            key = *desc++;
>> -            key |= (u16)*desc++ << 8;
>> +            if (desc_end - desc < sizeof(key) + sizeof(length))
>> +                goto unrecognized;
>> +
>> +            key = get_unaligned_le16(desc);
> 
> Is there a reason why you switch to unconditional little-endian reads?
> Is this "vendor descriptor" always little-endian?
> If yes, then your patch is probably correct.
> If not, I think your patch will most likely break big-endian machines.
Please ignore my comments above.
I should have looked more closely.
Your patch is of course correct!

The patch is now added to fbdev git tree.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbdev: sstfb: add missing MODULE_DEVICE_TABLE()
From: Helge Deller @ 2026-07-18 18:55 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: linux-fbdev, dri-devel, linux-kernel
In-Reply-To: <20260705001509.66078-1-pengpeng@iscas.ac.cn>

On 7/5/26 02:14, Pengpeng Hou wrote:
> The driver has a match table for the pci bus wired into its driver
> structure, but the table is not exported with MODULE_DEVICE_TABLE().
> 
> Add the missing MODULE_DEVICE_TABLE() entry so module alias information
> is generated for automatic module loading.
> 
> This is a source-level fix.  It does not claim dynamic hardware
> reproduction; the evidence is the driver-owned match table, its use by
> the driver registration structure, and the missing module alias
> publication.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>   drivers/video/fbdev/sstfb.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/video/fbdev/sstfb.c b/drivers/video/fbdev/sstfb.c
> index 2ea947f57efb..2745557822f7 100644
> --- a/drivers/video/fbdev/sstfb.c
> +++ b/drivers/video/fbdev/sstfb.c
> @@ -1492,6 +1492,7 @@ static const struct pci_device_id sstfb_id_tbl[] = {
>   		.driver_data = ID_VOODOO2, },
>   	{ 0 },
>   };
> +MODULE_DEVICE_TABLE(pci, sstfb_id_tbl);
I'm not sure if it was intentionally not added, maybe because it's an
add-on card for which people should manually load the driver.

Anyway, I'm adding this patch now to the fbdev git tree and will find out if
someone reports a regression...

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fb: omap2: dsi: do not copy isr table
From: Helge Deller @ 2026-07-18 18:51 UTC (permalink / raw)
  To: Andreas Kemnade
  Cc: linux-omap, linux-fbdev, dri-devel, linux-kernel, sashiko-bot
In-Reply-To: <20260702-fbomap-uaf-fix-v1-1-6417edf9d3e7@kemnade.info>

On 7/2/26 17:50, Andreas Kemnade wrote:
> To te able to unregister stuff from isrs, the corresponding table was
> copied.  Nobody seems to unregister stuff that way, so it does not help.
> But there are stack-allocated objects passed to these isrs giving chances
> of UAF of these objects if irqs are unregistered while they are handled,
> so better do not copy that table.
> 
> Suggested-by: sashiko-bot@kernel.org
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
> Fix for drm variant fo driver:
> https://lore.kernel.org/lkml/20260702-dsi-uaf-v2-1-dbb4aa0f0b8e@kemnade.info/
> ---
>   drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 9 +--------
>   1 file changed, 1 insertion(+), 8 deletions(-)

applied.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbdev: tdfxfb: fix PCI enable cleanup with pcim_enable_device()
From: Helge Deller @ 2026-07-18 18:48 UTC (permalink / raw)
  To: Myeonghun Pak; +Cc: linux-fbdev, dri-devel, linux-kernel, Ijae Kim
In-Reply-To: <20260701112147.55048-1-mhun512@gmail.com>

On 7/1/26 13:21, Myeonghun Pak wrote:
> tdfxfb_probe() enables the PCI device with pci_enable_device(), but
> several failure paths after that point return without disabling it. The
> framebuffer_alloc() failure path returns -ENOMEM directly, and the later
> shared out_err path releases the framebuffer and returns -ENXIO without
> balancing the PCI enable state.
> 
> The successful probe path has the same imbalance because tdfxfb_remove()
> releases the framebuffer, mappings and regions, but never calls
> pci_disable_device().
> 
> Use pcim_enable_device() so the PCI device is disabled automatically on
> probe failure and driver detach.
> 
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
>   drivers/video/fbdev/tdfxfb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
applied.
Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbdev: uvesafb: unregister connector callback on init failure
From: Helge Deller @ 2026-07-18 18:40 UTC (permalink / raw)
  To: Myeonghun Pak, Michal Januszewski
  Cc: linux-fbdev, dri-devel, linux-kernel, stable, Ijae Kim
In-Reply-To: <20260701111224.48646-1-mhun512@gmail.com>

On 7/1/26 13:12, Myeonghun Pak wrote:
> uvesafb_init() registers the v86d connector callback before registering
> the platform driver. If platform_driver_register() fails, the function
> returns the error directly and leaves the connector callback registered.
> 
> The later platform-device failure path already unregisters the callback.
> Add the same cleanup before the final return when platform-driver
> registration fails.
> 
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
> 
> Fixes: 8bdb3a2d7df4 ("uvesafb: the driver core")
> Cc: stable@vger.kernel.org
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
> ---
>   drivers/video/fbdev/uvesafb.c | 2 ++
>   1 file changed, 2 insertions(+)
applied.

Thanks!
Helge

^ permalink raw reply

* Re: [PATCH] fbdev: udlfb: validate vendor descriptor items
From: Helge Deller @ 2026-07-18 18:26 UTC (permalink / raw)
  To: Pengpeng Hou, Bernie Thompson; +Cc: linux-fbdev, dri-devel, linux-kernel
In-Reply-To: <20260706093038.80131-1-pengpeng@iscas.ac.cn>

On 7/6/26 11:30, Pengpeng Hou wrote:
> dlfb_parse_vendor_descriptor() walks key-length-value items inside the
> DisplayLink vendor descriptor.
> 
> Require each item to contain its key, length and declared value bytes
> before reading item-specific fields such as max_area.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>   drivers/video/fbdev/udlfb.c | 22 ++++++++++++++++------
>   1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c
> index fdbb8671a810..e78d6f95c9c5 100644
> --- a/drivers/video/fbdev/udlfb.c
> +++ b/drivers/video/fbdev/udlfb.c
> @@ -1586,19 +1586,29 @@ static int dlfb_parse_vendor_descriptor(struct dlfb_data *dlfb,
>   		desc += 5; /* the fixed header we've already parsed */
>   
>   		while (desc < desc_end) {
> +			char *value;
>   			u8 length;
>   			u16 key;
>   
> -			key = *desc++;
> -			key |= (u16)*desc++ << 8;
> +			if (desc_end - desc < sizeof(key) + sizeof(length))
> +				goto unrecognized;
> +
> +			key = get_unaligned_le16(desc);

Is there a reason why you switch to unconditional little-endian reads?
Is this "vendor descriptor" always little-endian?
If yes, then your patch is probably correct.
If not, I think your patch will most likely break big-endian machines.

Helge

> +			desc += sizeof(key);
>   			length = *desc++;
>   
> +			if (length > desc_end - desc)
> +				goto unrecognized;
> +
> +			value = desc;
>   			switch (key) {
>   			case 0x0200: { /* max_area */
> -				u32 max_area = *desc++;
> -				max_area |= (u32)*desc++ << 8;
> -				max_area |= (u32)*desc++ << 16;
> -				max_area |= (u32)*desc++ << 24;
> +				u32 max_area;
> +
> +				if (length < sizeof(max_area))
> +					goto unrecognized;
> +
> +				max_area = get_unaligned_le32(value);
>   				dev_warn(&intf->dev,
>   					 "DL chip limited to %d pixel modes\n",
>   					 max_area);


^ permalink raw reply

* [PATCH] staging: fbtft: fix checkpatch errors in fbtft-bus.c
From: Shivesh @ 2026-07-18 18:23 UTC (permalink / raw)
  To: andy, gregkh; +Cc: dri-devel, linux-fbdev, linux-staging, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1330 bytes --]

From 7e9684b26176644bc92c2285acc7444f3f7ddb4d Mon Sep 17 00:00:00 2001
From: Shivesh <chanelshivesh@gmail.com>
Date: Sat, 18 Jul 2026 18:08:04 +0000
Subject: [PATCH] staging: fbtft: fix checkpatch errors in fbtft-bus.c

Fix space-related checkpatch errors in macro invocations. When the
modifier argument is empty, remove the trailing comma to avoid
'space required after comma' and 'space prohibited before close
parenthesis' conflicting errors.

Signed-off-by: Shivesh <chanelshivesh@gmail.com>
---
 drivers/staging/fbtft/fbtft-bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
index 30e436ff19e4..409770891c54 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -62,9 +62,9 @@ out:									      \
 }                                                                             \
 EXPORT_SYMBOL(func);
 
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8)
 define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16)
 
 void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 {
-- 
2.53.0


[-- Attachment #2: 0001-staging-fbtft-fix-checkpatch-errors-in-fbtft-bus.c.patch --]
[-- Type: application/octet-stream, Size: 1330 bytes --]

From 7e9684b26176644bc92c2285acc7444f3f7ddb4d Mon Sep 17 00:00:00 2001
From: Shivesh <chanelshivesh@gmail.com>
Date: Sat, 18 Jul 2026 18:08:04 +0000
Subject: [PATCH] staging: fbtft: fix checkpatch errors in fbtft-bus.c

Fix space-related checkpatch errors in macro invocations. When the
modifier argument is empty, remove the trailing comma to avoid
'space required after comma' and 'space prohibited before close
parenthesis' conflicting errors.

Signed-off-by: Shivesh <chanelshivesh@gmail.com>
---
 drivers/staging/fbtft/fbtft-bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-bus.c b/drivers/staging/fbtft/fbtft-bus.c
index 30e436ff19e4..409770891c54 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -62,9 +62,9 @@ out:									      \
 }                                                                             \
 EXPORT_SYMBOL(func);
 
-define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8, )
+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, u8)
 define_fbtft_write_reg(fbtft_write_reg16_bus8, __be16, u16, cpu_to_be16)
-define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16, )
+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, u16)
 
 void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...)
 {
-- 
2.53.0


^ permalink raw reply related

* Re: [PATCH] fbdev: arkfb: Move a variable assignment behind a condition check in ics5342_init()
From: Helge Deller @ 2026-07-18 18:17 UTC (permalink / raw)
  To: Markus Elfring, linux-fbdev, dri-devel, Kees Cook,
	Uwe Kleine-König
  Cc: LKML, kernel-janitors
In-Reply-To: <36d0eba7-e78d-4a06-95bc-c97d9b91f8f0@web.de>

On 7/13/26 12:18, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 13 Jul 2026 12:12:52 +0200
> 
> The address of a data structure member was determined before
> a corresponding null pointer check in the implementation of
> the function “ics5342_init”.
> 
> Thus avoid the risk for undefined behaviour by moving the assignment
> for the variable “info” behind a condition check.
> 
> This issue was detected by using the Coccinelle software.

There is no "risk" here.
It just adds an offset to a potential NULL value (which isn't then used afterwards).

Helge 
> Fixes: ede481f6dad47d40b7e561cfbc6c04286a9faf1a ("fbdev: arkfb: Cast ics5342_init() allocation type")
> Cc: stable@vger.kernel.org
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>   drivers/video/fbdev/arkfb.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c
> index 195dbf4a5142..9658f407b79a 100644
> --- a/drivers/video/fbdev/arkfb.c
> +++ b/drivers/video/fbdev/arkfb.c
> @@ -432,11 +432,12 @@ static struct dac_ops ics5342_ops = {
>   static struct dac_info * ics5342_init(dac_read_regs_t drr, dac_write_regs_t dwr, void *data)
>   {
>   	struct ics5342_info *ics_info = kzalloc_obj(struct ics5342_info);
> -	struct dac_info *info = &ics_info->dac;
> +	struct dac_info *info;
>   
>   	if (!ics_info)
>   		return NULL;
>   
> +	info = &ics_info->dac;
>   	info->dacops = &ics5342_ops;
>   	info->dac_read_regs = drr;
>   	info->dac_write_regs = dwr;


^ permalink raw reply

* Re: [PATCH v2] staging: sm750fb: fix mono image source stride mismatch in lynxfb_ops_imageblit()
From: Dan Carpenter @ 2026-07-18 11:57 UTC (permalink / raw)
  To: Muhammad Bilal
  Cc: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman, linux-fbdev,
	linux-staging, linux-kernel
In-Reply-To: <20260718103103.18082-1-meatuni001@gmail.com>

On Sat, Jul 18, 2026 at 03:31:03PM +0500, Muhammad Bilal wrote:
> sm750_hw_imageblit() advances its monochrome source pointer by
> src_delta per scanline, and computes the correct rounded-up stride
> internally as:
> 
> 	bytes_per_scan = (width + start_bit + 7) / 8;
> 
> Its only caller, lynxfb_ops_imageblit(), instead passed src_delta as
> image->width >> 3. For widths not a multiple of 8 this under-counted
> the stride, so the source pointer fell further behind the real
> per-scanline layout on every line, corrupting the rendered image.
> 
> Rather than just fixing the caller's calculation, remove src_delta
> as a parameter entirely and have sm750_hw_imageblit() advance by the
> bytes_per_scan it already computes for itself. There has only ever
> been one caller, and that caller was passing an out-of-sync
> derivative of the same width/start_bit values sm750_hw_imageblit()
> already has, so keeping stride as a separate parameter served no
> purpose beyond letting the two calculations drift apart, which is
> exactly what happened here.
> 
> Fixes: 81dee67e215b2 ("staging: sm750fb: add sm750 to staging")
> Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
> ---

There is supposed to be a little note here:
---
v2: Added a Fixes tag.

https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/

Obviously there is an inconsistency between rounding up and down
but without testing it's less clear which one is correct...

regards,
dan carpenter


^ permalink raw reply

* Re: [PATCH] staging: sm750fb: fix mono image source stride mismatch in lynxfb_ops_imageblit()
From: Dan Carpenter @ 2026-07-18 11:54 UTC (permalink / raw)
  To: Muhammad Bilal
  Cc: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman, linux-fbdev,
	linux-staging, linux-kernel
In-Reply-To: <CADqcGB=F6Qvk-3zQ=DCPewfpOAQvCta2q-WrfuSPanmoVqyGpg@mail.gmail.com>

On Sat, Jul 18, 2026 at 03:38:52PM +0500, Muhammad Bilal wrote:
> On Sat, Jul 18, 2026, Dan Carpenter wrote:
> > Looks reasonable.  Add a Fixes tag.
> >
> > You have this hardware and are finding these with testing?
> >
> > It would be better to move the source delta calculation into
> > the the sm750_hw_imageblit() since it's just width rounded up
> > (or rounded down if you want to be wrong I suppose).
> 
> Thanks for the review. Sending v2 as a separate message since it
> came out as a fuller rework rather than a small diff on v1:
> 
>  - Added Fixes: 81dee67e215b2 ("staging: sm750fb: add sm750 to
>    staging"), traced via git blame. The bug has been there,
>    unchanged, since the original 2015 staging import.
> 
>  - No, I don't have this hardware. This was found by auditing
>    sm750_hw_imageblit()'s internal stride calculation against what
>    its caller was passing in, and confirmed with a clean "-Werror"
>    build. No runtime testing on real sm750 silicon.

You really need to put this into the commit message.

regards,
dan carpenter


^ permalink raw reply

* Re: [PATCH] staging: sm750fb: fix mono image source stride mismatch in lynxfb_ops_imageblit()
From: Muhammad Bilal @ 2026-07-18 10:38 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman, linux-fbdev,
	linux-staging, linux-kernel
In-Reply-To: <alsSp5tAe8tunTeG@stanley.mountain>

On Sat, Jul 18, 2026, Dan Carpenter wrote:
> Looks reasonable.  Add a Fixes tag.
>
> You have this hardware and are finding these with testing?
>
> It would be better to move the source delta calculation into
> the the sm750_hw_imageblit() since it's just width rounded up
> (or rounded down if you want to be wrong I suppose).

Thanks for the review. Sending v2 as a separate message since it
came out as a fuller rework rather than a small diff on v1:

 - Added Fixes: 81dee67e215b2 ("staging: sm750fb: add sm750 to
   staging"), traced via git blame. The bug has been there,
   unchanged, since the original 2015 staging import.

 - No, I don't have this hardware. This was found by auditing
   sm750_hw_imageblit()'s internal stride calculation against what
   its caller was passing in, and confirmed with a clean "-Werror"
   build. No runtime testing on real sm750 silicon.

 - Moved the stride calculation into sm750_hw_imageblit() itself, as
   you suggested, and dropped src_delta as a parameter entirely. It
   was the only caller and was independently recomputing (wrong)
   something the function already had every input for - which is
   exactly how this bug happened. Updated the declaration in
   sm750_accel.h and the de_imageblit function pointer typedef in
   sm750.h to match.

regards,
Muhammad Bilal

^ permalink raw reply

* [PATCH v2] staging: sm750fb: fix mono image source stride mismatch in lynxfb_ops_imageblit()
From: Muhammad Bilal @ 2026-07-18 10:31 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang
  Cc: Greg Kroah-Hartman, linux-fbdev, linux-staging, linux-kernel,
	Muhammad Bilal

sm750_hw_imageblit() advances its monochrome source pointer by
src_delta per scanline, and computes the correct rounded-up stride
internally as:

	bytes_per_scan = (width + start_bit + 7) / 8;

Its only caller, lynxfb_ops_imageblit(), instead passed src_delta as
image->width >> 3. For widths not a multiple of 8 this under-counted
the stride, so the source pointer fell further behind the real
per-scanline layout on every line, corrupting the rendered image.

Rather than just fixing the caller's calculation, remove src_delta
as a parameter entirely and have sm750_hw_imageblit() advance by the
bytes_per_scan it already computes for itself. There has only ever
been one caller, and that caller was passing an out-of-sync
derivative of the same width/start_bit values sm750_hw_imageblit()
already has, so keeping stride as a separate parameter served no
purpose beyond letting the two calculations drift apart, which is
exactly what happened here.

Fixes: 81dee67e215b2 ("staging: sm750fb: add sm750 to staging")
Signed-off-by: Muhammad Bilal <meatuni001@gmail.com>
---
 drivers/staging/sm750fb/sm750.c       | 2 +-
 drivers/staging/sm750fb/sm750.h       | 2 +-
 drivers/staging/sm750fb/sm750_accel.c | 6 ++----
 drivers/staging/sm750fb/sm750_accel.h | 4 +---
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 89c811e0806c..da0b4979a281 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -261,7 +261,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info,
 	spin_lock(&sm750_dev->slock);
 
 	sm750_dev->accel.de_imageblit(&sm750_dev->accel,
-				      image->data, image->width >> 3, 0,
+				      image->data, 0,
 				      base, pitch, bpp,
 				      image->dx, image->dy,
 				      image->width, image->height,
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index d2c522e67f26..83229fe155ec 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -73,7 +73,7 @@ struct lynx_accel {
 			   u32 rop2);
 
 	int (*de_imageblit)(struct lynx_accel *accel, const char *p_srcbuf,
-			    u32 src_delta, u32 start_bit, u32 d_base, u32 d_pitch,
+			    u32 start_bit, u32 d_base, u32 d_pitch,
 			    u32 byte_per_pixel, u32 dx, u32 dy, u32 width,
 			    u32 height, u32 f_color, u32 b_color, u32 rop2);
 
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 0316ea69d009..bac9a209899c 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -288,8 +288,6 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)
  * sm750_hw_imageblit
  * @accel: Acceleration device data
  * @src_buf: pointer to start of source buffer in system memory
- * @src_delta: Pitch value (in bytes) of the source buffer, +ive means top down
- *	      and -ive mean button up
  * @start_bit: Mono data can start at any bit in a byte, this value should be
  *	      0 to 7
  * @dest_base: Address of destination: offset in frame buffer
@@ -304,7 +302,7 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)
  * @rop2: ROP value
  */
 int sm750_hw_imageblit(struct lynx_accel *accel, const char *src_buf,
-		       u32 src_delta, u32 start_bit, u32 dest_base, u32 dest_pitch,
+		       u32 start_bit, u32 dest_base, u32 dest_pitch,
 		       u32 byte_per_pixel, u32 dx, u32 dy, u32 width,
 		       u32 height, u32 fg_color, u32 bg_color, u32 rop2)
 {
@@ -395,7 +393,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *src_buf,
 			write_dp_port(accel, *(unsigned int *)remain);
 		}
 
-		src_buf += src_delta;
+		src_buf += bytes_per_scan;
 	}
 
 	return 0;
diff --git a/drivers/staging/sm750fb/sm750_accel.h b/drivers/staging/sm750fb/sm750_accel.h
index d15a40cacb84..4f609d6af0fa 100644
--- a/drivers/staging/sm750fb/sm750_accel.h
+++ b/drivers/staging/sm750fb/sm750_accel.h
@@ -220,8 +220,6 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
 /**
  * sm750_hw_imageblit
  * @pSrcbuf: pointer to start of source buffer in system memory
- * @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down
- *>-----      and -ive mean button up
  * @startBit: Mono data can start at any bit in a byte, this value should be
  *>-----      0 to 7
  * @dBase: Address of destination: offset in frame buffer
@@ -236,7 +234,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
  * @rop2: ROP value
  */
 int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
-		       u32 srcDelta, u32 startBit, u32 dBase, u32 dPitch,
+		       u32 startBit, u32 dBase, u32 dPitch,
 		       u32 bytePerPixel, u32 dx, u32 dy, u32 width,
 		       u32 height, u32 fColor, u32 bColor, u32 rop2);
 
-- 
2.55.0


^ permalink raw reply related

* Re: [PATCH v2 0/2] staging: sm750fb: remove dead VALIDATION_CHIP code
From: Greg Kroah-Hartman @ 2026-07-18  6:31 UTC (permalink / raw)
  To: Nils Lehnen
  Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, linux-staging,
	linux-kernel
In-Reply-To: <20260718062027.5850-1-nils.lehnen@proton.me>

On Sat, Jul 18, 2026 at 06:20:56AM +0000, Nils Lehnen wrote:
> VALIDATION_CHIP is defined nowhere in the tree, yet fourteen
> preprocessor conditionals in the sm750fb DDK files still test it.
> Patch 1 resolves all of them (dead branches dropped, always-true
> branches kept), as the driver TODO asks under "remove unused code";
> patch 2 cleans up the indentation and blank lines the removal leaves
> behind.
> 
> Verification, both patches: the disassembly of all ten sm750fb object
> files (objdump -d, x86, CONFIG_FB_SM750=m) is bit-identical across the
> series. Compile-tested only; no SM750 hardware available.
> 
> All English text in this series (cover letter, commit messages, code
> comments) was translated from a German draft with the assistance of
> Claude Fable 5.
> 
> v2: resend of v1 -- patch 1/2 of v1 arrived with an empty subject due
> to a local send mishap; no code changes.
> v1: https://lore.kernel.org/r/20260718055132.441-1-nils.lehnen@proton.me

Please wait a day or so between new versions, gives people a chance to
review what you sent and you to make changes based on it.

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH 2/2] staging: sm750fb: unindent defines left by conditional removal
From: Nils Lehnen @ 2026-07-18  6:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, linux-staging,
	linux-kernel
In-Reply-To: <2026071810-reprogram-decade-7537@gregkh>

On Sat, Jul 18, 2026 at 08:20:36AM +0200, Greg Kroah-Hartman wrote:
> No, this is not correct, the indentation gives you context of what is
> happening.

Right, the indented defines are the values of the field define right
above them, and unindenting throws that context away. I'll drop this
patch.

A v2 of the series crossed with your review -- please disregard its
patch 2/2 as well. A v3 with only the conditional removal follows.

Sorry also for the subject-less 1/2 in this thread; that was a local
send-email mishap on my side.

Thanks for the review,

Nils


^ permalink raw reply

* [PATCH v2 2/2] staging: sm750fb: unindent defines left by conditional removal
From: Nils Lehnen @ 2026-07-18  6:21 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Nils Lehnen
In-Reply-To: <20260718062027.5850-1-nils.lehnen@proton.me>

The preceding removal of the VALIDATION_CHIP conditionals left the
surviving define blocks and one comment indented by four spaces, and
two double blank lines where conditional lines went away. Move the
now-unconditional defines to column zero while keeping the aligned
value column untouched, and collapse the blank lines.

No functional change: whitespace and preprocessor layout only; the
disassembly of all ten sm750fb object files stays bit-identical.

All English text in this patch (commit message and code comments) was
translated from a German draft with the assistance of Claude Fable 5.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Nils Lehnen <nils.lehnen@proton.me>
---
 drivers/staging/sm750fb/ddk750_reg.h | 50 +++++++++++++---------------
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h
index 4bcede37584a..2888ffe32fa2 100644
--- a/drivers/staging/sm750fb/ddk750_reg.h
+++ b/drivers/staging/sm750fb/ddk750_reg.h
@@ -294,15 +294,15 @@
 
 #define CURRENT_GATE                                  0x000040
 #define CURRENT_GATE_MCLK_MASK                        (0x3 << 14)
-    #define CURRENT_GATE_MCLK_DIV_3                   (0x0 << 14)
-    #define CURRENT_GATE_MCLK_DIV_4                   (0x1 << 14)
-    #define CURRENT_GATE_MCLK_DIV_6                   (0x2 << 14)
-    #define CURRENT_GATE_MCLK_DIV_8                   (0x3 << 14)
+#define CURRENT_GATE_MCLK_DIV_3                       (0x0 << 14)
+#define CURRENT_GATE_MCLK_DIV_4                       (0x1 << 14)
+#define CURRENT_GATE_MCLK_DIV_6                       (0x2 << 14)
+#define CURRENT_GATE_MCLK_DIV_8                       (0x3 << 14)
 #define CURRENT_GATE_M2XCLK_MASK                      (0x3 << 12)
-    #define CURRENT_GATE_M2XCLK_DIV_1                 (0x0 << 12)
-    #define CURRENT_GATE_M2XCLK_DIV_2                 (0x1 << 12)
-    #define CURRENT_GATE_M2XCLK_DIV_3                 (0x2 << 12)
-    #define CURRENT_GATE_M2XCLK_DIV_4                 (0x3 << 12)
+#define CURRENT_GATE_M2XCLK_DIV_1                     (0x0 << 12)
+#define CURRENT_GATE_M2XCLK_DIV_2                     (0x1 << 12)
+#define CURRENT_GATE_M2XCLK_DIV_3                     (0x2 << 12)
+#define CURRENT_GATE_M2XCLK_DIV_4                     (0x3 << 12)
 #define CURRENT_GATE_VGA                              BIT(10)
 #define CURRENT_GATE_PWM                              BIT(9)
 #define CURRENT_GATE_I2C                              BIT(8)
@@ -383,10 +383,10 @@
 #define PLL_CTRL_BYPASS                               BIT(18)
 #define PLL_CTRL_POWER                                BIT(17)
 #define PLL_CTRL_INPUT                                BIT(16)
-    #define PLL_CTRL_POD_SHIFT                        14
-    #define PLL_CTRL_POD_MASK                         (0x3 << 14)
-    #define PLL_CTRL_OD_SHIFT                         12
-    #define PLL_CTRL_OD_MASK                          (0x3 << 12)
+#define PLL_CTRL_POD_SHIFT                            14
+#define PLL_CTRL_POD_MASK                             (0x3 << 14)
+#define PLL_CTRL_OD_SHIFT                             12
+#define PLL_CTRL_OD_MASK                              (0x3 << 12)
 #define PLL_CTRL_N_SHIFT                              8
 #define PLL_CTRL_N_MASK                               (0xf << 8)
 #define PLL_CTRL_M_SHIFT                              0
@@ -400,7 +400,6 @@
 
 #define SCRATCH_DATA                                  0x00006c
 
-
 #define MXCLK_PLL_CTRL                                0x000070
 
 #define VGA_CONFIGURATION                             0x000088
@@ -408,7 +407,6 @@
 #define VGA_CONFIGURATION_PLL                         BIT(2)
 #define VGA_CONFIGURATION_MODE                        BIT(1)
 
-
 #define GPIO_DATA                                       0x010000
 #define GPIO_DATA_31                                    BIT(31)
 #define GPIO_DATA_30                                    BIT(30)
@@ -996,7 +994,7 @@
 #define CRT_DISPLAY_CTRL_CRTSELECT                    BIT(25)
 #define CRT_DISPLAY_CTRL_RGBBIT                       BIT(24)
 
-    #define CRT_DISPLAY_CTRL_CENTERING                BIT(24)
+#define CRT_DISPLAY_CTRL_CENTERING                    BIT(24)
 #define CRT_DISPLAY_CTRL_LOCK_TIMING                  BIT(23)
 #define CRT_DISPLAY_CTRL_EXPANSION                    BIT(22)
 #define CRT_DISPLAY_CTRL_VERTICAL_MODE                BIT(21)
@@ -1095,26 +1093,26 @@
 
 /* This vertical expansion below start at 0x080240 ~ 0x080264 */
 #define CRT_VERTICAL_EXPANSION                        0x080240
-    #define CRT_VERTICAL_CENTERING_VALUE_MASK         (0xff << 24)
+#define CRT_VERTICAL_CENTERING_VALUE_MASK             (0xff << 24)
 #define CRT_VERTICAL_EXPANSION_COMPARE_VALUE_MASK     (0xff << 16)
 #define CRT_VERTICAL_EXPANSION_LINE_BUFFER_MASK       (0xf << 12)
 #define CRT_VERTICAL_EXPANSION_SCALE_FACTOR_MASK      0xfff
 
 /* This horizontal expansion below start at 0x080268 ~ 0x08027C */
 #define CRT_HORIZONTAL_EXPANSION                      0x080268
-    #define CRT_HORIZONTAL_CENTERING_VALUE_MASK       (0xff << 24)
+#define CRT_HORIZONTAL_CENTERING_VALUE_MASK           (0xff << 24)
 #define CRT_HORIZONTAL_EXPANSION_COMPARE_VALUE_MASK   (0xff << 16)
 #define CRT_HORIZONTAL_EXPANSION_SCALE_FACTOR_MASK    0xfff
 
-    /* Auto Centering */
-    #define CRT_AUTO_CENTERING_TL                     0x080280
-    #define CRT_AUTO_CENTERING_TL_TOP_MASK            (0x7ff << 16)
-    #define CRT_AUTO_CENTERING_TL_LEFT_MASK           0x7ff
+/* Auto Centering */
+#define CRT_AUTO_CENTERING_TL                         0x080280
+#define CRT_AUTO_CENTERING_TL_TOP_MASK                (0x7ff << 16)
+#define CRT_AUTO_CENTERING_TL_LEFT_MASK               0x7ff
 
-    #define CRT_AUTO_CENTERING_BR                     0x080284
-    #define CRT_AUTO_CENTERING_BR_BOTTOM_MASK         (0x7ff << 16)
-    #define CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT        16
-    #define CRT_AUTO_CENTERING_BR_RIGHT_MASK          0x7ff
+#define CRT_AUTO_CENTERING_BR                         0x080284
+#define CRT_AUTO_CENTERING_BR_BOTTOM_MASK             (0x7ff << 16)
+#define CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT            16
+#define CRT_AUTO_CENTERING_BR_RIGHT_MASK              0x7ff
 
 /* sm750le new register to control panel output */
 #define DISPLAY_CONTROL_750LE			      0x80288
@@ -1294,7 +1292,7 @@
 #define ZV0_CAPTURE_BUF1_ADDRESS_ADDRESS_MASK           0x3ffffff
 
 #define ZV0_CAPTURE_BUF_OFFSET                          0x090014
-    #define ZV0_CAPTURE_BUF_OFFSET_YCLIP_ODD_FIELD      (0x3ff << 16)
+#define ZV0_CAPTURE_BUF_OFFSET_YCLIP_ODD_FIELD          (0x3ff << 16)
 #define ZV0_CAPTURE_BUF_OFFSET_OFFSET_MASK              0xffff
 
 #define ZV0_CAPTURE_FIFO_CTRL                           0x090018
-- 
2.43.0



^ permalink raw reply related

* [PATCH v2 1/2] staging: sm750fb: remove dead VALIDATION_CHIP conditionals
From: Nils Lehnen @ 2026-07-18  6:21 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Nils Lehnen
In-Reply-To: <20260718062027.5850-1-nils.lehnen@proton.me>

VALIDATION_CHIP is defined nowhere in the tree and no Makefile passes
-DVALIDATION_CHIP, so every #ifdef VALIDATION_CHIP block is dead code
and every #ifndef VALIDATION_CHIP condition is always true. Resolve all
fourteen conditionals accordingly (dead branches dropped, live branches
kept), as the driver TODO asks under "remove unused code".

No functional change: the disassembly of all ten sm750fb object files
is bit-identical before and after this patch.

All English text in this patch (commit message and code comments) was
translated from a German draft with the assistance of Claude Fable 5.

Assisted-by: Claude:claude-fable-5 sparse unifdef
Signed-off-by: Nils Lehnen <nils.lehnen@proton.me>
---
 drivers/staging/sm750fb/ddk750_reg.h   | 34 --------------------------
 drivers/staging/sm750fb/ddk750_chip.c  |  4 ---
 drivers/staging/sm750fb/ddk750_power.c |  6 -----
 3 files changed, 44 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h
index fe412ead72e5..4bcede37584a 100644
--- a/drivers/staging/sm750fb/ddk750_reg.h
+++ b/drivers/staging/sm750fb/ddk750_reg.h
@@ -294,29 +294,15 @@
 
 #define CURRENT_GATE                                  0x000040
 #define CURRENT_GATE_MCLK_MASK                        (0x3 << 14)
-#ifdef VALIDATION_CHIP
-    #define CURRENT_GATE_MCLK_112MHZ                  (0x0 << 14)
-    #define CURRENT_GATE_MCLK_84MHZ                   (0x1 << 14)
-    #define CURRENT_GATE_MCLK_56MHZ                   (0x2 << 14)
-    #define CURRENT_GATE_MCLK_42MHZ                   (0x3 << 14)
-#else
     #define CURRENT_GATE_MCLK_DIV_3                   (0x0 << 14)
     #define CURRENT_GATE_MCLK_DIV_4                   (0x1 << 14)
     #define CURRENT_GATE_MCLK_DIV_6                   (0x2 << 14)
     #define CURRENT_GATE_MCLK_DIV_8                   (0x3 << 14)
-#endif
 #define CURRENT_GATE_M2XCLK_MASK                      (0x3 << 12)
-#ifdef VALIDATION_CHIP
-    #define CURRENT_GATE_M2XCLK_336MHZ                (0x0 << 12)
-    #define CURRENT_GATE_M2XCLK_168MHZ                (0x1 << 12)
-    #define CURRENT_GATE_M2XCLK_112MHZ                (0x2 << 12)
-    #define CURRENT_GATE_M2XCLK_84MHZ                 (0x3 << 12)
-#else
     #define CURRENT_GATE_M2XCLK_DIV_1                 (0x0 << 12)
     #define CURRENT_GATE_M2XCLK_DIV_2                 (0x1 << 12)
     #define CURRENT_GATE_M2XCLK_DIV_3                 (0x2 << 12)
     #define CURRENT_GATE_M2XCLK_DIV_4                 (0x3 << 12)
-#endif
 #define CURRENT_GATE_VGA                              BIT(10)
 #define CURRENT_GATE_PWM                              BIT(9)
 #define CURRENT_GATE_I2C                              BIT(8)
@@ -376,9 +362,6 @@
 #define MODE1_GATE_DMA                                BIT(0)
 
 #define POWER_MODE_CTRL                               0x00004C
-#ifdef VALIDATION_CHIP
-    #define POWER_MODE_CTRL_336CLK                    BIT(4)
-#endif
 #define POWER_MODE_CTRL_OSC_INPUT                     BIT(3)
 #define POWER_MODE_CTRL_ACPI                          BIT(2)
 #define POWER_MODE_CTRL_MODE_MASK                     (0x3 << 0)
@@ -400,15 +383,10 @@
 #define PLL_CTRL_BYPASS                               BIT(18)
 #define PLL_CTRL_POWER                                BIT(17)
 #define PLL_CTRL_INPUT                                BIT(16)
-#ifdef VALIDATION_CHIP
-    #define PLL_CTRL_OD_SHIFT                         14
-    #define PLL_CTRL_OD_MASK                          (0x3 << 14)
-#else
     #define PLL_CTRL_POD_SHIFT                        14
     #define PLL_CTRL_POD_MASK                         (0x3 << 14)
     #define PLL_CTRL_OD_SHIFT                         12
     #define PLL_CTRL_OD_MASK                          (0x3 << 12)
-#endif
 #define PLL_CTRL_N_SHIFT                              8
 #define PLL_CTRL_N_MASK                               (0xf << 8)
 #define PLL_CTRL_M_SHIFT                              0
@@ -422,7 +400,6 @@
 
 #define SCRATCH_DATA                                  0x00006c
 
-#ifndef VALIDATION_CHIP
 
 #define MXCLK_PLL_CTRL                                0x000070
 
@@ -431,7 +408,6 @@
 #define VGA_CONFIGURATION_PLL                         BIT(2)
 #define VGA_CONFIGURATION_MODE                        BIT(1)
 
-#endif
 
 #define GPIO_DATA                                       0x010000
 #define GPIO_DATA_31                                    BIT(31)
@@ -1020,9 +996,7 @@
 #define CRT_DISPLAY_CTRL_CRTSELECT                    BIT(25)
 #define CRT_DISPLAY_CTRL_RGBBIT                       BIT(24)
 
-#ifndef VALIDATION_CHIP
     #define CRT_DISPLAY_CTRL_CENTERING                BIT(24)
-#endif
 #define CRT_DISPLAY_CTRL_LOCK_TIMING                  BIT(23)
 #define CRT_DISPLAY_CTRL_EXPANSION                    BIT(22)
 #define CRT_DISPLAY_CTRL_VERTICAL_MODE                BIT(21)
@@ -1121,22 +1095,17 @@
 
 /* This vertical expansion below start at 0x080240 ~ 0x080264 */
 #define CRT_VERTICAL_EXPANSION                        0x080240
-#ifndef VALIDATION_CHIP
     #define CRT_VERTICAL_CENTERING_VALUE_MASK         (0xff << 24)
-#endif
 #define CRT_VERTICAL_EXPANSION_COMPARE_VALUE_MASK     (0xff << 16)
 #define CRT_VERTICAL_EXPANSION_LINE_BUFFER_MASK       (0xf << 12)
 #define CRT_VERTICAL_EXPANSION_SCALE_FACTOR_MASK      0xfff
 
 /* This horizontal expansion below start at 0x080268 ~ 0x08027C */
 #define CRT_HORIZONTAL_EXPANSION                      0x080268
-#ifndef VALIDATION_CHIP
     #define CRT_HORIZONTAL_CENTERING_VALUE_MASK       (0xff << 24)
-#endif
 #define CRT_HORIZONTAL_EXPANSION_COMPARE_VALUE_MASK   (0xff << 16)
 #define CRT_HORIZONTAL_EXPANSION_SCALE_FACTOR_MASK    0xfff
 
-#ifndef VALIDATION_CHIP
     /* Auto Centering */
     #define CRT_AUTO_CENTERING_TL                     0x080280
     #define CRT_AUTO_CENTERING_TL_TOP_MASK            (0x7ff << 16)
@@ -1146,7 +1115,6 @@
     #define CRT_AUTO_CENTERING_BR_BOTTOM_MASK         (0x7ff << 16)
     #define CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT        16
     #define CRT_AUTO_CENTERING_BR_RIGHT_MASK          0x7ff
-#endif
 
 /* sm750le new register to control panel output */
 #define DISPLAY_CONTROL_750LE			      0x80288
@@ -1326,9 +1294,7 @@
 #define ZV0_CAPTURE_BUF1_ADDRESS_ADDRESS_MASK           0x3ffffff
 
 #define ZV0_CAPTURE_BUF_OFFSET                          0x090014
-#ifndef VALIDATION_CHIP
     #define ZV0_CAPTURE_BUF_OFFSET_YCLIP_ODD_FIELD      (0x3ff << 16)
-#endif
 #define ZV0_CAPTURE_BUF_OFFSET_OFFSET_MASK              0xffff
 
 #define ZV0_CAPTURE_FIFO_CTRL                           0x090018
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 0bb56bbec43f..ab8b68076dec 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -387,9 +387,7 @@ unsigned int sm750_calc_pll_value(unsigned int request_orig,
 
 unsigned int sm750_format_pll_reg(struct pll_value *p_PLL)
 {
-#ifndef VALIDATION_CHIP
 	unsigned int POD = p_PLL->POD;
-#endif
 	unsigned int OD = p_PLL->OD;
 	unsigned int M = p_PLL->M;
 	unsigned int N = p_PLL->N;
@@ -401,9 +399,7 @@ unsigned int sm750_format_pll_reg(struct pll_value *p_PLL)
 	 * applied to any PLL in the calling function.
 	 */
 	return PLL_CTRL_POWER |
-#ifndef VALIDATION_CHIP
 		((POD << PLL_CTRL_POD_SHIFT) & PLL_CTRL_POD_MASK) |
-#endif
 		((OD << PLL_CTRL_OD_SHIFT) & PLL_CTRL_OD_MASK) |
 		((N << PLL_CTRL_N_SHIFT) & PLL_CTRL_N_MASK) |
 		((M << PLL_CTRL_M_SHIFT) & PLL_CTRL_M_MASK);
diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c
index eaba3bc2e01a..d617f554f58d 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -58,14 +58,8 @@ void sm750_set_power_mode(unsigned int mode)
 	/* Set up other fields in Power Control Register */
 	if (mode == POWER_MODE_CTRL_MODE_SLEEP) {
 		ctrl &= ~POWER_MODE_CTRL_OSC_INPUT;
-#ifdef VALIDATION_CHIP
-		ctrl &= ~POWER_MODE_CTRL_336CLK;
-#endif
 	} else {
 		ctrl |= POWER_MODE_CTRL_OSC_INPUT;
-#ifdef VALIDATION_CHIP
-		ctrl |= POWER_MODE_CTRL_336CLK;
-#endif
 	}
 
 	/* Program new power mode. */
-- 
2.43.0



^ permalink raw reply related

* [PATCH v2 0/2] staging: sm750fb: remove dead VALIDATION_CHIP code
From: Nils Lehnen @ 2026-07-18  6:20 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Nils Lehnen

VALIDATION_CHIP is defined nowhere in the tree, yet fourteen
preprocessor conditionals in the sm750fb DDK files still test it.
Patch 1 resolves all of them (dead branches dropped, always-true
branches kept), as the driver TODO asks under "remove unused code";
patch 2 cleans up the indentation and blank lines the removal leaves
behind.

Verification, both patches: the disassembly of all ten sm750fb object
files (objdump -d, x86, CONFIG_FB_SM750=m) is bit-identical across the
series. Compile-tested only; no SM750 hardware available.

All English text in this series (cover letter, commit messages, code
comments) was translated from a German draft with the assistance of
Claude Fable 5.

v2: resend of v1 -- patch 1/2 of v1 arrived with an empty subject due
to a local send mishap; no code changes.
v1: https://lore.kernel.org/r/20260718055132.441-1-nils.lehnen@proton.me

Nils Lehnen (2):
  staging: sm750fb: remove dead VALIDATION_CHIP conditionals
  staging: sm750fb: unindent defines left by conditional removal

 drivers/staging/sm750fb/ddk750_reg.h   | 84 ++++++++------------------
 drivers/staging/sm750fb/ddk750_chip.c  |  4 --
 drivers/staging/sm750fb/ddk750_power.c |  6 --
 3 files changed, 24 insertions(+), 70 deletions(-)


base-commit: 64276d9bfe4d1fdd5cf2636f1065f7ea55c2defb
-- 
2.43.0



^ permalink raw reply

* Re: [PATCH 2/2] staging: sm750fb: unindent defines left by conditional removal
From: Greg Kroah-Hartman @ 2026-07-18  6:20 UTC (permalink / raw)
  To: Nils Lehnen
  Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, linux-staging,
	linux-kernel
In-Reply-To: <20260718055709.466-2-nils.lehnen@proton.me>

On Sat, Jul 18, 2026 at 05:57:58AM +0000, Nils Lehnen wrote:
> The preceding removal of the VALIDATION_CHIP conditionals left the
> surviving define blocks and one comment indented by four spaces, and
> two double blank lines where conditional lines went away. Move the
> now-unconditional defines to column zero while keeping the aligned
> value column untouched, and collapse the blank lines.
> 
> No functional change: whitespace and preprocessor layout only; the
> disassembly of all ten sm750fb object files stays bit-identical.
> 
> All English text in this patch (commit message and code comments) was
> translated from a German draft with the assistance of Claude Fable 5.
> 
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Nils Lehnen <nils.lehnen@proton.me>
> ---
>  drivers/staging/sm750fb/ddk750_reg.h | 50 +++++++++++++---------------
>  1 file changed, 24 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h
> index 4bcede37584a..2888ffe32fa2 100644
> --- a/drivers/staging/sm750fb/ddk750_reg.h
> +++ b/drivers/staging/sm750fb/ddk750_reg.h
> @@ -294,15 +294,15 @@
>  
>  #define CURRENT_GATE                                  0x000040
>  #define CURRENT_GATE_MCLK_MASK                        (0x3 << 14)
> -    #define CURRENT_GATE_MCLK_DIV_3                   (0x0 << 14)
> -    #define CURRENT_GATE_MCLK_DIV_4                   (0x1 << 14)
> -    #define CURRENT_GATE_MCLK_DIV_6                   (0x2 << 14)
> -    #define CURRENT_GATE_MCLK_DIV_8                   (0x3 << 14)
> +#define CURRENT_GATE_MCLK_DIV_3                       (0x0 << 14)
> +#define CURRENT_GATE_MCLK_DIV_4                       (0x1 << 14)
> +#define CURRENT_GATE_MCLK_DIV_6                       (0x2 << 14)
> +#define CURRENT_GATE_MCLK_DIV_8                       (0x3 << 14)
>  #define CURRENT_GATE_M2XCLK_MASK                      (0x3 << 12)

No, this is not correct, the indentation gives you context of what is
happening.

thanks,

greg k-h

^ permalink raw reply

* Re: (No Subject)
From: Greg Kroah-Hartman @ 2026-07-18  6:19 UTC (permalink / raw)
  To: Nils Lehnen
  Cc: Sudip Mukherjee, Teddy Wang, linux-fbdev, linux-staging,
	linux-kernel
In-Reply-To: <20260718055709.466-1-nils.lehnen@proton.me>

On Sat, Jul 18, 2026 at 05:57:26AM +0000, Nils Lehnen wrote:
> >From b62c709ab6d719d625199dfdb3053589f925eaad Mon Sep 17 00:00:00 2001
> From: Nils Lehnen <nils.lehnen@proton.me>
> Date: Sat, 18 Jul 2026 07:43:49 +0200
> Subject: [PATCH 1/2] staging: sm750fb: remove dead VALIDATION_CHIP
>  conditionals

Something went wrong here :(


^ permalink raw reply

* [PATCH 2/2] staging: sm750fb: unindent defines left by conditional removal
From: Nils Lehnen @ 2026-07-18  5:57 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Nils Lehnen
In-Reply-To: <20260718055709.466-1-nils.lehnen@proton.me>

The preceding removal of the VALIDATION_CHIP conditionals left the
surviving define blocks and one comment indented by four spaces, and
two double blank lines where conditional lines went away. Move the
now-unconditional defines to column zero while keeping the aligned
value column untouched, and collapse the blank lines.

No functional change: whitespace and preprocessor layout only; the
disassembly of all ten sm750fb object files stays bit-identical.

All English text in this patch (commit message and code comments) was
translated from a German draft with the assistance of Claude Fable 5.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Nils Lehnen <nils.lehnen@proton.me>
---
 drivers/staging/sm750fb/ddk750_reg.h | 50 +++++++++++++---------------
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h
index 4bcede37584a..2888ffe32fa2 100644
--- a/drivers/staging/sm750fb/ddk750_reg.h
+++ b/drivers/staging/sm750fb/ddk750_reg.h
@@ -294,15 +294,15 @@
 
 #define CURRENT_GATE                                  0x000040
 #define CURRENT_GATE_MCLK_MASK                        (0x3 << 14)
-    #define CURRENT_GATE_MCLK_DIV_3                   (0x0 << 14)
-    #define CURRENT_GATE_MCLK_DIV_4                   (0x1 << 14)
-    #define CURRENT_GATE_MCLK_DIV_6                   (0x2 << 14)
-    #define CURRENT_GATE_MCLK_DIV_8                   (0x3 << 14)
+#define CURRENT_GATE_MCLK_DIV_3                       (0x0 << 14)
+#define CURRENT_GATE_MCLK_DIV_4                       (0x1 << 14)
+#define CURRENT_GATE_MCLK_DIV_6                       (0x2 << 14)
+#define CURRENT_GATE_MCLK_DIV_8                       (0x3 << 14)
 #define CURRENT_GATE_M2XCLK_MASK                      (0x3 << 12)
-    #define CURRENT_GATE_M2XCLK_DIV_1                 (0x0 << 12)
-    #define CURRENT_GATE_M2XCLK_DIV_2                 (0x1 << 12)
-    #define CURRENT_GATE_M2XCLK_DIV_3                 (0x2 << 12)
-    #define CURRENT_GATE_M2XCLK_DIV_4                 (0x3 << 12)
+#define CURRENT_GATE_M2XCLK_DIV_1                     (0x0 << 12)
+#define CURRENT_GATE_M2XCLK_DIV_2                     (0x1 << 12)
+#define CURRENT_GATE_M2XCLK_DIV_3                     (0x2 << 12)
+#define CURRENT_GATE_M2XCLK_DIV_4                     (0x3 << 12)
 #define CURRENT_GATE_VGA                              BIT(10)
 #define CURRENT_GATE_PWM                              BIT(9)
 #define CURRENT_GATE_I2C                              BIT(8)
@@ -383,10 +383,10 @@
 #define PLL_CTRL_BYPASS                               BIT(18)
 #define PLL_CTRL_POWER                                BIT(17)
 #define PLL_CTRL_INPUT                                BIT(16)
-    #define PLL_CTRL_POD_SHIFT                        14
-    #define PLL_CTRL_POD_MASK                         (0x3 << 14)
-    #define PLL_CTRL_OD_SHIFT                         12
-    #define PLL_CTRL_OD_MASK                          (0x3 << 12)
+#define PLL_CTRL_POD_SHIFT                            14
+#define PLL_CTRL_POD_MASK                             (0x3 << 14)
+#define PLL_CTRL_OD_SHIFT                             12
+#define PLL_CTRL_OD_MASK                              (0x3 << 12)
 #define PLL_CTRL_N_SHIFT                              8
 #define PLL_CTRL_N_MASK                               (0xf << 8)
 #define PLL_CTRL_M_SHIFT                              0
@@ -400,7 +400,6 @@
 
 #define SCRATCH_DATA                                  0x00006c
 
-
 #define MXCLK_PLL_CTRL                                0x000070
 
 #define VGA_CONFIGURATION                             0x000088
@@ -408,7 +407,6 @@
 #define VGA_CONFIGURATION_PLL                         BIT(2)
 #define VGA_CONFIGURATION_MODE                        BIT(1)
 
-
 #define GPIO_DATA                                       0x010000
 #define GPIO_DATA_31                                    BIT(31)
 #define GPIO_DATA_30                                    BIT(30)
@@ -996,7 +994,7 @@
 #define CRT_DISPLAY_CTRL_CRTSELECT                    BIT(25)
 #define CRT_DISPLAY_CTRL_RGBBIT                       BIT(24)
 
-    #define CRT_DISPLAY_CTRL_CENTERING                BIT(24)
+#define CRT_DISPLAY_CTRL_CENTERING                    BIT(24)
 #define CRT_DISPLAY_CTRL_LOCK_TIMING                  BIT(23)
 #define CRT_DISPLAY_CTRL_EXPANSION                    BIT(22)
 #define CRT_DISPLAY_CTRL_VERTICAL_MODE                BIT(21)
@@ -1095,26 +1093,26 @@
 
 /* This vertical expansion below start at 0x080240 ~ 0x080264 */
 #define CRT_VERTICAL_EXPANSION                        0x080240
-    #define CRT_VERTICAL_CENTERING_VALUE_MASK         (0xff << 24)
+#define CRT_VERTICAL_CENTERING_VALUE_MASK             (0xff << 24)
 #define CRT_VERTICAL_EXPANSION_COMPARE_VALUE_MASK     (0xff << 16)
 #define CRT_VERTICAL_EXPANSION_LINE_BUFFER_MASK       (0xf << 12)
 #define CRT_VERTICAL_EXPANSION_SCALE_FACTOR_MASK      0xfff
 
 /* This horizontal expansion below start at 0x080268 ~ 0x08027C */
 #define CRT_HORIZONTAL_EXPANSION                      0x080268
-    #define CRT_HORIZONTAL_CENTERING_VALUE_MASK       (0xff << 24)
+#define CRT_HORIZONTAL_CENTERING_VALUE_MASK           (0xff << 24)
 #define CRT_HORIZONTAL_EXPANSION_COMPARE_VALUE_MASK   (0xff << 16)
 #define CRT_HORIZONTAL_EXPANSION_SCALE_FACTOR_MASK    0xfff
 
-    /* Auto Centering */
-    #define CRT_AUTO_CENTERING_TL                     0x080280
-    #define CRT_AUTO_CENTERING_TL_TOP_MASK            (0x7ff << 16)
-    #define CRT_AUTO_CENTERING_TL_LEFT_MASK           0x7ff
+/* Auto Centering */
+#define CRT_AUTO_CENTERING_TL                         0x080280
+#define CRT_AUTO_CENTERING_TL_TOP_MASK                (0x7ff << 16)
+#define CRT_AUTO_CENTERING_TL_LEFT_MASK               0x7ff
 
-    #define CRT_AUTO_CENTERING_BR                     0x080284
-    #define CRT_AUTO_CENTERING_BR_BOTTOM_MASK         (0x7ff << 16)
-    #define CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT        16
-    #define CRT_AUTO_CENTERING_BR_RIGHT_MASK          0x7ff
+#define CRT_AUTO_CENTERING_BR                         0x080284
+#define CRT_AUTO_CENTERING_BR_BOTTOM_MASK             (0x7ff << 16)
+#define CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT            16
+#define CRT_AUTO_CENTERING_BR_RIGHT_MASK              0x7ff
 
 /* sm750le new register to control panel output */
 #define DISPLAY_CONTROL_750LE			      0x80288
@@ -1294,7 +1292,7 @@
 #define ZV0_CAPTURE_BUF1_ADDRESS_ADDRESS_MASK           0x3ffffff
 
 #define ZV0_CAPTURE_BUF_OFFSET                          0x090014
-    #define ZV0_CAPTURE_BUF_OFFSET_YCLIP_ODD_FIELD      (0x3ff << 16)
+#define ZV0_CAPTURE_BUF_OFFSET_YCLIP_ODD_FIELD          (0x3ff << 16)
 #define ZV0_CAPTURE_BUF_OFFSET_OFFSET_MASK              0xffff
 
 #define ZV0_CAPTURE_FIFO_CTRL                           0x090018
-- 
2.43.0



^ permalink raw reply related

* (No Subject)
From: Nils Lehnen @ 2026-07-18  5:57 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Nils Lehnen
In-Reply-To: <20260718055132.441-1-nils.lehnen@proton.me>

From b62c709ab6d719d625199dfdb3053589f925eaad Mon Sep 17 00:00:00 2001
From: Nils Lehnen <nils.lehnen@proton.me>
Date: Sat, 18 Jul 2026 07:43:49 +0200
Subject: [PATCH 1/2] staging: sm750fb: remove dead VALIDATION_CHIP
 conditionals

VALIDATION_CHIP is defined nowhere in the tree and no Makefile passes
-DVALIDATION_CHIP, so every #ifdef VALIDATION_CHIP block is dead code
and every #ifndef VALIDATION_CHIP condition is always true. Resolve all
fourteen conditionals accordingly (dead branches dropped, live branches
kept), as the driver TODO asks under "remove unused code".

No functional change: the disassembly of all ten sm750fb object files
is bit-identical before and after this patch.

All English text in this patch (commit message and code comments) was
translated from a German draft with the assistance of Claude Fable 5.

Assisted-by: Claude:claude-fable-5 sparse unifdef
Signed-off-by: Nils Lehnen <nils.lehnen@proton.me>
---
 drivers/staging/sm750fb/ddk750_reg.h   | 34 --------------------------
 drivers/staging/sm750fb/ddk750_chip.c  |  4 ---
 drivers/staging/sm750fb/ddk750_power.c |  6 -----
 3 files changed, 44 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_reg.h b/drivers/staging/sm750fb/ddk750_reg.h
index fe412ead72e5..4bcede37584a 100644
--- a/drivers/staging/sm750fb/ddk750_reg.h
+++ b/drivers/staging/sm750fb/ddk750_reg.h
@@ -294,29 +294,15 @@
 
 #define CURRENT_GATE                                  0x000040
 #define CURRENT_GATE_MCLK_MASK                        (0x3 << 14)
-#ifdef VALIDATION_CHIP
-    #define CURRENT_GATE_MCLK_112MHZ                  (0x0 << 14)
-    #define CURRENT_GATE_MCLK_84MHZ                   (0x1 << 14)
-    #define CURRENT_GATE_MCLK_56MHZ                   (0x2 << 14)
-    #define CURRENT_GATE_MCLK_42MHZ                   (0x3 << 14)
-#else
     #define CURRENT_GATE_MCLK_DIV_3                   (0x0 << 14)
     #define CURRENT_GATE_MCLK_DIV_4                   (0x1 << 14)
     #define CURRENT_GATE_MCLK_DIV_6                   (0x2 << 14)
     #define CURRENT_GATE_MCLK_DIV_8                   (0x3 << 14)
-#endif
 #define CURRENT_GATE_M2XCLK_MASK                      (0x3 << 12)
-#ifdef VALIDATION_CHIP
-    #define CURRENT_GATE_M2XCLK_336MHZ                (0x0 << 12)
-    #define CURRENT_GATE_M2XCLK_168MHZ                (0x1 << 12)
-    #define CURRENT_GATE_M2XCLK_112MHZ                (0x2 << 12)
-    #define CURRENT_GATE_M2XCLK_84MHZ                 (0x3 << 12)
-#else
     #define CURRENT_GATE_M2XCLK_DIV_1                 (0x0 << 12)
     #define CURRENT_GATE_M2XCLK_DIV_2                 (0x1 << 12)
     #define CURRENT_GATE_M2XCLK_DIV_3                 (0x2 << 12)
     #define CURRENT_GATE_M2XCLK_DIV_4                 (0x3 << 12)
-#endif
 #define CURRENT_GATE_VGA                              BIT(10)
 #define CURRENT_GATE_PWM                              BIT(9)
 #define CURRENT_GATE_I2C                              BIT(8)
@@ -376,9 +362,6 @@
 #define MODE1_GATE_DMA                                BIT(0)
 
 #define POWER_MODE_CTRL                               0x00004C
-#ifdef VALIDATION_CHIP
-    #define POWER_MODE_CTRL_336CLK                    BIT(4)
-#endif
 #define POWER_MODE_CTRL_OSC_INPUT                     BIT(3)
 #define POWER_MODE_CTRL_ACPI                          BIT(2)
 #define POWER_MODE_CTRL_MODE_MASK                     (0x3 << 0)
@@ -400,15 +383,10 @@
 #define PLL_CTRL_BYPASS                               BIT(18)
 #define PLL_CTRL_POWER                                BIT(17)
 #define PLL_CTRL_INPUT                                BIT(16)
-#ifdef VALIDATION_CHIP
-    #define PLL_CTRL_OD_SHIFT                         14
-    #define PLL_CTRL_OD_MASK                          (0x3 << 14)
-#else
     #define PLL_CTRL_POD_SHIFT                        14
     #define PLL_CTRL_POD_MASK                         (0x3 << 14)
     #define PLL_CTRL_OD_SHIFT                         12
     #define PLL_CTRL_OD_MASK                          (0x3 << 12)
-#endif
 #define PLL_CTRL_N_SHIFT                              8
 #define PLL_CTRL_N_MASK                               (0xf << 8)
 #define PLL_CTRL_M_SHIFT                              0
@@ -422,7 +400,6 @@
 
 #define SCRATCH_DATA                                  0x00006c
 
-#ifndef VALIDATION_CHIP
 
 #define MXCLK_PLL_CTRL                                0x000070
 
@@ -431,7 +408,6 @@
 #define VGA_CONFIGURATION_PLL                         BIT(2)
 #define VGA_CONFIGURATION_MODE                        BIT(1)
 
-#endif
 
 #define GPIO_DATA                                       0x010000
 #define GPIO_DATA_31                                    BIT(31)
@@ -1020,9 +996,7 @@
 #define CRT_DISPLAY_CTRL_CRTSELECT                    BIT(25)
 #define CRT_DISPLAY_CTRL_RGBBIT                       BIT(24)
 
-#ifndef VALIDATION_CHIP
     #define CRT_DISPLAY_CTRL_CENTERING                BIT(24)
-#endif
 #define CRT_DISPLAY_CTRL_LOCK_TIMING                  BIT(23)
 #define CRT_DISPLAY_CTRL_EXPANSION                    BIT(22)
 #define CRT_DISPLAY_CTRL_VERTICAL_MODE                BIT(21)
@@ -1121,22 +1095,17 @@
 
 /* This vertical expansion below start at 0x080240 ~ 0x080264 */
 #define CRT_VERTICAL_EXPANSION                        0x080240
-#ifndef VALIDATION_CHIP
     #define CRT_VERTICAL_CENTERING_VALUE_MASK         (0xff << 24)
-#endif
 #define CRT_VERTICAL_EXPANSION_COMPARE_VALUE_MASK     (0xff << 16)
 #define CRT_VERTICAL_EXPANSION_LINE_BUFFER_MASK       (0xf << 12)
 #define CRT_VERTICAL_EXPANSION_SCALE_FACTOR_MASK      0xfff
 
 /* This horizontal expansion below start at 0x080268 ~ 0x08027C */
 #define CRT_HORIZONTAL_EXPANSION                      0x080268
-#ifndef VALIDATION_CHIP
     #define CRT_HORIZONTAL_CENTERING_VALUE_MASK       (0xff << 24)
-#endif
 #define CRT_HORIZONTAL_EXPANSION_COMPARE_VALUE_MASK   (0xff << 16)
 #define CRT_HORIZONTAL_EXPANSION_SCALE_FACTOR_MASK    0xfff
 
-#ifndef VALIDATION_CHIP
     /* Auto Centering */
     #define CRT_AUTO_CENTERING_TL                     0x080280
     #define CRT_AUTO_CENTERING_TL_TOP_MASK            (0x7ff << 16)
@@ -1146,7 +1115,6 @@
     #define CRT_AUTO_CENTERING_BR_BOTTOM_MASK         (0x7ff << 16)
     #define CRT_AUTO_CENTERING_BR_BOTTOM_SHIFT        16
     #define CRT_AUTO_CENTERING_BR_RIGHT_MASK          0x7ff
-#endif
 
 /* sm750le new register to control panel output */
 #define DISPLAY_CONTROL_750LE			      0x80288
@@ -1326,9 +1294,7 @@
 #define ZV0_CAPTURE_BUF1_ADDRESS_ADDRESS_MASK           0x3ffffff
 
 #define ZV0_CAPTURE_BUF_OFFSET                          0x090014
-#ifndef VALIDATION_CHIP
     #define ZV0_CAPTURE_BUF_OFFSET_YCLIP_ODD_FIELD      (0x3ff << 16)
-#endif
 #define ZV0_CAPTURE_BUF_OFFSET_OFFSET_MASK              0xffff
 
 #define ZV0_CAPTURE_FIFO_CTRL                           0x090018
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 0bb56bbec43f..ab8b68076dec 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -387,9 +387,7 @@ unsigned int sm750_calc_pll_value(unsigned int request_orig,
 
 unsigned int sm750_format_pll_reg(struct pll_value *p_PLL)
 {
-#ifndef VALIDATION_CHIP
 	unsigned int POD = p_PLL->POD;
-#endif
 	unsigned int OD = p_PLL->OD;
 	unsigned int M = p_PLL->M;
 	unsigned int N = p_PLL->N;
@@ -401,9 +399,7 @@ unsigned int sm750_format_pll_reg(struct pll_value *p_PLL)
 	 * applied to any PLL in the calling function.
 	 */
 	return PLL_CTRL_POWER |
-#ifndef VALIDATION_CHIP
 		((POD << PLL_CTRL_POD_SHIFT) & PLL_CTRL_POD_MASK) |
-#endif
 		((OD << PLL_CTRL_OD_SHIFT) & PLL_CTRL_OD_MASK) |
 		((N << PLL_CTRL_N_SHIFT) & PLL_CTRL_N_MASK) |
 		((M << PLL_CTRL_M_SHIFT) & PLL_CTRL_M_MASK);
diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c
index eaba3bc2e01a..d617f554f58d 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -58,14 +58,8 @@ void sm750_set_power_mode(unsigned int mode)
 	/* Set up other fields in Power Control Register */
 	if (mode == POWER_MODE_CTRL_MODE_SLEEP) {
 		ctrl &= ~POWER_MODE_CTRL_OSC_INPUT;
-#ifdef VALIDATION_CHIP
-		ctrl &= ~POWER_MODE_CTRL_336CLK;
-#endif
 	} else {
 		ctrl |= POWER_MODE_CTRL_OSC_INPUT;
-#ifdef VALIDATION_CHIP
-		ctrl |= POWER_MODE_CTRL_336CLK;
-#endif
 	}
 
 	/* Program new power mode. */
-- 
2.43.0



^ permalink raw reply related

* [PATCH 0/2] staging: sm750fb: remove dead VALIDATION_CHIP code
From: Nils Lehnen @ 2026-07-18  5:51 UTC (permalink / raw)
  To: Sudip Mukherjee, Teddy Wang, Greg Kroah-Hartman
  Cc: linux-fbdev, linux-staging, linux-kernel, Nils Lehnen

VALIDATION_CHIP is defined nowhere in the tree, yet fourteen
preprocessor conditionals in the sm750fb DDK files still test it.
Patch 1 resolves all of them (dead branches dropped, always-true
branches kept), as the driver TODO asks under "remove unused code";
patch 2 cleans up the indentation and blank lines the removal leaves
behind.

Verification, both patches: the disassembly of all ten sm750fb object
files (objdump -d, x86, CONFIG_FB_SM750=m) is bit-identical across the
series. Compile-tested only; no SM750 hardware available.

All English text in this series (cover letter, commit messages, code
comments) was translated from a German draft with the assistance of
Claude Fable 5.

Nils Lehnen (2):
  staging: sm750fb: remove dead VALIDATION_CHIP conditionals
  staging: sm750fb: unindent defines left by conditional removal

 drivers/staging/sm750fb/ddk750_reg.h   | 84 ++++++++------------------
 drivers/staging/sm750fb/ddk750_chip.c  |  4 --
 drivers/staging/sm750fb/ddk750_power.c |  6 --
 3 files changed, 24 insertions(+), 70 deletions(-)


base-commit: 64276d9bfe4d1fdd5cf2636f1065f7ea55c2defb
-- 
2.43.0



^ 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