From: Colin Foster <colin.foster@in-advantage.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxim Kochetkov <fido_max@inbox.ru>
Subject: Re: [PATCH net-next 5/5] net: dsa: felix: update regmap requests to be string-based
Date: Tue, 27 Sep 2022 13:28:40 -0700 [thread overview]
Message-ID: <YzNc+O/FsoRLle60@colin-ia-desktop> (raw)
In-Reply-To: <20220927191521.1578084-7-vladimir.oltean@nxp.com>
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);
> +}
next prev parent reply other threads:[~2022-09-27 20:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 19:15 [PATCH net-next 0/5] Rework resource allocation in Felix DSA driver Vladimir Oltean
2022-09-27 19:15 ` [PATCH net-next 1/5] net: dsa: felix: remove felix_info :: imdio_res Vladimir Oltean
2022-09-27 19:15 ` [PATCH net-next 2/5] net: dsa: felix: remove felix_info :: imdio_base Vladimir Oltean
2022-09-27 19:15 ` [PATCH net-next 3/5] net: dsa: felix: remove felix_info :: init_regmap Vladimir Oltean
2022-09-27 19:15 ` [PATCH net-next 4/5] net: dsa: felix: use DEFINE_RES_MEM_NAMED for resources Vladimir Oltean
2022-09-27 19:15 ` [PATCH net-next 5/5] net: dsa: felix: update init_regmap to be string-based Vladimir Oltean
2022-09-27 19:27 ` Vladimir Oltean
2022-09-27 23:51 ` Jakub Kicinski
2022-09-27 19:15 ` [PATCH net-next 5/5] net: dsa: felix: update regmap requests " Vladimir Oltean
2022-09-27 20:28 ` Colin Foster [this message]
2022-09-29 2:50 ` [PATCH net-next 0/5] Rework resource allocation in Felix DSA driver patchwork-bot+netdevbpf
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=YzNc+O/FsoRLle60@colin-ia-desktop \
--to=colin.foster@in-advantage.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=fido_max@inbox.ru \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
/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