public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lan78xx: Protect runtime_auto check by #ifdef CONFIG_PM
@ 2016-03-20 10:43 Geert Uytterhoeven
  2016-03-20 16:35 ` Eric Dumazet
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Geert Uytterhoeven @ 2016-03-20 10:43 UTC (permalink / raw)
  To: Woojung Huh, Microchip Linux Driver Support, David S. Miller
  Cc: Guenter Roeck, Rafael J. Wysocki, netdev, linux-usb, linux-pm,
	linux-kernel, Geert Uytterhoeven

If CONFIG_PM=n:

    drivers/net/usb/lan78xx.c: In function ‘lan78xx_get_stats64’:
    drivers/net/usb/lan78xx.c:3274: error: ‘struct dev_pm_info’ has no member named ‘runtime_auto’

If PM is disabled, the runtime_auto flag is not available, but auto
suspend is not enabled anyway.  Hence protect the check for runtime_auto
by #ifdef CONFIG_PM to fix this.

Fixes: a59f8c5b048dc938 ("lan78xx: add ndo_get_stats64")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Alternatively, we can add a dev_pm_runtime_auto_is_enabled() wrapper to
include/linux/pm.h, which always return false if CONFIG_PM is disabled.

The only other user in non-core code (drivers/usb/core/sysfs.c) has a
big #ifdef CONFIG_PM check around all PM-related code.

Thoughts?
---
 drivers/net/usb/lan78xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index d36d5ebf37f355f2..7b9ac47b2ecf9905 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -3271,7 +3271,9 @@ struct rtnl_link_stats64 *lan78xx_get_stats64(struct net_device *netdev,
 	 * periodic reading from HW will prevent from entering USB auto suspend.
 	 * if autosuspend is disabled, read from HW.
 	 */
+#ifdef CONFIG_PM
 	if (!dev->udev->dev.power.runtime_auto)
+#endif
 		lan78xx_update_stats(dev);
 
 	mutex_lock(&dev->stats.access_lock);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-03-22 15:32 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-20 10:43 [PATCH] lan78xx: Protect runtime_auto check by #ifdef CONFIG_PM Geert Uytterhoeven
2016-03-20 16:35 ` Eric Dumazet
2016-03-20 20:52   ` David Miller
2016-03-20 22:59 ` Guenter Roeck
2016-03-21 14:59   ` Woojung.Huh
2016-03-21  8:36 ` Oliver Neukum
2016-03-21 14:41   ` Woojung.Huh
2016-03-21 14:57   ` Alan Stern
2016-03-21 17:34     ` Oliver Neukum
2016-03-21 18:24       ` Alan Stern
2016-03-21 18:42         ` Woojung.Huh
2016-03-21 19:27           ` Alan Stern
2016-03-21 20:09             ` Woojung.Huh
2016-03-21 21:02               ` Alan Stern
2016-03-21 18:51         ` Oliver Neukum
2016-03-21 19:30           ` Alan Stern
2016-03-22  9:50             ` Oliver Neukum
2016-03-22 14:21               ` Alan Stern
2016-03-22 14:28                 ` Oliver Neukum
2016-03-22 15:13                   ` Alan Stern
2016-03-22 15:29                     ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox