linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Zaidman <michael.zaidman@gmail.com>
To: jikos@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	linux-i2c@vger.kernel.org, Enrik.Berkhan@inka.de,
	Michael Zaidman <michael.zaidman@gmail.com>,
	kernel test robot <lkp@intel.com>
Subject: [PATCH v4 13/13] HID: ft260: fix 'cast to restricted' kernel CI bot warnings
Date: Sat,  5 Nov 2022 23:11:51 +0200	[thread overview]
Message-ID: <20221105211151.7094-14-michael.zaidman@gmail.com> (raw)
In-Reply-To: <20221105211151.7094-1-michael.zaidman@gmail.com>

Fix 'cast to restricted' sparse warnings reported by kernel test robot
in https://lore.kernel.org/all/202211021607.ssjymlKi-lkp@intel.com/

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
---
 drivers/hid/hid-ft260.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/hid-ft260.c b/drivers/hid/hid-ft260.c
index d5b092b85d7f..333341e80b0e 100644
--- a/drivers/hid/hid-ft260.c
+++ b/drivers/hid/hid-ft260.c
@@ -588,7 +588,7 @@ static int ft260_i2c_write_read(struct ft260_device *dev, struct i2c_msg *msgs)
 
 	if (ft260_debug) {
 		if (wr_len == 2)
-			read_off = be16_to_cpu(*(u16 *)msgs[0].buf);
+			read_off = be16_to_cpu(*(__be16 *)msgs[0].buf);
 		else
 			read_off = *msgs[0].buf;
 
@@ -830,7 +830,7 @@ static int ft260_byte_show(struct hid_device *hdev, int id, u8 *cfg, int len,
 }
 
 static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
-			   u16 *field, u8 *buf)
+			   __le16 *field, u8 *buf)
 {
 	int ret;
 
@@ -859,9 +859,9 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
 
 #define FT260_I2CST_ATTR_SHOW(name)					       \
 		FT260_ATTR_SHOW(name, ft260_get_i2c_status_report,	       \
-				FT260_I2C_STATUS, u16, ft260_word_show)
+				FT260_I2C_STATUS, __le16, ft260_word_show)
 
-#define FT260_ATTR_STORE(name, reptype, id, req, type, func)		       \
+#define FT260_ATTR_STORE(name, reptype, id, req, type, ctype, func)	       \
 	static ssize_t name##_store(struct device *kdev,		       \
 				    struct device_attribute *attr,	       \
 				    const char *buf, size_t count)	       \
@@ -871,7 +871,7 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
 		type name;						       \
 		int ret;						       \
 									       \
-		if (!func(buf, 10, &name)) {				       \
+		if (!func(buf, 10, (ctype *)&name)) {			       \
 			rep.name = name;				       \
 			rep.report = id;				       \
 			rep.request = req;				       \
@@ -887,11 +887,11 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len,
 
 #define FT260_BYTE_ATTR_STORE(name, reptype, req)			       \
 		FT260_ATTR_STORE(name, reptype, FT260_SYSTEM_SETTINGS, req,    \
-				 u8, kstrtou8)
+				 u8, u8, kstrtou8)
 
 #define FT260_WORD_ATTR_STORE(name, reptype, req)			       \
 		FT260_ATTR_STORE(name, reptype, FT260_SYSTEM_SETTINGS, req,    \
-				 u16, kstrtou16)
+				 __le16, u16, kstrtou16)
 
 FT260_SSTAT_ATTR_SHOW(chip_mode);
 static DEVICE_ATTR_RO(chip_mode);
-- 
2.34.1


  parent reply	other threads:[~2022-11-05 21:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05 21:11 [PATCH v4 00/13] HID: ft260: fixes and performance improvements Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 01/13] HID: ft260: ft260_xfer_status routine cleanup Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 02/13] HID: ft260: improve i2c write performance Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 03/13] HID: ft260: support i2c writes larger than HID report size Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 04/13] HID: ft260: support i2c reads greater " Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 05/13] HID: ft260: improve i2c large reads performance Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 06/13] HID: ft260: do not populate /dev/hidraw device Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 07/13] HID: ft260: skip unexpected HID input reports Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 08/13] HID: ft260: remove SMBus Quick command support Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 09/13] HID: ft260: missed NACK from big i2c read Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 10/13] HID: ft260: wake up device from power saving mode Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 11/13] HID: ft260: fix a NULL pointer dereference in ft260_i2c_write Michael Zaidman
2022-11-05 21:11 ` [PATCH v4 12/13] HID: ft260: missed NACK from busy device Michael Zaidman
2022-11-05 21:11 ` Michael Zaidman [this message]
2022-11-11 10:19 ` [PATCH v4 00/13] HID: ft260: fixes and performance improvements Jiri Kosina
2022-11-11 17:13   ` Michael Zaidman

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=20221105211151.7094-14-michael.zaidman@gmail.com \
    --to=michael.zaidman@gmail.com \
    --cc=Enrik.Berkhan@inka.de \
    --cc=jikos@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.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;
as well as URLs for NNTP newsgroup(s).