summaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome
diff options
context:
space:
mode:
authorBernardo Perez Priego <bernardo.perez.priego@intel.com>2020-04-03 00:33:30 +0200
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2020-04-13 16:36:54 +0200
commitad35da94b61785ddc1186095c3e488c5c0af6bd2 (patch)
tree68b32b4c66ed844daa39789b84f6323f994f5467 /drivers/platform/chrome
parentplatform/chrome: chromeos_pstore: set user space log size (diff)
downloadlinux-ad35da94b61785ddc1186095c3e488c5c0af6bd2.tar.xz
linux-ad35da94b61785ddc1186095c3e488c5c0af6bd2.zip
platform/chrome: wilco_ec: Provide correct output format to 'h1_gpio' file
Function 'h1_gpio_get' is receiving 'val' parameter of type u64, this is being passed to 'send_ec_cmd' as type u8, thus, result is stored in least significant byte. Due to output format, the whole 'val' value was being displayed when any of the most significant bytes are different than zero. This fix will make sure only least significant byte is displayed regardless of remaining bytes value. Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Diffstat (limited to 'drivers/platform/chrome')
-rw-r--r--drivers/platform/chrome/wilco_ec/debugfs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/platform/chrome/wilco_ec/debugfs.c b/drivers/platform/chrome/wilco_ec/debugfs.c
index df5a5f6c3ec6..a812788a0bdc 100644
--- a/drivers/platform/chrome/wilco_ec/debugfs.c
+++ b/drivers/platform/chrome/wilco_ec/debugfs.c
@@ -208,7 +208,12 @@ static int send_ec_cmd(struct wilco_ec_device *ec, u8 sub_cmd, u8 *out_val)
*/
static int h1_gpio_get(void *arg, u64 *val)
{
- return send_ec_cmd(arg, SUB_CMD_H1_GPIO, (u8 *)val);
+ int ret;
+
+ ret = send_ec_cmd(arg, SUB_CMD_H1_GPIO, (u8 *)val);
+ if (ret == 0)
+ *val &= 0xFF;
+ return ret;
}
DEFINE_DEBUGFS_ATTRIBUTE(fops_h1_gpio, h1_gpio_get, NULL, "0x%02llx\n");