From ceb6c9c862c86423f41c1e20ecf8d454f837f519 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Sat, 29 Nov 2014 23:47:05 +0100 Subject: USB / PM: Drop CONFIG_PM_RUNTIME from the USB core After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so quite a few depend on CONFIG_PM (or even dropped in some cases). Replace CONFIG_PM_RUNTIME with CONFIG_PM in the USB core code and documentation. Signed-off-by: Rafael J. Wysocki Acked-by: Alan Stern Acked-by: Greg Kroah-Hartman --- drivers/usb/core/driver.c | 6 +----- drivers/usb/core/hcd-pci.c | 11 ----------- drivers/usb/core/hcd.c | 12 ++++-------- drivers/usb/core/hub.c | 6 +++--- drivers/usb/core/port.c | 4 ++-- drivers/usb/core/sysfs.c | 13 ++++--------- drivers/usb/core/usb.c | 4 +--- drivers/usb/core/usb.h | 23 +++++++++-------------- 8 files changed, 24 insertions(+), 55 deletions(-) (limited to 'drivers/usb/core') diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 9bffd26cea05..874dec31a111 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1493,10 +1493,6 @@ int usb_resume(struct device *dev, pm_message_t msg) return status; } -#endif /* CONFIG_PM */ - -#ifdef CONFIG_PM_RUNTIME - /** * usb_enable_autosuspend - allow a USB device to be autosuspended * @udev: the USB device which may be autosuspended @@ -1876,7 +1872,7 @@ int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) return ret; } -#endif /* CONFIG_PM_RUNTIME */ +#endif /* CONFIG_PM */ struct bus_type usb_bus_type = { .name = "usb", diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index efc953119ce2..9eb1cff28bd4 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -429,7 +429,6 @@ static int check_root_hub_suspended(struct device *dev) return 0; } -#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) static int suspend_common(struct device *dev, bool do_wakeup) { struct pci_dev *pci_dev = to_pci_dev(dev); @@ -528,7 +527,6 @@ static int resume_common(struct device *dev, int event) } return retval; } -#endif /* SLEEP || RUNTIME */ #ifdef CONFIG_PM_SLEEP @@ -607,8 +605,6 @@ static int hcd_pci_restore(struct device *dev) #endif /* CONFIG_PM_SLEEP */ -#ifdef CONFIG_PM_RUNTIME - static int hcd_pci_runtime_suspend(struct device *dev) { int retval; @@ -630,13 +626,6 @@ static int hcd_pci_runtime_resume(struct device *dev) return retval; } -#else - -#define hcd_pci_runtime_suspend NULL -#define hcd_pci_runtime_resume NULL - -#endif /* CONFIG_PM_RUNTIME */ - const struct dev_pm_ops usb_hcd_pci_pm_ops = { .suspend = hcd_pci_suspend, .suspend_noirq = hcd_pci_suspend_noirq, diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index a6efb4184f2b..278be0515e8e 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -2258,10 +2258,6 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) return status; } -#endif /* CONFIG_PM */ - -#ifdef CONFIG_PM_RUNTIME - /* Workqueue routine for root-hub remote wakeup */ static void hcd_resume_work(struct work_struct *work) { @@ -2293,7 +2289,7 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd) } EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub); -#endif /* CONFIG_PM_RUNTIME */ +#endif /* CONFIG_PM */ /*-------------------------------------------------------------------------*/ @@ -2476,7 +2472,7 @@ struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver, init_timer(&hcd->rh_timer); hcd->rh_timer.function = rh_timer_func; hcd->rh_timer.data = (unsigned long) hcd; -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM INIT_WORK(&hcd->wakeup_work, hcd_resume_work); #endif @@ -2790,7 +2786,7 @@ error_create_attr_group: hcd->rh_registered = 0; spin_unlock_irq(&hcd_root_hub_lock); -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM cancel_work_sync(&hcd->wakeup_work); #endif mutex_lock(&usb_bus_list_lock); @@ -2858,7 +2854,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) hcd->rh_registered = 0; spin_unlock_irq (&hcd_root_hub_lock); -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM cancel_work_sync(&hcd->wakeup_work); #endif diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index b649fef2e35d..c9596525ba8c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1737,7 +1737,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) * - If user has indicated to prevent autosuspend by passing * usbcore.autosuspend = -1 then keep autosuspend disabled. */ -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM if (hdev->dev.power.autosuspend_delay >= 0) pm_runtime_set_autosuspend_delay(&hdev->dev, 0); #endif @@ -3449,7 +3449,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) return status; } -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM int usb_remote_wakeup(struct usb_device *udev) { @@ -4856,7 +4856,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, udev->state != USB_STATE_NOTATTACHED) { if (portstatus & USB_PORT_STAT_ENABLE) { status = 0; /* Nothing to do */ -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM } else if (udev->state == USB_STATE_SUSPENDED && udev->persist_enabled) { /* For a suspended device, treat this as a diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index cd3f9dc24a06..210618319f10 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c @@ -72,7 +72,7 @@ static void usb_port_device_release(struct device *dev) kfree(port_dev); } -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM static int usb_port_runtime_resume(struct device *dev) { struct usb_port *port_dev = to_usb_port(dev); @@ -171,7 +171,7 @@ static int usb_port_runtime_suspend(struct device *dev) #endif static const struct dev_pm_ops usb_port_pm_ops = { -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM .runtime_suspend = usb_port_runtime_suspend, .runtime_resume = usb_port_runtime_resume, #endif diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 1236c6011c70..d26973844a4d 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -334,14 +334,6 @@ static void remove_persist_attributes(struct device *dev) &dev_attr_persist.attr, power_group_name); } -#else - -#define add_persist_attributes(dev) 0 -#define remove_persist_attributes(dev) do {} while (0) - -#endif /* CONFIG_PM */ - -#ifdef CONFIG_PM_RUNTIME static ssize_t connected_duration_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -585,10 +577,13 @@ static void remove_power_attributes(struct device *dev) #else +#define add_persist_attributes(dev) 0 +#define remove_persist_attributes(dev) do {} while (0) + #define add_power_attributes(dev) 0 #define remove_power_attributes(dev) do {} while (0) -#endif /* CONFIG_PM_RUNTIME */ +#endif /* CONFIG_PM */ /* Descriptor fields */ diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 2dd2362198d2..2a92b97f0144 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -49,7 +49,7 @@ const char *usbcore_name = "usbcore"; static bool nousb; /* Disable USB when built into kernel image */ -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM static int usb_autosuspend_delay = 2; /* Default delay value, * in seconds */ module_param_named(autosuspend, usb_autosuspend_delay, int, 0644); @@ -348,11 +348,9 @@ static const struct dev_pm_ops usb_device_pm_ops = { .thaw = usb_dev_thaw, .poweroff = usb_dev_poweroff, .restore = usb_dev_restore, -#ifdef CONFIG_PM_RUNTIME .runtime_suspend = usb_runtime_suspend, .runtime_resume = usb_runtime_resume, .runtime_idle = usb_runtime_idle, -#endif }; #endif /* CONFIG_PM */ diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index b1b34d0557c9..7eb1e26798e5 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -75,6 +75,14 @@ extern int usb_resume_complete(struct device *dev); extern int usb_port_suspend(struct usb_device *dev, pm_message_t msg); extern int usb_port_resume(struct usb_device *dev, pm_message_t msg); +extern void usb_autosuspend_device(struct usb_device *udev); +extern int usb_autoresume_device(struct usb_device *udev); +extern int usb_remote_wakeup(struct usb_device *dev); +extern int usb_runtime_suspend(struct device *dev); +extern int usb_runtime_resume(struct device *dev); +extern int usb_runtime_idle(struct device *dev); +extern int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable); + #else static inline int usb_port_suspend(struct usb_device *udev, pm_message_t msg) @@ -87,20 +95,6 @@ static inline int usb_port_resume(struct usb_device *udev, pm_message_t msg) return 0; } -#endif - -#ifdef CONFIG_PM_RUNTIME - -extern void usb_autosuspend_device(struct usb_device *udev); -extern int usb_autoresume_device(struct usb_device *udev); -extern int usb_remote_wakeup(struct usb_device *dev); -extern int usb_runtime_suspend(struct device *dev); -extern int usb_runtime_resume(struct device *dev); -extern int usb_runtime_idle(struct device *dev); -extern int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable); - -#else - #define usb_autosuspend_device(udev) do {} while (0) static inline int usb_autoresume_device(struct usb_device *udev) { @@ -111,6 +105,7 @@ static inline int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) { return 0; } + #endif extern struct bus_type usb_bus_type; -- cgit