All of lore.kernel.org
 help / color / mirror / Atom feed
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFCv2 5/6] net: phy: suspend unused PHYs on mdio_bus in late_initcall
Date: Thu, 05 Dec 2013 00:05:44 +0300	[thread overview]
Message-ID: <529F9928.9090407@cogentembedded.com> (raw)
In-Reply-To: <1386171888-28190-6-git-send-email-sebastian.hesselbarth@gmail.com>

Hello.

On 12/04/2013 06:44 PM, Sebastian Hesselbarth wrote:

> Since phy_attach ensures PHYs are resumed, we can now suspend all
> PHYs that have no attached netdev after initcalls.

> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Changelog:
> RFCv1->RFCv2:
> - only check for phydev->attached_dev and let phy_suspend decide on
>    performing suspend or not (Suggested by Florian)

> @Florian: You suggested to 'make sure that the MDIO bus suspend policy
> was set to "auto"'. I wasn't able to find any clue how to check that,
> so I ignored that for now.

> Cc: David Miller <davem@davemloft.net>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Mugunthan V N <mugunthanvnm@ti.com>
> Cc: netdev at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> ---
>   drivers/net/phy/mdio_bus.c |   25 +++++++++++++++++++++++++
>   1 files changed, 25 insertions(+), 0 deletions(-)

> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 5617876..f533d17 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -320,6 +320,31 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
>   		(phydev->phy_id & phydrv->phy_id_mask));
>   }
>
> +static int mdio_bus_suspend_unused(struct device *busdev, void *data)
> +{
> +	struct mii_bus *bus = to_mii_bus(busdev);
> +	struct phy_device *phydev;
> +	int i;
> +
> +	for (i = 0; i < PHY_MAX_ADDR; i++) {
> +		if (!bus->phy_map[i])
> +			continue;
> +
> +		phydev = to_phy_device(&bus->phy_map[i]->dev);

    Why so complex? 'bus->phy_map[i]' already gives you 'phydev'.

> +		if (!phydev->attached_dev)
> +			phy_suspend(phydev);
> +	}
> +
> +	return 0;
> +}

WBR, Sergei

WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Mugunthan V N <mugunthanvnm@ti.com>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFCv2 5/6] net: phy: suspend unused PHYs on mdio_bus in late_initcall
Date: Thu, 05 Dec 2013 00:05:44 +0300	[thread overview]
Message-ID: <529F9928.9090407@cogentembedded.com> (raw)
In-Reply-To: <1386171888-28190-6-git-send-email-sebastian.hesselbarth@gmail.com>

Hello.

On 12/04/2013 06:44 PM, Sebastian Hesselbarth wrote:

> Since phy_attach ensures PHYs are resumed, we can now suspend all
> PHYs that have no attached netdev after initcalls.

> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Changelog:
> RFCv1->RFCv2:
> - only check for phydev->attached_dev and let phy_suspend decide on
>    performing suspend or not (Suggested by Florian)

> @Florian: You suggested to 'make sure that the MDIO bus suspend policy
> was set to "auto"'. I wasn't able to find any clue how to check that,
> so I ignored that for now.

> Cc: David Miller <davem@davemloft.net>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Mugunthan V N <mugunthanvnm@ti.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
>   drivers/net/phy/mdio_bus.c |   25 +++++++++++++++++++++++++
>   1 files changed, 25 insertions(+), 0 deletions(-)

> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 5617876..f533d17 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -320,6 +320,31 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
>   		(phydev->phy_id & phydrv->phy_id_mask));
>   }
>
> +static int mdio_bus_suspend_unused(struct device *busdev, void *data)
> +{
> +	struct mii_bus *bus = to_mii_bus(busdev);
> +	struct phy_device *phydev;
> +	int i;
> +
> +	for (i = 0; i < PHY_MAX_ADDR; i++) {
> +		if (!bus->phy_map[i])
> +			continue;
> +
> +		phydev = to_phy_device(&bus->phy_map[i]->dev);

    Why so complex? 'bus->phy_map[i]' already gives you 'phydev'.

> +		if (!phydev->attached_dev)
> +			phy_suspend(phydev);
> +	}
> +
> +	return 0;
> +}

