From ca35910a1ba21e45368640ac4d884536649966d9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 23 Jan 2018 11:24:07 +0100 Subject: USB: move many drivers to use DEVICE_ATTR_WO Instead of "open coding" a DEVICE_ATTR() define, use the DEVICE_ATTR_WO() macro instead, which does everything properly instead. This does require a few static functions to be renamed to work properly, but thanks to a script from Joe Perches, this was easily done. Reported-by: Joe Perches Cc: Peter Chen Cc: Valentina Manea Acked-by: Felipe Balbi Acked-by: Johan Hovold Acked-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- drivers/usb/usbip/stub_dev.c | 4 ++-- drivers/usb/usbip/vhci_sysfs.c | 8 ++++---- drivers/usb/usbip/vudc_sysfs.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/usb/usbip') diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c index e31a6f204397..49e552472c3f 100644 --- a/drivers/usb/usbip/stub_dev.c +++ b/drivers/usb/usbip/stub_dev.c @@ -39,7 +39,7 @@ static DEVICE_ATTR_RO(usbip_status); * is used to transfer usbip requests by kernel threads. -1 is a magic number * by which usbip connection is finished. */ -static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr, +static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct stub_device *sdev = dev_get_drvdata(dev); @@ -103,7 +103,7 @@ err: spin_unlock_irq(&sdev->ud.lock); return -EINVAL; } -static DEVICE_ATTR(usbip_sockfd, S_IWUSR, NULL, store_sockfd); +static DEVICE_ATTR_WO(usbip_sockfd); static int stub_add_files(struct device *dev) { diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c index a9de15cab2ec..48808388ec33 100644 --- a/drivers/usb/usbip/vhci_sysfs.c +++ b/drivers/usb/usbip/vhci_sysfs.c @@ -218,7 +218,7 @@ static int valid_port(__u32 pdev_nr, __u32 rhport) return 1; } -static ssize_t store_detach(struct device *dev, struct device_attribute *attr, +static ssize_t detach_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { __u32 port = 0, pdev_nr = 0, rhport = 0; @@ -256,7 +256,7 @@ static ssize_t store_detach(struct device *dev, struct device_attribute *attr, return count; } -static DEVICE_ATTR(detach, S_IWUSR, NULL, store_detach); +static DEVICE_ATTR_WO(detach); static int valid_args(__u32 pdev_nr, __u32 rhport, enum usb_device_speed speed) { @@ -292,7 +292,7 @@ static int valid_args(__u32 pdev_nr, __u32 rhport, enum usb_device_speed speed) * * write() returns 0 on success, else negative errno. */ -static ssize_t store_attach(struct device *dev, struct device_attribute *attr, +static ssize_t attach_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct socket *socket; @@ -387,7 +387,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, return count; } -static DEVICE_ATTR(attach, S_IWUSR, NULL, store_attach); +static DEVICE_ATTR_WO(attach); #define MAX_STATUS_NAME 16 diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c index 1adc8af292ec..d86f72bbbb91 100644 --- a/drivers/usb/usbip/vudc_sysfs.c +++ b/drivers/usb/usbip/vudc_sysfs.c @@ -90,7 +90,7 @@ unlock: } static BIN_ATTR_RO(dev_desc, sizeof(struct usb_device_descriptor)); -static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr, +static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *attr, const char *in, size_t count) { struct vudc *udc = (struct vudc *) dev_get_drvdata(dev); @@ -180,7 +180,7 @@ unlock: return ret; } -static DEVICE_ATTR(usbip_sockfd, S_IWUSR, NULL, store_sockfd); +static DEVICE_ATTR_WO(usbip_sockfd); static ssize_t usbip_status_show(struct device *dev, struct device_attribute *attr, char *out) -- cgit v1.2.3