Re: [PATCH net-next v5 1/6] net: dsa: motorcomm: refactor registration path for upcoming switch families

From: David Yang

Date: Fri Sep 04 2026 - 13:32:26 EST


On Fri, Sep 4, 2026 at 5:54 PM Kyle Switch <kyle.switch@xxxxxxxxxxxxxx> wrote:
> + .name = "YT921X",

nit: We usually stylize it with "YT921x".

> + if (major == YT9215_MAJOR || major == YT9218_MAJOR)
> + mode = YT921X;
> +
> + for (i = 0; i < ARRAY_SIZE(yt92xx_series_info_table); ++i)
> + if (yt92xx_series_info_table[i].mode == mode)
> + return &yt92xx_series_info_table[i];

Redundant if you use both indexed assignment and lookup routine, since
you know the index already.

> static const struct of_device_id yt921x_of_match[] = {
> - { .compatible = "motorcomm,yt9215" },
> - {}
> + {
> + .compatible = "motorcomm,yt9215",
> + .data = &yt92xx_series_info_table[YT921X],

Redundant if you use both runtime identification and the match data.
Also I'm concerned with early IO operations, although I didn't see any
incorrectness here.

> +enum yt92xx_mode {
> + YT921X,
> + YT922X,
> + YT_MAX,
> +};

nit: Use prefix/suffix like YT92XX_MODE_YT921X or YT921X_SERIES to
avoid too broad names and future name collision.

> struct yt921x_priv {
> struct dsa_switch ds;
>
> + const struct yt92xx_series_info *series_info;
> const struct yt921x_info *info;

nit: Better to use const struct yt92xx_series *series for simplicity.