summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/sysfs.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-04-02 13:22:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 13:21:37 -0700
commita90309860b0935805d49e75499fb8dc59fea8e94 (patch)
tree2d5ed0376a0f0ead945afdaa11be00a48bc0af6c /drivers/usb/core/sysfs.c
parent9e18c821659d836bd63f88df3c19729327728496 (diff)
downloadop-kernel-dev-a90309860b0935805d49e75499fb8dc59fea8e94.zip
op-kernel-dev-a90309860b0935805d49e75499fb8dc59fea8e94.tar.gz
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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index b65c1ea..06863be 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;
OpenPOWER on IntegriCloud