Re: [PATCH net-next v5 1/6] net: dsa: motorcomm: refactor registration path for upcoming switch families
From: Kyle Switch <hidden>
Date: 2026-09-06 02:08:56
Also in:
lkml
On 9/5/26 01:03, David Yang wrote:
On Fri, Sep 4, 2026 at 5:54 PM Kyle Switch [off-list ref] wrote:quoted
+ .name = "YT921X",nit: We usually stylize it with "YT921x".
Ans: okay,will be fixed in next version.
quoted
+ 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.quoted
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?
quoted
+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.
quoted
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.