Message ID | 20240308210519.2986-2-W_Armin@gmx.de (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | [v4,1/2] platform/x86: wmi: Support reading/writing 16 bit EC values | expand |
On 3/8/24 1:05 PM, Armin Wolf wrote: > If an error code other than EINVAL, ENODEV or ETIME is returned > by ec_read()/ec_write(), then AE_OK is wrongly returned. > > Fix this by only returning AE_OK if the return code is 0, and > return AE_ERROR otherwise. > > Tested on a Dell Inspiron 3505 and a Asus Prime B650-Plus. > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > Signed-off-by: Armin Wolf <W_Armin@gmx.de> > --- > drivers/platform/x86/wmi.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c > index d9bf6d452b3a..84d1ccf6bc14 100644 > --- a/drivers/platform/x86/wmi.c > +++ b/drivers/platform/x86/wmi.c > @@ -1218,8 +1218,10 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, > return AE_NOT_FOUND; > case -ETIME: > return AE_TIME; > - default: > + case 0: > return AE_OK; > + default: > + return AE_ERROR; > } After checking the callers of acpi_wmi_ec_space_handler() it looks like there is no benefit in returning different ACPI status per error values. It is not being used. why no just return for result < 0 AE_ERROR and return for other cases? > } > > -- > 2.39.2 > >
Am 09.03.24 um 18:41 schrieb Kuppuswamy Sathyanarayanan: > On 3/8/24 1:05 PM, Armin Wolf wrote: >> If an error code other than EINVAL, ENODEV or ETIME is returned >> by ec_read()/ec_write(), then AE_OK is wrongly returned. >> >> Fix this by only returning AE_OK if the return code is 0, and >> return AE_ERROR otherwise. >> >> Tested on a Dell Inspiron 3505 and a Asus Prime B650-Plus. >> >> Reviewed-by: Hans de Goede <hdegoede@redhat.com> >> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> >> Signed-off-by: Armin Wolf <W_Armin@gmx.de> >> --- >> drivers/platform/x86/wmi.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c >> index d9bf6d452b3a..84d1ccf6bc14 100644 >> --- a/drivers/platform/x86/wmi.c >> +++ b/drivers/platform/x86/wmi.c >> @@ -1218,8 +1218,10 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, >> return AE_NOT_FOUND; >> case -ETIME: >> return AE_TIME; >> - default: >> + case 0: >> return AE_OK; >> + default: >> + return AE_ERROR; >> } > After checking the callers of acpi_wmi_ec_space_handler() it looks like there is no benefit in returning different ACPI status per error values. It is not being used. why no just return for result < 0 AE_ERROR and return for other cases? Hi, those handler functions are being called in acpi_ev_address_space_dispatch(), which uses the return value to print error messages. So it makes sense to return different ACPI error values here. Thanks, Armin Wolf >> } >> >> -- >> 2.39.2 >> >>
On Sat, Mar 9, 2024 at 11:10 AM Armin Wolf <W_Armin@gmx.de> wrote: > > Am 09.03.24 um 18:41 schrieb Kuppuswamy Sathyanarayanan: > > > On 3/8/24 1:05 PM, Armin Wolf wrote: > >> If an error code other than EINVAL, ENODEV or ETIME is returned > >> by ec_read()/ec_write(), then AE_OK is wrongly returned. > >> > >> Fix this by only returning AE_OK if the return code is 0, and > >> return AE_ERROR otherwise. > >> > >> Tested on a Dell Inspiron 3505 and a Asus Prime B650-Plus. > >> > >> Reviewed-by: Hans de Goede <hdegoede@redhat.com> > >> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > >> Signed-off-by: Armin Wolf <W_Armin@gmx.de> > >> --- Got it. Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > >> drivers/platform/x86/wmi.c | 4 +++- > >> 1 file changed, 3 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c > >> index d9bf6d452b3a..84d1ccf6bc14 100644 > >> --- a/drivers/platform/x86/wmi.c > >> +++ b/drivers/platform/x86/wmi.c > >> @@ -1218,8 +1218,10 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, > >> return AE_NOT_FOUND; > >> case -ETIME: > >> return AE_TIME; > >> - default: > >> + case 0: > >> return AE_OK; > >> + default: > >> + return AE_ERROR; > >> } > > After checking the callers of acpi_wmi_ec_space_handler() it looks like there is no benefit in returning different ACPI status per error values. It is not being used. why no just return for result < 0 AE_ERROR and return for other cases? > > Hi, > > those handler functions are being called in acpi_ev_address_space_dispatch(), which uses the return value to print error messages. > So it makes sense to return different ACPI error values here. > > Thanks, > Armin Wolf > > >> } > >> > >> -- > >> 2.39.2 > >> > >>
On 3/8/24 1:05 PM, Armin Wolf wrote: > If an error code other than EINVAL, ENODEV or ETIME is returned > by ec_read()/ec_write(), then AE_OK is wrongly returned. > > Fix this by only returning AE_OK if the return code is 0, and > return AE_ERROR otherwise. > > Tested on a Dell Inspiron 3505 and a Asus Prime B650-Plus. > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> > Signed-off-by: Armin Wolf <W_Armin@gmx.de> > --- Looks good to me. Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> > drivers/platform/x86/wmi.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c > index d9bf6d452b3a..84d1ccf6bc14 100644 > --- a/drivers/platform/x86/wmi.c > +++ b/drivers/platform/x86/wmi.c > @@ -1218,8 +1218,10 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, > return AE_NOT_FOUND; > case -ETIME: > return AE_TIME; > - default: > + case 0: > return AE_OK; > + default: > + return AE_ERROR; > } > } > > -- > 2.39.2 > >
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index d9bf6d452b3a..84d1ccf6bc14 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -1218,8 +1218,10 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, return AE_NOT_FOUND; case -ETIME: return AE_TIME; - default: + case 0: return AE_OK; + default: + return AE_ERROR; } }