diff options
author | Harvey Harrison <harvey.harrison@gmail.com> | 2008-09-22 14:53:50 -0700 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2008-09-26 03:46:12 +0400 |
commit | 8aef7e8f8de2d900da892085edbf14ea35fe6881 (patch) | |
tree | 07d4d60b16cab0ee710e51b635139899db234db9 /drivers/power | |
parent | 6a9037887ccea92152b034edeb15d453d1a98555 (diff) | |
download | op-kernel-dev-8aef7e8f8de2d900da892085edbf14ea35fe6881.zip op-kernel-dev-8aef7e8f8de2d900da892085edbf14ea35fe6881.tar.gz |
bq27x00_battery: use unaligned access helper
Remove hand-rolled get_unaligned_be16, this points to a possible bug as
bq27x00_read does another endian byteswap which sparse notices:
drivers/power/bq27x00_battery.c:81:14: warning: cast to restricted __be16
Which should probably be checked.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/bq27x00_battery.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index 62d4948..0c056fcc 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c @@ -23,8 +23,8 @@ #include <linux/platform_device.h> #include <linux/power_supply.h> #include <linux/idr.h> - #include <linux/i2c.h> +#include <asm/unaligned.h> #define DRIVER_VERSION "1.0.0" @@ -33,7 +33,6 @@ #define BQ27x00_REG_RSOC 0x0B /* Relative State-of-Charge */ #define BQ27x00_REG_AI 0x14 #define BQ27x00_REG_FLAGS 0x0A -#define HIGH_BYTE(A) ((A) << 8) /* If the system has several batteries we need a different name for each * of them... @@ -239,7 +238,7 @@ static int bq27200_read(u8 reg, int *rt_value, int b_single, err = i2c_transfer(client->adapter, msg, 1); if (err >= 0) { if (!b_single) - *rt_value = data[1] | HIGH_BYTE(data[0]); + *rt_value = get_unaligned_be16(data); else *rt_value = data[0]; |