.. | .. |
---|
46 | 46 | struct trancevibrator *tv = usb_get_intfdata(intf); |
---|
47 | 47 | int temp, retval, old; |
---|
48 | 48 | |
---|
49 | | - temp = simple_strtoul(buf, NULL, 10); |
---|
| 49 | + retval = kstrtoint(buf, 10, &temp); |
---|
| 50 | + if (retval) |
---|
| 51 | + return retval; |
---|
50 | 52 | if (temp > 255) |
---|
51 | 53 | temp = 255; |
---|
52 | 54 | else if (temp < 0) |
---|
.. | .. |
---|
69 | 71 | } |
---|
70 | 72 | return count; |
---|
71 | 73 | } |
---|
72 | | - |
---|
73 | 74 | static DEVICE_ATTR_RW(speed); |
---|
| 75 | + |
---|
| 76 | +static struct attribute *tv_attrs[] = { |
---|
| 77 | + &dev_attr_speed.attr, |
---|
| 78 | + NULL, |
---|
| 79 | +}; |
---|
| 80 | +ATTRIBUTE_GROUPS(tv); |
---|
74 | 81 | |
---|
75 | 82 | static int tv_probe(struct usb_interface *interface, |
---|
76 | 83 | const struct usb_device_id *id) |
---|
.. | .. |
---|
87 | 94 | |
---|
88 | 95 | dev->udev = usb_get_dev(udev); |
---|
89 | 96 | usb_set_intfdata(interface, dev); |
---|
90 | | - retval = device_create_file(&interface->dev, &dev_attr_speed); |
---|
91 | | - if (retval) |
---|
92 | | - goto error_create_file; |
---|
93 | 97 | |
---|
94 | 98 | return 0; |
---|
95 | 99 | |
---|
96 | | -error_create_file: |
---|
97 | | - usb_put_dev(udev); |
---|
98 | | - usb_set_intfdata(interface, NULL); |
---|
99 | 100 | error: |
---|
100 | 101 | kfree(dev); |
---|
101 | 102 | return retval; |
---|
.. | .. |
---|
106 | 107 | struct trancevibrator *dev; |
---|
107 | 108 | |
---|
108 | 109 | dev = usb_get_intfdata (interface); |
---|
109 | | - device_remove_file(&interface->dev, &dev_attr_speed); |
---|
110 | 110 | usb_set_intfdata(interface, NULL); |
---|
111 | 111 | usb_put_dev(dev->udev); |
---|
112 | 112 | kfree(dev); |
---|
.. | .. |
---|
118 | 118 | .probe = tv_probe, |
---|
119 | 119 | .disconnect = tv_disconnect, |
---|
120 | 120 | .id_table = id_table, |
---|
| 121 | + .dev_groups = tv_groups, |
---|
121 | 122 | }; |
---|
122 | 123 | |
---|
123 | 124 | module_usb_driver(tv_driver); |
---|