Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84ebc102 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman
Browse files

USB: remove CONFIG_USB_SUSPEND option



This patch (as1675) removes the CONFIG_USB_SUSPEND option, essentially
replacing it everywhere with CONFIG_PM_RUNTIME (except for one place
in hub.c, where it is replaced with CONFIG_PM because the code needs
to be used in both runtime and system PM).  The net result is code
shrinkage and simplification.

There's very little point in keeping CONFIG_USB_SUSPEND because almost
everybody enables it.  The few that don't will find that the usbcore
module has gotten somewhat bigger and they will have to take active
measures if they want to prevent hubs from being runtime suspended.

Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
CC: Peter Chen <peter.chen@freescale.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0aa2832d
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -38,22 +38,6 @@ config USB_DYNAMIC_MINORS

	  If you are unsure about this, say N here.

config USB_SUSPEND
	bool "USB runtime power management (autosuspend) and wakeup"
	depends on USB && PM_RUNTIME
	help
	  If you say Y here, you can use driver calls or the sysfs
	  "power/control" file to enable or disable autosuspend for
	  individual USB peripherals (see
	  Documentation/usb/power-management.txt for more details).

	  Also, USB "remote wakeup" signaling is supported, whereby some
	  USB devices (like keyboards and network adapters) can wake up
	  their parent hub.  That wakeup cascades up the USB tree, and
	  could wake the system from states like suspend-to-RAM.

	  If you are unsure about this, say N here.

config USB_OTG
	bool "OTG support"
	depends on USB
+2 −2
Original line number Diff line number Diff line
@@ -1412,7 +1412,7 @@ int usb_resume(struct device *dev, pm_message_t msg)

#endif /* CONFIG_PM */

#ifdef CONFIG_USB_SUSPEND
#ifdef CONFIG_PM_RUNTIME

/**
 * usb_enable_autosuspend - allow a USB device to be autosuspended
@@ -1780,7 +1780,7 @@ int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable)
	return ret;
}

#endif /* CONFIG_USB_SUSPEND */
#endif /* CONFIG_PM_RUNTIME */

struct bus_type usb_bus_type = {
	.name =		"usb",
+5 −5
Original line number Diff line number Diff line
@@ -2125,7 +2125,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg)

#endif	/* CONFIG_PM */

#ifdef	CONFIG_USB_SUSPEND
#ifdef	CONFIG_PM_RUNTIME

/* Workqueue routine for root-hub remote wakeup */
static void hcd_resume_work(struct work_struct *work)
@@ -2160,7 +2160,7 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd)
}
EXPORT_SYMBOL_GPL(usb_hcd_resume_root_hub);

#endif	/* CONFIG_USB_SUSPEND */
#endif	/* CONFIG_PM_RUNTIME */

/*-------------------------------------------------------------------------*/

@@ -2336,7 +2336,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_USB_SUSPEND
#ifdef CONFIG_PM_RUNTIME
	INIT_WORK(&hcd->wakeup_work, hcd_resume_work);
#endif

@@ -2590,7 +2590,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
	hcd->rh_registered = 0;
	spin_unlock_irq(&hcd_root_hub_lock);

#ifdef CONFIG_USB_SUSPEND
#ifdef CONFIG_PM_RUNTIME
	cancel_work_sync(&hcd->wakeup_work);
#endif
	mutex_lock(&usb_bus_list_lock);
@@ -2645,7 +2645,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
	hcd->rh_registered = 0;
	spin_unlock_irq (&hcd_root_hub_lock);

#ifdef CONFIG_USB_SUSPEND
#ifdef CONFIG_PM_RUNTIME
	cancel_work_sync(&hcd->wakeup_work);
#endif

+7 −35
Original line number Diff line number Diff line
@@ -2827,7 +2827,7 @@ void usb_enable_ltm(struct usb_device *udev)
}
EXPORT_SYMBOL_GPL(usb_enable_ltm);

#ifdef	CONFIG_USB_SUSPEND
#ifdef	CONFIG_PM
/*
 * usb_disable_function_remotewakeup - disable usb3.0
 * device's function remote wakeup
@@ -2886,7 +2886,7 @@ static int usb_disable_function_remotewakeup(struct usb_device *udev)
 * Linux (2.6) currently has NO mechanisms to initiate that:  no khubd
 * timer, no SRP, no requests through sysfs.
 *
 * If CONFIG_USB_SUSPEND isn't enabled, non-SuperSpeed devices really get
 * If Runtime PM isn't enabled or used, non-SuperSpeed devices really get
 * suspended only when their bus goes into global suspend (i.e., the root
 * hub is suspended).  Nevertheless, we change @udev->state to
 * USB_STATE_SUSPENDED as this is the device's "logical" state.  The actual
@@ -3247,6 +3247,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
	return status;
}

#endif	/* CONFIG_PM */

#ifdef	CONFIG_PM_RUNTIME

/* caller has locked udev */
int usb_remote_wakeup(struct usb_device *udev)
{
@@ -3263,38 +3267,6 @@ int usb_remote_wakeup(struct usb_device *udev)
	return status;
}

#else	/* CONFIG_USB_SUSPEND */

/* When CONFIG_USB_SUSPEND isn't set, we never suspend or resume any ports. */

int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
{
	return 0;
}

/* However we may need to do a reset-resume */

int usb_port_resume(struct usb_device *udev, pm_message_t msg)
{
	struct usb_hub	*hub = usb_hub_to_struct_hub(udev->parent);
	int		port1 = udev->portnum;
	int		status;
	u16		portchange, portstatus;

	status = hub_port_status(hub, port1, &portstatus, &portchange);
	status = check_port_resume_type(udev,
			hub, port1, status, portchange, portstatus);

	if (status) {
		dev_dbg(&udev->dev, "can't resume, status %d\n", status);
		hub_port_logical_disconnect(hub, port1);
	} else if (udev->reset_resume) {
		dev_dbg(&udev->dev, "reset-resume\n");
		status = usb_reset_and_verify_device(udev);
	}
	return status;
}

#endif

static int check_ports_changed(struct usb_hub *hub)
@@ -4356,7 +4328,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
		if (portstatus & USB_PORT_STAT_ENABLE) {
			status = 0;		/* Nothing to do */

#ifdef CONFIG_USB_SUSPEND
#ifdef CONFIG_PM_RUNTIME
		} else if (udev->state == USB_STATE_SUSPENDED &&
				udev->persist_enabled) {
			/* For a suspended device, treat this as a
+2 −2
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ static void usb_port_device_release(struct device *dev)
	kfree(port_dev);
}

#ifdef CONFIG_USB_SUSPEND
#ifdef CONFIG_PM_RUNTIME
static int usb_port_runtime_resume(struct device *dev)
{
	struct usb_port *port_dev = to_usb_port(dev);
@@ -139,7 +139,7 @@ static int usb_port_runtime_suspend(struct device *dev)
#endif

static const struct dev_pm_ops usb_port_pm_ops = {
#ifdef CONFIG_USB_SUSPEND
#ifdef CONFIG_PM_RUNTIME
	.runtime_suspend =	usb_port_runtime_suspend,
	.runtime_resume =	usb_port_runtime_resume,
	.runtime_idle =		pm_generic_runtime_idle,
Loading