Re: Propose WMI patch

Duarte Silva
2008-09-30T13:07:50Z

On Tuesday 30 September 2008 12:40:33 Carlos Corbacho wrote:
> 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 */
> }
>
> -Carlos

yes, a bool should suffice, thanks :)