linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bence Csókás" <bence98@sch.bme.hu>
To: <linux-i2c@vger.kernel.org>
Cc: "Bence Csókás" <bence98@sch.bme.hu>, linux-kernel@vger.kernel.org
Subject: [PATCH] Fix 'assignment to __be16' warning
Date: Mon, 12 Apr 2021 11:53:02 +0000	[thread overview]
Message-ID: <20210412115302.95686-1-bence98@sch.bme.hu> (raw)

While the preamble field _is_ technically big-endian, its value is always 0x2A2A,
which is the same in either endianness, therefore it should be u16 instead.

Signed-off-by: Bence Csókás <bence98@sch.bme.hu>

---
 drivers/i2c/busses/i2c-cp2615.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-cp2615.c b/drivers/i2c/busses/i2c-cp2615.c
index 78cfecd1ea76..2824f4ba7131 100644
--- a/drivers/i2c/busses/i2c-cp2615.c
+++ b/drivers/i2c/busses/i2c-cp2615.c
@@ -38,7 +38,9 @@ enum cp2615_iop_msg_type {
 };
 
 struct __packed cp2615_iop_msg {
-	__be16 preamble, length, msg;
+	/* always 0x2A2A, which is the same in either endianness */
+	u16 preamble;
+	__be16 length, msg;
 	u8 data[MAX_IOP_PAYLOAD_SIZE];
 };
 
-- 
2.31.0


             reply	other threads:[~2021-04-12 11:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 11:53 Bence Csókás [this message]
2021-04-15 20:19 ` [PATCH] Fix 'assignment to __be16' warning Wolfram Sang
2021-04-15 20:37 ` Al Viro

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=20210412115302.95686-1-bence98@sch.bme.hu \
    --to=bence98@sch.bme.hu \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@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).