diff mbox series

[v2,1/4] iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error code

Message ID 20200720202243.180230-2-linux@roeck-us.net (mailing list archive)
State New, archived
Headers show
Series platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes | expand

Commit Message

Guenter Roeck July 20, 2020, 8:22 p.m. UTC
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: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Cc: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Added patch

 drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron July 26, 2020, 12:26 p.m. UTC | #1
On Mon, 20 Jul 2020 13:22:40 -0700
Guenter Roeck <linux@roeck-us.net> wrote:

> 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: Yu-Hsuan Hsu <yuhsuan@chromium.org>
> Cc: Prashant Malani <pmalani@chromium.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> v2: Added patch
> 
>  drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> index a66941fdb385..e3aff95493dd 100644
> --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
> @@ -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;
diff mbox series

Patch

diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
index a66941fdb385..e3aff95493dd 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
@@ -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;