public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Duarte Silva <duartejcsilva@gmail.com>
To: linux-acpi@vger.kernel.org
Subject: Re: Propose WMI patch
Date: Tue, 30 Sep 2008 14:05:25 +0100	[thread overview]
Message-ID: <200809301405.25117.duartejcsilva@gmail.com> (raw)
In-Reply-To: <200809301240.34032.carlos@strangeworlds.co.uk>

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 :)

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2008-09-30 13:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-30 11:06 Propose WMI patch Duarte Silva
2008-09-30 11:13 ` Carlos Corbacho
2008-09-30 11:16   ` Carlos Corbacho
2008-09-30 11:29     ` Duarte Silva
2008-09-30 11:40       ` Carlos Corbacho
2008-09-30 13:05         ` Duarte Silva [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200809301405.25117.duartejcsilva@gmail.com \
    --to=duartejcsilva@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox