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

platform/chrome: cros_ec_proto: Drop cros_ec_cmd_xfer()

Since cros_ec_cmd_xfer_status() now returns Linux error codes and all
other files use that command, remove the now-unused function
cros_ec_cmd_xfer().

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

authored by

Prashant Malani and committed by
Enric Balletbo i Serra
6b194ee9 64b02e54

+11 -33
+11 -33
drivers/platform/chrome/cros_ec_proto.c
··· 549 549 EXPORT_SYMBOL(cros_ec_query_all); 550 550 551 551 /** 552 - * cros_ec_cmd_xfer() - Send a command to the ChromeOS EC. 552 + * cros_ec_cmd_xfer_status() - Send a command to the ChromeOS EC. 553 553 * @ec_dev: EC device. 554 554 * @msg: Message to write. 555 555 * 556 - * Call this to send a command to the ChromeOS EC. This should be used 557 - * instead of calling the EC's cmd_xfer() callback directly. 556 + * Call this to send a command to the ChromeOS EC. This should be used instead of calling the EC's 557 + * cmd_xfer() callback directly. It returns success status only if both the command was transmitted 558 + * successfully and the EC replied with success status. 558 559 * 559 - * Return: 0 on success or negative error code. 560 + * Return: 561 + * >=0 - The number of bytes transferred 562 + * <0 - Linux error code 560 563 */ 561 - static int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev, 564 + int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev, 562 565 struct cros_ec_command *msg) 563 566 { 564 - int ret; 567 + int ret, mapped; 565 568 566 569 mutex_lock(&ec_dev->lock); 567 570 if (ec_dev->proto_version == EC_PROTO_VERSION_UNKNOWN) { ··· 601 598 return -EMSGSIZE; 602 599 } 603 600 } 601 + 604 602 ret = send_command(ec_dev, msg); 605 603 mutex_unlock(&ec_dev->lock); 606 604 607 - return ret; 608 - } 609 - 610 - /** 611 - * cros_ec_cmd_xfer_status() - Send a command to the ChromeOS EC. 612 - * @ec_dev: EC device. 613 - * @msg: Message to write. 614 - * 615 - * This function is identical to cros_ec_cmd_xfer, except it returns success 616 - * status only if both the command was transmitted successfully and the EC 617 - * replied with success status. It's not necessary to check msg->result when 618 - * using this function. 619 - * 620 - * Return: 621 - * >=0 - The number of bytes transferred 622 - * <0 - Linux error code 623 - */ 624 - int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev, 625 - struct cros_ec_command *msg) 626 - { 627 - int ret, mapped; 628 - 629 - ret = cros_ec_cmd_xfer(ec_dev, msg); 630 - if (ret < 0) { 631 - dev_err(ec_dev->dev, "Command xfer error (err:%d)\n", ret); 632 - return ret; 633 - } 634 605 mapped = cros_ec_map_error(msg->result); 635 606 if (mapped) { 636 607 dev_dbg(ec_dev->dev, "Command result (err: %d [%d])\n", 637 608 msg->result, mapped); 638 609 ret = mapped; 639 610 } 611 + 640 612 return ret; 641 613 } 642 614 EXPORT_SYMBOL(cros_ec_cmd_xfer_status);