diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-23 18:12:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-23 18:12:14 -0400 |
commit | 598d03610a0169eb88d2b08d6743be31b3b9c258 (patch) | |
tree | b80d19bf1a46254ee1f46fb250242083f377576c /drivers/usb/core | |
parent | 3bbc47d8b07abad56780a8e214520259808c4f8b (diff) |
USB: core: use DRIVER_ATTR_RW()
Use DRIVER_ATTR_RW() to make it easier to audit sysfs file permissions.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/driver.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 124bcc50b0b7..f7841d44feda 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -94,34 +94,27 @@ ssize_t usb_show_dynids(struct usb_dynids *dynids, char *buf) | |||
94 | } | 94 | } |
95 | EXPORT_SYMBOL_GPL(usb_show_dynids); | 95 | EXPORT_SYMBOL_GPL(usb_show_dynids); |
96 | 96 | ||
97 | static ssize_t show_dynids(struct device_driver *driver, char *buf) | 97 | static ssize_t new_id_show(struct device_driver *driver, char *buf) |
98 | { | 98 | { |
99 | struct usb_driver *usb_drv = to_usb_driver(driver); | 99 | struct usb_driver *usb_drv = to_usb_driver(driver); |
100 | 100 | ||
101 | return usb_show_dynids(&usb_drv->dynids, buf); | 101 | return usb_show_dynids(&usb_drv->dynids, buf); |
102 | } | 102 | } |
103 | 103 | ||
104 | static ssize_t store_new_id(struct device_driver *driver, | 104 | static ssize_t new_id_store(struct device_driver *driver, |
105 | const char *buf, size_t count) | 105 | const char *buf, size_t count) |
106 | { | 106 | { |
107 | struct usb_driver *usb_drv = to_usb_driver(driver); | 107 | struct usb_driver *usb_drv = to_usb_driver(driver); |
108 | 108 | ||
109 | return usb_store_new_id(&usb_drv->dynids, driver, buf, count); | 109 | return usb_store_new_id(&usb_drv->dynids, driver, buf, count); |
110 | } | 110 | } |
111 | static DRIVER_ATTR(new_id, S_IRUGO | S_IWUSR, show_dynids, store_new_id); | 111 | static DRIVER_ATTR_RW(new_id); |
112 | 112 | ||
113 | /** | 113 | /* |
114 | * store_remove_id - remove a USB device ID from this driver | 114 | * Remove a USB device ID from this driver |
115 | * @driver: target device driver | ||
116 | * @buf: buffer for scanning device ID data | ||
117 | * @count: input size | ||
118 | * | ||
119 | * Removes a dynamic usb device ID from this driver. | ||
120 | * | ||
121 | * Return: @count on success. A negative error code otherwise. | ||
122 | */ | 115 | */ |
123 | static ssize_t | 116 | static ssize_t remove_id_store(struct device_driver *driver, const char *buf, |
124 | store_remove_id(struct device_driver *driver, const char *buf, size_t count) | 117 | size_t count) |
125 | { | 118 | { |
126 | struct usb_dynid *dynid, *n; | 119 | struct usb_dynid *dynid, *n; |
127 | struct usb_driver *usb_driver = to_usb_driver(driver); | 120 | struct usb_driver *usb_driver = to_usb_driver(driver); |
@@ -146,7 +139,12 @@ store_remove_id(struct device_driver *driver, const char *buf, size_t count) | |||
146 | spin_unlock(&usb_driver->dynids.lock); | 139 | spin_unlock(&usb_driver->dynids.lock); |
147 | return count; | 140 | return count; |
148 | } | 141 | } |
149 | static DRIVER_ATTR(remove_id, S_IRUGO | S_IWUSR, show_dynids, store_remove_id); | 142 | |
143 | static ssize_t remove_id_show(struct device_driver *driver, char *buf) | ||
144 | { | ||
145 | return new_id_show(driver, buf); | ||
146 | } | ||
147 | static DRIVER_ATTR_RW(remove_id); | ||
150 | 148 | ||
151 | static int usb_create_newid_files(struct usb_driver *usb_drv) | 149 | static int usb_create_newid_files(struct usb_driver *usb_drv) |
152 | { | 150 | { |