diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-04-02 13:22:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-20 16:21:37 -0400 |
commit | a90309860b0935805d49e75499fb8dc59fea8e94 (patch) | |
tree | 2d5ed0376a0f0ead945afdaa11be00a48bc0af6c /drivers/usb/core/sysfs.c | |
parent | 9e18c821659d836bd63f88df3c19729327728496 (diff) |
USB: deprecate the power/level sysfs attribute
This patch (as1367) deprecates USB's power/level sysfs attribute in
favor of the power/control attribute provided by the runtime PM core.
The two attributes do the same thing.
It would be nice to replace power/level with a symlink to
power/control, but at the moment sysfs doesn't offer any way to do so.
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 | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index b65c1eaf3aba..06863befaf3a 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -383,12 +383,23 @@ static DEVICE_ATTR(autosuspend, S_IRUGO | S_IWUSR, | |||
383 | static const char on_string[] = "on"; | 383 | static const char on_string[] = "on"; |
384 | static const char auto_string[] = "auto"; | 384 | static const char auto_string[] = "auto"; |
385 | 385 | ||
386 | static void warn_level(void) { | ||
387 | static int level_warned; | ||
388 | |||
389 | if (!level_warned) { | ||
390 | level_warned = 1; | ||
391 | printk(KERN_WARNING "WARNING! power/level is deprecated; " | ||
392 | "use power/control instead\n"); | ||
393 | } | ||
394 | } | ||
395 | |||
386 | static ssize_t | 396 | static ssize_t |
387 | show_level(struct device *dev, struct device_attribute *attr, char *buf) | 397 | show_level(struct device *dev, struct device_attribute *attr, char *buf) |
388 | { | 398 | { |
389 | struct usb_device *udev = to_usb_device(dev); | 399 | struct usb_device *udev = to_usb_device(dev); |
390 | const char *p = auto_string; | 400 | const char *p = auto_string; |
391 | 401 | ||
402 | warn_level(); | ||
392 | if (udev->state != USB_STATE_SUSPENDED && !udev->dev.power.runtime_auto) | 403 | if (udev->state != USB_STATE_SUSPENDED && !udev->dev.power.runtime_auto) |
393 | p = on_string; | 404 | p = on_string; |
394 | return sprintf(buf, "%s\n", p); | 405 | return sprintf(buf, "%s\n", p); |
@@ -403,6 +414,7 @@ set_level(struct device *dev, struct device_attribute *attr, | |||
403 | char *cp; | 414 | char *cp; |
404 | int rc = count; | 415 | int rc = count; |
405 | 416 | ||
417 | warn_level(); | ||
406 | cp = memchr(buf, '\n', count); | 418 | cp = memchr(buf, '\n', count); |
407 | if (cp) | 419 | if (cp) |
408 | len = cp - buf; | 420 | len = cp - buf; |