From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Mark Hasemeyer <markhas@chromium.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Tzung-Bi Shih <tzungbi@kernel.org>,
Raul Rangel <rrangel@chromium.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Andy Shevchenko <andriy.shevchenko@intel.com>,
Rob Herring <robh@kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Daniel Scally <djrscally@gmail.com>,
Frank Rowand <frowand.list@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Len Brown <lenb@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH v2 20/22] device property: Modify fwnode irq_get() to use resource
Date: Thu, 21 Dec 2023 10:37:40 +0000 [thread overview]
Message-ID: <ZYQVdE4esAZbtMrn@kekkonen.localdomain> (raw)
In-Reply-To: <20231220165423.v2.20.I38ac58ab04985a404ed6551eb5813fa7841ef410@changeid>
Hi Mark,
Thank you for the patch.
On Wed, Dec 20, 2023 at 04:54:34PM -0700, Mark Hasemeyer wrote:
> The underlying ACPI and OF subsystems provide their own APIs which
> provide IRQ information as a struct resource. This allows callers to get
> more information about the IRQ by looking at the resource flags. For
> example, whether or not an IRQ is wake capable.
>
> Signed-off-by: Mark Hasemeyer <markhas@chromium.org>
> ---
>
> Changes in v2:
> -New patch
>
> drivers/acpi/property.c | 11 +++++------
> drivers/base/property.c | 24 +++++++++++++++++++++---
> drivers/of/property.c | 8 ++++----
> include/linux/fwnode.h | 8 +++++---
> include/linux/property.h | 2 ++
> 5 files changed, 37 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index a6ead5204046b..259869987ffff 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -1627,17 +1627,16 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
> return 0;
> }
>
> -static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode,
> - unsigned int index)
> +static int acpi_fwnode_irq_get_resource(const struct fwnode_handle *fwnode,
> + unsigned int index, struct resource *r)
> {
> - struct resource res;
> int ret;
>
> - ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
> + ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, r);
> if (ret)
> return ret;
>
> - return res.start;
> + return r->start;
> }
>
> #define DECLARE_ACPI_FWNODE_OPS(ops) \
> @@ -1664,7 +1663,7 @@ static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode,
> acpi_graph_get_remote_endpoint, \
> .graph_get_port_parent = acpi_fwnode_get_parent, \
> .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \
> - .irq_get = acpi_fwnode_irq_get, \
> + .irq_get_resource = acpi_fwnode_irq_get_resource, \
> }; \
> EXPORT_SYMBOL_GPL(ops)
>
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index a1b01ab420528..4f5d5ab5ab8cf 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -1047,23 +1047,41 @@ void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
> EXPORT_SYMBOL(fwnode_iomap);
>
> /**
> - * fwnode_irq_get - Get IRQ directly from a fwnode
> + * fwnode_irq_get_resource - Get IRQ directly from a fwnode and populate
> + * the resource struct
> * @fwnode: Pointer to the firmware node
> * @index: Zero-based index of the IRQ
> + * @r: Pointer to resource to populate with IRQ information.
> *
> * Return: Linux IRQ number on success. Negative errno on failure.
> */
> -int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
> +int fwnode_irq_get_resource(const struct fwnode_handle *fwnode,
> + unsigned int index, struct resource *r)
> {
> int ret;
>
> - ret = fwnode_call_int_op(fwnode, irq_get, index);
> + ret = fwnode_call_int_op(fwnode, irq_get_resource, index, r);
> /* We treat mapping errors as invalid case */
> if (ret == 0)
> return -EINVAL;
>
> return ret;
> }
> +EXPORT_SYMBOL(fwnode_irq_get_resource);
Both acpi_irq_get() and of_irq_to_resourece() use EXPORT_SYMBOL_GPL()
instead. I don't see why fwnode_irq_get_resource() shouldn't do the same.
With this changed,
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
In fact this should have always been the case for fwnode_irq_get(). I
wouldn't mind changing that, too, in a separate patch.
> +
> +/**
> + * fwnode_irq_get - Get IRQ directly from a fwnode
> + * @fwnode: Pointer to the firmware node
> + * @index: Zero-based index of the IRQ
> + *
> + * Return: Linux IRQ number on success. Negative errno on failure.
> + */
> +int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
> +{
> + struct resource r;
> +
> + return fwnode_irq_get_resource(fwnode, index, &r);
> +}
> EXPORT_SYMBOL(fwnode_irq_get);
>
> /**
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index afdaefbd03f61..864ea5fa5702b 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1425,10 +1425,10 @@ static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index)
> #endif
> }
>
> -static int of_fwnode_irq_get(const struct fwnode_handle *fwnode,
> - unsigned int index)
> +static int of_fwnode_irq_get_resource(const struct fwnode_handle *fwnode,
> + unsigned int index, struct resource *r)
> {
> - return of_irq_get(to_of_node(fwnode), index);
> + return of_irq_to_resource(to_of_node(fwnode), index, r);
> }
>
> static int of_fwnode_add_links(struct fwnode_handle *fwnode)
> @@ -1469,7 +1469,7 @@ const struct fwnode_operations of_fwnode_ops = {
> .graph_get_port_parent = of_fwnode_graph_get_port_parent,
> .graph_parse_endpoint = of_fwnode_graph_parse_endpoint,
> .iomap = of_fwnode_iomap,
> - .irq_get = of_fwnode_irq_get,
> + .irq_get_resource = of_fwnode_irq_get_resource,
> .add_links = of_fwnode_add_links,
> };
> EXPORT_SYMBOL_GPL(of_fwnode_ops);
> diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
> index 2a72f55d26eb8..716ed863acde0 100644
> --- a/include/linux/fwnode.h
> +++ b/include/linux/fwnode.h
> @@ -9,10 +9,11 @@
> #ifndef _LINUX_FWNODE_H_
> #define _LINUX_FWNODE_H_
>
> -#include <linux/types.h>
> -#include <linux/list.h>
> #include <linux/bits.h>
> #include <linux/err.h>
> +#include <linux/ioport.h>
> +#include <linux/list.h>
> +#include <linux/types.h>
>
> struct fwnode_operations;
> struct device;
> @@ -164,7 +165,8 @@ struct fwnode_operations {
> int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
> struct fwnode_endpoint *endpoint);
> void __iomem *(*iomap)(struct fwnode_handle *fwnode, int index);
> - int (*irq_get)(const struct fwnode_handle *fwnode, unsigned int index);
> + int (*irq_get_resource)(const struct fwnode_handle *fwnode,
> + unsigned int index, struct resource *r);
> int (*add_links)(struct fwnode_handle *fwnode);
> };
>
> diff --git a/include/linux/property.h b/include/linux/property.h
> index e6516d0b7d52a..685ba72a8ce9e 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -190,6 +190,8 @@ struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode);
> void fwnode_handle_put(struct fwnode_handle *fwnode);
>
> int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index);
> +int fwnode_irq_get_resource(const struct fwnode_handle *fwnode,
> + unsigned int index, struct resource *r);
> int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name);
>
> unsigned int device_get_child_node_count(const struct device *dev);
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2023-12-21 10:38 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-20 23:54 [PATCH v2 00/22] Improve IRQ wake capability reporting and update the cros_ec driver to use it Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 01/22] gpiolib: acpi: Modify acpi_dev_irq_wake_get_by() to use resource Mark Hasemeyer
2023-12-21 15:17 ` Andy Shevchenko
2023-12-23 2:05 ` kernel test robot
2023-12-23 3:09 ` Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 02/22] i2c: acpi: Modify i2c_acpi_get_irq() " Mark Hasemeyer
2023-12-21 13:51 ` Andy Shevchenko
2023-12-20 23:54 ` [PATCH v2 03/22] Documentation: devicetree: Clarify wording for wakeup-source property Mark Hasemeyer
2023-12-21 8:13 ` Krzysztof Kozlowski
2023-12-21 18:16 ` Mark Hasemeyer
2023-12-21 18:42 ` Krzysztof Kozlowski
2023-12-20 23:54 ` [PATCH v2 04/22] ARM: dts: tegra: Enable cros-ec-spi as wake source Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 05/22] ARM: dts: rockchip: rk3288: " Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 06/22] ARM: dts: samsung: exynos5420: " Mark Hasemeyer
2023-12-21 8:14 ` Krzysztof Kozlowski
2023-12-21 18:29 ` Mark Hasemeyer
2023-12-21 18:38 ` Krzysztof Kozlowski
2023-12-21 19:24 ` Mark Hasemeyer
2023-12-21 20:34 ` Krzysztof Kozlowski
2024-01-22 11:15 ` (subset) " Krzysztof Kozlowski
2023-12-20 23:54 ` [PATCH v2 07/22] ARM: dts: samsung: exynos5800: " Mark Hasemeyer
2024-01-22 11:15 ` (subset) " Krzysztof Kozlowski
2023-12-20 23:54 ` [PATCH v2 08/22] arm64: dts: mediatek: mt8173: " Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 09/22] arm64: dts: mediatek: mt8183: " Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 10/22] arm64: dts: mediatek: mt8192: " Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 11/22] arm64: dts: mediatek: mt8195: " Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 12/22] arm64: dts: tegra: " Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 13/22] arm64: dts: qcom: sc7180: " Mark Hasemeyer
2023-12-21 0:10 ` Doug Anderson
2023-12-20 23:54 ` [PATCH v2 14/22] arm64: dts: qcom: sc7280: " Mark Hasemeyer
2023-12-21 0:10 ` Doug Anderson
2023-12-20 23:54 ` [PATCH v2 15/22] arm64: dts: qcom: sdm845: " Mark Hasemeyer
2023-12-21 0:11 ` Doug Anderson
2023-12-20 23:54 ` [PATCH v2 16/22] arm64: dts: rockchip: rk3399: " Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 17/22] of: irq: add wake capable bit to of_irq_resource() Mark Hasemeyer
2023-12-21 15:25 ` Andy Shevchenko
2023-12-22 22:22 ` Mark Hasemeyer
2023-12-21 20:44 ` Rob Herring
2023-12-20 23:54 ` [PATCH v2 18/22] of: irq: Add default implementation for of_irq_to_resource() Mark Hasemeyer
2023-12-21 20:48 ` Rob Herring
2023-12-20 23:54 ` [PATCH v2 19/22] of: irq: Remove extern from function declarations Mark Hasemeyer
2023-12-21 20:49 ` Rob Herring
2023-12-20 23:54 ` [PATCH v2 20/22] device property: Modify fwnode irq_get() to use resource Mark Hasemeyer
2023-12-21 10:37 ` Sakari Ailus [this message]
2023-12-21 23:52 ` Mark Hasemeyer
2023-12-22 12:48 ` Andy Shevchenko
2023-12-21 13:56 ` Andy Shevchenko
2023-12-21 23:46 ` Mark Hasemeyer
[not found] ` <CAHQZ30BOA7zuRrN-kK5Qw+NYSVydfhJ0gDPr9q-U+7VKXHzG8g@mail.gmail.com>
2023-12-21 23:59 ` Mark Hasemeyer
2023-12-22 12:46 ` Andy Shevchenko
2023-12-22 12:46 ` Andy Shevchenko
2023-12-22 12:44 ` Andy Shevchenko
2023-12-20 23:54 ` [PATCH v2 21/22] platform: Modify platform_get_irq_optional() " Mark Hasemeyer
2023-12-21 15:33 ` Andy Shevchenko
2023-12-22 21:51 ` Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 22/22] platform/chrome: cros_ec: Use PM subsystem to manage wakeirq Mark Hasemeyer
2023-12-21 8:58 ` Tzung-Bi Shih
2023-12-22 22:19 ` Mark Hasemeyer
2023-12-21 15:45 ` Andy Shevchenko
2023-12-22 22:21 ` Mark Hasemeyer
2023-12-23 0:32 ` kernel test robot
2023-12-23 3:11 ` Mark Hasemeyer
2023-12-23 16:41 ` kernel test robot
2023-12-21 13:42 ` [PATCH v2 00/22] Improve IRQ wake capability reporting and update the cros_ec driver to use it Andy Shevchenko
2023-12-22 22:30 ` Mark Hasemeyer
2023-12-27 16:01 ` Andy Shevchenko
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=ZYQVdE4esAZbtMrn@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=andriy.shevchenko@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=devicetree@vger.kernel.org \
--cc=djrscally@gmail.com \
--cc=frowand.list@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markhas@chromium.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=robh@kernel.org \
--cc=rrangel@chromium.org \
--cc=sudeep.holla@arm.com \
--cc=tzungbi@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
all inboxes | Powered by JetHome®