public inbox for linux-input@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Input: analog: fix coding style violations
@ 2026-04-13 22:19 Akash Sukhavasi
  2026-04-13 22:19 ` [PATCH 1/2] Input: analog: Fix coding style - trailing statements on same line Akash Sukhavasi
  2026-04-13 22:19 ` [PATCH 2/2] Input: analog: Fix coding style - indentation and parenthesis spacing Akash Sukhavasi
  0 siblings, 2 replies; 3+ messages in thread
From: Akash Sukhavasi @ 2026-04-13 22:19 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Akash Sukhavasi

This patch series resolves 15 errors and addresses several warnings 
reported by checkpatch.pl in the drivers/input/joystick/analog.c driver. 
The original code contained multiple instances of trailing statements 
on single-line conditionals, as well as minor indentation and spacing 
issues that are in violation of kernel coding style. 

This series breaks the cleanups into two logical parts:
1. Fixing trailing statements (moving them to their own lines).
2. Correcting indentation and parenthesis spacing.

Several warnings are intentionally left unaddressed, as they require 
semantic or functional changes outside the scope of this formatting 
cleanup:
- printk() to pr_warn()/pr_info() conversions
- simple_strtoul() to kstrtoul() conversion
- Filename strings embedded in printk() messages
- Quoted string split across lines
- Suspect indent on fail3 label

Tested with: scripts/checkpatch.pl --strict on the final patch.

Signed-off-by: Akash Sukhavasi <akash.sukhavasi@gmail.com>
---
Akash Sukhavasi (2):
  Input: analog: Fix coding style - trailing statements on same line
  Input: analog: Fix coding style - indentation and parenthesis spacing

 drivers/input/joystick/analog.c | 49 +++++++++++++++++++++++----------
 1 file changed, 34 insertions(+), 15 deletions(-)

-- 
2.53.0


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

* [PATCH 1/2] Input: analog: Fix coding style - trailing statements on same line
  2026-04-13 22:19 [PATCH 0/2] Input: analog: fix coding style violations Akash Sukhavasi
@ 2026-04-13 22:19 ` Akash Sukhavasi
  2026-04-13 22:19 ` [PATCH 2/2] Input: analog: Fix coding style - indentation and parenthesis spacing Akash Sukhavasi
  1 sibling, 0 replies; 3+ messages in thread
From: Akash Sukhavasi @ 2026-04-13 22:19 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Akash Sukhavasi

The checkpatch.pl script flags several errors where trailing
statements are placed on the same line as 'if', 'while', or 'for'
conditionals. This violates the kernel coding style and makes the
control flow harder to read.

Separate these single-line bodies onto their own dedicated lines to
conform with standard kernel formatting.

No functional change intended.

Signed-off-by: Akash Sukhavasi <akash.sukhavasi@gmail.com>
---
 drivers/input/joystick/analog.c | 45 +++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index b6f7bce1c..6e1255a82 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -231,11 +231,13 @@ static int analog_button_read(struct analog_port *port, char saitek, char chf)
 
 	while ((~u & 0xf0) && (i < 16) && t) {
 		port->buttons |= 1 << analog_chf[(~u >> 4) & 0xf];
-		if (!saitek) return 0;
+		if (!saitek)
+			return 0;
 		udelay(ANALOG_SAITEK_DELAY);
 		t = strobe;
 		gameport_trigger(port->gameport);
-		while (((u = gameport_read(port->gameport)) & port->mask) && t) t--;
+		while (((u = gameport_read(port->gameport)) & port->mask) && t)
+			t--;
 		i++;
 	}
 
@@ -324,7 +326,8 @@ static void analog_calibrate_timer(struct analog_port *port)
 		local_irq_restore(flags);
 		udelay(i);
 		t = ktime_sub(t2, t1) - ktime_sub(t3, t2);
-		if (t < tx) tx = t;
+		if (t < tx)
+			tx = t;
 	}
 
         port->loop = tx / 50;
@@ -405,7 +408,8 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i
 				x = y;
 
 			if (analog->mask & ANALOG_SAITEK) {
-				if (i == 2) x = port->axes[i];
+				if (i == 2)
+					x = port->axes[i];
 				v = x - (x >> 2);
 				w = (x >> 4);
 			}
