From a90309860b0935805d49e75499fb8dc59fea8e94 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Fri, 2 Apr 2010 13:22:16 -0400 Subject: 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 Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/sysfs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers') diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index b65c1eaf3ab..06863befaf3 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, static const char on_string[] = "on"; static const char auto_string[] = "auto"; +static void warn_level(void) { + static int level_warned; + + if (!level_warned) { + level_warned = 1; + printk(KERN_WARNING "WARNING! power/level is deprecated; " + "use power/control instead\n"); + } +} + static ssize_t show_level(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_device *udev = to_usb_device(dev); const char *p = auto_string; + warn_level(); if (udev->state != USB_STATE_SUSPENDED && !udev->dev.power.runtime_auto) p = on_string; return sprintf(buf, "%s\n", p); @@ -403,6 +414,7 @@ set_level(struct device *dev, struct device_attribute *attr, char *cp; int rc = count; + warn_level(); cp = memchr(buf, '\n', count); if (cp) len = cp - buf; -- cgit v1.2.3-70-g09d2