mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akhil R <akhilrajeev@nvidia.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Christian Koenig <christian.koenig@amd.com>,
	Dmitry Osipenko <digetx@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-tegra <linux-tegra@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Wolfram Sang <wsa@kernel.org>, Len Brown <lenb@kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Subject: RE: [PATCH v2 3/3] i2c: smbus: Use device_*() functions instead of of_*()
Date: Thu, 20 Jan 2022 10:29:10 +0000	[thread overview]
Message-ID: <DM5PR12MB185098D36F665AC5702D47DDC05A9@DM5PR12MB1850.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CAHp75VfVJo=8FPX_Pw15X5B3awFXpuEq+=LryxB6M4Ub-YJ7uA@mail.gmail.com>

> ...
> 
> > > This change reveals potential issue:
> > >
> > > > -               irq = of_irq_get_byname(adapter->dev.of_node, "smbus_alert");
> > > > +               irq = device_irq_get_byname(adapter->dev.parent,
> "smbus_alert");
> > >
> > > >                 if (irq <= 0)
> > >
> > > I guess this '= 0' part should be fixed first.
> >
> > '0' is a failure as per the documentation of of_irq_get_byname() as well as
> > of_irq_get(). The case is different for acpi_irq_get(), but it is handled in
> > fwnode_irq_get(). If I understood it right, a return value of '0' should be
> > considered a failure here.
> 
> Depends. I have no idea what the original code does here. But
> returning an error or 0 from this function seems confusing to me.
> 
The description in of_irq_get*() says - 
/* Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or
 * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case
 * of any other failure.
 */
As I see from the code of fwnode_irq_get(), which is used in this case, returns 
either the return value of of_irq_get() or error code from acpi_irq_get() when
it fails, or res.start if it didn't fail. I guess, any of these would not be 0 unless
there is an error.

Thanks,
Akhil

 

  reply	other threads:[~2022-01-20 10:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 14:14 [PATCH v2 0/3] Enable named interrupt smbus-alert for ACPI Akhil R
2022-01-12 14:14 ` [PATCH v2 1/3] device property: Add device_irq_get_byname Akhil R
2022-01-12 15:53   ` Andy Shevchenko
2022-01-12 16:13   ` Rafael J. Wysocki
2022-01-13  4:41     ` Akhil R
2022-01-12 14:14 ` [PATCH v2 2/3] docs: firmware-guide: ACPI: Add named interrupt doc Akhil R
2022-01-12 15:48   ` Andy Shevchenko
2022-01-12 14:14 ` [PATCH v2 3/3] i2c: smbus: Use device_*() functions instead of of_*() Akhil R
2022-01-12 15:41   ` Andy Shevchenko
2022-01-20  9:48     ` Akhil R
2022-01-20 10:12       ` Andy Shevchenko
2022-01-20 10:29         ` Akhil R [this message]
2022-01-20 10:43           ` Andy Shevchenko
2022-01-20 11:30             ` Akhil R
2022-01-20 11:30             ` Uwe Kleine-König
2022-01-12 15:55 ` [PATCH v2 0/3] Enable named interrupt smbus-alert for ACPI 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=DM5PR12MB185098D36F665AC5702D47DDC05A9@DM5PR12MB1850.namprd12.prod.outlook.com \
    --to=akhilrajeev@nvidia.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=digetx@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=thierry.reding@gmail.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

all inboxes | Powered by JetHome®