linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i2c: cp2615: Fix 'assignment to __be16' warning
@ 2023-10-30 17:19 Bence Csókás
  2023-11-08  9:28 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Bence Csókás @ 2023-10-30 17:19 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, Bence Csókás

While the preamble field _is_ technically big-endian, its value is always 0x2A2A,
which is the same in either endianness. However, to avoid generating a warning,
we should still call `htons()` explicitly.

Signed-off-by: Bence Csókás <bence98@sch.bme.hu>
---
 drivers/i2c/busses/i2c-cp2615.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-cp2615.c b/drivers/i2c/busses/i2c-cp2615.c
index 20f8f7c9a8cd..cf3747d87034 100644
--- a/drivers/i2c/busses/i2c-cp2615.c
+++ b/drivers/i2c/busses/i2c-cp2615.c
@@ -85,7 +85,7 @@ static int cp2615_init_iop_msg(struct cp2615_iop_msg *ret, enum cp2615_iop_msg_t
 	if (!ret)
 		return -EINVAL;
 
-	ret->preamble = 0x2A2A;
+	ret->preamble = htons(0x2A2AU);
 	ret->length = htons(data_len + 6);
 	ret->msg = htons(msg);
 	if (data && data_len)
-- 
2.42.0


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

* Re: [PATCH v2] i2c: cp2615: Fix 'assignment to __be16' warning
  2023-10-30 17:19 [PATCH v2] i2c: cp2615: Fix 'assignment to __be16' warning Bence Csókás
@ 2023-11-08  9:28 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2023-11-08  9:28 UTC (permalink / raw)
  To: Bence Csókás; +Cc: linux-i2c

[-- Attachment #1: Type: text/plain, Size: 374 bytes --]

On Mon, Oct 30, 2023 at 05:19:10PM +0000, Bence Csókás wrote:
> While the preamble field _is_ technically big-endian, its value is always 0x2A2A,
> which is the same in either endianness. However, to avoid generating a warning,
> we should still call `htons()` explicitly.
> 
> Signed-off-by: Bence Csókás <bence98@sch.bme.hu>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-11-08  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-30 17:19 [PATCH v2] i2c: cp2615: Fix 'assignment to __be16' warning Bence Csókás
2023-11-08  9:28 ` Wolfram Sang

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