diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-06-29 11:00:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-23 09:46:23 -0400 |
commit | ccf5b801cef4f9e2d708d3b87e91e2bc6abd5206 (patch) | |
tree | 1b7de13df336f44f6f74657934e79dc8c0bfd142 /include/linux/usb.h | |
parent | 7cbe5dca399a50ce8aa74314b1d276e2fb904e1b (diff) |
USB: make intf.pm_usage an atomic_t
This patch (as1260) changes the pm_usage_cnt field in struct
usb_interface from an int to an atomic_t. This is so that drivers can
invoke the usb_autopm_get_interface_async() and
usb_autopm_put_interface_async() routines without locking and without
fear of corrupting the pm_usage_cnt value.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 3b45a0d27b80..a34fa89f1474 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -195,7 +195,7 @@ struct usb_interface { | |||
195 | 195 | ||
196 | struct device dev; /* interface specific device info */ | 196 | struct device dev; /* interface specific device info */ |
197 | struct device *usb_dev; | 197 | struct device *usb_dev; |
198 | int pm_usage_cnt; /* usage counter for autosuspend */ | 198 | atomic_t pm_usage_cnt; /* usage counter for autosuspend */ |
199 | struct work_struct reset_ws; /* for resets in atomic context */ | 199 | struct work_struct reset_ws; /* for resets in atomic context */ |
200 | }; | 200 | }; |
201 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) | 201 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) |
@@ -551,13 +551,13 @@ extern void usb_autopm_put_interface_async(struct usb_interface *intf); | |||
551 | 551 | ||
552 | static inline void usb_autopm_enable(struct usb_interface *intf) | 552 | static inline void usb_autopm_enable(struct usb_interface *intf) |
553 | { | 553 | { |
554 | intf->pm_usage_cnt = 0; | 554 | atomic_set(&intf->pm_usage_cnt, 0); |
555 | usb_autopm_set_interface(intf); | 555 | usb_autopm_set_interface(intf); |
556 | } | 556 | } |
557 | 557 | ||
558 | static inline void usb_autopm_disable(struct usb_interface *intf) | 558 | static inline void usb_autopm_disable(struct usb_interface *intf) |
559 | { | 559 | { |
560 | intf->pm_usage_cnt = 1; | 560 | atomic_set(&intf->pm_usage_cnt, 1); |
561 | usb_autopm_set_interface(intf); | 561 | usb_autopm_set_interface(intf); |
562 | } | 562 | } |
563 | 563 | ||