Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756279AbcCUO5u (ORCPT ); Mon, 21 Mar 2016 10:57:50 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:60646 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1756127AbcCUO5r (ORCPT ); Mon, 21 Mar 2016 10:57:47 -0400 Date: Mon, 21 Mar 2016 10:57:45 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Oliver Neukum cc: Geert Uytterhoeven , Woojung Huh , Microchip Linux Driver Support , "David S. Miller" , Guenter Roeck , "Rafael J. Wysocki" , , , , Subject: Re: [PATCH] lan78xx: Protect runtime_auto check by #ifdef CONFIG_PM In-Reply-To: <1458549361.2299.1.camel@suse.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1796 Lines: 44 On Mon, 21 Mar 2016, Oliver Neukum wrote: > On Sun, 2016-03-20 at 11:43 +0100, Geert Uytterhoeven wrote: > > 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 > > Signed-off-by: Geert Uytterhoeven > > --- > > 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. > > That is what we do for almost everything else in include/pm_runtime.h > So it is the best solution to add the stub. Guenter's question about whether drivers should try to access runtime_auto in the first place was a good one. A similar problem arises in the block layer: When a block device has removable media, the block layer probes at 1-second intervals looking for media changes. This defeats autosuspend in the same way as we're talking about here. One possible solution is to export a sysfs parameter to prevent statistics collection (or more generally, to change the interval at which it occurs). But checking the runtime_auto flag is probably not a great idea. Even if it isn't set, collecting statistics is likely to wait up a device that otherwise would have remained suspended. Perhaps the best solution is to collect the statistics only when the device is not suspended or is about to suspend. Alan Stern