From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Daniel Scally <djrscally@gmail.com>
Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>,
Hans de Goede <hdegoede@redhat.com>,
Maximilian Luz <luzmaximilian@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
linux-i2c <linux-i2c@vger.kernel.org>,
Platform Driver <platform-driver-x86@vger.kernel.org>,
"open list:ACPI COMPONENT ARCHITECTURE (ACPICA)"
<devel@acpica.org>, Len Brown <lenb@kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Wolfram Sang <wsa@kernel.org>,
Mark Gross <mgross@linux.intel.com>,
Robert Moore <robert.moore@intel.com>,
Erik Kaneda <erik.kaneda@intel.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [PATCH v5 2/6] ACPI: scan: Add function to fetch dependent of acpi device
Date: Mon, 7 Jun 2021 16:52:43 +0200 [thread overview]
Message-ID: <CAJZ5v0j8pLo3pjuByYxJue9mr4TOGieYTHm8tghNQgk+LphL=w@mail.gmail.com> (raw)
In-Reply-To: <20210603224007.120560-3-djrscally@gmail.com>
On Fri, Jun 4, 2021 at 12:41 AM Daniel Scally <djrscally@gmail.com> wrote:
>
> In some ACPI tables we encounter, devices use the _DEP method to assert
> a dependence on other ACPI devices as opposed to the OpRegions that the
> specification intends. We need to be able to find those devices "from"
> the dependee, so add a callback and a wrapper to walk over the
> acpi_dep_list and return the dependent ACPI device.
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Daniel Scally <djrscally@gmail.com>
> ---
> Changes since v5:
>
> - Functions renamed
>
> drivers/acpi/scan.c | 35 +++++++++++++++++++++++++++++++++++
> include/acpi/acpi_bus.h | 1 +
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 195635c3462b..9af64c34e286 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -2105,6 +2105,20 @@ static void acpi_bus_attach(struct acpi_device *device, bool first_pass)
> device->handler->hotplug.notify_online(device);
> }
>
> +static int acpi_dev_get_first_consumer_dev_cb(struct acpi_dep_data *dep, void *data)
> +{
> + struct acpi_device *adev;
> +
> + adev = acpi_bus_get_acpi_device(dep->consumer);
> + if (!adev)
> + /* If we don't find an adev then we want to continue parsing */
> + return 0;
> +
> + *(struct acpi_device **)data = adev;
> +
> + return 1;
> +}
> +
> static int acpi_scan_clear_dep(struct acpi_dep_data *dep, void *data)
> {
> struct acpi_device *adev;
> @@ -2168,6 +2182,27 @@ void acpi_dev_clear_dependencies(struct acpi_device *supplier)
> }
> EXPORT_SYMBOL_GPL(acpi_dev_clear_dependencies);
>
> +/**
> + * acpi_dev_get_first_consumer_dev - Return ACPI device dependent on @supplier
> + * @supplier: Pointer to the dependee device
> + *
> + * Returns the first &struct acpi_device which declares itself dependent on
> + * @supplier via the _DEP buffer, parsed from the acpi_dep_list.
> + *
> + * The caller is responsible for putting the reference to adev when it is no
> + * longer needed.
> + */
> +struct acpi_device *acpi_dev_get_first_consumer_dev(struct acpi_device *supplier)
> +{
> + struct acpi_device *adev = NULL;
> +
> + acpi_walk_dep_device_list(supplier->handle,
> + acpi_dev_get_first_consumer_dev_cb, &adev);
> +
> + return adev;
> +}
> +EXPORT_SYMBOL_GPL(acpi_dev_get_first_consumer_dev);
> +
> /**
> * acpi_bus_scan - Add ACPI device node objects in a given namespace scope.
> * @handle: Root of the namespace scope to scan.
> diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> index 0b2c4f170f4d..4bed30e61c5b 100644
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -692,6 +692,7 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
> bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2);
>
> void acpi_dev_clear_dependencies(struct acpi_device *supplier);
> +struct acpi_device *acpi_dev_get_first_consumer_dev(struct acpi_device *supplier);
> struct acpi_device *
> acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const char *uid, s64 hrv);
> struct acpi_device *
> --
Applied as 5.14 material along the [1/6].
I'll expose a branch containing the 2 patches to pull from later this week.
Thanks!
next prev parent reply other threads:[~2021-06-07 14:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-03 22:40 [PATCH v5 0/6] Introduce intel_skl_int3472 module Daniel Scally
2021-06-03 22:40 ` [PATCH v5 1/6] ACPI: scan: Extend acpi_walk_dep_device_list() Daniel Scally
2021-06-03 22:40 ` [PATCH v5 2/6] ACPI: scan: Add function to fetch dependent of acpi device Daniel Scally
2021-06-07 14:52 ` Rafael J. Wysocki [this message]
2021-06-03 22:40 ` [PATCH v5 3/6] gpiolib: acpi: Export acpi_get_gpiod() Daniel Scally
2021-06-04 12:59 ` Andy Shevchenko
2021-06-04 14:09 ` Daniel Scally
2021-06-03 22:40 ` [PATCH v5 4/6] gpiolib: acpi: Add acpi_gpio_get_io_resource() Daniel Scally
2021-06-04 13:01 ` Andy Shevchenko
2021-06-04 14:09 ` Daniel Scally
2021-06-04 14:33 ` Andy Shevchenko
2021-06-04 16:54 ` Daniel Scally
2021-06-03 22:40 ` [PATCH v5 5/6] platform/x86: Add intel_skl_int3472 driver Daniel Scally
2021-06-04 1:31 ` kernel test robot
2021-06-05 23:07 ` Daniel Scally
2021-06-04 6:49 ` kernel test robot
2021-06-16 17:58 ` Hans de Goede
2021-06-16 18:08 ` Andy Shevchenko
2021-06-16 18:13 ` Hans de Goede
2021-06-16 21:42 ` Daniel Scally
2021-06-03 22:40 ` [PATCH v5 6/6] mfd: tps68470: Remove tps68470 MFD driver Daniel Scally
2021-06-17 11:14 ` Hans de Goede
2021-06-08 9:00 ` [PATCH v5 0/6] Introduce intel_skl_int3472 module Hans de Goede
2021-06-08 9:33 ` Laurent Pinchart
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='CAJZ5v0j8pLo3pjuByYxJue9mr4TOGieYTHm8tghNQgk+LphL=w@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=devel@acpica.org \
--cc=djrscally@gmail.com \
--cc=erik.kaneda@intel.com \
--cc=hdegoede@redhat.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=lee.jones@linaro.org \
--cc=lenb@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luzmaximilian@gmail.com \
--cc=mgross@linux.intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
--cc=wsa@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;
as well as URLs for NNTP newsgroup(s).