WBR, Sergei


  reply	other threads:[~2013-12-04 21:05 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 20:21 [PATCH RFC v1 0/7] net: phy: Ethernet PHY powerdown optimization Sebastian Hesselbarth
2013-11-20 20:21 ` Sebastian Hesselbarth
2013-11-20 20:21 ` [PATCH RFC v1 1/7] net: phy: marvell: provide genphy suspend/resume Sebastian Hesselbarth
2013-11-20 20:21   ` Sebastian Hesselbarth
2013-11-20 20:21   ` Sebastian Hesselbarth
2013-11-20 20:21 ` [PATCH RFC v1 2/7] net: phy: provide phy_resume/phy_suspend helpers Sebastian Hesselbarth
2013-11-20 20:21   ` Sebastian Hesselbarth
2013-11-20 20:36   ` Florian Fainelli
2013-11-20 20:36     ` Florian Fainelli
2013-11-20 20:21 ` [PATCH RFC v1 3/7] net: phy: resume/suspend PHYs on attach/detach Sebastian Hesselbarth
2013-11-20 20:21   ` Sebastian Hesselbarth
2013-11-20 20:21 ` [PATCH RFC v1 4/7] net: phy: suspend unused PHYs on mdio_bus in late_initcall Sebastian Hesselbarth
2013-11-20 20:21   ` Sebastian Hesselbarth
2013-11-20 20:58   ` Florian Fainelli
2013-11-20 20:58     ` Florian Fainelli
2013-11-20 21:05     ` Sebastian Hesselbarth
2013-11-20 21:05       ` Sebastian Hesselbarth
2013-11-20 22:36       ` Florian Fainelli
2013-11-20 22:36         ` Florian Fainelli
2013-11-20 20:21 ` [PATCH RFC v1 5/7] net: mv643xx_eth: resume/suspend PHY on port start/stop Sebastian Hesselbarth
2013-11-20 20:21   ` Sebastian Hesselbarth
2013-11-20 20:21 ` [PATCH RFC v1 6/7] net: mvneta: " Sebastian Hesselbarth
2013-11-20 20:21   ` Sebastian Hesselbarth
2013-11-20 20:21 ` [PATCH RFC v1 7/7] net: cpsw: " Sebastian Hesselbarth
2013-11-20 20:21   ` Sebastian Hesselbarth
2013-11-20 20:48   ` Florian Fainelli
2013-11-20 20:48     ` Florian Fainelli
2013-11-20 20:57     ` Sebastian Hesselbarth
2013-11-20 20:57       ` Sebastian Hesselbarth
2013-11-21  8:35   ` Mugunthan V N
2013-11-21  8:35     ` Mugunthan V N
2013-11-21  8:35     ` Mugunthan V N
2013-11-21  8:41     ` Sebastian Hesselbarth
2013-11-21  8:41       ` Sebastian Hesselbarth
2013-11-20 20:36 ` [PATCH RFC v1 0/7] net: phy: Ethernet PHY powerdown optimization David Miller
2013-11-20 20:36   ` David Miller
2013-11-20 20:54   ` Sebastian Hesselbarth
2013-11-20 20:54     ` Sebastian Hesselbarth
2013-11-20 21:10     ` Florian Fainelli
2013-11-20 21:10       ` Florian Fainelli
2013-11-20 21:20       ` Sebastian Hesselbarth
2013-11-20 21:20         ` Sebastian Hesselbarth
2013-11-20 22:15     ` David Miller
2013-11-20 22:15       ` David Miller
2013-12-04 15:44 ` [PATCH RFCv2 0/6] " Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth
2013-12-05  7:57   ` Mugunthan V N
2013-12-05  7:57     ` Mugunthan V N
2013-12-06  0:16     ` Florian Fainelli
2013-12-06  0:16       ` Florian Fainelli
2013-12-08 14:40   ` [PATCH v1 " Sebastian Hesselbarth
2013-12-08 14:40     ` Sebastian Hesselbarth
2013-12-08 14:40     ` [PATCH v1 1/6] net: mv643xx_eth: properly start/stop phy device Sebastian Hesselbarth
2013-12-08 14:40       ` Sebastian Hesselbarth
2013-12-11  2:52       ` David Miller
2013-12-11  2:52         ` David Miller
2013-12-11  2:56         ` David Miller
2013-12-11  2:56           ` David Miller
2013-12-11  2:56           ` David Miller
2013-12-11  7:06           ` Sebastian Hesselbarth
2013-12-11  7:06             ` Sebastian Hesselbarth
2013-12-11  7:06             ` Sebastian Hesselbarth
2013-12-11 17:28             ` David Miller
2013-12-11 17:28               ` David Miller
2013-12-11 17:28               ` David Miller
2013-12-08 14:40     ` [PATCH v1 2/6] net: phy: marvell: provide genphy suspend/resume Sebastian Hesselbarth
2013-12-08 14:40       ` Sebastian Hesselbarth
2013-12-08 14:40     ` [PATCH v1 3/6] net: phy: provide phy_resume/phy_suspend helpers Sebastian Hesselbarth
2013-12-08 14:40       ` Sebastian Hesselbarth
2013-12-08 14:40     ` [PATCH v1 4/6] net: phy: resume/suspend PHYs on attach/detach Sebastian Hesselbarth
2013-12-08 14:40       ` Sebastian Hesselbarth
2013-12-08 14:40     ` [PATCH v1 5/6] net: phy: suspend unused PHYs on mdio_bus in late_initcall Sebastian Hesselbarth
2013-12-08 14:40       ` Sebastian Hesselbarth
2013-12-08 14:40     ` [PATCH v1 6/6] net: phy: suspend phydev when going to HALTED Sebastian Hesselbarth
2013-12-08 14:40       ` Sebastian Hesselbarth
2013-12-13  9:20     ` [PATCH v2 0/5] net: phy: Ethernet PHY powerdown optimization Sebastian Hesselbarth
2013-12-13  9:20       ` Sebastian Hesselbarth
2013-12-17 19:43       ` David Miller
2013-12-17 19:43         ` David Miller
2014-02-04 19:38         ` Sebastian Hesselbarth
2014-02-04 19:38           ` Sebastian Hesselbarth
2014-02-04 22:51           ` Florian Fainelli
2014-02-04 22:51             ` Florian Fainelli
2014-02-06 16:57           ` Ezequiel Garcia
2014-02-06 16:57             ` Ezequiel Garcia
2013-12-13  9:20     ` [PATCH v2 1/5] net: mv643xx_eth: properly start/stop phy device Sebastian Hesselbarth
2013-12-13  9:20       ` Sebastian Hesselbarth
2013-12-13  9:20     ` [PATCH v2 2/5] net: phy: marvell: provide genphy suspend/resume Sebastian Hesselbarth
2013-12-13  9:20       ` Sebastian Hesselbarth
2013-12-13  9:20     ` [PATCH v2 3/5] net: phy: provide phy_resume/phy_suspend helpers Sebastian Hesselbarth
2013-12-13  9:20       ` Sebastian Hesselbarth
2013-12-13  9:20     ` [PATCH v2 4/5] net: phy: resume/suspend PHYs on attach/detach Sebastian Hesselbarth
2013-12-13  9:20       ` Sebastian Hesselbarth
2013-12-13  9:20       ` Sebastian Hesselbarth
2013-12-13  9:20     ` [PATCH v2 5/5] net: phy: suspend phydev when going to HALTED Sebastian Hesselbarth
2013-12-13  9:20       ` Sebastian Hesselbarth
2013-12-04 15:44 ` [PATCH RFCv2 1/6] net: mv643xx_eth: properly start/stop phy device Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth
2013-12-04 15:44 ` [PATCH RFCv2 2/6] net: phy: marvell: provide genphy suspend/resume Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth
2013-12-04 15:44 ` [PATCH RFCv2 3/6] net: phy: provide phy_resume/phy_suspend helpers Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth
2013-12-06  0:08   ` Florian Fainelli
2013-12-06  0:08     ` Florian Fainelli
2013-12-04 15:44 ` [PATCH RFCv2 4/6] net: phy: resume/suspend PHYs on attach/detach Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth
2013-12-04 15:44 ` [PATCH RFCv2 5/6] net: phy: suspend unused PHYs on mdio_bus in late_initcall Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth
2013-12-04 21:05   ` Sergei Shtylyov [this message]
2013-12-04 21:05     ` Sergei Shtylyov
2013-12-06  0:02   ` Florian Fainelli
2013-12-06  0:02     ` Florian Fainelli
2013-12-04 15:44 ` [PATCH RFCv2 6/6] net: phy: suspend phydev when going to HALTED Sebastian Hesselbarth
2013-12-04 15:44   ` Sebastian Hesselbarth

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=529F9928.9090407@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.