Linux Input/HID development
 help / color / mirror / Atom feed
From: Miro Kropacek <miro.kropacek@gmail.com>
To: geert@linux-m68k.org, dmitry.torokhov@gmail.com
Cc: schmitzmic@gmail.com, linux-m68k@vger.kernel.org,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Miro Kropacek <miro.kropacek@gmail.com>
Subject: [PATCH v4] m68k: Fix atari mouse movement
Date: Wed, 21 Oct 2026 10:03:37 +1000	[thread overview]
Message-ID: <20261021000338.2160223-1-miro.kropacek@gmail.com> (raw)
In-Reply-To: <20260819222838.21256-2-schmitzmic@gmail.com>

Kernels are built with -funsigned-char since version 6.2, resulting in
the signed 8-bit position deltas reported by the IKBD being
misinterpreted as unsigned.

Carry the sign in the type of the mouse interrupt hook. The scancode
buffer is shared with the keyboard and joystick paths, where unsigned is
correct, so it stays unsigned and is cast at the single call site that
passes it to the mouse driver.

Fixes: 3bc753c06dd02a35 ("kbuild: treat char as always unsigned")
Link: https://lists.debian.org/debian-68k/2026/08/msg00000.html
Signed-off-by: Miro Kropacek <miro.kropacek@gmail.com>
Reviewed-by: Michael Schmitz <schmitzmic@gmail.com>
Cc: linux-input <linux-input@vger.kernel.org>
---

Changes in v4:

- cast at the atakeyb.c call site, so the signed hook no longer
  produces a -Wpointer-sign warning there

The functional change was tested on an Atari Falcon030 with CT60 in its
v3 form; v4 only adds the cast at the call site.

Note that the original version of this patch, which cast the two deltas
inside atamouse_interrupt() and left the hook as char *, produced no
warning at all. The signature change was your suggestion, Geert - if you
prefer the earlier form, say so and I will send that instead.

 arch/m68k/atari/atakeyb.c        | 5 +++--
 arch/m68k/include/asm/atarikb.h  | 2 +-
 drivers/input/mouse/atarimouse.c | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/atari/atakeyb.c b/arch/m68k/atari/atakeyb.c
index 49a9a459bdf4..1eadeb8e4d7b 100644
--- a/arch/m68k/atari/atakeyb.c
+++ b/arch/m68k/atari/atakeyb.c
@@ -39,7 +39,7 @@ void (*atari_MIDI_interrupt_hook) (void);
 /* Hook for keyboard inputdev  driver */
 void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
 /* Hook for mouse inputdev  driver */
-void (*atari_input_mouse_interrupt_hook) (char *);
+void (*atari_input_mouse_interrupt_hook)(signed char *buf);
 EXPORT_SYMBOL(atari_input_keyboard_interrupt_hook);
 EXPORT_SYMBOL(atari_input_mouse_interrupt_hook);
 
@@ -260,7 +260,8 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)
 			if (kb_state.len == 3) {
 				kb_state.state = KEYBOARD;
 				if (atari_input_mouse_interrupt_hook)
-					atari_input_mouse_interrupt_hook(kb_state.buf);
+					atari_input_mouse_interrupt_hook(
+						(signed char *)kb_state.buf);
 			}
 			break;
 
diff --git a/arch/m68k/include/asm/atarikb.h b/arch/m68k/include/asm/atarikb.h
index 68f3622bf591..c5a84c7ee85d 100644
--- a/arch/m68k/include/asm/atarikb.h
+++ b/arch/m68k/include/asm/atarikb.h
@@ -37,7 +37,7 @@ extern void (*atari_MIDI_interrupt_hook) (void);
 /* Hook for keyboard inputdev  driver */
 extern void (*atari_input_keyboard_interrupt_hook) (unsigned char, char);
 /* Hook for mouse inputdev  driver */
-extern void (*atari_input_mouse_interrupt_hook) (char *);
+extern void (*atari_input_mouse_interrupt_hook)(signed char *buf);
 
 int atari_keyb_init(void);
 
diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c
index b1219cc4d9a2..6bac2288c494 100644
--- a/drivers/input/mouse/atarimouse.c
+++ b/drivers/input/mouse/atarimouse.c
@@ -60,7 +60,7 @@ extern int atari_mouse_buttons;
 
 static struct input_dev *atamouse_dev;
 
-static void atamouse_interrupt(char *buf)
+static void atamouse_interrupt(signed char *buf)
 {
 	int buttons, dx, dy;
 
-- 
2.43.0


  reply	other threads:[~2026-10-21  0:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260819222838.21256-1-schmitzmic@gmail.com>
2026-08-19 22:28 ` [PATCH v3 1/5] m68k: Fix atari mouse movement Michael Schmitz
2026-10-21  0:03   ` Miro Kropacek [this message]
2026-10-21  1:41     ` [PATCH v4] " Dmitry Torokhov
2026-10-21  2:23     ` [PATCH v5] " Miro Kropacek
2026-10-21  2:50       ` Michael Schmitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261021000338.2160223-1-miro.kropacek@gmail.com \
    --to=miro.kropacek@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=schmitzmic@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox