aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/bq27x00_battery.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 62d4948e8206..0c056fcc01ce 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -23,8 +23,8 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/power_supply.h> 24#include <linux/power_supply.h>
25#include <linux/idr.h> 25#include <linux/idr.h>
26
27#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <asm/unaligned.h>
28 28
29#define DRIVER_VERSION "1.0.0" 29#define DRIVER_VERSION "1.0.0"
30 30
@@ -33,7 +33,6 @@
33#define BQ27x00_REG_RSOC 0x0B /* Relative State-of-Charge */ 33#define BQ27x00_REG_RSOC 0x0B /* Relative State-of-Charge */
34#define BQ27x00_REG_AI 0x14 34#define BQ27x00_REG_AI 0x14
35#define BQ27x00_REG_FLAGS 0x0A 35#define BQ27x00_REG_FLAGS 0x0A
36#define HIGH_BYTE(A) ((A) << 8)
37 36
38/* If the system has several batteries we need a different name for each 37/* If the system has several batteries we need a different name for each
39 * of them... 38 * of them...
@@ -239,7 +238,7 @@ static int bq27200_read(u8 reg, int *rt_value, int b_single,
239 err = i2c_transfer(client->adapter, msg, 1); 238 err = i2c_transfer(client->adapter, msg, 1);
240 if (err >= 0) { 239 if (err >= 0) {
241 if (!b_single) 240 if (!b_single)
242 *rt_value = data[1] | HIGH_BYTE(data[0]); 241 *rt_value = get_unaligned_be16(data);
243 else 242 else
244 *rt_value = data[0]; 243 *rt_value = data[0];
245 244