Re: Propose WMI patch

Carlos Corbacho
2008-09-30T11:40:37Z

On Tuesday 30 September 2008 12:29:17 Duarte Silva wrote:
> For instance, it would be nice to be able to do this,
>
> for (i = 0; i < ARRAY_SIZE(laptop->methods); i++)
>         laptop->methods[i].status =
> wmi_is_guid_present(laptop->methods[i].guid);
>
> instead of
>
> for (i = 0; i < ARRAY_SIZE(laptop->methods); i++)
>         if (wmi_has_guid(laptop->methods[i].guid))
>                 laptop->methods[i].status = AE_OK;
>         else
>                 laptop->methods[i].status = AE_NOT_FOUND;

Why not just do:

for (i = 0; i < ARRAY_SIZE(laptop->methods); i++)
laptop->methods[i].exists =
wmi_is_guid_present(laptop->methods[i].guid);

I don't see why you need an ACPI status here, when a simple bool will do just
fine?

Otherwise, instead of being able to do this:

if (laptop->methods[i].exists) {
/* do something */
}

you end up having to use one of the ACPI status wrappers all the time:

if (ACPI_SUCCESS(laptop->methods[i].status)) {
/* do something */
}