linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] Input: cypress_ps2 - clean up setting reporting rate
@ 2024-06-28 22:47 Dmitry Torokhov
  2024-06-28 22:47 ` [PATCH 2/5] Input: cypress_ps2 - fix error handling when sending command fails Dmitry Torokhov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2024-06-28 22:47 UTC (permalink / raw)
  To: linux-input; +Cc: linux-kernel

Casting an integer field containing desired rate to a pointer to bytes
works on little endian architectures where the driver is used, but not
a good practice. Use a temporary of proper type instead.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/mouse/cypress_ps2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index c693130bef41..32b55b2b9b76 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -612,6 +612,7 @@ static psmouse_ret_t cypress_protocol_handler(struct psmouse *psmouse)
 static void cypress_set_rate(struct psmouse *psmouse, unsigned int rate)
 {
 	struct cytp_data *cytp = psmouse->private;
+	u8 rate_param;
 
 	if (rate >= 80) {
 		psmouse->rate = 80;
@@ -621,8 +622,8 @@ static void cypress_set_rate(struct psmouse *psmouse, unsigned int rate)
 		cytp->mode &= ~CYTP_BIT_HIGH_RATE;
 	}
 
-	ps2_command(&psmouse->ps2dev, (unsigned char *)&psmouse->rate,
-		    PSMOUSE_CMD_SETRATE);
+	rate_param = (u8)rate;
+	ps2_command(&psmouse->ps2dev, &rate_param, PSMOUSE_CMD_SETRATE);
 }
 
 static void cypress_disconnect(struct psmouse *psmouse)
-- 
2.45.2.803.g4e1b14247a-goog


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

end of thread, other threads:[~2024-06-28 22:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28 22:47 [PATCH 1/5] Input: cypress_ps2 - clean up setting reporting rate Dmitry Torokhov
2024-06-28 22:47 ` [PATCH 2/5] Input: cypress_ps2 - fix error handling when sending command fails Dmitry Torokhov
2024-06-28 22:47 ` [PATCH 3/5] Input: cypress_ps2 - report timeouts when reading command status Dmitry Torokhov
2024-06-28 22:47 ` [PATCH 4/5] Input: cypress_ps2 - propagate errors from lower layers Dmitry Torokhov
2024-06-28 22:47 ` [PATCH 5/5] Input: cypress_ps2 - use u8 when dealing with byte data Dmitry Torokhov

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).