linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: msizanoen <msizanoen@qtmlabs.xyz>
Cc: "Pali Rohár" <pali@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	stable@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] input: alps: fix compatibility with -funsigned-char
Date: Sun, 19 Mar 2023 18:45:08 +0100	[thread overview]
Message-ID: <ZBdKJJ+HJaB0mdNR@zx2c4.com> (raw)
In-Reply-To: <20230318144206.14309-1-msizanoen@qtmlabs.xyz>

Might be wise to clean up a few other ones in that file? Or not. Up to
you:

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 989228b5a0a4..afbf67c2488a 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -852,8 +852,8 @@ static void alps_process_packet_v6(struct psmouse *psmouse)
 			x = y = z = 0;

 		/* Divide 4 since trackpoint's speed is too fast */
-		input_report_rel(dev2, REL_X, (char)x / 4);
-		input_report_rel(dev2, REL_Y, -((char)y / 4));
+		input_report_rel(dev2, REL_X, (signed char)x / 4);
+		input_report_rel(dev2, REL_Y, -((signed char)y / 4));

 		psmouse_report_standard_buttons(dev2, packet[3]);

@@ -1104,8 +1104,8 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse)
 	    ((packet[3] & 0x20) << 1);
 	z = (packet[5] & 0x3f) | ((packet[3] & 0x80) >> 1);

-	input_report_rel(dev2, REL_X, (char)x);
-	input_report_rel(dev2, REL_Y, -((char)y));
+	input_report_rel(dev2, REL_X, (signed char)x);
+	input_report_rel(dev2, REL_Y, -((signed char)y));
 	input_report_abs(dev2, ABS_PRESSURE, z);

 	psmouse_report_standard_buttons(dev2, packet[1]);
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 5f0d75a45c80..43a1116c5852 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -382,7 +382,7 @@ static unsigned int elan_convert_resolution(u8 val, u8 pattern)
 	 *	((value from firmware) + 3) * 100 = dpi
 	 */
 	int res = pattern <= 0x01 ?
-		(int)(char)val * 10 + 790 : ((int)(char)val + 3) * 100;
+		(int)(signed char)val * 10 + 790 : ((int)(signed char)val + 3) * 100;
 	/*
 	 * We also have to convert dpi to dots/mm (*10/254 to avoid floating
 	 * point).

  parent reply	other threads:[~2023-03-19 17:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-18 14:42 [PATCH] input: alps: fix compatibility with -funsigned-char msizanoen
2023-03-18 16:25 ` Hans de Goede
2023-03-19  9:56 ` msizanoen
2023-03-19 16:54   ` Pali Rohár
2023-03-19 17:45 ` Jason A. Donenfeld [this message]
2023-03-19 19:43   ` Pali Rohár
2023-03-20  0:17 ` [PATCH v2] " msizanoen
2023-03-20  4:43   ` Dmitry Torokhov
2023-03-20  4:52 ` [PATCH v3] " msizanoen1
2023-03-20  6:03   ` Dmitry Torokhov

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=ZBdKJJ+HJaB0mdNR@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msizanoen@qtmlabs.xyz \
    --cc=pali@kernel.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).