USB: move many drivers to use DEVICE_ATTR_WO
Greg Kroah-Hartman
maintainerPATCH 3/6 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 <[email protected]>
Cc Peter Chen <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Johan Hovold <[email protected]>
Cc Valentina Manea <[email protected]>
Cc Shuah Khan <[email protected]>
Signed-off-by Greg Kroah-Hartman <[email protected]>
--- drivers/usb/chipidea/otg_fsm.c | 4 ++-- drivers/usb/gadget/udc/core.c | 8 ++++---- drivers/usb/phy/phy-mv-usb.c | 4 ++-- drivers/usb/serial/ftdi_sio.c | 4 ++-- drivers/usb/usbip/stub_dev.c | 4 ++-- drivers/usb/usbip/vhci_sysfs.c | 8 ++++---- drivers/usb/usbip/vudc_sysfs.c | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-)
drivers/usb/chipidea/otg_fsm.c +2 -2
@@ -162,7 +162,7 @@ b_bus_req_store(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RW (b_bus_req);static ssize_t -set_a_clr_err (struct device *dev,struct device_attribute *attr, +a_clr_err_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {struct ci_hdrc *ci =dev_get_drvdata (dev);
@@ -179,7 +179,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr,return count; } -static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err); +static DEVICE_ATTR_WO (a_clr_err);static struct attribute *inputs_attrs[] = { &dev_attr_a_bus_req.attr,
drivers/usb/gadget/udc/core.c +4 -4
@@ -1417,7 +1417,7 @@ EXPORT_SYMBOL_GPL(usb_gadget_unregister_driver);/* ------------------------------------------------------------------------- */ -static ssize_t usb_udc_srp_store (struct device *dev, +static ssize_t srp_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t n) { struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
@@ -1427,9 +1427,9 @@ static ssize_t usb_udc_srp_store(struct device *dev,return n; } -static DEVICE_ATTR(srp, S_IWUSR, NULL, usb_udc_srp_store); +static DEVICE_ATTR_WO (srp); -static ssize_t usb_udc_softconn_store (struct device *dev, +static ssize_t soft_connect_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t n) { struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
@@ -1453,7 +1453,7 @@ static ssize_t usb_udc_softconn_store(struct device *dev,return n; } -static DEVICE_ATTR(soft_connect, S_IWUSR, NULL, usb_udc_softconn_store); +static DEVICE_ATTR_WO (soft_connect);static ssize_t state_show (struct device *dev,struct device_attribute *attr,char *buf)
drivers/usb/phy/phy-mv-usb.c +2 -2
@@ -562,7 +562,7 @@ a_bus_req_store(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RW (a_bus_req);static ssize_t -set_a_clr_err (struct device *dev,struct device_attribute *attr, +a_clr_err_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t count) {struct mv_otg *mvotg =dev_get_drvdata (dev);
@@ -586,7 +586,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr,return count; } -static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err); +static DEVICE_ATTR_WO (a_clr_err); static ssize_t a_bus_drop_show(struct device *dev, struct device_attribute *attr,
drivers/usb/serial/ftdi_sio.c +2 -2
@@ -1691,7 +1691,7 @@ static DEVICE_ATTR_RW(latency_timer);/* Write an event character directly to the FTDI register. The ASCII value is in the low 8 bits, with the enable bit in the 9th bit. */ -static ssize_t store_event_char (struct device *dev, +static ssize_t event_char_store (struct device *dev,struct device_attribute *attr,const char *valbuf,size_t count) {struct usb_serial_port *port =to_usb_serial_port (dev);
@@ -1718,7 +1718,7 @@ static ssize_t store_event_char(struct device *dev,return count; } -static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char); +static DEVICE_ATTR_WO (event_char);static int create_sysfs_attrs (struct usb_serial_port *port) {
drivers/usb/usbip/stub_dev.c +2 -2
@@ -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 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,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) {
drivers/usb/usbip/vhci_sysfs.c +4 -4
@@ -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
drivers/usb/usbip/vudc_sysfs.c +2 -2
@@ -90,7 +90,7 @@ static ssize_t dev_desc_read(struct file *file, struct kobject *kobj, } 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 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,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)