platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT
authorGuenter Roeck <linux@roeck-us.net>
Sat, 22 Aug 2020 15:08:55 +0000 (08:08 -0700)
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>
Mon, 24 Aug 2020 09:37:34 +0000 (11:37 +0200)
-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>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
drivers/input/keyboard/cros_ec_keyb.c
drivers/platform/chrome/cros_ec_proto.c

index fc1793c..15d17c7 100644 (file)
@@ -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;
index 8d52b3b..f472751 100644 (file)
@@ -579,7 +579,7 @@ static int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
  *
  * 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,
@@ -593,7 +593,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;