From: Andy Shevchenko <andriy.shevchenko@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>,
"Rob Herring" <robh@kernel.org>,
"Sudeep Holla" <sudeep.holla@arm.com>,
"David Gow" <davidgow@google.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Mark Brown" <broonie@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Takashi Iwai" <tiwai@suse.de>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH v2 21/22] platform: Modify platform_get_irq_optional() to use resource
Date: Thu, 21 Dec 2023 17:33:20 +0200 [thread overview]
Message-ID: <ZYRawMwhtimA-rkD@smile.fi.intel.com> (raw)
In-Reply-To: <20231220165423.v2.21.Ife9ebad2bbfbab3a05e90040f344d750aa0aac7e@changeid>
On Wed, Dec 20, 2023 at 04:54:35PM -0700, Mark Hasemeyer wrote:
> Unify handling of ACPI, GPIO, devictree, and platform resource
> interrupts in platform_get_irq_optional(). Each of these subsystems
> provide their own APIs which provide IRQ information as a struct
> resource. This simplifies the logic of the function and 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.
...
> * For example::
> *
> - * int irq = platform_get_irq_optional(pdev, 0);
> + * int irq = platform_get_irq_resource_optional(pdev, 0, &res);
> * if (irq < 0)
> * return irq;
> *
> * Return: non-zero IRQ number on success, negative error number on failure.
Why do we need the irq to be returned via error code?
...
> int ret;
Missing blank line, have you run checkpatch.pl?
> + if (IS_ERR_OR_NULL(r))
> + return -EINVAL;
If we ever have an error pointer in r, I prefer to see
if (!r)
return -EINVAL;
if (IS_ERR(r))
return PTR_ERR(r);
But Q is the same as earlier: when would we have the error pointer in @r?
...
> + platform_res = platform_get_resource(dev, IORESOURCE_IRQ, num);
I would move this closer to the condition...
> /*
> * The resources may pass trigger flags to the irqs that need
> * to be set up. It so happens that the trigger flags for
> * IORESOURCE_BITS correspond 1-to-1 to the IRQF_TRIGGER*
> * settings.
> */
...i.e. here.
> - if (r && r->flags & IORESOURCE_BITS) {
> + if (platform_res && platform_res->flags & IORESOURCE_BITS) {
> }
...
> if (num == 0 && is_acpi_device_node(fwnode)) {
> - ret = acpi_dev_gpio_irq_get(to_acpi_device_node(fwnode), num);
> + ret = acpi_dev_get_gpio_irq_resource(to_acpi_device_node(fwnode), NULL, num, r);
> /* Our callers expect -ENXIO for missing IRQs. */
> - if (ret >= 0 || ret == -EPROBE_DEFER)
> + if (!ret || ret == -EPROBE_DEFER) {
Can we save this and be consistent with above fwnode API return code check?
> + ret = ret ?: r->start;
> goto out;
> + }
> }
...
> -EXPORT_SYMBOL_GPL(platform_get_irq_optional);
> +EXPORT_SYMBOL_GPL(platform_get_irq_resource_optional);
> +
Stray blank line change.
...
> EXPORT_SYMBOL_GPL(platform_get_irq);
>
> +
Ditto.
...
> +int platform_get_irq_optional(struct platform_device *dev, unsigned int num)
> +{
> + struct resource r;
struct resource r = {};
?
> + return platform_get_irq_resource_optional(dev, num, &r);
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-12-21 15:33 UTC|newest]
Thread overview: 90+ 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 ` 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 ` Mark Hasemeyer
2023-12-20 23:54 ` Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 06/22] ARM: dts: samsung: exynos5420: " Mark Hasemeyer
2023-12-20 23:54 ` Mark Hasemeyer
2023-12-21 8:14 ` Krzysztof Kozlowski
2023-12-21 8:14 ` Krzysztof Kozlowski
2023-12-21 18:29 ` Mark Hasemeyer
2023-12-21 18:29 ` Mark Hasemeyer
2023-12-21 18:38 ` Krzysztof Kozlowski
2023-12-21 18:38 ` Krzysztof Kozlowski
2023-12-21 19:24 ` Mark Hasemeyer
2023-12-21 19:24 ` Mark Hasemeyer
2023-12-21 20:34 ` Krzysztof Kozlowski
2023-12-21 20:34 ` Krzysztof Kozlowski
2024-01-22 11:15 ` (subset) " Krzysztof Kozlowski
2024-01-22 11:15 ` Krzysztof Kozlowski
2023-12-20 23:54 ` [PATCH v2 07/22] ARM: dts: samsung: exynos5800: " Mark Hasemeyer
2023-12-20 23:54 ` Mark Hasemeyer
2024-01-22 11:15 ` (subset) " Krzysztof Kozlowski
2024-01-22 11:15 ` Krzysztof Kozlowski
2023-12-20 23:54 ` [PATCH v2 08/22] arm64: dts: mediatek: mt8173: " Mark Hasemeyer
2023-12-20 23:54 ` Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 09/22] arm64: dts: mediatek: mt8183: " Mark Hasemeyer
2023-12-20 23:54 ` Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 10/22] arm64: dts: mediatek: mt8192: " Mark Hasemeyer
2023-12-20 23:54 ` Mark Hasemeyer
2023-12-20 23:54 ` [PATCH v2 11/22] arm64: dts: mediatek: mt8195: " Mark Hasemeyer
2023-12-20 23:54 ` 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 ` Mark Hasemeyer
2023-12-20 23:54 ` 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
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
2023-12-22 12:44 ` Andy Shevchenko
[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-20 23:54 ` [PATCH v2 21/22] platform: Modify platform_get_irq_optional() " Mark Hasemeyer
2023-12-21 15:33 ` Andy Shevchenko [this message]
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-21 13:42 ` Andy Shevchenko
2023-12-21 13:42 ` Andy Shevchenko
2023-12-22 22:30 ` Mark Hasemeyer
2023-12-22 22:30 ` Mark Hasemeyer
2023-12-22 22:30 ` Mark Hasemeyer
2023-12-27 16:01 ` Andy Shevchenko
2023-12-27 16:01 ` Andy Shevchenko
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=ZYRawMwhtimA-rkD@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=davidgow@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markhas@chromium.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rrangel@chromium.org \
--cc=sudeep.holla@arm.com \
--cc=tiwai@suse.de \
--cc=tzungbi@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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.