Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bernardo Perez Priego and committed by
Enric Balletbo i Serra
ad35da94 1c7c5134

+6 -1
+6 -1
drivers/platform/chrome/wilco_ec/debugfs.c
··· 208 208 */ 209 209 static int h1_gpio_get(void *arg, u64 *val) 210 210 { 211 - return send_ec_cmd(arg, SUB_CMD_H1_GPIO, (u8 *)val); 211 + int ret; 212 + 213 + ret = send_ec_cmd(arg, SUB_CMD_H1_GPIO, (u8 *)val); 214 + if (ret == 0) 215 + *val &= 0xFF; 216 + return ret; 212 217 } 213 218 214 219 DEFINE_DEBUGFS_ATTRIBUTE(fops_h1_gpio, h1_gpio_get, NULL, "0x%02llx\n");