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>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Wolfram Sang <wsa@kernel.org>,
linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH v2 02/22] i2c: acpi: Modify i2c_acpi_get_irq() to use resource
Date: Thu, 21 Dec 2023 15:51:11 +0200 [thread overview]
Message-ID: <ZYRCz-FiG_w71qhB@smile.fi.intel.com> (raw)
In-Reply-To: <20231220165423.v2.2.Ib65096357993ff602e7dd0000dd59a36571c48d8@changeid>
On Wed, Dec 20, 2023 at 04:54:16PM -0700, Mark Hasemeyer wrote:
> The i2c_acpi_irq_context structure provides redundant information that
> can be provided with struct resource.
>
> Refactor i2c_acpi_get_irq() to use struct resource instead of struct
> i2c_acpi_irq_context.
Suggested-by?
...
> static int i2c_acpi_add_irq_resource(struct acpi_resource *ares, void *data)
> {
> - struct i2c_acpi_irq_context *irq_ctx = data;
> - struct resource r;
> + struct resource *r = data;
> - if (irq_ctx->irq > 0)
> + if (r->start > 0)
> return 1;
Checking flags is more robust.
if (r->flags)
return 1;
> - if (!acpi_dev_resource_interrupt(ares, 0, &r))
> + if (!acpi_dev_resource_interrupt(ares, 0, r))
> return 1;
>
> - irq_ctx->irq = i2c_dev_irq_from_resources(&r, 1);
> - irq_ctx->wake_capable = r.flags & IORESOURCE_IRQ_WAKECAPABLE;
> + i2c_dev_irq_from_resources(r, 1);
>
> return 1; /* No need to add resource to the list */
> }
...
> + if (IS_ERR_OR_NULL(r))
> + return -EINVAL;
Hmm... Do we expect this to be an error pointer in some cases?
...
> + ret = acpi_dev_get_gpio_irq_resource(adev, NULL, 0, r);
> + if (!ret)
> + return r->start;
>
> - return irq_ctx.irq;
> + return ret;
What's wrong with the standard pattern?
if (ret)
return ret;
...
return ...;
...
> + struct resource r = {0};
'0' is redundant.
...
> + irq = i2c_acpi_get_irq(client, &r);
> + if (irq > 0 && r.flags & IORESOURCE_IRQ_WAKECAPABLE)
Why checking just flags is not enough?
> client->flags |= I2C_CLIENT_WAKE;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-12-21 13:51 UTC|newest]
Thread overview: 20+ 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 [this message]
2023-12-20 23:54 ` [PATCH v2 20/22] device property: Modify fwnode irq_get() " 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
[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-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=ZYRCz-FiG_w71qhB@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markhas@chromium.org \
--cc=mika.westerberg@linux.intel.com \
--cc=robh@kernel.org \
--cc=rrangel@chromium.org \
--cc=sudeep.holla@arm.com \
--cc=tzungbi@kernel.org \
--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