Thread (12 messages) flat view 12 messages, 3 authors, 6d ago

Re: [PATCH net-next v18 2/3] net: phy: Add support for Template Control register for PMA

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-09-15 12:19:06
Also in: lkml

+/**
+ * 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
	
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help