diff mbox series

[v3,5/6] platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT

Message ID 20200726220101.29059-6-linux@roeck-us.net (mailing list archive)
State Superseded
Headers show
Series platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes | expand

Commit Message

Guenter Roeck July 26, 2020, 10:01 p.m. UTC
-ENOTSUPP is not a SUSV4 error code and should not be used. Use
-ENOPROTOOPT instead to report EC_RES_INVALID_VERSION responses
from the EC. This matches match the NFS response for unsupported
protocol versions.

Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Cc: Prashant Malani <pmalani@chromium.org>
Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v3: Added patch

 drivers/input/keyboard/cros_ec_keyb.c   | 2 +-
 drivers/platform/chrome/cros_ec_proto.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Dmitry Torokhov July 30, 2020, 4:53 a.m. UTC | #1
On Sun, Jul 26, 2020 at 03:01:00PM -0700, Guenter Roeck wrote:
> -ENOTSUPP is not a SUSV4 error code and should not be used. Use
> -ENOPROTOOPT instead to report EC_RES_INVALID_VERSION responses
> from the EC. This matches match the NFS response for unsupported
> protocol versions.
> 
> Cc: Gwendal Grignou <gwendal@chromium.org>
> Cc: Yu-Hsuan Hsu <yuhsuan@chromium.org>
> Cc: Prashant Malani <pmalani@chromium.org>
> Cc: Brian Norris <briannorris@chromium.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

for the input bit.

> ---
> v3: Added patch
> 
>  drivers/input/keyboard/cros_ec_keyb.c   | 2 +-
>  drivers/platform/chrome/cros_ec_proto.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> index fc1793ca2f17..15d17c717081 100644
> --- a/drivers/input/keyboard/cros_ec_keyb.c
> +++ b/drivers/input/keyboard/cros_ec_keyb.c
> @@ -348,7 +348,7 @@ static int cros_ec_keyb_info(struct cros_ec_device *ec_dev,
>  	params->event_type = event_type;
>  
>  	ret = cros_ec_cmd_xfer_status(ec_dev, msg);
> -	if (ret == -ENOTSUPP) {
> +	if (ret == -ENOPROTOOPT) {
>  		/* With older ECs we just return 0 for everything */
>  		memset(result, 0, result_size);
>  		ret = 0;
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index 3e745e0fe092..e5bbec979a2a 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -555,7 +555,7 @@ EXPORT_SYMBOL(cros_ec_cmd_xfer);
>   *
>   * Return:
>   * >=0 - The number of bytes transferred
> - * -ENOTSUPP - Operation not supported
> + * -ENOPROTOOPT - Operation not supported
>   * -EPROTO - Protocol error
>   */
>  int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
> @@ -569,7 +569,7 @@ int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
>  	} else if (msg->result == EC_RES_INVALID_VERSION) {
>  		dev_dbg(ec_dev->dev, "Command invalid version (err:%d)\n",
>  			msg->result);
> -		return -ENOTSUPP;
> +		return -ENOPROTOOPT;
>  	} else if (msg->result != EC_RES_SUCCESS) {
>  		dev_dbg(ec_dev->dev, "Command result (err: %d)\n", msg->result);
>  		return -EPROTO;
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index fc1793ca2f17..15d17c717081 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -348,7 +348,7 @@  static int cros_ec_keyb_info(struct cros_ec_device *ec_dev,
 	params->event_type = event_type;
 
 	ret = cros_ec_cmd_xfer_status(ec_dev, msg);
-	if (ret == -ENOTSUPP) {
+	if (ret == -ENOPROTOOPT) {
 		/* With older ECs we just return 0 for everything */
 		memset(result, 0, result_size);
 		ret = 0;
diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 3e745e0fe092..e5bbec979a2a 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -555,7 +555,7 @@  EXPORT_SYMBOL(cros_ec_cmd_xfer);
  *
  * Return:
  * >=0 - The number of bytes transferred
- * -ENOTSUPP - Operation not supported
+ * -ENOPROTOOPT - Operation not supported
  * -EPROTO - Protocol error
  */
 int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
@@ -569,7 +569,7 @@  int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
 	} else if (msg->result == EC_RES_INVALID_VERSION) {
 		dev_dbg(ec_dev->dev, "Command invalid version (err:%d)\n",
 			msg->result);
-		return -ENOTSUPP;
+		return -ENOPROTOOPT;
 	} else if (msg->result != EC_RES_SUCCESS) {
 		dev_dbg(ec_dev->dev, "Command result (err: %d)\n", msg->result);
 		return -EPROTO;