Skip to contentSkip to conversation

net: phy: at803x: don't pass function pointers with &

PATCH In review Daniel Mack 3 participants 6 messages Sep 21, 2013 – Sep 27, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: phy: at803x: don't pass function pointers with &

Just a cosmetic cleanup.

---
 drivers/net/phy/at803x.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/phy/at803x.c +6 -6
index ac22283..4179228 100644
@@ -163,8 +163,8 @@ static struct phy_driver at803x_driver[] = {
 	.get_wol	= at803x_get_wol,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
-	.config_aneg	= &genphy_config_aneg,
-	.read_status	= &genphy_read_status,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
 	.driver		= {
 		.owner = THIS_MODULE,
 	},
@@ -178,8 +178,8 @@ static struct phy_driver at803x_driver[] = {
 	.get_wol	= at803x_get_wol,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
-	.config_aneg	= &genphy_config_aneg,
-	.read_status	= &genphy_read_status,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
 	.driver		= {
 		.owner = THIS_MODULE,
 	},
@@ -193,8 +193,8 @@ static struct phy_driver at803x_driver[] = {
 	.get_wol	= at803x_get_wol,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
-	.config_aneg	= &genphy_config_aneg,
-	.read_status	= &genphy_read_status,
+	.config_aneg	= genphy_config_aneg,
+	.read_status	= genphy_read_status,
 	.driver		= {
 		.owner = THIS_MODULE,
 	},
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/2 net: phy: at803x: add suspend/resume callbacks

When WOL is enabled, the chip can't be put into power-down (BMCR_PDOWN) mode, as that will also switch off the MAC, which consequently leads to a link loss.

Use BMCR_ISOLATE in that case, which will at least save us some milliamperes in comparison to normal operation mode.

---
 drivers/net/phy/at803x.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
drivers/net/phy/at803x.c +45 -0
index 4179228..bc71947 100644
@@ -100,6 +100,45 @@ static void at803x_get_wol(struct phy_device *phydev,
 		wol->wolopts |= WAKE_MAGIC;
 }
 
+static int at803x_suspend(struct phy_device *phydev)
+{
+	int value;
+	int wol_enabled;
+
+	mutex_lock(&phydev->lock);
+
+	value = phy_read(phydev, AT803X_INTR_ENABLE);
+	wol_enabled = value & AT803X_WOL_ENABLE;
+
+	value = phy_read(phydev, MII_BMCR);
+
+	if (wol_enabled)
+		value |= BMCR_ISOLATE;
+	else
+		value |= BMCR_PDOWN;
+
+	phy_write(phydev, MII_BMCR, value);
+
+	mutex_unlock(&phydev->lock);
+
+	return 0;
+}
+
+static int at803x_resume(struct phy_device *phydev)
+{
+	int value;
+
+	mutex_lock(&phydev->lock);
+
+	value = phy_read(phydev, MII_BMCR);
+	value &= ~(BMCR_PDOWN | BMCR_ISOLATE);
+	phy_write(phydev, MII_BMCR, value);
+
+	mutex_unlock(&phydev->lock);
+
+	return 0;
+}
+
 static int at803x_config_init(struct phy_device *phydev)
 {
 	int val;
@@ -161,6 +200,8 @@ static struct phy_driver at803x_driver[] = {
 	.config_init	= at803x_config_init,
 	.set_wol	= at803x_set_wol,
 	.get_wol	= at803x_get_wol,
+	.suspend	= at803x_suspend,
+	.resume		= at803x_resume,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_aneg	= genphy_config_aneg,
@@ -176,6 +217,8 @@ static struct phy_driver at803x_driver[] = {
 	.config_init	= at803x_config_init,
 	.set_wol	= at803x_set_wol,
 	.get_wol	= at803x_get_wol,
+	.suspend	= at803x_suspend,
+	.resume		= at803x_resume,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_aneg	= genphy_config_aneg,
@@ -191,6 +234,8 @@ static struct phy_driver at803x_driver[] = {
 	.config_init	= at803x_config_init,
 	.set_wol	= at803x_set_wol,
 	.get_wol	= at803x_get_wol,
+	.suspend	= at803x_suspend,
+	.resume		= at803x_resume,
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_aneg	= genphy_config_aneg,
Signature · 1 line
1.8.3.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks

Quoted 8 lines · Daniel Mack

When WOL is enabled, the chip can't be put into power-down (BMCR_PDOWN) mode, as that will also switch off the MAC, which consequently leads to a link loss.

Use BMCR_ISOLATE in that case, which will at least save us some milliamperes in comparison to normal operation mode.

Looks good to me

Regards
Mugunthan V N

#3 lore raw

Re: [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks

Quoted 5 lines · Mugunthan V N
Quoted 4 lines · Daniel Mack

When WOL is enabled, the chip can't be put into power-down (BMCR_PDOWN) mode, as that will also switch off the MAC, which consequently leads to a link loss.

Quoted 7 lines
Quoted 4 lines

Use BMCR_ISOLATE in that case, which will at least save us some milliamperes in comparison to normal operation mode.

Looks good to me

Thanks :)

David, can you take these two patches with Mugunthan's Acked-by: or do you want me to resend them?

Best regards,
Daniel

maintainer
#4 lore raw

Re: [PATCH 2/2] net: phy: at803x: add suspend/resume callbacks

From: Daniel Mack <[email protected]>
Date: Fri, 27 Sep 2013 20:49:00 +0200

Quoted 10 lines · Mugunthan V N
Quoted 9 lines · Daniel Mack
Quoted 8 lines

When WOL is enabled, the chip can't be put into power-down (BMCR_PDOWN) mode, as that will also switch off the MAC, which consequently leads to a link loss.

Use BMCR_ISOLATE in that case, which will at least save us some milliamperes in comparison to normal operation mode.

Quoted 8 lines
Quoted 3 lines

Looks good to me

Thanks :)

David, can you take these two patches with Mugunthan's Acked-by: or do you want me to resend them?

Both applied to net-next, thanks.