Chrome platform driver development
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Mark Hasemeyer <markhas@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Raul Rangel <rrangel@chromium.org>,
	Benson Leung <bleung@chromium.org>,
	Bhanu Prakash Maiya <bhanumaiya@chromium.org>,
	Chen-Yu Tsai <wenst@chromium.org>,
	Guenter Roeck <groeck@chromium.org>, Lee Jones <lee@kernel.org>,
	Prashant Malani <pmalani@chromium.org>,
	Rob Barnes <robbarnes@google.com>,
	Stephen Boyd <swboyd@chromium.org>,
	chrome-platform@lists.linux.dev
Subject: Re: [PATCH v3 24/24] platform/chrome: cros_ec: Use PM subsystem to manage wakeirq
Date: Thu, 28 Dec 2023 10:18:40 +0800	[thread overview]
Message-ID: <ZYzbAIloJ9k28thL@google.com> (raw)
In-Reply-To: <ZYxgQn8L7ENkc0AJ@smile.fi.intel.com>

On Wed, Dec 27, 2023 at 07:34:58PM +0200, Andy Shevchenko wrote:
> On Tue, Dec 26, 2023 at 12:21:28PM -0700, Mark Hasemeyer wrote:
> > -	irq = platform_get_irq_optional(pdev, 0);
> > -	if (irq > 0)
> > +	irq = platform_get_irq_resource_optional(pdev, 0, &irqres);
> > +	if (irq > 0) {
> >  		ec_dev->irq = irq;
> > -	else if (irq != -ENXIO) {
> > +		if (should_force_irq_wake_capable())
> > +			ec_dev->irq_wake = true;
> > +		else
> > +			ec_dev->irq_wake = irqres.flags & IORESOURCE_IRQ_WAKECAPABLE;
> > +	} else if (irq != -ENXIO) {
> >  		dev_err(dev, "couldn't retrieve IRQ number (%d)\n", irq);
> >  		return irq;
> >  	}
> 
> Still I do not like ambiguity behind irq > 0 vs. irqres.start.
> 
> For this, and if needed others, return plain error.
> Seems I gave the tag for the previous patch, consider
> that tag conditional (it seems I missed this).

On a related note, I was confusing a while because of the differences:

platform_get_irq_optional() and platform_get_irq_resource_optional():
Return: non-zero IRQ number on success, negative error number on failure.

acpi_dev_get_gpio_irq_resource():
Return: 0 on success, negative errno on failure.

acpi_dev_gpio_irq_get():
Return: Linux IRQ number (> %0) on success, negative errno on failure.


How about let platform_get_irq_resource_optional():
- Return 0 on success and negative errno on failure.
- The callee needs to retrieve the IRQ number from irqres.start.
?

  parent reply	other threads:[~2023-12-28  2:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-26 19:21 [PATCH v3 00/24] Improve IRQ wake capability reporting and update the cros_ec driver to use it Mark Hasemeyer
2023-12-26 19:21 ` [PATCH v3 24/24] platform/chrome: cros_ec: Use PM subsystem to manage wakeirq Mark Hasemeyer
2023-12-27  6:26   ` Tzung-Bi Shih
2023-12-27 20:45     ` Mark Hasemeyer
2023-12-27 17:34   ` Andy Shevchenko
2023-12-27 21:29     ` Mark Hasemeyer
2023-12-28  2:18     ` Tzung-Bi Shih [this message]
2024-02-14 17:57 ` (subset) [PATCH v3 00/24] Improve IRQ wake capability reporting and update the cros_ec driver to use it Bjorn Andersson
2024-02-16 11:31 ` Thierry Reding

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=ZYzbAIloJ9k28thL@google.com \
    --to=tzungbi@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bhanumaiya@chromium.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markhas@chromium.org \
    --cc=pmalani@chromium.org \
    --cc=robbarnes@google.com \
    --cc=robh@kernel.org \
    --cc=rrangel@chromium.org \
    --cc=sudeep.holla@arm.com \
    --cc=swboyd@chromium.org \
    --cc=wenst@chromium.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