Thanks for the advice. This is a fix for a Japanese NTT OCU, which always outputs 2W, even though the chip revision always returns 0. This is not a bug, but a specification. https://business.ntt-east.co.jp/service/onu/pdf/interface.pdf
Therefore, since the situation is too special to be handled by sfp_module_parse_power(), the existing code was implemented to exit the process in the process just before the error occurs. The SF-8472 does not normally return 0, so there is no effect on other devices. https://members.snia.org/document/dl/25916 If possible, I would appreciate some practical advice on compile-time warnings. Translated with www.DeepL.com/Translator (free version) 2021年11月29日(月) 1:30 Bjørn Mork <[email protected]>: > > [email protected] writes: > > > From: "S.Teruyama" <[email protected]> > > > > Signed-off-by: S.Teruyama <[email protected]> > > --- > > .../pending-5.4/771-net-sfp-skip-hpowr-if-no-revision.patch | 12 > > ++++++++++++ > > 1 file changed, 12 insertions(+) > > create mode 100644 > > target/linux/generic/pending-5.4/771-net-sfp-skip-hpowr-if-no-revision.patch > > > > diff --git > > a/target/linux/generic/pending-5.4/771-net-sfp-skip-hpowr-if-no-revision.patch > > > > b/target/linux/generic/pending-5.4/771-net-sfp-skip-hpowr-if-no-revision.patch > > new file mode 100644 > > index 0000000..ffcf5ab > > --- /dev/null > > +++ > > b/target/linux/generic/pending-5.4/771-net-sfp-skip-hpowr-if-no-revision.patch > > @@ -0,0 +1,12 @@ > > +@@ -0,0 +1,11 @@ > > +--- a/drivers/net/phy/sfp.c > > ++++ b/drivers/net/phy/sfp.c > > +@@ -1590,6 +1590,8 @@ static int sfp_module_parse_power(struct > > + > > + static int sfp_sm_mod_hpower(struct sfp *sfp, bool enable) > > + { > > ++ if (sfp->id.ext.sff8472_compliance == SFP_SFF8472_COMPLIANCE_NONE) > > ++ return 0; > > + u8 val; > > + int err; > > + > > > This looks like a workaround for a specific buggy module. Is that > correct? Why not update sfp_module_parse_power() instead so you can > skip the HPOWER state completely? And add an appropriate warning about > this unexpected combination of options and sff8472_compliance. > > > In any case, that "if" is misplaced. Your compiler should warn about it. > > > > Bjørn -- 株式会社スプリングボード 照山 周一郎 [email protected] http://www.springboard-inc.jp/ 〒110-0005 東京都台東区上野3丁目2番2号 アイオス秋葉原505号室 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
