Thread (10 messages) flat view 10 messages, 2 authors, 2018-10-04

Re: [PATCH net-next v2 1/6] net: phy: mscc: migrate to phy_select/restore_page functions

From: Quentin Schulz <hidden>
Date: 2018-10-04 15:57:33
Also in: lkml

Hi Andrew,

On Thu, Oct 04, 2018 at 05:16:30PM +0200, Andrew Lunn wrote:
On Thu, Oct 04, 2018 at 02:47:23PM +0200, Quentin Schulz wrote:
quoted
@@ -197,25 +199,30 @@ static int vsc85xx_mdix_set(struct phy_device *phydev, u8 mdix)
 	if (rc != 0)
 		return rc;
 
-	rc = vsc85xx_phy_page_set(phydev, MSCC_PHY_PAGE_EXTENDED);
-	if (rc != 0)
-		return rc;
+	oldpage = phy_select_page(phydev, MSCC_PHY_PAGE_EXTENDED);
+	if (oldpage < 0) {
+		rc = oldpage;
+		goto out;
+	}
 
-	reg_val = phy_read(phydev, MSCC_PHY_EXT_MODE_CNTL);
+	reg_val = __phy_read(phydev, MSCC_PHY_EXT_MODE_CNTL);
 	reg_val &= ~(FORCE_MDI_CROSSOVER_MASK);
 	if (mdix == ETH_TP_MDI)
 		reg_val |= FORCE_MDI_CROSSOVER_MDI;
 	else if (mdix == ETH_TP_MDI_X)
 		reg_val |= FORCE_MDI_CROSSOVER_MDIX;
Hi Quentin

Could you use phy_modify_paged() here? This function only accesses a
single register, so using the wrapper should not have any
disadvantages. The same should apply for any function modifying a single
register.
Sure, will do.

Thanks,
Quentin

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help