Skip to content

Commit 6b194ee

Browse files
Prashant MalaniEnric Balletbo i Serra
authored andcommitted
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>
1 parent 64b02e5 commit 6b194ee

1 file changed

Lines changed: 11 additions & 33 deletions

File tree

drivers/platform/chrome/cros_ec_proto.c

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -549,19 +549,22 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
549549
EXPORT_SYMBOL(cros_ec_query_all);
550550

551551
/**
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.
553553
* @ec_dev: EC device.
554554
* @msg: Message to write.
555555
*
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.
558559
*
559-
* Return: 0 on success or negative error code.
560+
* Return:
561+
* >=0 - The number of bytes transferred
562+
* <0 - Linux error code
560563
*/
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,
562565
struct cros_ec_command *msg)
563566
{
564-
int ret;
567+
int ret, mapped;
565568

566569
mutex_lock(&ec_dev->lock);
567570
if (ec_dev->proto_version == EC_PROTO_VERSION_UNKNOWN) {
@@ -598,42 +601,17 @@ static int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
598601
return -EMSGSIZE;
599602
}
600603
}
604+
601605
ret = send_command(ec_dev, msg);
602606
mutex_unlock(&ec_dev->lock);
603607

604-
return ret;
605-
}
606-
607-
/**
608-
* cros_ec_cmd_xfer_status() - Send a command to the ChromeOS EC.
609-
* @ec_dev: EC device.
610-
* @msg: Message to write.
611-
*
612-
* This function is identical to cros_ec_cmd_xfer, except it returns success
613-
* status only if both the command was transmitted successfully and the EC
614-
* replied with success status. It's not necessary to check msg->result when
615-
* using this function.
616-
*
617-
* Return:
618-
* >=0 - The number of bytes transferred
619-
* <0 - Linux error code
620-
*/
621-
int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
622-
struct cros_ec_command *msg)
623-
{
624-
int ret, mapped;
625-
626-
ret = cros_ec_cmd_xfer(ec_dev, msg);
627-
if (ret < 0) {
628-
dev_err(ec_dev->dev, "Command xfer error (err:%d)\n", ret);
629-
return ret;
630-
}
631608
mapped = cros_ec_map_error(msg->result);
632609
if (mapped) {
633610
dev_dbg(ec_dev->dev, "Command result (err: %d [%d])\n",
634611
msg->result, mapped);
635612
ret = mapped;
636613
}
614+
637615
return ret;
638616
}
639617
EXPORT_SYMBOL(cros_ec_cmd_xfer_status);

0 commit comments

Comments
 (0)