* [PATCH 1/4] staging: sm750fb: remove unused includes
2026-05-12 16:41 [PATCH 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
@ 2026-05-12 16:41 ` Ahmet Sezgin Duran
2026-05-12 16:41 ` [PATCH 2/4] staging: sm750fb: use early returns in frequency checks Ahmet Sezgin Duran
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ahmet Sezgin Duran @ 2026-05-12 16:41 UTC (permalink / raw)
To: gregkh; +Cc: linux-fbdev, linux-staging, linux-kernel, Ahmet Sezgin Duran
Remove unused header file includes from multiple source files to
declutter the include sections.
Also remove the unused CONFIG_MTRR include block after verifying
that no MTRR interfaces are used by the driver.
No functional changes.
Signed-off-by: Ahmet Sezgin Duran <ahmet@sezginduran.net>
---
drivers/staging/sm750fb/sm750.c | 12 ------------
drivers/staging/sm750fb/sm750_accel.c | 14 --------------
drivers/staging/sm750fb/sm750_cursor.c | 14 --------------
drivers/staging/sm750fb/sm750_hw.c | 17 -----------------
4 files changed, 57 deletions(-)
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 996a586a3727..d26e9fab846a 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1,19 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/aperture.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
#include <linux/fb.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
#include <linux/pci.h>
-#include <linux/mm_types.h>
-#include <linux/vmalloc.h>
-#include <linux/pagemap.h>
#include <linux/console.h>
#include "sm750.h"
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index ec2f0a6aa57d..f695a2a61c28 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -1,19 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
#include <linux/fb.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/vmalloc.h>
-#include <linux/pagemap.h>
-#include <linux/console.h>
-#include <linux/platform_device.h>
#include "sm750.h"
#include "sm750_accel.h"
diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c
index f0338e6e76b1..9d6bca3106f4 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -1,19 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
#include <linux/fb.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/vmalloc.h>
-#include <linux/pagemap.h>
-#include <linux/console.h>
-#include <linux/platform_device.h>
#include "sm750.h"
#include "sm750_cursor.h"
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index 6f7c354a34a1..34a837fb4b64 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -1,23 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/delay.h>
#include <linux/fb.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
#include <linux/pci.h>
-#include <linux/vmalloc.h>
-#include <linux/pagemap.h>
-#include <linux/console.h>
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
-#include <linux/platform_device.h>
-#include <linux/sizes.h>
#include "sm750.h"
#include "ddk750.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] staging: sm750fb: use early returns in frequency checks
2026-05-12 16:41 [PATCH 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
2026-05-12 16:41 ` [PATCH 1/4] staging: sm750fb: remove unused includes Ahmet Sezgin Duran
@ 2026-05-12 16:41 ` Ahmet Sezgin Duran
2026-05-12 16:41 ` [PATCH 3/4] staging: sm750fb: remove unnecessary initialization Ahmet Sezgin Duran
2026-05-12 16:41 ` [PATCH 4/4] staging: sm750fb: remove double space in assignment Ahmet Sezgin Duran
3 siblings, 0 replies; 5+ messages in thread
From: Ahmet Sezgin Duran @ 2026-05-12 16:41 UTC (permalink / raw)
To: gregkh; +Cc: linux-fbdev, linux-staging, linux-kernel, Ahmet Sezgin Duran
Invert the frequency validation conditions and use early returns
to reduce nesting and improve readability.
No functional changes.
Signed-off-by: Ahmet Sezgin Duran <ahmet@sezginduran.net>
---
drivers/staging/sm750fb/ddk750_chip.c | 153 +++++++++++++-------------
1 file changed, 78 insertions(+), 75 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c
index 136692b00804..0bb56bbec43f 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -61,25 +61,26 @@ static void set_chip_clock(unsigned int frequency)
if (sm750_get_chip_type() == SM750LE)
return;
- if (frequency) {
- /*
- * Set up PLL structure to hold the value to be set in clocks.
- */
- pll.input_freq = DEFAULT_INPUT_CLOCK; /* Defined in CLOCK.H */
- pll.clock_type = MXCLK_PLL;
+ if (!frequency)
+ return;
- /*
- * Call sm750_calc_pll_value() to fill the other fields
- * of the PLL structure. Sometimes, the chip cannot set
- * up the exact clock required by the User.
- * Return value of sm750_calc_pll_value gives the actual
- * possible clock.
- */
- sm750_calc_pll_value(frequency, &pll);
+ /*
+ * Set up PLL structure to hold the value to be set in clocks.
+ */
+ pll.input_freq = DEFAULT_INPUT_CLOCK; /* Defined in CLOCK.H */
+ pll.clock_type = MXCLK_PLL;
- /* Master Clock Control: MXCLK_PLL */
- poke32(MXCLK_PLL_CTRL, sm750_format_pll_reg(&pll));
- }
+ /*
+ * Call sm750_calc_pll_value() to fill the other fields
+ * of the PLL structure. Sometimes, the chip cannot set
+ * up the exact clock required by the User.
+ * Return value of sm750_calc_pll_value gives the actual
+ * possible clock.
+ */
+ sm750_calc_pll_value(frequency, &pll);
+
+ /* Master Clock Control: MXCLK_PLL */
+ poke32(MXCLK_PLL_CTRL, sm750_format_pll_reg(&pll));
}
static void set_memory_clock(unsigned int frequency)
@@ -93,37 +94,38 @@ static void set_memory_clock(unsigned int frequency)
if (sm750_get_chip_type() == SM750LE)
return;
- if (frequency) {
- /*
- * Set the frequency to the maximum frequency
- * that the DDR Memory can take which is 336MHz.
- */
- if (frequency > MHz(336))
- frequency = MHz(336);
-
- /* Calculate the divisor */
- divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
-
- /* Set the corresponding divisor in the register. */
- reg = peek32(CURRENT_GATE) & ~CURRENT_GATE_M2XCLK_MASK;
- switch (divisor) {
- default:
- case 1:
- reg |= CURRENT_GATE_M2XCLK_DIV_1;
- break;
- case 2:
- reg |= CURRENT_GATE_M2XCLK_DIV_2;
- break;
- case 3:
- reg |= CURRENT_GATE_M2XCLK_DIV_3;
- break;
- case 4:
- reg |= CURRENT_GATE_M2XCLK_DIV_4;
- break;
- }
+ if (!frequency)
+ return;
+
+ /*
+ * Set the frequency to the maximum frequency
+ * that the DDR Memory can take which is 336MHz.
+ */
+ if (frequency > MHz(336))
+ frequency = MHz(336);
+
+ /* Calculate the divisor */
+ divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
- sm750_set_current_gate(reg);
+ /* Set the corresponding divisor in the register. */
+ reg = peek32(CURRENT_GATE) & ~CURRENT_GATE_M2XCLK_MASK;
+ switch (divisor) {
+ default:
+ case 1:
+ reg |= CURRENT_GATE_M2XCLK_DIV_1;
+ break;
+ case 2:
+ reg |= CURRENT_GATE_M2XCLK_DIV_2;
+ break;
+ case 3:
+ reg |= CURRENT_GATE_M2XCLK_DIV_3;
+ break;
+ case 4:
+ reg |= CURRENT_GATE_M2XCLK_DIV_4;
+ break;
}
+
+ sm750_set_current_gate(reg);
}
/*
@@ -145,37 +147,38 @@ static void set_master_clock(unsigned int frequency)
if (sm750_get_chip_type() == SM750LE)
return;
- if (frequency) {
- /*
- * Set the frequency to the maximum frequency
- * that the SM750 engine can run, which is about 190 MHz.
- */
- if (frequency > MHz(190))
- frequency = MHz(190);
-
- /* Calculate the divisor */
- divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
-
- /* Set the corresponding divisor in the register. */
- reg = peek32(CURRENT_GATE) & ~CURRENT_GATE_MCLK_MASK;
- switch (divisor) {
- default:
- case 3:
- reg |= CURRENT_GATE_MCLK_DIV_3;
- break;
- case 4:
- reg |= CURRENT_GATE_MCLK_DIV_4;
- break;
- case 6:
- reg |= CURRENT_GATE_MCLK_DIV_6;
- break;
- case 8:
- reg |= CURRENT_GATE_MCLK_DIV_8;
- break;
- }
+ if (!frequency)
+ return;
+
+ /*
+ * Set the frequency to the maximum frequency
+ * that the SM750 engine can run, which is about 190 MHz.
+ */
+ if (frequency > MHz(190))
+ frequency = MHz(190);
+
+ /* Calculate the divisor */
+ divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
- sm750_set_current_gate(reg);
+ /* Set the corresponding divisor in the register. */
+ reg = peek32(CURRENT_GATE) & ~CURRENT_GATE_MCLK_MASK;
+ switch (divisor) {
+ default:
+ case 3:
+ reg |= CURRENT_GATE_MCLK_DIV_3;
+ break;
+ case 4:
+ reg |= CURRENT_GATE_MCLK_DIV_4;
+ break;
+ case 6:
+ reg |= CURRENT_GATE_MCLK_DIV_6;
+ break;
+ case 8:
+ reg |= CURRENT_GATE_MCLK_DIV_8;
+ break;
}
+
+ sm750_set_current_gate(reg);
}
unsigned int ddk750_get_vm_size(void)
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] staging: sm750fb: remove unnecessary initialization
2026-05-12 16:41 [PATCH 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
2026-05-12 16:41 ` [PATCH 1/4] staging: sm750fb: remove unused includes Ahmet Sezgin Duran
2026-05-12 16:41 ` [PATCH 2/4] staging: sm750fb: use early returns in frequency checks Ahmet Sezgin Duran
@ 2026-05-12 16:41 ` Ahmet Sezgin Duran
2026-05-12 16:41 ` [PATCH 4/4] staging: sm750fb: remove double space in assignment Ahmet Sezgin Duran
3 siblings, 0 replies; 5+ messages in thread
From: Ahmet Sezgin Duran @ 2026-05-12 16:41 UTC (permalink / raw)
To: gregkh; +Cc: linux-fbdev, linux-staging, linux-kernel, Ahmet Sezgin Duran
Remove `data = 0` initialization since the variable is reset each
time in the for loop.
Signed-off-by: Ahmet Sezgin Duran <ahmet@sezginduran.net>
---
drivers/staging/sm750fb/sm750_cursor.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c
index 9d6bca3106f4..f822d147ede9 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -84,7 +84,6 @@ void sm750_hw_cursor_set_data(struct lynx_cursor *cursor, u16 rop,
/* in byte */
offset = cursor->max_w * 2 / 8;
- data = 0;
pstart = cursor->vstart;
pbuffer = pstart;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] staging: sm750fb: remove double space in assignment
2026-05-12 16:41 [PATCH 0/4] staging: sm750fb: various code cleanups Ahmet Sezgin Duran
` (2 preceding siblings ...)
2026-05-12 16:41 ` [PATCH 3/4] staging: sm750fb: remove unnecessary initialization Ahmet Sezgin Duran
@ 2026-05-12 16:41 ` Ahmet Sezgin Duran
3 siblings, 0 replies; 5+ messages in thread
From: Ahmet Sezgin Duran @ 2026-05-12 16:41 UTC (permalink / raw)
To: gregkh; +Cc: linux-fbdev, linux-staging, linux-kernel, Ahmet Sezgin Duran
Remove extra space after `=` in assignment of `reg` variable.
Signed-off-by: Ahmet Sezgin Duran <ahmet@sezginduran.net>
---
drivers/staging/sm750fb/sm750_accel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index f695a2a61c28..e3225c0c320b 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -26,7 +26,7 @@ void sm750_hw_de_init(struct lynx_accel *accel)
write_dpr(accel, DE_MASKS, 0xFFFFFFFF);
/* dpr1c */
- reg = 0x3;
+ reg = 0x3;
clr = DE_STRETCH_FORMAT_PATTERN_XY |
DE_STRETCH_FORMAT_PATTERN_Y_MASK |
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread