netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: David Miller <davem@davemloft.net>
Cc: Andrew Lunn <andrew@lunn.ch>,
	netdev@vger.kernel.org, kernel@pengutronix.de,
	Lucas Stach <l.stach@pengutronix.de>,
	Alan Stern <stern@rowland.harvard.edu>
Subject: [PATCH net-master v2] net: fec: fix initial runtime PM refcount
Date: Wed,  5 Aug 2015 10:49:24 +0200	[thread overview]
Message-ID: <1438764564-15321-1-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1438617011-19073-1-git-send-email-l.stach@pengutronix.de>

From: Lucas Stach <l.stach@pengutronix.de>

The clocks are initially active and thus the device is marked active.
This still keeps the PM refcount at 0, the pm_runtime_put_autosuspend()
call at the end of probe then leaves us with an invalid refcount of -1,
which in turn leads to the device staying in suspended state even though
netdev open had been called.

Fix this by initializing the refcount to be coherent with the initial
device status.

Fixes: 8fff755e9f8 (net: fec: Ensure clocks are enabled while using mdio bus)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello David,

I think this is fine to apply now for 4.2-rc. I just picked up the
patch, added Alan's ack and a tested-by for me to make it easier for
you.

Best regards
Uwe

 drivers/net/ethernet/freescale/fec_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 32e3807c650e..271bb5862346 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -3433,6 +3433,7 @@ fec_probe(struct platform_device *pdev)
 
 	pm_runtime_set_autosuspend_delay(&pdev->dev, FEC_MDIO_PM_TIMEOUT);
 	pm_runtime_use_autosuspend(&pdev->dev);
+	pm_runtime_get_noresume(&pdev->dev);
 	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
 
-- 
2.4.6

  parent reply	other threads:[~2015-08-05  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 15:50 [PATCH] net: fec: fix initial runtime PM refcount Lucas Stach
2015-08-03 16:15 ` Andrew Lunn
2015-08-03 18:05   ` Uwe Kleine-König
2015-08-03 18:28     ` Alan Stern
2015-08-04  7:43       ` Lucas Stach
2015-08-04 14:20         ` Alan Stern
2015-08-04 14:35           ` Uwe Kleine-König
2015-08-04 15:59             ` Alan Stern
2015-08-04  7:34   ` Lucas Stach
2015-08-04  5:23 ` David Miller
2015-08-04  8:11 ` Uwe Kleine-König
2015-08-05  8:49 ` Uwe Kleine-König [this message]
2015-08-07  1:54 ` David Miller

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=1438764564-15321-1-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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;
as well as URLs for NNTP newsgroup(s).