All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akhil R <akhilrajeev@nvidia.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Wolfram Sang <wsa@kernel.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Christian Koenig <christian.koenig@amd.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Dmitry Osipenko <digetx@gmail.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@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>,
	Krishna Yarlagadda <kyarlagadda@nvidia.com>,
	Suresh Mangipudi <smangipudi@nvidia.com>
Subject: RE: [PATCH 2/2] i2c: smbus: Use device_ functions instead of of_
Date: Fri, 17 Dec 2021 05:31:48 +0000	[thread overview]
Message-ID: <BN9PR12MB52736B1658C0B13526728119C0789@BN9PR12MB5273.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CAHp75VfQpgWhKXM=1oRg8d_ntZvxkSArQv=6eaq7tyU6-KvJjg@mail.gmail.com>

> On Thu, Dec 16, 2021 at 6:08 PM Akhil R <akhilrajeev@nvidia.com> wrote:
> > > On Thu, Dec 16, 2021 at 3:14 PM Akhil R <akhilrajeev@nvidia.com> wrote:
> 
> ...
> 
> > > > -       irq = of_property_match_string(adapter->dev.of_node, "interrupt-
> > > names",
> > > > -                                      "smbus_alert");
> > > > +       irq = device_property_match_string(adapter->dev.parent,
> > > > + "interrupt-
> > > names",
> > > > +                                          "smbus_alert");
> > >
> > > Hmm... Adapter device node is not the same as the node for its parent.
> > > Do you have some code that propagates of_node from parent to child?
> > Adapter device does not have an of_node unless the adapter driver sets
> > it, I guess. I see all the adapter drivers add the of_node and parent
> > for adapter. Also, there are many places in i2c-core-base and
> > i2c-core-acpi where adapter->dev.parent is referred to as the adapter
> > driver device.
> >
> > Basically, adapter->dev.parent and adapter->dev.of_node would
> > ultimately refer to the same device (or the of_node of that device),
> > as far as I understand.
> > >
> > > I.o.w. I would expect to see
> > >
> > >        irq = device_property_match_string(&adapter->dev,
> > > "interrupt-names",
> > >
> > > here.
> > It would then require adding the fw_node as well from the adapter driver.
> > I felt it made more sense to refer adapter->dev.parent here as most of
> > the (or rather all of the) adapter drivers already sets it.
> 
> Is this
> https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L1047
>
> what you are looking for?
This, I suppose, is for the i2c client driver.
I meant the individual adapter drivers.
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/busses/i2c-tegra.c#L1786
similar is there in all drivers.
If to use adapter->dev for interrupt-names, I assume, it would require to add

	adapter->dev.fwnode = i2c_dev->dev->fwnode;

in all drivers (or at least in the drivers which does not use devicetree).
I thought it would be decent to use adapter->dev.parent as all the drivers already
set it.

> 
> ...
> 
> > > >         if (irq == -EINVAL || irq == -ENODATA)
> > > >                 return 0;
> > > >         else if (irq < 0)
> > >
> > > TBH the entire code smells. "Interesting" way of getting an optional
> > > named interrupt.
> > I felt it useful to have it this way as it would remain agnostic to
> > device tree and the ACPI. We would not have to add redundant codes in
> > adapter drivers that are using ACPI table.
> >
> > Named interrupts for the ACPI as well, I feel would be a useful
> > addition that can prove to be of value more than this change; I believe.
> 
> Me too. My comment was about current state of affairs, and not to your
> change.
Got it :)

Thanks,
Akhil


      reply	other threads:[~2021-12-17  5:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 13:13 [PATCH 0/2] Enable named interrupt smbus-alert for ACPI as well Akhil R
2021-12-16 13:13 ` [PATCH 1/2] device property: Add device_irq_get_byname Akhil R
2021-12-16 14:38   ` Andy Shevchenko
2022-01-04 10:06     ` Akhil R
2021-12-16 13:13 ` [PATCH 2/2] i2c: smbus: Use device_ functions instead of of_ Akhil R
2021-12-16 14:59   ` Andy Shevchenko
2021-12-16 16:08     ` Akhil R
2021-12-16 20:18       ` Andy Shevchenko
2021-12-17  5:31         ` Akhil R [this message]

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=BN9PR12MB52736B1658C0B13526728119C0789@BN9PR12MB5273.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=kyarlagadda@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=smangipudi@nvidia.com \
    --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 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.