diff options
| author | Marek Belisko <marek@goldelico.com> | 2014-06-30 15:49:56 -0400 |
|---|---|---|
| committer | Sebastian Reichel <sre@kernel.org> | 2014-07-18 17:40:22 -0400 |
| commit | 3dd843e1c26a023dc8d776e5d984c635c642785f (patch) | |
| tree | ef5a65a69280bc6d2aa3e2a88a625b1609a7847d | |
| parent | 1cb82fdb2a0fb2af9da69eeee92877189ec9a560 (diff) | |
bq27000: report missing device better.
One an hdq buss, a missing device reads as 0xff, not -1.
So do a translation to allow detecting of a missing bus.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
| -rw-r--r-- | drivers/power/bq27x00_battery.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index a0f205b0471d..e10763e3a1d5 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c | |||
| @@ -416,6 +416,9 @@ static void bq27x00_update(struct bq27x00_device_info *di) | |||
| 416 | bool is_bq27425 = di->chip == BQ27425; | 416 | bool is_bq27425 = di->chip == BQ27425; |
| 417 | 417 | ||
| 418 | cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500); | 418 | cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500); |
| 419 | if ((cache.flags & 0xff) == 0xff) | ||
| 420 | /* read error */ | ||
| 421 | cache.flags = -1; | ||
| 419 | if (cache.flags >= 0) { | 422 | if (cache.flags >= 0) { |
| 420 | if (!is_bq27500 && !is_bq27425 | 423 | if (!is_bq27500 && !is_bq27425 |
| 421 | && (cache.flags & BQ27000_FLAG_CI)) { | 424 | && (cache.flags & BQ27000_FLAG_CI)) { |
