OSDN Git Service

iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error code
authorGuenter Roeck <linux@roeck-us.net>
Sat, 22 Aug 2020 15:08:51 +0000 (08:08 -0700)
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>
Mon, 24 Aug 2020 09:37:34 +0000 (11:37 +0200)
A follow-up patch will extend the number of errors reported by
cros_ec_cmd_xfer_status(). Specifically, the function will return
-EOPNOTSUPP if a command is not supported by the EC. Prepare for it.

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: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c

index 130ab8c..d71e906 100644 (file)
@@ -73,7 +73,7 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev,
                st->core.param.sensor_offset.flags = 0;
 
                ret = cros_ec_motion_send_host_cmd(&st->core, 0);
-               if (ret == -EPROTO) {
+               if (ret == -EPROTO || ret == -EOPNOTSUPP) {
                        /* Reading calibscale is not supported on older EC. */
                        *val = 1;
                        *val2 = 0;