Re: [PATCH v3 net-next 08/14] net: dsa: felix: update init_regmap to be string-based

From: Vladimir Oltean
Date: Tue Sep 27 2022 - 14:57:08 EST


On Tue, Sep 27, 2022 at 11:43:46AM -0700, Colin Foster wrote:
> I see your point. The init_regmap(name) interface collides with the
> *_io_res arrays. Changing the init_regmap() interface doesn't really
> change the underlying issue - *_io_res[] is the thing that you're
> suggesting to go.
>
> I'm interested to see where this is going. I feel like it might be a
> constant names[] array, then felix_vsc9959_init_regmap() where the
> specific name <> resource mapping happens. Maybe a common
> felix_match_resource_to_name(name, res, len)?
>
> That would definitely remove the need for exporting the
> vsc7512_*_io_res[] arrays, which I didn't understand from your v1
> review.

Yes, having an array of strings, meaning which targets are required by
each driver, is what I wanted to see. Isn't that what I said in v1?

> vsc9959_init_regmap(name)
> {
> /* more logic for port_io_res, but you get the point */
> return felix_init_regmap(name, &vsc9959_target_io_res, TARGET_MAX);
> }

Yeah, wait a minute, you'll see.

> > I am also sorry for the mess that the felix driver currently is in, and
> > the fact that some things may have confused you.
>
> Vladimir, you might be the last person on earth who owes me an apology.

I have some more comments on the other patches. This driver looks weird
not only because the hardware is complicated and all over the place, but
also because you're working on a driver (felix) which was designed
around NXP variations of Microchip hardware, and this really transpires
especially around the probing and dt-bindings. The goal, otherwise,
would be for you to have dt-bindings for vsc7512 that are identical to
what Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
provides. It doesn't matter how the driver probes, that is to some
extent independent from how the drivers look like. Anyway, I'm getting
ahead of myself.