From: Yinghai Lu <yinghai@kernel.org>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>, Jiang Liu <liuj97@gmail.com>,
"Alexander E. Patrakov" <patrakov@gmail.com>
Subject: Re: [PATCH 2/4] ACPI / dock: Rework and simplify find_dock_devices()
Date: Fri, 28 Jun 2013 13:08:14 -0700 [thread overview]
Message-ID: <CAE9FiQVikZHs1BXLM9v-aAK-N4Ub4Rv-xHvq-r+82FakDK4JPw@mail.gmail.com> (raw)
In-Reply-To: <1872152.oRKhS5XAuA@vostro.rjw.lan>
On Fri, Jun 28, 2013 at 12:46 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Since acpi_walk_namespace() calls find_dock_devices() during tree
> pre-order visit, the latter doesn't need to add devices whose
> parents have _EJD pointing to the docking station to the list of
> that station's dependent devices, because those parents are going to
> be added to that list anyway and the removal of a parent will take
> care of the removal of its children in those cases.
>
> For this reason, rework find_dock_devices() to only call
> add_dock_dependent_device() for devices whose _EJD point directy to
> the docking station represented by its context argument and simplify
> it slightly.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
> ---
> drivers/acpi/dock.c | 19 +++----------------
> 1 file changed, 3 insertions(+), 16 deletions(-)
>
> Index: linux-pm/drivers/acpi/dock.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/dock.c
> +++ linux-pm/drivers/acpi/dock.c
> @@ -855,26 +855,13 @@ static struct notifier_block dock_acpi_n
> static acpi_status
> find_dock_devices(acpi_handle handle, u32 lvl, void *context, void **rv)
> {
> - acpi_status status;
> - acpi_handle tmp, parent;
> struct dock_station *ds = context;
> + acpi_handle ejd = NULL;
>
> - status = acpi_bus_get_ejd(handle, &tmp);
> - if (ACPI_FAILURE(status)) {
> - /* try the parent device as well */
> - status = acpi_get_parent(handle, &parent);
> - if (ACPI_FAILURE(status))
> - goto fdd_out;
> - /* see if parent is dependent on dock */
> - status = acpi_bus_get_ejd(parent, &tmp);
> - if (ACPI_FAILURE(status))
> - goto fdd_out;
> - }
> -
> - if (tmp == ds->handle)
> + acpi_bus_get_ejd(handle, &ejd);
> + if (ejd == ds->handle)
> add_dock_dependent_device(ds, handle);
>
> -fdd_out:
> return AE_OK;
> }
>
>
next prev parent reply other threads:[~2013-06-28 20:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 19:44 [PATCH 0/4] ACPI / dock: Cleanups and simplifications Rafael J. Wysocki
2013-06-28 19:45 ` [PATCH 1/4] ACPI / dock: Drop the hp_lock mutex from struct dock_station Rafael J. Wysocki
2013-06-28 19:46 ` [PATCH 2/4] ACPI / dock: Rework and simplify find_dock_devices() Rafael J. Wysocki
2013-06-28 20:08 ` Yinghai Lu [this message]
2013-06-28 19:47 ` [PATCH 3/4] ACPI / dock: Walk list in reverse order during removal of devices Rafael J. Wysocki
2013-06-28 20:14 ` Yinghai Lu
2013-06-28 19:48 ` [PATCH 4/4] ACPI / dock: Simplify dock_init_hotplug() and dock_release_hotplug() Rafael J. Wysocki
2013-06-28 20:16 ` Yinghai Lu
2013-06-28 22:47 ` [PATCH 0/3] ACPI / dock: Notification rework and memory leak fix Rafael J. Wysocki
2013-06-28 22:53 ` [PATCH 1/3] ACPI / dock: Rework the handling of notifications Rafael J. Wysocki
2013-06-28 23:34 ` Yinghai Lu
2013-06-29 11:16 ` Rafael J. Wysocki
2013-06-29 16:12 ` Yinghai Lu
2013-06-30 14:18 ` Rafael J. Wysocki
2013-07-01 20:21 ` Bjorn Helgaas
2013-07-02 1:28 ` Rafael J. Wysocki
2013-06-28 22:54 ` [PATCH 2/3] ACPI: Drop ACPI bus notifier call chain Rafael J. Wysocki
2013-06-28 22:54 ` [PATCH 3/3] ACPI / dock: Do not leak memory on falilures to add a dock station Rafael J. Wysocki
2013-07-03 23:23 ` [PATCH 0/4] ACPI / dock: One fix and more cleanups Rafael J. Wysocki
2013-07-03 23:25 ` [PATCH 1/4] ACPI / dock: Actually define acpi_dock_init() as void Rafael J. Wysocki
2013-07-03 23:26 ` [PATCH 2/4] ACPI / dock: Do not check CONFIG_ACPI_DOCK_MODULE Rafael J. Wysocki
2013-07-03 23:27 ` [PATCH 3/4] ACPI / dock / PCI: Drop ACPI dock notifier chain Rafael J. Wysocki
2013-07-03 23:28 ` [PATCH 4/4] ACPI / dock: Drop unnecessary local variable from dock_add() 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=CAE9FiQVikZHs1BXLM9v-aAK-N4Ub4Rv-xHvq-r+82FakDK4JPw@mail.gmail.com \
--to=yinghai@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuj97@gmail.com \
--cc=patrakov@gmail.com \
--cc=rjw@sisk.pl \
/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;
as well as URLs for NNTP newsgroup(s).