Skip to content

Commit

Permalink
Merge tag 'scpi-fixes-4.10' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/sudeep.holla/linux into fixes

Pull "SCPI fix for v4.10" from Sudeep Holla:

A simple fix for reading only lower 32-bit sensor values on pre-1.0 SCPI
firmwares so that upper 32-bit (garbage) value is discarded properly.

* tag 'scpi-fixes-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  firmware: arm_scpi: fix reading sensor values on pre-1.0 SCPI firmwares
  • Loading branch information
Arnd Bergmann committed Jan 4, 2017
2 parents ad040d8 + a766347 commit 43a8df7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/firmware/arm_scpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,17 @@ static int scpi_sensor_get_value(u16 sensor, u64 *val)

ret = scpi_send_message(CMD_SENSOR_VALUE, &id, sizeof(id),
&buf, sizeof(buf));
if (!ret)
if (ret)
return ret;

if (scpi_info->is_legacy)
/* only 32-bits supported, hi_val can be junk */
*val = le32_to_cpu(buf.lo_val);
else
*val = (u64)le32_to_cpu(buf.hi_val) << 32 |
le32_to_cpu(buf.lo_val);

return ret;
return 0;
}

static int scpi_device_get_power_state(u16 dev_id)
Expand Down

0 comments on commit 43a8df7

Please sign in to comment.