linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hennie Muller <hm@bitlabs.co.za>
To: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Hennie Muller <hm@bitlabs.co.za>
Subject: [PATCH 2/2] [PATCH] gpio: Explicitly cast from __be16 to unsigned short
Date: Sun, 21 Jul 2019 14:52:59 +0200	[thread overview]
Message-ID: <20190721125259.13990-2-hm@bitlabs.co.za> (raw)
In-Reply-To: <20190721125259.13990-1-hm@bitlabs.co.za>

cpu_to_be16 returns a __be16 value. This does not break anything
but does cause sparse to generate unnecessary warnings.

Signed-off-by: Hennie Muller <hm@bitlabs.co.za>
---
 drivers/gpio/gpio-viperboard.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-viperboard.c b/drivers/gpio/gpio-viperboard.c
index c301c1d56dd2..7ff80d18bb70 100644
--- a/drivers/gpio/gpio-viperboard.c
+++ b/drivers/gpio/gpio-viperboard.c
@@ -258,8 +258,8 @@ static int vprbrd_gpiob_setdir(struct vprbrd *vb, unsigned int offset,
 	int ret;
 
 	gbmsg->cmd = VPRBRD_GPIOB_CMD_SETDIR;
-	gbmsg->val = cpu_to_be16(dir << offset);
-	gbmsg->mask = cpu_to_be16(0x0001 << offset);
+	gbmsg->val = (__force u16)cpu_to_be16(dir << offset);
+	gbmsg->mask = (__force u16)cpu_to_be16(0x0001 << offset);
 
 	ret = usb_control_msg(vb->usb_dev, usb_sndctrlpipe(vb->usb_dev, 0),
 		VPRBRD_USB_REQUEST_GPIOB, VPRBRD_USB_TYPE_OUT, 0x0000,
@@ -321,8 +321,8 @@ static void vprbrd_gpiob_set(struct gpio_chip *chip,
 		mutex_lock(&vb->lock);
 
 		gbmsg->cmd = VPRBRD_GPIOB_CMD_SETVAL;
-		gbmsg->val = cpu_to_be16(value << offset);
-		gbmsg->mask = cpu_to_be16(0x0001 << offset);
+		gbmsg->val = (__force u16)cpu_to_be16(value << offset);
+		gbmsg->mask = (__force u16)cpu_to_be16(0x0001 << offset);
 
 		ret = usb_control_msg(vb->usb_dev,
 			usb_sndctrlpipe(vb->usb_dev, 0),
-- 
2.22.0


  reply	other threads:[~2019-07-21 12:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-21 12:52 [PATCH 1/2] [PATCH] gpio: Replace usage of bare 'unsigned' with 'unsigned int' Hennie Muller
2019-07-21 12:52 ` Hennie Muller [this message]
2019-08-05  9:10   ` [PATCH 2/2] [PATCH] gpio: Explicitly cast from __be16 to unsigned short Linus Walleij
2019-08-05 11:52     ` Arnd Bergmann
2019-07-22  2:05 ` [PATCH 1/2] [PATCH] gpio: Replace usage of bare 'unsigned' with 'unsigned int' Phil Reid
2019-07-22  4:51   ` Hennie Muller
2019-08-05  9:26     ` Linus Walleij
2019-08-05  9:27 ` Linus Walleij

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=20190721125259.13990-2-hm@bitlabs.co.za \
    --to=hm@bitlabs.co.za \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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).