mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: "David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
	Sekhar Nori <nsekhar@ti.com>, Mugunthan V N <mugunthanvnm@ti.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>,
	Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>,
	Rob Herring <robh+dt@kernel.org>, <devicetree@vger.kernel.org>,
	Grygorii Strashko <grygorii.strashko@ti.com>
Subject: [PATCH 08/15] drivers: net: davinci_mdio: drop suspended and lock fields from mdio_data
Date: Wed, 15 Jun 2016 14:55:56 +0300	[thread overview]
Message-ID: <20160615115603.4897-9-grygorii.strashko@ti.com> (raw)
In-Reply-To: <20160615115603.4897-1-grygorii.strashko@ti.com>

The Davinci MDIO is not expected to be accessible after its suspend
callbacks has been called:
 - all consumers of Davinci MDIO will stop/disconnect their phys at Device
suspend stage;
 - all phys are expected to be suspended already by PHY/MDIO core;
 - MDIO locking is done by MDIO Bus code.

Hence, it's safe to drop "suspended" and "lock" fields from mdio_data.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/net/ethernet/ti/davinci_mdio.c | 30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index 291c42e..b6d0059 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -90,11 +90,9 @@ static const struct mdio_platform_data default_pdata = {
 struct davinci_mdio_data {
 	struct mdio_platform_data pdata;
 	struct davinci_mdio_regs __iomem *regs;
-	spinlock_t	lock;
 	struct clk	*clk;
 	struct device	*dev;
 	struct mii_bus	*bus;
-	bool		suspended;
 	unsigned long	access_time; /* jiffies */
 	/* Indicates that driver shouldn't modify phy_mask in case
 	 * if MDIO bus is registered from DT.
@@ -225,13 +223,6 @@ static int davinci_mdio_read(struct mii_bus *bus, int phy_id, int phy_reg)
 	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
 		return -EINVAL;
 
-	spin_lock(&data->lock);
-
-	if (data->suspended) {
-		spin_unlock(&data->lock);
-		return -ENODEV;
-	}
-
 	reg = (USERACCESS_GO | USERACCESS_READ | (phy_reg << 21) |
 	       (phy_id << 16));
 
@@ -255,8 +246,6 @@ static int davinci_mdio_read(struct mii_bus *bus, int phy_id, int phy_reg)
 		break;
 	}
 
-	spin_unlock(&data->lock);
-
 	return ret;
 }
 
@@ -270,13 +259,6 @@ static int davinci_mdio_write(struct mii_bus *bus, int phy_id,
 	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
 		return -EINVAL;
 
-	spin_lock(&data->lock);
-
-	if (data->suspended) {
-		spin_unlock(&data->lock);
-		return -ENODEV;
-	}
-
 	reg = (USERACCESS_GO | USERACCESS_WRITE | (phy_reg << 21) |
 		   (phy_id << 16) | (phy_data & USERACCESS_DATA));
 
@@ -295,8 +277,6 @@ static int davinci_mdio_write(struct mii_bus *bus, int phy_id,
 		break;
 	}
 
-	spin_unlock(&data->lock);
-
 	return 0;
 }
 
@@ -364,7 +344,6 @@ static int davinci_mdio_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, data);
 	data->dev = dev;
-	spin_lock_init(&data->lock);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	data->regs = devm_ioremap_resource(dev, res);
@@ -426,17 +405,12 @@ static int davinci_mdio_suspend(struct device *dev)
 	struct davinci_mdio_data *data = dev_get_drvdata(dev);
 	u32 ctrl;
 
-	spin_lock(&data->lock);
-
 	/* shutdown the scan state machine */
 	ctrl = __raw_readl(&data->regs->control);
 	ctrl &= ~CONTROL_ENABLE;
 	__raw_writel(ctrl, &data->regs->control);
 	wait_for_idle(data);
 
-	data->suspended = true;
-	spin_unlock(&data->lock);
-
 	/* Select sleep pin state */
 	pinctrl_pm_select_sleep_state(dev);
 
@@ -450,13 +424,9 @@ static int davinci_mdio_resume(struct device *dev)
 	/* Select default pin state */
 	pinctrl_pm_select_default_state(dev);
 
-	spin_lock(&data->lock);
 	/* restart the scan state machine */
 	__davinci_mdio_reset(data);
 
-	data->suspended = false;
-	spin_unlock(&data->lock);
-
 	return 0;
 }
 #endif
-- 
2.8.4

  parent reply	other threads:[~2016-06-15 11:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 11:55 [PATCH 00/15] drivers: net: cpsw: improve runtime pm Grygorii Strashko
2016-06-15 11:55 ` [PATCH 01/15] drivers: net: cpsw: fix suspend when all ethX devices are down Grygorii Strashko
2016-06-15 11:55 ` [PATCH 02/15] drivers: net: cpsw: check return code from pm runtime calls Grygorii Strashko
2016-06-15 11:55 ` [PATCH 03/15] drivers: net: cpsw: remove pm runtime calls from suspend callbacks Grygorii Strashko
2016-06-15 11:55 ` [PATCH 04/15] drivers: net: cpsw: ethtool: fix accessing to suspended device Grygorii Strashko
2016-06-15 16:14   ` Florian Fainelli
2016-06-15 16:45     ` Grygorii Strashko
2016-06-16 12:48       ` Ivan Khoronzhuk
2016-06-16 13:32         ` Ivan Khoronzhuk
2016-06-15 11:55 ` [PATCH 05/15] drivers: net: cpsw: ndev: " Grygorii Strashko
2016-06-15 11:55 ` [PATCH 06/15] drivers: net: davinci_mdio: do pm runtime initialization later in probe Grygorii Strashko
2016-06-15 11:55 ` [PATCH 07/15] drivers: net: davinci_mdio: remove pm runtime calls from suspend callbacks Grygorii Strashko
2016-06-15 11:55 ` Grygorii Strashko [this message]
2016-06-15 11:55 ` [PATCH 09/15] drivers: net: davinci_mdio: split reset function on init_clk and enable Grygorii Strashko
2016-06-15 11:55 ` [PATCH 10/15] drivers: net: davinci_mdio: add pm runtime callbacks Grygorii Strashko
2016-06-15 11:55 ` [PATCH 11/15] drivers: net: davinci_mdio: implement pm runtime auto mode Grygorii Strashko
2016-06-15 11:56 ` [PATCH 12/15] net: davinci_mdio: document missed "ti,am4372-mdio" compat string Grygorii Strashko
2016-06-19 14:35   ` Rob Herring
2016-06-22 10:26     ` Grygorii Strashko
2016-06-15 11:56 ` [PATCH 13/15] net: davinci_mdio: introduce "ti,cpsw-mdio" " Grygorii Strashko
2016-06-15 11:56 ` [PATCH 14/15] drivers: net: davinci_mdio: enable pm runtime auto for ti cpsw-mdio Grygorii Strashko
2016-06-15 13:48   ` kbuild test robot
2016-06-15 11:56 ` [PATCH 15/15] ARM: dts: am335x/am437x/dra7: use new "ti,cpsw-mdio" compat string Grygorii Strashko
2016-06-21 11:34   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160615115603.4897-9-grygorii.strashko@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=ivan.khoronzhuk@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome