All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Jiang Liu <liuj97@gmail.com>
Cc: "Rafael J . Wysocki" <rjw@sisk.pl>,
	Jiang Liu <jiang.liu@huawei.com>,
	Yijing Wang <wangyijing@huawei.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Yinghai Lu <yinghai@kernel.org>, Len Brown <lenb@kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH v3 10/10] ACPI: simplify acpiphp driver with new helper functions
Date: Fri, 28 Jun 2013 11:20:21 -0600	[thread overview]
Message-ID: <CAErSpo7DTioqp_atjr5NLfGk=afqgbdt=ZZerSzV=EJeR1WwLA@mail.gmail.com> (raw)
In-Reply-To: <1372436683-31711-11-git-send-email-liuj97@gmail.com>

On Fri, Jun 28, 2013 at 10:24 AM, Jiang Liu <liuj97@gmail.com> wrote:
> From: Jiang Liu <jiang.liu@huawei.com>
>
> Use new helper functions to simplify acpiphp driver.
>
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

I assume this will be merged via linux-pm with the rest of the series.

> Cc: Jiang Liu <liuj97@gmail.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Yinghai Lu <yinghai@kernel.org>
> Cc: Len Brown <lenb@kernel.org>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Cc: Yijing Wang <wangyijing@huawei.com>
> Cc: linux-acpi@vger.kernel.org
> Cc: linux-pci@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/pci/hotplug/acpiphp_glue.c | 30 ++++++++----------------------
>  1 file changed, 8 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
> index 59df857..a0a7133 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -201,7 +201,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
>         struct acpiphp_bridge *bridge = (struct acpiphp_bridge *)context;
>         struct acpiphp_slot *slot;
>         struct acpiphp_func *newfunc;
> -       acpi_handle tmp;
>         acpi_status status = AE_OK;
>         unsigned long long adr, sun;
>         int device, function, retval, found = 0;
> @@ -232,19 +231,19 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
>         newfunc->handle = handle;
>         newfunc->function = function;
>
> -       if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp)))
> +       if (acpi_has_method(handle, "_EJ0"))
>                 newfunc->flags = FUNC_HAS_EJ0;
>
> -       if (ACPI_SUCCESS(acpi_get_handle(handle, "_STA", &tmp)))
> +       if (acpi_has_method(handle, "_STA"))
>                 newfunc->flags |= FUNC_HAS_STA;
>
> -       if (ACPI_SUCCESS(acpi_get_handle(handle, "_PS0", &tmp)))
> +       if (acpi_has_method(handle, "_PS0"))
>                 newfunc->flags |= FUNC_HAS_PS0;
>
> -       if (ACPI_SUCCESS(acpi_get_handle(handle, "_PS3", &tmp)))
> +       if (acpi_has_method(handle, "_PS3"))
>                 newfunc->flags |= FUNC_HAS_PS3;
>
> -       if (ACPI_SUCCESS(acpi_get_handle(handle, "_DCK", &tmp)))
> +       if (acpi_has_method(handle, "_DCK"))
>                 newfunc->flags |= FUNC_HAS_DCK;
>
>         status = acpi_evaluate_integer(handle, "_SUN", NULL, &sun);
> @@ -843,25 +842,14 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
>   */
>  int acpiphp_eject_slot(struct acpiphp_slot *slot)
>  {
> -       acpi_status status;
>         struct acpiphp_func *func;
> -       struct acpi_object_list arg_list;
> -       union acpi_object arg;
>
>         list_for_each_entry(func, &slot->funcs, sibling) {
>                 /* We don't want to call _EJ0 on non-existing functions. */
>                 if ((func->flags & FUNC_HAS_EJ0)) {
> -                       /* _EJ0 method take one argument */
> -                       arg_list.count = 1;
> -                       arg_list.pointer = &arg;
> -                       arg.type = ACPI_TYPE_INTEGER;
> -                       arg.integer.value = 1;
> -
> -                       status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL);
> -                       if (ACPI_FAILURE(status)) {
> -                               warn("%s: _EJ0 failed\n", __func__);
> +                       if (ACPI_FAILURE(acpi_evaluate_ej0(func->handle)))
>                                 return -1;
> -                       } else
> +                       else
>                                 break;
>                 }
>         }
> @@ -1171,7 +1159,6 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type,
>   */
>  void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle)
>  {
> -       acpi_handle dummy_handle;
>         struct acpiphp_bridge *bridge;
>
>         if (acpiphp_disabled)
> @@ -1200,8 +1187,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle)
>         get_device(&bus->dev);
>
>         if (!pci_is_root_bus(bridge->pci_bus) &&
> -           ACPI_SUCCESS(acpi_get_handle(bridge->handle,
> -                                       "_EJ0", &dummy_handle))) {
> +           acpi_has_method(bridge->handle, "_EJ0")) {
>                 dbg("found ejectable p2p bridge\n");
>                 bridge->flags |= BRIDGE_HAS_EJ0;
>                 bridge->func = acpiphp_bridge_handle_to_function(handle);
> --
> 1.8.1.2
>

  reply	other threads:[~2013-06-28 17:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 16:24 [PATCH v3 00/10] minor improvements for ACPI dock and acpiphp drivers Jiang Liu
2013-06-28 16:24 ` [PATCH v3 01/10] ACPI, DOCK: avoid initializing acpi_dock_notifier_list multiple times Jiang Liu
2013-06-28 16:24 ` [PATCH v3 02/10] ACPI, DOCK: kill redundant spin lock in dock station object Jiang Liu
2013-06-28 16:24 ` [PATCH v3 03/10] ACPI, DOCK: mark initialization functions with __init Jiang Liu
2013-06-28 16:24 ` [PATCH v3 04/10] ACPI, DOCK: simplify implementation of dock_create_acpi_device() Jiang Liu
2013-06-28 16:24 ` [PATCH v3 05/10] ACPI: introduce helper function acpi_has_method() Jiang Liu
2013-06-28 16:24 ` [PATCH v3 06/10] ACPI: introduce helper function acpi_execute_simple_method() Jiang Liu
2013-06-28 16:24 ` [PATCH v3 07/10] ACPI: introduce two helper functions to simplify code Jiang Liu
2013-06-28 16:24 ` [PATCH v3 08/10] ACPI: change acpi_[bay|dock]_match() in scan.c as global functions Jiang Liu
2013-06-28 16:24 ` [PATCH v3 09/10] ACPI: simplify dock driver with new helper functions Jiang Liu
2013-06-28 16:24 ` [PATCH v3 10/10] ACPI: simplify acpiphp " Jiang Liu
2013-06-28 17:20   ` Bjorn Helgaas [this message]
2013-06-28 18:42     ` Rafael J. Wysocki
2013-06-28 18:42 ` [PATCH v3 00/10] minor improvements for ACPI dock and acpiphp drivers 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='CAErSpo7DTioqp_atjr5NLfGk=afqgbdt=ZZerSzV=EJeR1WwLA@mail.gmail.com' \
    --to=bhelgaas@google.com \
    --cc=jiang.liu@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liuj97@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=wangyijing@huawei.com \
    --cc=yinghai@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 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.