From 21ae38f8558511450a33fb3873bfcd6b8f1e0922 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Fri, 10 Aug 2018 13:54:02 -0700 Subject: Input: iforce - use unaligned accessors, where appropriate Instead of open-coding conversion from/to little-endian, let's use proper accessors. Tested-by: Tim Schumacher Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/iforce/iforce-main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/input/joystick/iforce/iforce-main.c') diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 5cb3e80f4e0d..d696b0b653b6 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c @@ -21,6 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "iforce.h" MODULE_AUTHOR("Vojtech Pavlik , Johann Deneux "); @@ -286,17 +287,17 @@ int iforce_init_device(struct device *parent, u16 bustype, */ if (!iforce_get_id_packet(iforce, 'M', buf, &len) || len < 3) - input_dev->id.vendor = (buf[2] << 8) | buf[1]; + input_dev->id.vendor = get_unaligned_le16(buf + 1); else dev_warn(&iforce->dev->dev, "Device does not respond to id packet M\n"); if (!iforce_get_id_packet(iforce, 'P', buf, &len) || len < 3) - input_dev->id.product = (buf[2] << 8) | buf[1]; + input_dev->id.product = get_unaligned_le16(buf + 1); else dev_warn(&iforce->dev->dev, "Device does not respond to id packet P\n"); if (!iforce_get_id_packet(iforce, 'B', buf, &len) || len < 3) - iforce->device_memory.end = (buf[2] << 8) | buf[1]; + iforce->device_memory.end = get_unaligned_le16(buf + 1); else dev_warn(&iforce->dev->dev, "Device does not respond to id packet B\n"); -- cgit v1.2.3