From: Hans de Goede <hdegoede@redhat.com>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Clément Léger" <clement.leger@bootlin.com>
Cc: Daniel Scally <djrscally@gmail.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Wolfram Sang <wsa@kernel.org>, Peter Rosin <peda@axentia.se>,
Russell King <linux@armlinux.org.uk>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-i2c@vger.kernel.org, netdev@vger.kernel.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Subject: Re: [RFC 10/10] net: sfp: add support for fwnode
Date: Wed, 23 Feb 2022 13:02:23 +0100 [thread overview]
Message-ID: <888f9f1a-ca5a-1250-1423-6c012ec773e2@redhat.com> (raw)
In-Reply-To: <YhYZAc5+Q1rN3vhk@smile.fi.intel.com>
Hi,
On 2/23/22 12:22, Andy Shevchenko wrote:
> On Tue, Feb 22, 2022 at 02:25:13PM +0100, Clément Léger wrote:
>> Le Mon, 21 Feb 2022 19:57:39 +0200,
>> Andy Shevchenko <andriy.shevchenko@linux.intel.com> a écrit :
>>
>>> On Mon, Feb 21, 2022 at 05:26:52PM +0100, Clément Léger wrote:
>>>> Add support to retrieve a i2c bus in sfp with a fwnode. This support
>>>> is using the fwnode API which also works with device-tree and ACPI.
>>>> For this purpose, the device-tree and ACPI code handling the i2c
>>>> adapter retrieval was factorized with the new code. This also allows
>>>> i2c devices using a software_node description to be used by sfp code.
>>>
>>> If I'm not mistaken this patch can even go separately right now, since all used
>>> APIs are already available.
>>
>> This patches uses fwnode_find_i2c_adapter_by_node() which is introduced
>> by "i2c: fwnode: add fwnode_find_i2c_adapter_by_node()" but they can
>> probably be contributed both in a separate series.
>
> I summon Hans into the discussion since I remember he recently refactored
> a bit I2C (ACPI/fwnode) APIs. Also he might have an idea about entire big
> picture approach with this series based on his ACPI experience.
If I understand this series correctly then this is about a PCI-E card
which has an I2C controller on the card and behind that I2C-controller
there are a couple if I2C muxes + I2C clients.
And the goal of the series is to describe those I2C muxes + I2C clients
with software nodes so that the existing I2C enumeration code can be
used (after porting the existing I2C enumeration code from OF functions
to generic fwnode functions).
Did I understand this bit correctly? I believe that a lot of the
discussion here is caused by the initial problem / hw-setup this
series tries to address / support is not described very well ?
Assuming I did understand the above correctly. One alternative would be
to simply manually instantiate the I2C muxes + clients using
i2c_new_client_device(). But I'm not sure if i2c_new_client_device()
will work for the muxes without adding some software_nodes which
brings us back to something like this patch-set.
In general I believe that porting things away from OF specific parsing
to the generic fwnode APIs is a good thing.
Making device_get_match_data() for devices with only a software fwnode
use of_device_id matching feels a bit weird. But it also makes sense
since that requires just adding a compatible string to the software
fwnode properties which is easy and it allows re-uses existing
matching code in the drivers.
I understand various people falling over this weirdness but AFAICT
the alternative would be adding some special swnode_id type + matching
code for devices where the primary fwnode is a software fwnode, which
would just be a whole bunch of extra code ending up with something
similar.
So re-using of_device_id-s for matching of devices where the primary
fwnode is a software fwnode seems like a good idea. *But* this all
needs to be explained in the commit message a lot better. It really
needs to be spelled out that this is:
a) Only for matching devices where the primary fwnode is a software fwnode
b) Really has nothing to do with of/dt but of_device_id matching is
used here to avoid having to introduce a new matching mechanism just
for devices where the primary fwnode is a software fwnode
c) That introducing a new software fwnode matching mechanism would be
a bad idea since this will require adding new swnode_match tables
to many drivers, where as re-using of_device_id will make drivers
which already have an of_match_table just work.
And this should be spelled out in both the commit message as well
as in some documentation / kdoc comments. Because although a useful
trick, reusing the of_match_id-s is also confusing which I believe
is what has led to a lot of the discussion on this patch-set so far.
Note the above all relies on my interpretation of this patch set,
which may be wrong, since as said the patch-set does seem to be
lacking when it comes to documentation / motivation of the patches.
Regards,
Hans
next prev parent reply other threads:[~2022-02-23 12:02 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 16:26 [RFC 00/10] add support for fwnode in i2c mux system and sfp Clément Léger
2022-02-21 16:26 ` [RFC 01/10] property: add fwnode_match_node() Clément Léger
2022-02-21 17:44 ` Andy Shevchenko
2022-02-22 8:14 ` Clément Léger
2022-02-21 16:26 ` [RFC 02/10] property: add fwnode_get_match_data() Clément Léger
2022-02-21 17:46 ` Andy Shevchenko
2022-02-22 8:19 ` Clément Léger
2022-02-22 8:33 ` Andy Shevchenko
2022-02-22 8:46 ` Clément Léger
2022-02-22 9:24 ` Andy Shevchenko
2022-02-22 9:47 ` Clément Léger
2022-02-22 10:20 ` Greg Kroah-Hartman
2022-02-22 15:16 ` Clément Léger
2022-02-21 16:26 ` [RFC 03/10] base: swnode: use fwnode_get_match_data() Clément Léger
2022-02-21 17:48 ` Andy Shevchenko
2022-02-22 8:39 ` Clément Léger
2022-02-23 15:05 ` Sakari Ailus
2022-02-23 15:15 ` Clément Léger
2022-02-23 15:21 ` Sakari Ailus
2022-02-21 16:26 ` [RFC 04/10] property: add a callback parameter to fwnode_property_match_string() Clément Léger
2022-02-21 17:51 ` Andy Shevchenko
2022-02-21 16:26 ` [RFC 05/10] property: add fwnode_property_read_string_index() Clément Léger
2022-02-21 16:26 ` [RFC 06/10] i2c: fwnode: add fwnode_find_i2c_adapter_by_node() Clément Léger
2022-02-21 18:00 ` Andy Shevchenko
2022-02-21 16:26 ` [RFC 07/10] i2c: of: use fwnode_get_i2c_adapter_by_node() Clément Léger
2022-02-21 16:26 ` [RFC 08/10] i2c: mux: pinctrl: remove CONFIG_OF dependency and use fwnode API Clément Léger
2022-02-21 16:26 ` [RFC 09/10] i2c: mux: add support for fwnode Clément Léger
2022-02-21 17:55 ` Andy Shevchenko
2022-02-22 8:53 ` Clément Léger
2022-02-22 10:57 ` Andrew Lunn
2022-02-22 20:31 ` Alexandre Belloni
2022-02-21 16:26 ` [RFC 10/10] net: sfp: " Clément Léger
2022-02-21 16:45 ` Russell King (Oracle)
2022-02-21 17:57 ` Andy Shevchenko
2022-02-22 13:25 ` Clément Léger
2022-02-23 11:22 ` Andy Shevchenko
2022-02-23 12:02 ` Hans de Goede [this message]
2022-02-23 12:31 ` Andrew Lunn
2022-02-23 12:41 ` Russell King (Oracle)
2022-02-23 13:39 ` Hans de Goede
2022-02-23 14:14 ` Clément Léger
2022-02-23 15:23 ` Andrew Lunn
2022-02-23 15:27 ` Hans de Goede
2022-02-23 15:27 ` Hans de Goede
2022-02-23 15:36 ` Andy Shevchenko
2022-02-23 15:38 ` Clément Léger
2022-02-23 14:37 ` Andy Shevchenko
2022-02-21 17:41 ` [RFC 00/10] add support for fwnode in i2c mux system and sfp Andy Shevchenko
2022-02-22 16:30 ` Clément Léger
2022-02-23 14:46 ` Andy Shevchenko
2022-02-23 15:11 ` Clément Léger
2022-02-23 15:24 ` Andy Shevchenko
2022-02-23 17:41 ` Mark Brown
2022-02-23 17:59 ` Clément Léger
2022-02-23 18:12 ` Mark Brown
2022-02-23 18:19 ` Andy Shevchenko
2022-02-21 21:44 ` Andrew Lunn
2022-02-22 8:26 ` Andy Shevchenko
2022-02-22 8:57 ` Andrew Lunn
2022-02-22 9:20 ` Andy Shevchenko
2022-02-24 14:40 ` Clément Léger
2022-02-24 14:58 ` Hans de Goede
2022-02-24 15:33 ` Mark Brown
2022-02-24 18:14 ` Sakari Ailus
2022-02-24 18:39 ` Alexandre Belloni
2022-02-24 18:43 ` Mark Brown
2022-02-24 18:39 ` Mark Brown
2022-02-24 16:42 ` Clément Léger
2022-02-24 17:26 ` Mark Brown
2022-03-03 8:48 ` Clément Léger
2022-03-03 12:26 ` Mark Brown
2022-03-08 10:45 ` Clément Léger
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=888f9f1a-ca5a-1250-1423-6c012ec773e2@redhat.com \
--to=hdegoede@redhat.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=clement.leger@bootlin.com \
--cc=davem@davemloft.net \
--cc=djrscally@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=peda@axentia.se \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=thomas.petazzoni@bootlin.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;
as well as URLs for NNTP newsgroup(s).