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

Commit 98d9a82e authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman
Browse files

USB: cleanup the handling of the PM complete call



This eliminates the last instance of a function's behavior
controlled by a parameter as Linus hates such things.

Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1493138a
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -1336,27 +1336,31 @@ int usb_suspend(struct device *dev, pm_message_t msg)
}

/* The device lock is held by the PM core */
int usb_resume(struct device *dev, pm_message_t msg)
int usb_resume_complete(struct device *dev)
{
	struct usb_device *udev = to_usb_device(dev);
	int			status;

	/* For PM complete calls, all we do is rebind interfaces
	 * whose needs_binding flag is set
	 */
	if (msg.event == PM_EVENT_ON) {
	if (udev->state != USB_STATE_NOTATTACHED)
		do_rebind_interfaces(udev);
		status = 0;
	return 0;
}

	/* For all other calls, take the device back to full power and
/* The device lock is held by the PM core */
int usb_resume(struct device *dev, pm_message_t msg)
{
	struct usb_device	*udev = to_usb_device(dev);
	int			status;

	/* For all calls, take the device back to full power and
	 * tell the PM core in case it was autosuspended previously.
	 * Unbind the interfaces that will need rebinding later,
	 * because they fail to support reset_resume.
	 * (This can't be done in usb_resume_interface()
	 * above because it doesn't own the right set of locks.)
	 */
	} else {
	status = usb_resume_both(udev, msg);
	if (status == 0) {
		pm_runtime_disable(dev);
@@ -1364,7 +1368,6 @@ int usb_resume(struct device *dev, pm_message_t msg)
		pm_runtime_enable(dev);
		unbind_no_reset_resume_drivers_interfaces(udev);
	}
	}

	/* Avoid PM error messages for devices disconnected while suspended
	 * as we'll display regular disconnect messages just a bit later.
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ static int usb_dev_prepare(struct device *dev)
static void usb_dev_complete(struct device *dev)
{
	/* Currently used only for rebinding interfaces */
	usb_resume(dev, PMSG_ON);	/* FIXME: change to PMSG_COMPLETE */
	usb_resume_complete(dev);
}

static int usb_dev_suspend(struct device *dev)
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ extern void usb_major_cleanup(void);

extern int usb_suspend(struct device *dev, pm_message_t msg);
extern int usb_resume(struct device *dev, pm_message_t msg);
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);