* [PATCH v4 0/7] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
@ 2020-08-06 15:32 Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-08-06 15:32 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Jonathan Cameron, Benson Leung, Dmitry Torokhov, Thierry Reding,
Uwe Kleine-König, Lee Jones, Gwendal Grignou, Brian Norris,
Yu-Hsuan Hsu, Prashant Malani, linux-iio, linux-input, linux-pwm,
linux-kernel
The EC reports a variety of error codes. Most of those, with the exception
of EC_RES_INVALID_VERSION, are converted to -EPROTO. As result, the actual
error code gets lost. In cros_ec_cmd_xfer_status(), convert all EC errors
to Linux error codes to report a more meaningful error to the caller to aid
debugging.
To prepare for this change, handle error codes other than -EPROTO for all
callers of cros_ec_cmd_xfer_status(). Specifically, no longer assume that
-EPROTO reflects an error from the EC and all other error codes reflect a
transfer error.
v2: Add patches 1/4 to 3/4 to handle callers of cros_ec_cmd_xfer_status()
v3: Add patches 4/6 and 5/6 to handle additional callers of
cros_ec_cmd_xfer_status()
Use -ENOPROTOOPT for EC_RES_INVALID_VERSION
Implement function to convert error codes
v4: Add coments describing the functionality of cros_ec_num_pwms().
Add patch 7/7 to clean up cros_ec_num_pwms() after the new error code
support has been implemented.
Rebased series to v5.8.
----------------------------------------------------------------
Guenter Roeck (7):
iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error code
cros_ec_lightbar: Accept more error codes from cros_ec_cmd_xfer_status
platform/chrome: cros_ec_sysfs: Report range of error codes from EC
pwm: cros-ec: Accept more error codes from cros_ec_cmd_xfer_status
platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT
platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
pwm: cros-ec: Simplify EC error handling
.../iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +-
drivers/input/keyboard/cros_ec_keyb.c | 2 +-
drivers/platform/chrome/cros_ec_lightbar.c | 10 ++---
drivers/platform/chrome/cros_ec_proto.c | 52 +++++++++++++++++-----
drivers/platform/chrome/cros_ec_sysfs.c | 24 ++++------
drivers/pwm/pwm-cros-ec.c | 37 +++++++--------
6 files changed, 74 insertions(+), 53 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v4 0/7] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
@ 2020-08-06 15:33 Guenter Roeck
2020-08-21 8:21 ` Enric Balletbo i Serra
0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2020-08-06 15:33 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Jonathan Cameron, Benson Leung, Dmitry Torokhov, Thierry Reding,
Uwe Kleine-König, Lee Jones, Gwendal Grignou, Brian Norris,
Yu-Hsuan Hsu, Prashant Malani, linux-iio, linux-input, linux-pwm,
linux-kernel
The EC reports a variety of error codes. Most of those, with the exception
of EC_RES_INVALID_VERSION, are converted to -EPROTO. As result, the actual
error code gets lost. In cros_ec_cmd_xfer_status(), convert all EC errors
to Linux error codes to report a more meaningful error to the caller to aid
debugging.
To prepare for this change, handle error codes other than -EPROTO for all
callers of cros_ec_cmd_xfer_status(). Specifically, no longer assume that
-EPROTO reflects an error from the EC and all other error codes reflect a
transfer error.
v2: Add patches 1/4 to 3/4 to handle callers of cros_ec_cmd_xfer_status()
v3: Add patches 4/6 and 5/6 to handle additional callers of
cros_ec_cmd_xfer_status()
Use -ENOPROTOOPT for EC_RES_INVALID_VERSION
Implement function to convert error codes
v4: Add coments describing the functionality of cros_ec_num_pwms().
Add patch 7/7 to clean up cros_ec_num_pwms() after the new error code
support has been implemented.
Rebased series to v5.8.
----------------------------------------------------------------
Guenter Roeck (7):
iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error code
cros_ec_lightbar: Accept more error codes from cros_ec_cmd_xfer_status
platform/chrome: cros_ec_sysfs: Report range of error codes from EC
pwm: cros-ec: Accept more error codes from cros_ec_cmd_xfer_status
platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT
platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
pwm: cros-ec: Simplify EC error handling
.../iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +-
drivers/input/keyboard/cros_ec_keyb.c | 2 +-
drivers/platform/chrome/cros_ec_lightbar.c | 10 ++---
drivers/platform/chrome/cros_ec_proto.c | 52 +++++++++++++++++-----
drivers/platform/chrome/cros_ec_sysfs.c | 24 ++++------
drivers/pwm/pwm-cros-ec.c | 37 +++++++--------
6 files changed, 74 insertions(+), 53 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4 0/7] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
2020-08-06 15:33 Guenter Roeck
@ 2020-08-21 8:21 ` Enric Balletbo i Serra
2020-08-21 15:39 ` Guenter Roeck
0 siblings, 1 reply; 4+ messages in thread
From: Enric Balletbo i Serra @ 2020-08-21 8:21 UTC (permalink / raw)
To: Guenter Roeck
Cc: Jonathan Cameron, Benson Leung, Dmitry Torokhov, Thierry Reding,
Uwe Kleine-König, Lee Jones, Gwendal Grignou, Brian Norris,
Yu-Hsuan Hsu, Prashant Malani, linux-iio, linux-input, linux-pwm,
linux-kernel
Hi Guenter et all,
On 6/8/20 17:33, Guenter Roeck wrote:
> The EC reports a variety of error codes. Most of those, with the exception
> of EC_RES_INVALID_VERSION, are converted to -EPROTO. As result, the actual
> error code gets lost. In cros_ec_cmd_xfer_status(), convert all EC errors
> to Linux error codes to report a more meaningful error to the caller to aid
> debugging.
>
> To prepare for this change, handle error codes other than -EPROTO for all
> callers of cros_ec_cmd_xfer_status(). Specifically, no longer assume that
> -EPROTO reflects an error from the EC and all other error codes reflect a
> transfer error.
>
> v2: Add patches 1/4 to 3/4 to handle callers of cros_ec_cmd_xfer_status()
> v3: Add patches 4/6 and 5/6 to handle additional callers of
> cros_ec_cmd_xfer_status()
> Use -ENOPROTOOPT for EC_RES_INVALID_VERSION
> Implement function to convert error codes
> v4: Add coments describing the functionality of cros_ec_num_pwms().
> Add patch 7/7 to clean up cros_ec_num_pwms() after the new error code
> support has been implemented.
> Rebased series to v5.8.
>
> ----------------------------------------------------------------
> Guenter Roeck (7):
> iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error code
> cros_ec_lightbar: Accept more error codes from cros_ec_cmd_xfer_status
> platform/chrome: cros_ec_sysfs: Report range of error codes from EC
> pwm: cros-ec: Accept more error codes from cros_ec_cmd_xfer_status
> platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT
> platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
> pwm: cros-ec: Simplify EC error handling
>
> .../iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +-
> drivers/input/keyboard/cros_ec_keyb.c | 2 +-
> drivers/platform/chrome/cros_ec_lightbar.c | 10 ++---
> drivers/platform/chrome/cros_ec_proto.c | 52 +++++++++++++++++-----
> drivers/platform/chrome/cros_ec_sysfs.c | 24 ++++------
> drivers/pwm/pwm-cros-ec.c | 37 +++++++--------
> 6 files changed, 74 insertions(+), 53 deletions(-)
>
The patches LGTM, and if the other maintainers are fine, I'd like to queue all
these through the chrome-platform tree.
I noticed, thought, that KernelCI reported a regression on Kevin that I'll try
to debug at the beginning of next week.
[ 3.821203] cros-ec-spi spi2.0: Wrong size 1/3: 0 != 4
[ 3.827320] cros-ec-keyb ff200000.spi:ec@0:keyboard-controller: cannot
register non-matrix inputs: -71
[ 3.838506] cros-ec-keyb: probe of ff200000.spi:ec@0:keyboard-controller
failed with error -71
[ 3.853492] cros-ec-spi spi2.0: Chrome EC device registered
Thanks,
Enric
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4 0/7] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
2020-08-21 8:21 ` Enric Balletbo i Serra
@ 2020-08-21 15:39 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2020-08-21 15:39 UTC (permalink / raw)
To: Enric Balletbo i Serra
Cc: Jonathan Cameron, Benson Leung, Dmitry Torokhov, Thierry Reding,
Uwe Kleine-König, Lee Jones, Gwendal Grignou, Brian Norris,
Yu-Hsuan Hsu, Prashant Malani, linux-iio, linux-input, linux-pwm,
linux-kernel
On 8/21/20 1:21 AM, Enric Balletbo i Serra wrote:
> Hi Guenter et all,
>
> On 6/8/20 17:33, Guenter Roeck wrote:
>> The EC reports a variety of error codes. Most of those, with the exception
>> of EC_RES_INVALID_VERSION, are converted to -EPROTO. As result, the actual
>> error code gets lost. In cros_ec_cmd_xfer_status(), convert all EC errors
>> to Linux error codes to report a more meaningful error to the caller to aid
>> debugging.
>>
>> To prepare for this change, handle error codes other than -EPROTO for all
>> callers of cros_ec_cmd_xfer_status(). Specifically, no longer assume that
>> -EPROTO reflects an error from the EC and all other error codes reflect a
>> transfer error.
>>
>> v2: Add patches 1/4 to 3/4 to handle callers of cros_ec_cmd_xfer_status()
>> v3: Add patches 4/6 and 5/6 to handle additional callers of
>> cros_ec_cmd_xfer_status()
>> Use -ENOPROTOOPT for EC_RES_INVALID_VERSION
>> Implement function to convert error codes
>> v4: Add coments describing the functionality of cros_ec_num_pwms().
>> Add patch 7/7 to clean up cros_ec_num_pwms() after the new error code
>> support has been implemented.
>> Rebased series to v5.8.
>>
>> ----------------------------------------------------------------
>> Guenter Roeck (7):
>> iio: cros_ec: Accept -EOPNOTSUPP as 'not supported' error code
>> cros_ec_lightbar: Accept more error codes from cros_ec_cmd_xfer_status
>> platform/chrome: cros_ec_sysfs: Report range of error codes from EC
>> pwm: cros-ec: Accept more error codes from cros_ec_cmd_xfer_status
>> platform/input: cros_ec: Replace -ENOTSUPP with -ENOPROTOOPT
>> platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes
>> pwm: cros-ec: Simplify EC error handling
>>
>> .../iio/common/cros_ec_sensors/cros_ec_sensors.c | 2 +-
>> drivers/input/keyboard/cros_ec_keyb.c | 2 +-
>> drivers/platform/chrome/cros_ec_lightbar.c | 10 ++---
>> drivers/platform/chrome/cros_ec_proto.c | 52 +++++++++++++++++-----
>> drivers/platform/chrome/cros_ec_sysfs.c | 24 ++++------
>> drivers/pwm/pwm-cros-ec.c | 37 +++++++--------
>> 6 files changed, 74 insertions(+), 53 deletions(-)
>>
>
> The patches LGTM, and if the other maintainers are fine, I'd like to queue all
> these through the chrome-platform tree.
>
> I noticed, thought, that KernelCI reported a regression on Kevin that I'll try
> to debug at the beginning of next week.
>
> [ 3.821203] cros-ec-spi spi2.0: Wrong size 1/3: 0 != 4
> [ 3.827320] cros-ec-keyb ff200000.spi:ec@0:keyboard-controller: cannot
> register non-matrix inputs: -71
> [ 3.838506] cros-ec-keyb: probe of ff200000.spi:ec@0:keyboard-controller
> failed with error -71
> [ 3.853492] cros-ec-spi spi2.0: Chrome EC device registered
>
Easy to debug. cros_ec_cmd_xfer_status() now returns 0 for success and < 0 for errors.
It needs to return the receive length if there is no error. I'll send v5 with a fix,
and sorry for the trouble.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-21 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-06 15:32 [PATCH v4 0/7] platform/chrome: cros_ec_proto: Convert EC error codes to Linux error codes Guenter Roeck
-- strict thread matches above, loose matches on Subject: below --
2020-08-06 15:33 Guenter Roeck
2020-08-21 8:21 ` Enric Balletbo i Serra
2020-08-21 15:39 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).