[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzNc+O/FsoRLle60@colin-ia-desktop>
Date: Tue, 27 Sep 2022 13:28:40 -0700
From: Colin Foster <colin.foster@...advantage.com>
To: Vladimir Oltean <vladimir.oltean@....com>
Cc: netdev@...r.kernel.org, Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
UNGLinuxDriver@...rochip.com,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxim Kochetkov <fido_max@...ox.ru>
Subject: Re: [PATCH net-next 5/5] net: dsa: felix: update regmap requests to
be string-based
On Tue, Sep 27, 2022 at 10:15:21PM +0300, Vladimir Oltean wrote:
> +static struct regmap *felix_request_regmap_by_name(struct felix *felix,
> + const char *resource_name)
> +{
> + struct ocelot *ocelot = &felix->ocelot;
> + struct resource res;
> + int i;
> +
I like it. And a simple:
if (!felix->resources)
return dev_get_regmap(ocelot->dev->parent, resource_name);
here (with an appropriate comment) would be all I need in the MFD
scenario.
I'll share the names via macros for "reg", "ana", etc. by way of
linux/mfd/ocelot.h, unless you think felix / seville also want them.
Thanks Vladimir!
> + for (i = 0; i < felix->info->num_resources; i++) {
> + if (strcmp(resource_name, felix->info->resources[i].name))
> + continue;
> +
> + memcpy(&res, &felix->info->resources[i], sizeof(res));
> + res.start += felix->switch_base;
> + res.end += felix->switch_base;
> +
> + return ocelot_regmap_init(ocelot, &res);
> + }
> +
> + return ERR_PTR(-ENOENT);
> +}
Powered by blists - more mailing lists