[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220509172028.qcxzexnabovrdatq@skbuf>
Date: Mon, 9 May 2022 17:20:29 +0000
From: Vladimir Oltean <vladimir.oltean@....com>
To: Colin Foster <colin.foster@...advantage.com>
CC: "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Terry Bowman <terry.bowman@....com>,
Wolfram Sang <wsa@...nel.org>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Steen Hegelund <Steen.Hegelund@...rochip.com>,
Lars Povlsen <lars.povlsen@...rochip.com>,
Linus Walleij <linus.walleij@...aro.org>,
Russell King <linux@...linux.org.uk>,
Heiner Kallweit <hkallweit1@...il.com>,
Paolo Abeni <pabeni@...hat.com>,
Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Andrew Lunn <andrew@...n.ch>,
"UNGLinuxDriver@...rochip.com" <UNGLinuxDriver@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Lee Jones <lee.jones@...aro.org>
Subject: Re: [RFC v8 net-next 08/16] mfd: ocelot: add support for the vsc7512
chip via spi
On Mon, May 09, 2022 at 04:49:22PM -0700, Colin Foster wrote:
> > > +struct regmap *ocelot_init_regmap_from_resource(struct device *child,
> > > + const struct resource *res)
> > > +{
> > > + struct device *dev = child->parent;
> > > +
> > > + return ocelot_spi_devm_init_regmap(dev, child, res);
> >
> > So much for being bus-agnostic :-/
> > Maybe get the struct ocelot_ddata and call ocelot_spi_devm_init_regmap()
> > via a function pointer which is populated by ocelot-spi.c? If you do
> > that don't forget to clean up drivers/mfd/ocelot.h of SPI specific stuff.
>
> That was my initial design. "core" was calling into "spi" exclusively
> via function pointers.
>
> The request was "Please find a clearer way to do this without function
> pointers"
>
> https://lore.kernel.org/netdev/Ydwju35sN9QJqJ%2FP@google.com/
Yeah, I'm not sure what Lee was looking for, either. In any case I agree
with the comment that you aren't configuring a bus. In this context it
seems more appropriate to call this function pointer "init_regmap", with
different implementations per transport.
Or alternatively you could leave the "core"/"spi" pseudo-separation up
to the next person who needs to add support for some other register I/O
method.
Powered by blists - more mailing lists