Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] Input: gunze: replace deprecated APIs and fix warning style
@ 2026-07-18 19:00 Bivash Kumar Singh
  2026-07-18 19:12 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bivash Kumar Singh @ 2026-07-18 19:00 UTC (permalink / raw)
  To: linux-input; +Cc: dmitry.torokhov, Bivash Kumar Singh

Replace two uses of simple_strtoul() with kstrtoul() as the former
is deprecated. kstrtoul() also properly handles parse errors, so
add an early return if parsing fails.

Replace printk(KERN_WARNING) with dev_warn() using the serio device,
which is the correct logging style for driver code and removes the
redundant 'gunze.c:' filename prefix.

Signed-off-by: Bivash Kumar Singh <bivashraj750@gmail.com>
---
 drivers/input/touchscreen/gunze.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index 2baeb4f3b941..38450cabdd11 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -41,15 +41,19 @@ struct gunze {
 static void gunze_process_packet(struct gunze *gunze)
 {
 	struct input_dev *dev = gunze->dev;
+	unsigned long x, y;
 
 	if (gunze->idx != GUNZE_MAX_LENGTH || gunze->data[5] != ',' ||
 		(gunze->data[0] != 'T' && gunze->data[0] != 'R')) {
-		printk(KERN_WARNING "gunze.c: bad packet: >%.*s<\n", GUNZE_MAX_LENGTH, gunze->data);
+		dev_warn(&gunze->serio->dev, "bad packet: >%.*s<\n", GUNZE_MAX_LENGTH, gunze->data);
 		return;
 	}
 
-	input_report_abs(dev, ABS_X, simple_strtoul(gunze->data + 1, NULL, 10));
-	input_report_abs(dev, ABS_Y, 1024 - simple_strtoul(gunze->data + 6, NULL, 10));
+	if (kstrtoul(gunze->data + 1, 10, &x) || kstrtoul(gunze->data + 6, 10, &y))
+		return;
+
+	input_report_abs(dev, ABS_X, x);
+	input_report_abs(dev, ABS_Y, 1024 - y);
 	input_report_key(dev, BTN_TOUCH, gunze->data[0] == 'T');
 	input_sync(dev);
 }
-- 
2.53.0


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

end of thread, other threads:[~2026-07-19  6:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-18 19:00 [PATCH] Input: gunze: replace deprecated APIs and fix warning style Bivash Kumar Singh
2026-07-18 19:12 ` sashiko-bot
2026-07-19  5:41 ` [PATCH v2] " Bivash Kumar Singh
2026-07-19  5:53   ` sashiko-bot
2026-07-19  6:02 ` [PATCH v3] " Bivash Kumar Singh
2026-07-19  6:13   ` sashiko-bot

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