diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-04-02 13:22:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:37 -0400 |
commit | 9e18c821659d836bd63f88df3c19729327728496 (patch) | |
tree | 4148e58d0e03aecfe0dbeedd175bc960006570a9 /drivers/usb/core/sysfs.c | |
parent | 7aba8d014341341590ecb64050b7a026642a62eb (diff) |
USB: use PM core routines to enable/disable autosuspend
This patch (as1366) replaces the private routines
usb_enable_autosuspend() and usb_disable_autosuspend() with calls to
the standard pm_runtime_allow() and pm_runtime_forbid() functions in
the runtime PM framework. They do the same thing.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/sysfs.c')
-rw-r--r-- | drivers/usb/core/sysfs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 43c002e3a9aa..b65c1eaf3aba 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -389,7 +389,7 @@ show_level(struct device *dev, struct device_attribute *attr, char *buf) | |||
389 | struct usb_device *udev = to_usb_device(dev); | 389 | struct usb_device *udev = to_usb_device(dev); |
390 | const char *p = auto_string; | 390 | const char *p = auto_string; |
391 | 391 | ||
392 | if (udev->state != USB_STATE_SUSPENDED && udev->autosuspend_disabled) | 392 | if (udev->state != USB_STATE_SUSPENDED && !udev->dev.power.runtime_auto) |
393 | p = on_string; | 393 | p = on_string; |
394 | return sprintf(buf, "%s\n", p); | 394 | return sprintf(buf, "%s\n", p); |
395 | } | 395 | } |
@@ -401,7 +401,7 @@ set_level(struct device *dev, struct device_attribute *attr, | |||
401 | struct usb_device *udev = to_usb_device(dev); | 401 | struct usb_device *udev = to_usb_device(dev); |
402 | int len = count; | 402 | int len = count; |
403 | char *cp; | 403 | char *cp; |
404 | int rc; | 404 | int rc = count; |
405 | 405 | ||
406 | cp = memchr(buf, '\n', count); | 406 | cp = memchr(buf, '\n', count); |
407 | if (cp) | 407 | if (cp) |
@@ -411,17 +411,17 @@ set_level(struct device *dev, struct device_attribute *attr, | |||
411 | 411 | ||
412 | if (len == sizeof on_string - 1 && | 412 | if (len == sizeof on_string - 1 && |
413 | strncmp(buf, on_string, len) == 0) | 413 | strncmp(buf, on_string, len) == 0) |
414 | rc = usb_disable_autosuspend(udev); | 414 | usb_disable_autosuspend(udev); |
415 | 415 | ||
416 | else if (len == sizeof auto_string - 1 && | 416 | else if (len == sizeof auto_string - 1 && |
417 | strncmp(buf, auto_string, len) == 0) | 417 | strncmp(buf, auto_string, len) == 0) |
418 | rc = usb_enable_autosuspend(udev); | 418 | usb_enable_autosuspend(udev); |
419 | 419 | ||
420 | else | 420 | else |
421 | rc = -EINVAL; | 421 | rc = -EINVAL; |
422 | 422 | ||
423 | usb_unlock_device(udev); | 423 | usb_unlock_device(udev); |
424 | return (rc < 0 ? rc : count); | 424 | return rc; |
425 | } | 425 | } |
426 | 426 | ||
427 | static DEVICE_ATTR(level, S_IRUGO | S_IWUSR, show_level, set_level); | 427 | static DEVICE_ATTR(level, S_IRUGO | S_IWUSR, show_level, set_level); |