Skip to content

Commit baf5964

Browse files
lkundraksre
authored andcommitted
power: supply: olpc_battery: force the le/be casts
The endianness of data returned from the EC depends on the particular EC version determined at run time. Cast from little/big endian explicitey in the routine that flips endianness to the native one to make sparse happy. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Reported-by: kbuild test robot <lkp@intel.com> Fixes: 76311b9 ("power: supply: olpc_battery: Add OLPC XO 1.75 support") Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent c8f3c9f commit baf5964

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/power/supply/olpc_battery.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,9 @@ static int olpc_bat_get_voltage_max_design(union power_supply_propval *val)
327327
static u16 ecword_to_cpu(struct olpc_battery_data *data, u16 ec_word)
328328
{
329329
if (data->little_endian)
330-
return le16_to_cpu(ec_word);
330+
return le16_to_cpu((__force __le16)ec_word);
331331
else
332-
return be16_to_cpu(ec_word);
332+
return be16_to_cpu((__force __be16)ec_word);
333333
}
334334

335335
/*********************************************************************
@@ -341,7 +341,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
341341
{
342342
struct olpc_battery_data *data = power_supply_get_drvdata(psy);
343343
int ret = 0;
344-
__be16 ec_word;
344+
u16 ec_word;
345345
uint8_t ec_byte;
346346
__be64 ser_buf;
347347

0 commit comments

Comments
 (0)