diff options
author | Heiner Kallweit | 2017-10-04 21:05:17 +0200 |
---|---|---|
committer | Sudeep Holla | 2017-10-05 11:48:46 +0100 |
commit | 5c7ae6467df557f25daf42e78202531bc44c83df (patch) | |
tree | 35516e4b4dbe7315908cd62e3c86e13f77a6fd98 /drivers/firmware | |
parent | 4864dca72d3fb2586ffee0c92bd13d02cedfee2f (diff) |
firmware: arm_scpi: improve struct sensor_value
lo_val and hi_val together in this order are a little endian 64 bit value.
Therefore we can simplify struct sensor_value and the code by defining
it as a __le64 value and by using le64_to_cpu.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/arm_scpi.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index d305b926c6cd..c923d1ebfa3e 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c @@ -347,9 +347,8 @@ struct _scpi_sensor_info { }; struct sensor_value { - __le32 lo_val; - __le32 hi_val; -} __packed; + __le64 val; +}; struct dev_pstate_set { __le16 dev_id; @@ -785,11 +784,10 @@ static int scpi_sensor_get_value(u16 sensor, u64 *val) return ret; if (scpi_info->is_legacy) - /* only 32-bits supported, hi_val can be junk */ - *val = le32_to_cpu(buf.lo_val); + /* only 32-bits supported, upper 32 bits can be junk */ + *val = le32_to_cpup((__le32 *)&buf.val); else - *val = (u64)le32_to_cpu(buf.hi_val) << 32 | - le32_to_cpu(buf.lo_val); + *val = le64_to_cpu(buf.val); return 0; } |