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

From: Kyle Switch

Date: Sat Sep 05 2026 - 22:09:13 EST



On 9/5/26 01:03, David Yang wrote:
On Fri, Sep 4, 2026 at 5:54 PM Kyle Switch <kyle.switch@xxxxxxxxxxxxxx> wrote:
+ .name = "YT921X",
nit: We usually stylize it with "YT921x".
Ans: okay,will be fixed in next version.

+ 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.

Ans: we have considered this issue before. in the next version, we

will consider whether to do it via chip_detect() or using indexed

assignment. From your suggestion, what are the side effects of each

approach and which of the two approaches do you recommend?


+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.
Ans: okay, will be fixed in next version.
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.
Ans: okay.