Skip to content

Commit

Permalink
USB: use the device lock for persist_enabled
Browse files Browse the repository at this point in the history
This patch (as1325) changes the locking for the persist_enabled flag
in struct usb_device.  Now it is protected by the device lock, along
with all its neighboring bit flags, instead of the PM lock (which is
about to vanish anyway).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent 0534d46 commit 0c4db6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/usb/core/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ set_persist(struct device *dev, struct device_attribute *attr,

if (sscanf(buf, "%d", &value) != 1)
return -EINVAL;
usb_pm_lock(udev);

usb_lock_device(udev);
udev->persist_enabled = !!value;
usb_pm_unlock(udev);
usb_unlock_device(udev);
return count;
}

Expand Down

0 comments on commit 0c4db6d

Please sign in to comment.