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

staging: usbip: use DEVICE_ATTR_RO/RW for sysfs attributes

It's easier to audit the sysfs files if they use the RO/RW macros, so
convert the usbip code to them.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+11 -10
+3 -3
drivers/staging/usbip/stub_dev.c
··· 56 56 * usbip_status shows the status of usbip-host as long as this driver is bound 57 57 * to the target device. 58 58 */ 59 - static ssize_t show_status(struct device *dev, struct device_attribute *attr, 60 - char *buf) 59 + static ssize_t usbip_status_show(struct device *dev, 60 + struct device_attribute *attr, char *buf) 61 61 { 62 62 struct stub_device *sdev = dev_get_drvdata(dev); 63 63 int status; ··· 73 73 74 74 return snprintf(buf, PAGE_SIZE, "%d\n", status); 75 75 } 76 - static DEVICE_ATTR(usbip_status, S_IRUGO, show_status, NULL); 76 + static DEVICE_ATTR_RO(usbip_status); 77 77 78 78 /* 79 79 * usbip_sockfd gets a socket descriptor of an established TCP connection that
+6 -5
drivers/staging/usbip/usbip_common.c
··· 45 45 struct device_attribute dev_attr_usbip_debug; 46 46 EXPORT_SYMBOL_GPL(dev_attr_usbip_debug); 47 47 48 - static ssize_t show_flag(struct device *dev, struct device_attribute *attr, 49 - char *buf) 48 + static ssize_t usbip_debug_show(struct device *dev, 49 + struct device_attribute *attr, char *buf) 50 50 { 51 51 return sprintf(buf, "%lx\n", usbip_debug_flag); 52 52 } 53 53 54 - static ssize_t store_flag(struct device *dev, struct device_attribute *attr, 55 - const char *buf, size_t count) 54 + static ssize_t usbip_debug_store(struct device *dev, 55 + struct device_attribute *attr, const char *buf, 56 + size_t count) 56 57 { 57 58 sscanf(buf, "%lx", &usbip_debug_flag); 58 59 return count; 59 60 } 60 - DEVICE_ATTR(usbip_debug, (S_IRUGO | S_IWUSR), show_flag, store_flag); 61 + DEVICE_ATTR_RW(usbip_debug); 61 62 62 63 static void usbip_dump_buffer(char *buff, int bufflen) 63 64 {
+2 -2
drivers/staging/usbip/vhci_sysfs.c
··· 27 27 /* TODO: refine locking ?*/ 28 28 29 29 /* Sysfs entry to show port status */ 30 - static ssize_t show_status(struct device *dev, struct device_attribute *attr, 30 + static ssize_t status_show(struct device *dev, struct device_attribute *attr, 31 31 char *out) 32 32 { 33 33 char *s = out; ··· 74 74 75 75 return out - s; 76 76 } 77 - static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); 77 + static DEVICE_ATTR_RO(status); 78 78 79 79 /* Sysfs entry to shutdown a virtual connection */ 80 80 static int vhci_port_disconnect(__u32 rhport)