From: Greg Kroah-Hartman Date: Mon, 26 Aug 2013 19:02:54 +0000 (-0700) Subject: staging: usbip: use DEVICE_ATTR_RO/RW for sysfs attributes X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b1f56acaca2efefcdf4b3f5962a99b27700c6e0a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index 83d629afdfe1..d8957a556626 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -56,8 +56,8 @@ MODULE_DEVICE_TABLE(usb, stub_table); * usbip_status shows the status of usbip-host as long as this driver is bound * to the target device. */ -static ssize_t show_status(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t usbip_status_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct stub_device *sdev = dev_get_drvdata(dev); int status; @@ -73,7 +73,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr, return snprintf(buf, PAGE_SIZE, "%d\n", status); } -static DEVICE_ATTR(usbip_status, S_IRUGO, show_status, NULL); +static DEVICE_ATTR_RO(usbip_status); /* * usbip_sockfd gets a socket descriptor of an established TCP connection that diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index 7b97df6f2a42..e3fc749c1e7e 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c @@ -45,19 +45,20 @@ MODULE_PARM_DESC(usbip_debug_flag, "debug flags (defined in usbip_common.h)"); struct device_attribute dev_attr_usbip_debug; EXPORT_SYMBOL_GPL(dev_attr_usbip_debug); -static ssize_t show_flag(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t usbip_debug_show(struct device *dev, + struct device_attribute *attr, char *buf) { return sprintf(buf, "%lx\n", usbip_debug_flag); } -static ssize_t store_flag(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t usbip_debug_store(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t count) { sscanf(buf, "%lx", &usbip_debug_flag); return count; } -DEVICE_ATTR(usbip_debug, (S_IRUGO | S_IWUSR), show_flag, store_flag); +DEVICE_ATTR_RW(usbip_debug); static void usbip_dump_buffer(char *buff, int bufflen) { diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c index c66e9c05c76b..9b51586d11d9 100644 --- a/drivers/staging/usbip/vhci_sysfs.c +++ b/drivers/staging/usbip/vhci_sysfs.c @@ -27,7 +27,7 @@ /* TODO: refine locking ?*/ /* Sysfs entry to show port status */ -static ssize_t show_status(struct device *dev, struct device_attribute *attr, +static ssize_t status_show(struct device *dev, struct device_attribute *attr, char *out) { char *s = out; @@ -74,7 +74,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr, return out - s; } -static DEVICE_ATTR(status, S_IRUGO, show_status, NULL); +static DEVICE_ATTR_RO(status); /* Sysfs entry to shutdown a virtual connection */ static int vhci_port_disconnect(__u32 rhport)