Re: [PATCH net-next v18 2/3] net: phy: Add support for Template Control register for PMA
From: Andrew Lunn
Date: Tue Sep 15 2026 - 08:55:47 EST
> +/**
> + * genphy_c45_template_testmode - configure template testmode registers
> + * @phydev: target phy_device struct
> + * @test_mode: testmode includes Normal to Test mode 7
> + *
> + * Description: Set template testmode include Normal to Test mode 7
> + *
> + * Return: 0 on success, or a negative error code on failure (e.g. register
> + * read/write error).
> + */
> +int genphy_c45_template_testmode(struct phy_device *phydev, int test_mode)
> +{
> + int ctrl;
I would suggest test_mode is a u16, or at least an unsigned type. ctrl
should be a u16, since phy_modify_mmd() and phy_write() etc take a
u16.
> +
> + if (test_mode < MDIO_PMA_10GBT_TESTMODE_NORMAL ||
> + test_mode > MDIO_PMA_10GBT_TESTMODE_7)
> + return -EOPNOTSUPP;
And once test_mode is unsigned, you don't need to test if its is less
than 0.
Andrew
---
pw-bot: cr