[PATCH 2/2] [PATCH] gpio: Explicitly cast from __be16 to unsigned short

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux