Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08f980a8 authored by Andrey Smirnov's avatar Andrey Smirnov Committed by Wim Van Sebroeck
Browse files

watchdog: ziirave_wdt: Make use of put_unaligned_le16



Instead of doing this explicitly use put_unaligned_le16() to place
16-bit address value into command payload.

Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Rick Ramstetter <rick@anteaterllc.com>
Cc: linux-watchdog@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20190812200906.31344-12-andrew.smirnov@gmail.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 10f98fef
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -21,6 +21,8 @@
#include <linux/version.h>
#include <linux/version.h>
#include <linux/watchdog.h>
#include <linux/watchdog.h>


#include <asm/unaligned.h>

#define ZIIRAVE_TIMEOUT_MIN	3
#define ZIIRAVE_TIMEOUT_MIN	3
#define ZIIRAVE_TIMEOUT_MAX	255
#define ZIIRAVE_TIMEOUT_MAX	255
#define ZIIRAVE_TIMEOUT_DEFAULT	30
#define ZIIRAVE_TIMEOUT_DEFAULT	30
@@ -198,8 +200,7 @@ static int ziirave_firm_set_read_addr(struct watchdog_device *wdd, u16 addr)
	struct i2c_client *client = to_i2c_client(wdd->parent);
	struct i2c_client *client = to_i2c_client(wdd->parent);
	u8 address[2];
	u8 address[2];


	address[0] = addr & 0xff;
	put_unaligned_le16(addr, address);
	address[1] = (addr >> 8) & 0xff;


	return i2c_smbus_write_block_data(client,
	return i2c_smbus_write_block_data(client,
					  ZIIRAVE_CMD_DOWNLOAD_SET_READ_ADDR,
					  ZIIRAVE_CMD_DOWNLOAD_SET_READ_ADDR,
@@ -263,8 +264,7 @@ static int __ziirave_firm_write_pkt(struct watchdog_device *wdd,
	/* Packet length */
	/* Packet length */
	packet[0] = len;
	packet[0] = len;
	/* Packet address */
	/* Packet address */
	packet[1] = addr16 & 0xff;
	put_unaligned_le16(addr16, packet + 1);
	packet[2] = (addr16 & 0xff00) >> 8;


	memcpy(packet + 3, data, len);
	memcpy(packet + 3, data, len);
	memset(packet + 3 + len, 0, ZIIRAVE_FIRM_PKT_DATA_SIZE - len);
	memset(packet + 3 + len, 0, ZIIRAVE_FIRM_PKT_DATA_SIZE - len);