summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-23 05:24:05 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-24 02:49:51 -0500
commited5bd7a47fd77166860e39f857ae8e3fe25c836c (patch)
tree959a976e951c0165837f8b497858b3319ea9411e
parent32366fc9fe5a91c947e71616fb2b931442888fdd (diff)
USB: move many drivers to use DEVICE_ATTR_RW
Instead of "open coding" a DEVICE_ATTR() define, use the DEVICE_ATTR_RW() 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 <joe@perches.com> Cc: Matthieu CASTET <castet.matthieu@free.fr> Cc: Stanislaw Gruszka <stf_xl@wp.pl> Cc: Peter Chen <Peter.Chen@nxp.com> Cc: Mathias Nyman <mathias.nyman@intel.com> Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/atm/ueagle-atm.c6
-rw-r--r--drivers/usb/chipidea/core.c6
-rw-r--r--drivers/usb/chipidea/otg_fsm.c19
-rw-r--r--drivers/usb/host/ehci-sysfs.c12
-rw-r--r--drivers/usb/host/fotg210-hcd.c7
-rw-r--r--drivers/usb/host/xhci-dbgcap.c2
-rw-r--r--drivers/usb/misc/cypress_cy7c63.c12
-rw-r--r--drivers/usb/misc/trancevibrator.c6
-rw-r--r--drivers/usb/misc/usbsevseg.c18
-rw-r--r--drivers/usb/musb/musb_core.c12
-rw-r--r--drivers/usb/phy/phy-mv-usb.c14
-rw-r--r--drivers/usb/phy/phy-tahvo.c2
12 files changed, 56 insertions, 60 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index ab75690044bb..adc06609219f 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2280,7 +2280,7 @@ static struct uea_softc *dev_to_uea(struct device *dev)
2280 return usbatm->driver_data; 2280 return usbatm->driver_data;
2281} 2281}
2282 2282
2283static ssize_t read_status(struct device *dev, struct device_attribute *attr, 2283static ssize_t stat_status_show(struct device *dev, struct device_attribute *attr,
2284 char *buf) 2284 char *buf)
2285{ 2285{
2286 int ret = -ENODEV; 2286 int ret = -ENODEV;
@@ -2296,7 +2296,7 @@ out:
2296 return ret; 2296 return ret;
2297} 2297}
2298 2298
2299static ssize_t reboot(struct device *dev, struct device_attribute *attr, 2299static ssize_t stat_status_store(struct device *dev, struct device_attribute *attr,
2300 const char *buf, size_t count) 2300 const char *buf, size_t count)
2301{ 2301{
2302 int ret = -ENODEV; 2302 int ret = -ENODEV;
@@ -2313,7 +2313,7 @@ out:
2313 return ret; 2313 return ret;
2314} 2314}
2315 2315
2316static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot); 2316static DEVICE_ATTR_RW(stat_status);
2317 2317
2318static ssize_t read_human_status(struct device *dev, 2318static ssize_t read_human_status(struct device *dev,
2319 struct device_attribute *attr, char *buf) 2319 struct device_attribute *attr, char *buf)
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index dd2dd9391bb7..33ae87fa3ff3 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -835,7 +835,7 @@ static void ci_get_otg_capable(struct ci_hdrc *ci)
835 } 835 }
836} 836}
837 837
838static ssize_t ci_role_show(struct device *dev, struct device_attribute *attr, 838static ssize_t role_show(struct device *dev, struct device_attribute *attr,
839 char *buf) 839 char *buf)
840{ 840{
841 struct ci_hdrc *ci = dev_get_drvdata(dev); 841 struct ci_hdrc *ci = dev_get_drvdata(dev);
@@ -846,7 +846,7 @@ static ssize_t ci_role_show(struct device *dev, struct device_attribute *attr,
846 return 0; 846 return 0;
847} 847}
848 848
849static ssize_t ci_role_store(struct device *dev, 849static ssize_t role_store(struct device *dev,
850 struct device_attribute *attr, const char *buf, size_t n) 850 struct device_attribute *attr, const char *buf, size_t n)
851{ 851{
852 struct ci_hdrc *ci = dev_get_drvdata(dev); 852 struct ci_hdrc *ci = dev_get_drvdata(dev);
@@ -877,7 +877,7 @@ static ssize_t ci_role_store(struct device *dev,
877 877
878 return (ret == 0) ? n : ret; 878 return (ret == 0) ? n : ret;
879} 879}
880static DEVICE_ATTR(role, 0644, ci_role_show, ci_role_store); 880static DEVICE_ATTR_RW(role);
881 881
882static struct attribute *ci_attrs[] = { 882static struct attribute *ci_attrs[] = {
883 &dev_attr_role.attr, 883 &dev_attr_role.attr,
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index 9e2d300060bc..d076cfa22fdf 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -29,7 +29,7 @@
29 29
30/* Add for otg: interact with user space app */ 30/* Add for otg: interact with user space app */
31static ssize_t 31static ssize_t
32get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf) 32a_bus_req_show(struct device *dev, struct device_attribute *attr, char *buf)
33{ 33{
34 char *next; 34 char *next;
35 unsigned size, t; 35 unsigned size, t;
@@ -45,7 +45,7 @@ get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf)
45} 45}
46 46
47static ssize_t 47static ssize_t
48set_a_bus_req(struct device *dev, struct device_attribute *attr, 48a_bus_req_store(struct device *dev, struct device_attribute *attr,
49 const char *buf, size_t count) 49 const char *buf, size_t count)
50{ 50{
51 struct ci_hdrc *ci = dev_get_drvdata(dev); 51 struct ci_hdrc *ci = dev_get_drvdata(dev);
@@ -75,10 +75,10 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr,
75 75
76 return count; 76 return count;
77} 77}
78static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, set_a_bus_req); 78static DEVICE_ATTR_RW(a_bus_req);
79 79
80static ssize_t 80static ssize_t
81get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) 81a_bus_drop_show(struct device *dev, struct device_attribute *attr, char *buf)
82{ 82{
83 char *next; 83 char *next;
84 unsigned size, t; 84 unsigned size, t;
@@ -94,7 +94,7 @@ get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf)
94} 94}
95 95
96static ssize_t 96static ssize_t
97set_a_bus_drop(struct device *dev, struct device_attribute *attr, 97a_bus_drop_store(struct device *dev, struct device_attribute *attr,
98 const char *buf, size_t count) 98 const char *buf, size_t count)
99{ 99{
100 struct ci_hdrc *ci = dev_get_drvdata(dev); 100 struct ci_hdrc *ci = dev_get_drvdata(dev);
@@ -115,11 +115,10 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr,
115 115
116 return count; 116 return count;
117} 117}
118static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, 118static DEVICE_ATTR_RW(a_bus_drop);
119 set_a_bus_drop);
120 119
121static ssize_t 120static ssize_t
122get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) 121b_bus_req_show(struct device *dev, struct device_attribute *attr, char *buf)
123{ 122{
124 char *next; 123 char *next;
125 unsigned size, t; 124 unsigned size, t;
@@ -135,7 +134,7 @@ get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf)
135} 134}
136 135
137static ssize_t 136static ssize_t
138set_b_bus_req(struct device *dev, struct device_attribute *attr, 137b_bus_req_store(struct device *dev, struct device_attribute *attr,
139 const char *buf, size_t count) 138 const char *buf, size_t count)
140{ 139{
141 struct ci_hdrc *ci = dev_get_drvdata(dev); 140 struct ci_hdrc *ci = dev_get_drvdata(dev);
@@ -160,7 +159,7 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr,
160 159
161 return count; 160 return count;
162} 161}
163static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUSR, get_b_bus_req, set_b_bus_req); 162static DEVICE_ATTR_RW(b_bus_req);
164 163
165static ssize_t 164static ssize_t
166set_a_clr_err(struct device *dev, struct device_attribute *attr, 165set_a_clr_err(struct device *dev, struct device_attribute *attr,
diff --git a/drivers/usb/host/ehci-sysfs.c b/drivers/usb/host/ehci-sysfs.c
index 71fb61dd4a87..8f75cb7b197c 100644
--- a/drivers/usb/host/ehci-sysfs.c
+++ b/drivers/usb/host/ehci-sysfs.c
@@ -7,7 +7,7 @@
7 7
8 8
9/* Display the ports dedicated to the companion controller */ 9/* Display the ports dedicated to the companion controller */
10static ssize_t show_companion(struct device *dev, 10static ssize_t companion_show(struct device *dev,
11 struct device_attribute *attr, 11 struct device_attribute *attr,
12 char *buf) 12 char *buf)
13{ 13{
@@ -34,7 +34,7 @@ static ssize_t show_companion(struct device *dev,
34 * Syntax is "[-]portnum", where a leading '-' sign means 34 * Syntax is "[-]portnum", where a leading '-' sign means
35 * return control of the port to the EHCI controller. 35 * return control of the port to the EHCI controller.
36 */ 36 */
37static ssize_t store_companion(struct device *dev, 37static ssize_t companion_store(struct device *dev,
38 struct device_attribute *attr, 38 struct device_attribute *attr,
39 const char *buf, size_t count) 39 const char *buf, size_t count)
40{ 40{
@@ -59,13 +59,13 @@ static ssize_t store_companion(struct device *dev,
59 set_owner(ehci, portnum, new_owner); 59 set_owner(ehci, portnum, new_owner);
60 return count; 60 return count;
61} 61}
62static DEVICE_ATTR(companion, 0644, show_companion, store_companion); 62static DEVICE_ATTR_RW(companion);
63 63
64 64
65/* 65/*
66 * Display / Set uframe_periodic_max 66 * Display / Set uframe_periodic_max
67 */ 67 */
68static ssize_t show_uframe_periodic_max(struct device *dev, 68static ssize_t uframe_periodic_max_show(struct device *dev,
69 struct device_attribute *attr, 69 struct device_attribute *attr,
70 char *buf) 70 char *buf)
71{ 71{
@@ -78,7 +78,7 @@ static ssize_t show_uframe_periodic_max(struct device *dev,
78} 78}
79 79
80 80
81static ssize_t store_uframe_periodic_max(struct device *dev, 81static ssize_t uframe_periodic_max_store(struct device *dev,
82 struct device_attribute *attr, 82 struct device_attribute *attr,
83 const char *buf, size_t count) 83 const char *buf, size_t count)
84{ 84{
@@ -143,7 +143,7 @@ out_unlock:
143 spin_unlock_irqrestore (&ehci->lock, flags); 143 spin_unlock_irqrestore (&ehci->lock, flags);
144 return ret; 144 return ret;
145} 145}
146static DEVICE_ATTR(uframe_periodic_max, 0644, show_uframe_periodic_max, store_uframe_periodic_max); 146static DEVICE_ATTR_RW(uframe_periodic_max);
147 147
148 148
149static inline int create_sysfs_files(struct ehci_hcd *ehci) 149static inline int create_sysfs_files(struct ehci_hcd *ehci)
diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index f3e1e7df88a5..d8abf401918a 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -4693,7 +4693,7 @@ static void scan_isoc(struct fotg210_hcd *fotg210)
4693 4693
4694/* Display / Set uframe_periodic_max 4694/* Display / Set uframe_periodic_max
4695 */ 4695 */
4696static ssize_t show_uframe_periodic_max(struct device *dev, 4696static ssize_t uframe_periodic_max_show(struct device *dev,
4697 struct device_attribute *attr, char *buf) 4697 struct device_attribute *attr, char *buf)
4698{ 4698{
4699 struct fotg210_hcd *fotg210; 4699 struct fotg210_hcd *fotg210;
@@ -4705,7 +4705,7 @@ static ssize_t show_uframe_periodic_max(struct device *dev,
4705} 4705}
4706 4706
4707 4707
4708static ssize_t store_uframe_periodic_max(struct device *dev, 4708static ssize_t uframe_periodic_max_store(struct device *dev,
4709 struct device_attribute *attr, const char *buf, size_t count) 4709 struct device_attribute *attr, const char *buf, size_t count)
4710{ 4710{
4711 struct fotg210_hcd *fotg210; 4711 struct fotg210_hcd *fotg210;
@@ -4772,8 +4772,7 @@ out_unlock:
4772 return ret; 4772 return ret;
4773} 4773}
4774 4774
4775static DEVICE_ATTR(uframe_periodic_max, 0644, show_uframe_periodic_max, 4775static DEVICE_ATTR_RW(uframe_periodic_max);
4776 store_uframe_periodic_max);
4777 4776
4778static inline int create_sysfs_files(struct fotg210_hcd *fotg210) 4777static inline int create_sysfs_files(struct fotg210_hcd *fotg210)
4779{ 4778{
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index 452df0f87d6e..a1ab8acf39ba 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
920 return count; 920 return count;
921} 921}
922 922
923static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store); 923static DEVICE_ATTR_RW(dbc);
924 924
925int xhci_dbc_init(struct xhci_hcd *xhci) 925int xhci_dbc_init(struct xhci_hcd *xhci)
926{ 926{
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index bf4d2778907e..9d780b77314b 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -144,7 +144,7 @@ error:
144} 144}
145 145
146/* attribute callback handler (write) */ 146/* attribute callback handler (write) */
147static ssize_t set_port0_handler(struct device *dev, 147static ssize_t port0_store(struct device *dev,
148 struct device_attribute *attr, 148 struct device_attribute *attr,
149 const char *buf, size_t count) 149 const char *buf, size_t count)
150{ 150{
@@ -152,7 +152,7 @@ static ssize_t set_port0_handler(struct device *dev,
152} 152}
153 153
154/* attribute callback handler (write) */ 154/* attribute callback handler (write) */
155static ssize_t set_port1_handler(struct device *dev, 155static ssize_t port1_store(struct device *dev,
156 struct device_attribute *attr, 156 struct device_attribute *attr,
157 const char *buf, size_t count) 157 const char *buf, size_t count)
158{ 158{
@@ -178,22 +178,22 @@ static ssize_t read_port(struct device *dev, struct device_attribute *attr,
178} 178}
179 179
180/* attribute callback handler (read) */ 180/* attribute callback handler (read) */
181static ssize_t get_port0_handler(struct device *dev, 181static ssize_t port0_show(struct device *dev,
182 struct device_attribute *attr, char *buf) 182 struct device_attribute *attr, char *buf)
183{ 183{
184 return read_port(dev, attr, buf, 0, CYPRESS_READ_PORT_ID0); 184 return read_port(dev, attr, buf, 0, CYPRESS_READ_PORT_ID0);
185} 185}
186 186
187/* attribute callback handler (read) */ 187/* attribute callback handler (read) */
188static ssize_t get_port1_handler(struct device *dev, 188static ssize_t port1_show(struct device *dev,
189 struct device_attribute *attr, char *buf) 189 struct device_attribute *attr, char *buf)
190{ 190{
191 return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); 191 return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1);
192} 192}
193 193
194static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); 194static DEVICE_ATTR_RW(port0);
195 195
196static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); 196static DEVICE_ATTR_RW(port1);
197 197
198 198
199static int cypress_probe(struct usb_interface *interface, 199static int cypress_probe(struct usb_interface *interface,
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c
index d83af2a332e4..b3e1f553954a 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -30,7 +30,7 @@ struct trancevibrator {
30 unsigned int speed; 30 unsigned int speed;
31}; 31};
32 32
33static ssize_t show_speed(struct device *dev, struct device_attribute *attr, 33static ssize_t speed_show(struct device *dev, struct device_attribute *attr,
34 char *buf) 34 char *buf)
35{ 35{
36 struct usb_interface *intf = to_usb_interface(dev); 36 struct usb_interface *intf = to_usb_interface(dev);
@@ -39,7 +39,7 @@ static ssize_t show_speed(struct device *dev, struct device_attribute *attr,
39 return sprintf(buf, "%d\n", tv->speed); 39 return sprintf(buf, "%d\n", tv->speed);
40} 40}
41 41
42static ssize_t set_speed(struct device *dev, struct device_attribute *attr, 42static ssize_t speed_store(struct device *dev, struct device_attribute *attr,
43 const char *buf, size_t count) 43 const char *buf, size_t count)
44{ 44{
45 struct usb_interface *intf = to_usb_interface(dev); 45 struct usb_interface *intf = to_usb_interface(dev);
@@ -70,7 +70,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr,
70 return count; 70 return count;
71} 71}
72 72
73static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed); 73static DEVICE_ATTR_RW(speed);
74 74
75static int tv_probe(struct usb_interface *interface, 75static int tv_probe(struct usb_interface *interface,
76 const struct usb_device_id *id) 76 const struct usb_device_id *id)
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index 12f7e94695a2..793f6c498d5c 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -187,7 +187,7 @@ static ssize_t set_attr_##name(struct device *dev, \
187} \ 187} \
188static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); 188static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name);
189 189
190static ssize_t show_attr_text(struct device *dev, 190static ssize_t text_show(struct device *dev,
191 struct device_attribute *attr, char *buf) 191 struct device_attribute *attr, char *buf)
192{ 192{
193 struct usb_interface *intf = to_usb_interface(dev); 193 struct usb_interface *intf = to_usb_interface(dev);
@@ -196,7 +196,7 @@ static ssize_t show_attr_text(struct device *dev,
196 return snprintf(buf, mydev->textlength, "%s\n", mydev->text); 196 return snprintf(buf, mydev->textlength, "%s\n", mydev->text);
197} 197}
198 198
199static ssize_t set_attr_text(struct device *dev, 199static ssize_t text_store(struct device *dev,
200 struct device_attribute *attr, const char *buf, size_t count) 200 struct device_attribute *attr, const char *buf, size_t count)
201{ 201{
202 struct usb_interface *intf = to_usb_interface(dev); 202 struct usb_interface *intf = to_usb_interface(dev);
@@ -216,9 +216,9 @@ static ssize_t set_attr_text(struct device *dev,
216 return count; 216 return count;
217} 217}
218 218
219static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text); 219static DEVICE_ATTR_RW(text);
220 220
221static ssize_t show_attr_decimals(struct device *dev, 221static ssize_t decimals_show(struct device *dev,
222 struct device_attribute *attr, char *buf) 222 struct device_attribute *attr, char *buf)
223{ 223{
224 struct usb_interface *intf = to_usb_interface(dev); 224 struct usb_interface *intf = to_usb_interface(dev);
@@ -240,7 +240,7 @@ static ssize_t show_attr_decimals(struct device *dev,
240 return sizeof(mydev->decimals) + 1; 240 return sizeof(mydev->decimals) + 1;
241} 241}
242 242
243static ssize_t set_attr_decimals(struct device *dev, 243static ssize_t decimals_store(struct device *dev,
244 struct device_attribute *attr, const char *buf, size_t count) 244 struct device_attribute *attr, const char *buf, size_t count)
245{ 245{
246 struct usb_interface *intf = to_usb_interface(dev); 246 struct usb_interface *intf = to_usb_interface(dev);
@@ -265,9 +265,9 @@ static ssize_t set_attr_decimals(struct device *dev,
265 return count; 265 return count;
266} 266}
267 267
268static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals); 268static DEVICE_ATTR_RW(decimals);
269 269
270static ssize_t show_attr_textmode(struct device *dev, 270static ssize_t textmode_show(struct device *dev,
271 struct device_attribute *attr, char *buf) 271 struct device_attribute *attr, char *buf)
272{ 272{
273 struct usb_interface *intf = to_usb_interface(dev); 273 struct usb_interface *intf = to_usb_interface(dev);
@@ -293,7 +293,7 @@ static ssize_t show_attr_textmode(struct device *dev,
293 return strlen(buf); 293 return strlen(buf);
294} 294}
295 295
296static ssize_t set_attr_textmode(struct device *dev, 296static ssize_t textmode_store(struct device *dev,
297 struct device_attribute *attr, const char *buf, size_t count) 297 struct device_attribute *attr, const char *buf, size_t count)
298{ 298{
299 struct usb_interface *intf = to_usb_interface(dev); 299 struct usb_interface *intf = to_usb_interface(dev);
@@ -309,7 +309,7 @@ static ssize_t set_attr_textmode(struct device *dev,
309 return count; 309 return count;
310} 310}
311 311
312static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode); 312static DEVICE_ATTR_RW(textmode);
313 313
314 314
315MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); 315MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered);
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index ea5013aa69e2..f4f2693608e6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1687,7 +1687,7 @@ EXPORT_SYMBOL_GPL(musb_mailbox);
1687/*-------------------------------------------------------------------------*/ 1687/*-------------------------------------------------------------------------*/
1688 1688
1689static ssize_t 1689static ssize_t
1690musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf) 1690mode_show(struct device *dev, struct device_attribute *attr, char *buf)
1691{ 1691{
1692 struct musb *musb = dev_to_musb(dev); 1692 struct musb *musb = dev_to_musb(dev);
1693 unsigned long flags; 1693 unsigned long flags;
@@ -1701,7 +1701,7 @@ musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
1701} 1701}
1702 1702
1703static ssize_t 1703static ssize_t
1704musb_mode_store(struct device *dev, struct device_attribute *attr, 1704mode_store(struct device *dev, struct device_attribute *attr,
1705 const char *buf, size_t n) 1705 const char *buf, size_t n)
1706{ 1706{
1707 struct musb *musb = dev_to_musb(dev); 1707 struct musb *musb = dev_to_musb(dev);
@@ -1721,10 +1721,10 @@ musb_mode_store(struct device *dev, struct device_attribute *attr,
1721 1721
1722 return (status == 0) ? n : status; 1722 return (status == 0) ? n : status;
1723} 1723}
1724static DEVICE_ATTR(mode, 0644, musb_mode_show, musb_mode_store); 1724static DEVICE_ATTR_RW(mode);
1725 1725
1726static ssize_t 1726static ssize_t
1727musb_vbus_store(struct device *dev, struct device_attribute *attr, 1727vbus_store(struct device *dev, struct device_attribute *attr,
1728 const char *buf, size_t n) 1728 const char *buf, size_t n)
1729{ 1729{
1730 struct musb *musb = dev_to_musb(dev); 1730 struct musb *musb = dev_to_musb(dev);
@@ -1748,7 +1748,7 @@ musb_vbus_store(struct device *dev, struct device_attribute *attr,
1748} 1748}
1749 1749
1750static ssize_t 1750static ssize_t
1751musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) 1751vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
1752{ 1752{
1753 struct musb *musb = dev_to_musb(dev); 1753 struct musb *musb = dev_to_musb(dev);
1754 unsigned long flags; 1754 unsigned long flags;
@@ -1773,7 +1773,7 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf)
1773 return sprintf(buf, "Vbus %s, timeout %lu msec\n", 1773 return sprintf(buf, "Vbus %s, timeout %lu msec\n",
1774 vbus ? "on" : "off", val); 1774 vbus ? "on" : "off", val);
1775} 1775}
1776static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store); 1776static DEVICE_ATTR_RW(vbus);
1777 1777
1778/* Gadget drivers can't know that a host is connected so they might want 1778/* Gadget drivers can't know that a host is connected so they might want
1779 * to start SRP, but users can. This allows userspace to trigger SRP. 1779 * to start SRP, but users can. This allows userspace to trigger SRP.
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c
index 554b72282276..49a4dd88c301 100644
--- a/drivers/usb/phy/phy-mv-usb.c
+++ b/drivers/usb/phy/phy-mv-usb.c
@@ -519,7 +519,7 @@ static irqreturn_t mv_otg_inputs_irq(int irq, void *dev)
519} 519}
520 520
521static ssize_t 521static ssize_t
522get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf) 522a_bus_req_show(struct device *dev, struct device_attribute *attr, char *buf)
523{ 523{
524 struct mv_otg *mvotg = dev_get_drvdata(dev); 524 struct mv_otg *mvotg = dev_get_drvdata(dev);
525 return scnprintf(buf, PAGE_SIZE, "%d\n", 525 return scnprintf(buf, PAGE_SIZE, "%d\n",
@@ -527,7 +527,7 @@ get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf)
527} 527}
528 528
529static ssize_t 529static ssize_t
530set_a_bus_req(struct device *dev, struct device_attribute *attr, 530a_bus_req_store(struct device *dev, struct device_attribute *attr,
531 const char *buf, size_t count) 531 const char *buf, size_t count)
532{ 532{
533 struct mv_otg *mvotg = dev_get_drvdata(dev); 533 struct mv_otg *mvotg = dev_get_drvdata(dev);
@@ -559,8 +559,7 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr,
559 return count; 559 return count;
560} 560}
561 561
562static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, 562static DEVICE_ATTR_RW(a_bus_req);
563 set_a_bus_req);
564 563
565static ssize_t 564static ssize_t
566set_a_clr_err(struct device *dev, struct device_attribute *attr, 565set_a_clr_err(struct device *dev, struct device_attribute *attr,
@@ -590,7 +589,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr,
590static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err); 589static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err);
591 590
592static ssize_t 591static ssize_t
593get_a_bus_drop(struct device *dev, struct device_attribute *attr, 592a_bus_drop_show(struct device *dev, struct device_attribute *attr,
594 char *buf) 593 char *buf)
595{ 594{
596 struct mv_otg *mvotg = dev_get_drvdata(dev); 595 struct mv_otg *mvotg = dev_get_drvdata(dev);
@@ -599,7 +598,7 @@ get_a_bus_drop(struct device *dev, struct device_attribute *attr,
599} 598}
600 599
601static ssize_t 600static ssize_t
602set_a_bus_drop(struct device *dev, struct device_attribute *attr, 601a_bus_drop_store(struct device *dev, struct device_attribute *attr,
603 const char *buf, size_t count) 602 const char *buf, size_t count)
604{ 603{
605 struct mv_otg *mvotg = dev_get_drvdata(dev); 604 struct mv_otg *mvotg = dev_get_drvdata(dev);
@@ -630,8 +629,7 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr,
630 return count; 629 return count;
631} 630}
632 631
633static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, 632static DEVICE_ATTR_RW(a_bus_drop);
634 get_a_bus_drop, set_a_bus_drop);
635 633
636static struct attribute *inputs_attrs[] = { 634static struct attribute *inputs_attrs[] = {
637 &dev_attr_a_bus_req.attr, 635 &dev_attr_a_bus_req.attr,
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index b3ce42edb373..7f7c5c82420d 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device *device,
310 310
311 return r; 311 return r;
312} 312}
313static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store); 313static DEVICE_ATTR_RW(otg_mode);
314 314
315static struct attribute *tahvo_attributes[] = { 315static struct attribute *tahvo_attributes[] = {
316 &dev_attr_vbus.attr, 316 &dev_attr_vbus.attr,