olpc: olpc_battery.c sparse endian annotations
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Acked-by: Andres Salomon <dilinger@queued.net> Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d2efa6d5ce
commit
8e9c7716c1
|
@ -205,9 +205,9 @@ static int olpc_bat_get_property(struct power_supply *psy,
|
||||||
union power_supply_propval *val)
|
union power_supply_propval *val)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int16_t ec_word;
|
__be16 ec_word;
|
||||||
uint8_t ec_byte;
|
uint8_t ec_byte;
|
||||||
uint64_t ser_buf;
|
__be64 ser_buf;
|
||||||
|
|
||||||
ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1);
|
ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -257,16 +257,14 @@ static int olpc_bat_get_property(struct power_supply *psy,
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ec_word = be16_to_cpu(ec_word);
|
val->intval = (int)be16_to_cpu(ec_word) * 9760L / 32;
|
||||||
val->intval = ec_word * 9760L / 32;
|
|
||||||
break;
|
break;
|
||||||
case POWER_SUPPLY_PROP_CURRENT_AVG:
|
case POWER_SUPPLY_PROP_CURRENT_AVG:
|
||||||
ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2);
|
ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ec_word = be16_to_cpu(ec_word);
|
val->intval = (int)be16_to_cpu(ec_word) * 15625L / 120;
|
||||||
val->intval = ec_word * 15625L / 120;
|
|
||||||
break;
|
break;
|
||||||
case POWER_SUPPLY_PROP_CAPACITY:
|
case POWER_SUPPLY_PROP_CAPACITY:
|
||||||
ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1);
|
ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1);
|
||||||
|
@ -278,24 +276,22 @@ static int olpc_bat_get_property(struct power_supply *psy,
|
||||||
ret = olpc_ec_cmd(EC_BAT_TEMP, NULL, 0, (void *)&ec_word, 2);
|
ret = olpc_ec_cmd(EC_BAT_TEMP, NULL, 0, (void *)&ec_word, 2);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
ec_word = be16_to_cpu(ec_word);
|
|
||||||
val->intval = ec_word * 100 / 256;
|
val->intval = (int)be16_to_cpu(ec_word) * 100 / 256;
|
||||||
break;
|
break;
|
||||||
case POWER_SUPPLY_PROP_TEMP_AMBIENT:
|
case POWER_SUPPLY_PROP_TEMP_AMBIENT:
|
||||||
ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2);
|
ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ec_word = be16_to_cpu(ec_word);
|
val->intval = (int)be16_to_cpu(ec_word) * 100 / 256;
|
||||||
val->intval = ec_word * 100 / 256;
|
|
||||||
break;
|
break;
|
||||||
case POWER_SUPPLY_PROP_CHARGE_COUNTER:
|
case POWER_SUPPLY_PROP_CHARGE_COUNTER:
|
||||||
ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2);
|
ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ec_word = be16_to_cpu(ec_word);
|
val->intval = (int)be16_to_cpu(ec_word) * 6250 / 15;
|
||||||
val->intval = ec_word * 6250 / 15;
|
|
||||||
break;
|
break;
|
||||||
case POWER_SUPPLY_PROP_SERIAL_NUMBER:
|
case POWER_SUPPLY_PROP_SERIAL_NUMBER:
|
||||||
ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8);
|
ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8);
|
||||||
|
|
Loading…
Reference in New Issue