Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+13 -15
+13 -15
drivers/usb/core/driver.c
··· 94 94 } 95 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 99 struct usb_driver *usb_drv = to_usb_driver(driver); 100 100 101 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 105 const char *buf, size_t count) 106 106 { 107 107 struct usb_driver *usb_drv = to_usb_driver(driver); 108 108 109 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 - /** 114 - * store_remove_id - 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. 113 + /* 114 + * Remove a USB device ID from this driver 122 115 */ 123 - static ssize_t 124 - store_remove_id(struct device_driver *driver, const char *buf, size_t count) 116 + static ssize_t remove_id_store(struct device_driver *driver, const char *buf, 117 + size_t count) 125 118 { 126 119 struct usb_dynid *dynid, *n; 127 120 struct usb_driver *usb_driver = to_usb_driver(driver); ··· 139 146 spin_unlock(&usb_driver->dynids.lock); 140 147 return count; 141 148 } 142 - static DRIVER_ATTR(remove_id, S_IRUGO | S_IWUSR, show_dynids, store_remove_id); 149 + 150 + static ssize_t remove_id_show(struct device_driver *driver, char *buf) 151 + { 152 + return new_id_show(driver, buf); 153 + } 154 + static DRIVER_ATTR_RW(remove_id); 143 155 144 156 static int usb_create_newid_files(struct usb_driver *usb_drv) 145 157 {