@@ -496,13 +500,25 @@ static int analog_init_masks(struct analog_port *port)
 
 	if (port->cooked) {
 
-		for (i = 0; i < 4; i++) max[i] = port->axes[i] << 1;
+		for (i = 0; i < 4; i++)
+			max[i] = port->axes[i] << 1;
+
+		if ((analog[0].mask & 0x7) == 0x7)
+			max[2] = (max[0] + max[1]) >> 1;
+
+		if ((analog[0].mask & 0xb) == 0xb)
+			max[3] = (max[0] + max[1]) >> 1;
+
+		if ((analog[0].mask & ANALOG_BTN_TL) &&
+		    !(analog[0].mask & ANALOG_BTN_TL2))
+			max[2] >>= 1;
+
+		if ((analog[0].mask & ANALOG_BTN_TR) &&
+		    !(analog[0].mask & ANALOG_BTN_TR2))
+			max[3] >>= 1;
 
-		if ((analog[0].mask & 0x7) == 0x7) max[2] = (max[0] + max[1]) >> 1;
-		if ((analog[0].mask & 0xb) == 0xb) max[3] = (max[0] + max[1]) >> 1;
-		if ((analog[0].mask & ANALOG_BTN_TL) && !(analog[0].mask & ANALOG_BTN_TL2)) max[2] >>= 1;
-		if ((analog[0].mask & ANALOG_BTN_TR) && !(analog[0].mask & ANALOG_BTN_TR2)) max[3] >>= 1;
-		if ((analog[0].mask & ANALOG_HAT_FCS)) max[3] >>= 1;
+		if ((analog[0].mask & ANALOG_HAT_FCS))
+			max[3] >>= 1;
 
 		gameport_calibrate(port->gameport, port->axes, max);
 	}
@@ -662,13 +678,16 @@ static void analog_parse_options(void)
 				analog_options[i] = analog_types[j].value;
 				break;
 			}
-		if (analog_types[j].name) continue;
+		if (analog_types[j].name)
+			continue;
 
 		analog_options[i] = simple_strtoul(js[i], &end, 0);
-		if (end != js[i]) continue;
+		if (end != js[i])
+			continue;
 
 		analog_options[i] = 0xff;
-		if (!strlen(js[i])) continue;
+		if (!strlen(js[i]))
+			continue;
 
 		printk(KERN_WARNING "analog.c: Bad config for port %d - \"%s\"\n", i, js[i]);
 	}
-- 
2.53.0


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

* [PATCH 2/2] Input: analog: Fix coding style - indentation and parenthesis spacing
  2026-04-13 22:19 [PATCH 0/2] Input: analog: fix coding style violations Akash Sukhavasi
  2026-04-13 22:19 ` [PATCH 1/2] Input: analog: Fix coding style - trailing statements on same line Akash Sukhavasi
@ 2026-04-13 22:19 ` Akash Sukhavasi
  1 sibling, 0 replies; 3+ messages in thread
From: Akash Sukhavasi @ 2026-04-13 22:19 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: linux-input, linux-kernel, Akash Sukhavasi

The checkpatch.pl script reports minor whitespace and indentation
warnings in the analog joystick driver. Specifically, there is a
misaligned port->loop assignment using spaces instead of tabs, and
an extraneous space before a closing parenthesis in the
ANALOG_BTNS_TLR mask expression.

Signed-off-by: Akash Sukhavasi <akash.sukhavasi@gmail.com>
---
 drivers/input/joystick/analog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index 6e1255a82..04fd5b119 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -330,7 +330,7 @@ static void analog_calibrate_timer(struct analog_port *port)
 			tx = t;
 	}
 
-        port->loop = tx / 50;
+	port->loop = tx / 50;
 }
 
 /*
@@ -490,7 +490,7 @@ static int analog_init_masks(struct analog_port *port)
 			| ((~analog[0].mask & ANALOG_HAT_FCS) << 4);
 
 	analog[0].mask &= ~(ANALOG_THROTTLE | ANALOG_RUDDER)
-			| (((~analog[0].mask & ANALOG_BTNS_TLR ) >> 10)
+			| (((~analog[0].mask & ANALOG_BTNS_TLR) >> 10)
 			&  ((~analog[0].mask & ANALOG_BTNS_TLR2) >> 12));
 
 	analog[1].mask = ((i >> 20) & 0xff) | ((i >> 12) & 0xf0000);
-- 
2.53.0


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

end of thread, other threads:[~2026-04-13 22:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-13 22:19 [PATCH 0/2] Input: analog: fix coding style violations Akash Sukhavasi
2026-04-13 22:19 ` [PATCH 1/2] Input: analog: Fix coding style - trailing statements on same line Akash Sukhavasi
2026-04-13 22:19 ` [PATCH 2/2] Input: analog: Fix coding style - indentation and parenthesis spacing Akash Sukhavasi

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