[PATCH] kernal: skip hpower setting for the module which has no revs
Bjørn Mork
bjorn at mork.no
Sun Nov 28 08:30:11 PST 2021
teruyama at springboard-inc.jp writes:
> From: "S.Teruyama" <teruyama at springboard-inc.jp>
>
> Signed-off-by: S.Teruyama <teruyama at springboard-inc.jp>
> ---
> .../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
More information about the openwrt-devel
mailing list