Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH v3 0/4] staging: sm750fb: various code cleanups
@ 2026-05-25  8:58 Ahmet Sezgin Duran
  2026-05-25  8:58 ` [PATCH v3 1/4] staging: sm750fb: remove commented-out forward declarations Ahmet Sezgin Duran
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
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	[flat|nested] 8+ messages in thread

* [PATCH v3 1/4] staging: sm750fb: remove commented-out forward declarations
  2026-05-25  8:58 [PATCH v3 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
@ 2026-05-25  8:58 ` Ahmet Sezgin Duran
  2026-05-25  8:58 ` [PATCH v3 2/4] staging: sm750fb: remove unnecessary initializations Ahmet Sezgin Duran
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
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

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	[flat|nested] 8+ messages in thread

* [PATCH v3 2/4] staging: sm750fb: remove unnecessary initializations
  2026-05-25  8:58 [PATCH v3 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
  2026-05-25  8:58 ` [PATCH v3 1/4] staging: sm750fb: remove commented-out forward declarations Ahmet Sezgin Duran
@ 2026-05-25  8:58 ` Ahmet Sezgin Duran
  2026-05-25  8:58 ` [PATCH v3 3/4] staging: sm750fb: remove unused struct fields Ahmet Sezgin Duran
  2026-05-25  8:58 ` [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume Ahmet Sezgin Duran
  3 siblings, 0 replies; 8+ messages in thread
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

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	[flat|nested] 8+ messages in thread

* [PATCH v3 3/4] staging: sm750fb: remove unused struct fields
  2026-05-25  8:58 [PATCH v3 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
  2026-05-25  8:58 ` [PATCH v3 1/4] staging: sm750fb: remove commented-out forward declarations Ahmet Sezgin Duran
  2026-05-25  8:58 ` [PATCH v3 2/4] staging: sm750fb: remove unnecessary initializations Ahmet Sezgin Duran
@ 2026-05-25  8:58 ` Ahmet Sezgin Duran
  2026-05-25  8:58 ` [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume Ahmet Sezgin Duran
  3 siblings, 0 replies; 8+ messages in thread
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

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	[flat|nested] 8+ messages in thread

* [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
  2026-05-25  8:58 [PATCH v3 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
                   ` (2 preceding siblings ...)
  2026-05-25  8:58 ` [PATCH v3 3/4] staging: sm750fb: remove unused struct fields Ahmet Sezgin Duran
@ 2026-05-25  8:58 ` Ahmet Sezgin Duran
  2026-07-07  9:09   ` Greg KH
  3 siblings, 1 reply; 8+ messages in thread
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

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	[flat|nested] 8+ messages in thread

* Re: [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
  2026-05-25  8:58 ` [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume Ahmet Sezgin Duran
@ 2026-07-07  9:09   ` Greg KH
  2026-07-07 11:49     ` Ahmet Sezgin Duran
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2026-07-07  9:09 UTC (permalink / raw)
  To: Ahmet Sezgin Duran; +Cc: error27, linux-fbdev, linux-staging, linux-kernel

On Mon, May 25, 2026 at 08:58:08AM +0000, Ahmet Sezgin Duran wrote:
> 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.

Do you have the hardware to test changes like this?


thanks,

greg k-h

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

* Re: [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
  2026-07-07  9:09   ` Greg KH
@ 2026-07-07 11:49     ` Ahmet Sezgin Duran
  2026-07-07 12:27       ` Ahmet Sezgin Duran
  0 siblings, 1 reply; 8+ messages in thread
From: Ahmet Sezgin Duran @ 2026-07-07 11:49 UTC (permalink / raw)
  To: Greg KH; +Cc: error27, linux-fbdev, linux-staging, linux-kernel

On 7/7/26 12:09 PM, Greg KH wrote:
> On Mon, May 25, 2026 at 08:58:08AM +0000, Ahmet Sezgin Duran wrote:
>> 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.
> 
> Do you have the hardware to test changes like this?
> 
> 
> thanks,
> 
> greg k-h
No, I don't have the hardware. Just compile tested.

Though, I should mention that compiled object file (sm750.o) is 
identical in my dev machine, sha256sum matches.

Regards,
Ahmet Sezgin Duran

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

* Re: [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume
  2026-07-07 11:49     ` Ahmet Sezgin Duran
@ 2026-07-07 12:27       ` Ahmet Sezgin Duran
  0 siblings, 0 replies; 8+ messages in thread
From: Ahmet Sezgin Duran @ 2026-07-07 12:27 UTC (permalink / raw)
  To: Greg KH; +Cc: error27, linux-fbdev, linux-staging, linux-kernel

On 7/7/26 2:49 PM, Ahmet Sezgin Duran wrote:
> 
> Though, I should mention that compiled object file (sm750.o) is 
> identical in my dev machine, sha256sum matches.
> 

I made a mistake there. Those functions are omitted by the compiler, 
when CONFIG_PM_SLEEP is not enabled. That's why object file was identical.

When config is enabled, object file changes, before and after the patch.

Regards,
Ahmet Sezgin Duran

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

end of thread, other threads:[~2026-07-07 12:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-25  8:58 [PATCH v3 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
2026-05-25  8:58 ` [PATCH v3 1/4] staging: sm750fb: remove commented-out forward declarations Ahmet Sezgin Duran
2026-05-25  8:58 ` [PATCH v3 2/4] staging: sm750fb: remove unnecessary initializations Ahmet Sezgin Duran
2026-05-25  8:58 ` [PATCH v3 3/4] staging: sm750fb: remove unused struct fields Ahmet Sezgin Duran
2026-05-25  8:58 ` [PATCH v3 4/4] staging: sm750fb: deduplicate fbinfo loop in suspend/resume Ahmet Sezgin Duran
2026-07-07  9:09   ` Greg KH
2026-07-07 11:49     ` Ahmet Sezgin Duran
2026-07-07 12:27       ` Ahmet Sezgin Duran

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