aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-23 18:12:14 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-23 18:12:14 -0400
commit598d03610a0169eb88d2b08d6743be31b3b9c258 (patch)
treeb80d19bf1a46254ee1f46fb250242083f377576c /drivers/usb/core
parent3bbc47d8b07abad56780a8e214520259808c4f8b (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.c28
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}
95EXPORT_SYMBOL_GPL(usb_show_dynids); 95EXPORT_SYMBOL_GPL(usb_show_dynids);
96 96
97static ssize_t show_dynids(struct device_driver *driver, char *buf) 97static 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
104static ssize_t store_new_id(struct device_driver *driver, 104static 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}
111static DRIVER_ATTR(new_id, S_IRUGO | S_IWUSR, show_dynids, store_new_id); 111static 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 */
123static ssize_t 116static ssize_t remove_id_store(struct device_driver *driver, const char *buf,
124store_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}
149static DRIVER_ATTR(remove_id, S_IRUGO | S_IWUSR, show_dynids, store_remove_id); 142
143static ssize_t remove_id_show(struct device_driver *driver, char *buf)
144{
145 return new_id_show(driver, buf);
146}
147static DRIVER_ATTR_RW(remove_id);
150 148
151static int usb_create_newid_files(struct usb_driver *usb_drv) 149static int usb_create_newid_files(struct usb_driver *usb_drv)
152{ 150{