Skip to content

Commit 0bcee11

Browse files
Enric Balletbo i Serradtor
authored andcommitted
Input: cros_ec_keyb - use cros_ec_cmd_xfer_status helper
This patch makes use of cros_ec_cmd_xfer_status() instead of cros_ec_cmd_xfer(). In this case there is no advantage of doing this apart from that we want to make cros_ec_cmd_xfer() a private function for the EC protocol and let people only use the cros_ec_cmd_xfer_status() to return Linux standard error codes. Signed-off-by: Enric Balletbo i Serra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 3f8f770 commit 0bcee11

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

drivers/input/keyboard/cros_ec_keyb.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,14 @@ static int cros_ec_keyb_info(struct cros_ec_device *ec_dev,
347347
params->info_type = info_type;
348348
params->event_type = event_type;
349349

350-
ret = cros_ec_cmd_xfer(ec_dev, msg);
351-
if (ret < 0) {
352-
dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n",
353-
(int)info_type, (int)event_type, ret);
354-
} else if (msg->result == EC_RES_INVALID_VERSION) {
350+
ret = cros_ec_cmd_xfer_status(ec_dev, msg);
351+
if (ret == -ENOTSUPP) {
355352
/* With older ECs we just return 0 for everything */
356353
memset(result, 0, result_size);
357354
ret = 0;
358-
} else if (msg->result != EC_RES_SUCCESS) {
359-
dev_warn(ec_dev->dev, "Error getting info %d/%d: %d\n",
360-
(int)info_type, (int)event_type, msg->result);
361-
ret = -EPROTO;
355+
} else if (ret < 0) {
356+
dev_warn(ec_dev->dev, "Transfer error %d/%d: %d\n",
357+
(int)info_type, (int)event_type, ret);
362358
} else if (ret != result_size) {
363359
dev_warn(ec_dev->dev, "Wrong size %d/%d: %d != %zu\n",
364360
(int)info_type, (int)event_type,

0 commit comments

Comments
 (0)