From: Hanjun Guo <guohanjun@huawei.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>,
linux-gpio@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH 1/2] gpio / ACPI: Avoid unnecessary checks in __gpiod_get_index()
Date: Wed, 11 Mar 2015 09:36:15 +0800 [thread overview]
Message-ID: <54FF9C0F.3060107@huawei.com> (raw)
In-Reply-To: <1829371.gDPkhnsp25@vostro.rjw.lan>
On 2015/3/11 6:08, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> If dev is NULL in __gpiod_get_index() and both ACPI and OF are
> enabled, it will be checked twice before the code decides to give
> up with DT/ACPI lookup, so avoid that.
>
> Also use the observation that ACPI_COMPANION() is much more efficient
> than ACPI_HANDLE(), because the latter uses the former and carries out
> a check and a pointer dereference on top of it, so replace the
> ACPI_HANDLE() check with an ACPI_COMPANION() one which does not
> require the additional IS_ENABLED(CONFIG_ACPI) check too.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Quite straight forward to me, for both two patches,
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Thanks
Hanjun
> ---
> drivers/gpio/gpiolib.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> Index: linux-pm/drivers/gpio/gpiolib.c
> ===================================================================
> --- linux-pm.orig/drivers/gpio/gpiolib.c
> +++ linux-pm/drivers/gpio/gpiolib.c
> @@ -1865,13 +1865,15 @@ struct gpio_desc *__must_check __gpiod_g
>
> dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id);
>
> - /* Using device tree? */
> - if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) {
> - dev_dbg(dev, "using device tree for GPIO lookup\n");
> - desc = of_find_gpio(dev, con_id, idx, &lookupflags);
> - } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) {
> - dev_dbg(dev, "using ACPI for GPIO lookup\n");
> - desc = acpi_find_gpio(dev, con_id, idx, &lookupflags);
> + if (dev) {
> + /* Using device tree? */
> + if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
> + dev_dbg(dev, "using device tree for GPIO lookup\n");
> + desc = of_find_gpio(dev, con_id, idx, &lookupflags);
> + } else if (ACPI_COMPANION(dev)) {
> + dev_dbg(dev, "using ACPI for GPIO lookup\n");
> + desc = acpi_find_gpio(dev, con_id, idx, &lookupflags);
> + }
> }
>
> /*
>
> --
> 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
>
> .
>
WARNING: multiple messages have this Message-ID (diff)
From: Hanjun Guo <guohanjun@huawei.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>,
<linux-gpio@vger.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH 1/2] gpio / ACPI: Avoid unnecessary checks in __gpiod_get_index()
Date: Wed, 11 Mar 2015 09:36:15 +0800 [thread overview]
Message-ID: <54FF9C0F.3060107@huawei.com> (raw)
In-Reply-To: <1829371.gDPkhnsp25@vostro.rjw.lan>
On 2015/3/11 6:08, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> If dev is NULL in __gpiod_get_index() and both ACPI and OF are
> enabled, it will be checked twice before the code decides to give
> up with DT/ACPI lookup, so avoid that.
>
> Also use the observation that ACPI_COMPANION() is much more efficient
> than ACPI_HANDLE(), because the latter uses the former and carries out
> a check and a pointer dereference on top of it, so replace the
> ACPI_HANDLE() check with an ACPI_COMPANION() one which does not
> require the additional IS_ENABLED(CONFIG_ACPI) check too.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Quite straight forward to me, for both two patches,
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Thanks
Hanjun
> ---
> drivers/gpio/gpiolib.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> Index: linux-pm/drivers/gpio/gpiolib.c
> ===================================================================
> --- linux-pm.orig/drivers/gpio/gpiolib.c
> +++ linux-pm/drivers/gpio/gpiolib.c
> @@ -1865,13 +1865,15 @@ struct gpio_desc *__must_check __gpiod_g
>
> dev_dbg(dev, "GPIO lookup for consumer %s\n", con_id);
>
> - /* Using device tree? */
> - if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node) {
> - dev_dbg(dev, "using device tree for GPIO lookup\n");
> - desc = of_find_gpio(dev, con_id, idx, &lookupflags);
> - } else if (IS_ENABLED(CONFIG_ACPI) && dev && ACPI_HANDLE(dev)) {
> - dev_dbg(dev, "using ACPI for GPIO lookup\n");
> - desc = acpi_find_gpio(dev, con_id, idx, &lookupflags);
> + if (dev) {
> + /* Using device tree? */
> + if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
> + dev_dbg(dev, "using device tree for GPIO lookup\n");
> + desc = of_find_gpio(dev, con_id, idx, &lookupflags);
> + } else if (ACPI_COMPANION(dev)) {
> + dev_dbg(dev, "using ACPI for GPIO lookup\n");
> + desc = acpi_find_gpio(dev, con_id, idx, &lookupflags);
> + }
> }
>
> /*
>
> --
> 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
>
> .
>
next prev parent reply other threads:[~2015-03-11 1:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-10 22:07 [PATCH 0/2] gpio / ACPI: Two minor cleanups related to ACPI_HANDLE() Rafael J. Wysocki
2015-03-10 22:08 ` [PATCH 1/2] gpio / ACPI: Avoid unnecessary checks in __gpiod_get_index() Rafael J. Wysocki
2015-03-11 1:36 ` Hanjun Guo [this message]
2015-03-11 1:36 ` Hanjun Guo
2015-03-11 8:43 ` Mika Westerberg
2015-03-18 1:33 ` Linus Walleij
2015-03-10 22:10 ` [PATCH 2/2] gpio / ACPI: Use local variable instead of ACPI_HANDLE() Rafael J. Wysocki
2015-03-11 8:43 ` Mika Westerberg
2015-03-18 1:35 ` Linus Walleij
2015-03-18 1:37 ` [PATCH 0/2] gpio / ACPI: Two minor cleanups related to ACPI_HANDLE() Rafael J. Wysocki
2015-03-18 1:47 ` Alexandre Courbot
2015-03-18 14:37 ` Rafael J. Wysocki
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=54FF9C0F.3060107@huawei.com \
--to=guohanjun@huawei.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rjw@rjwysocki.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.