| .. | .. |
|---|
| 183 | 183 | { |
|---|
| 184 | 184 | return read_port(dev, attr, buf, 0, CYPRESS_READ_PORT_ID0); |
|---|
| 185 | 185 | } |
|---|
| 186 | +static DEVICE_ATTR_RW(port0); |
|---|
| 186 | 187 | |
|---|
| 187 | 188 | /* attribute callback handler (read) */ |
|---|
| 188 | 189 | static ssize_t port1_show(struct device *dev, |
|---|
| .. | .. |
|---|
| 190 | 191 | { |
|---|
| 191 | 192 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); |
|---|
| 192 | 193 | } |
|---|
| 193 | | - |
|---|
| 194 | | -static DEVICE_ATTR_RW(port0); |
|---|
| 195 | | - |
|---|
| 196 | 194 | static DEVICE_ATTR_RW(port1); |
|---|
| 197 | 195 | |
|---|
| 196 | +static struct attribute *cypress_attrs[] = { |
|---|
| 197 | + &dev_attr_port0.attr, |
|---|
| 198 | + &dev_attr_port1.attr, |
|---|
| 199 | + NULL, |
|---|
| 200 | +}; |
|---|
| 201 | +ATTRIBUTE_GROUPS(cypress); |
|---|
| 198 | 202 | |
|---|
| 199 | 203 | static int cypress_probe(struct usb_interface *interface, |
|---|
| 200 | 204 | const struct usb_device_id *id) |
|---|
| .. | .. |
|---|
| 212 | 216 | /* save our data pointer in this interface device */ |
|---|
| 213 | 217 | usb_set_intfdata(interface, dev); |
|---|
| 214 | 218 | |
|---|
| 215 | | - /* create device attribute files */ |
|---|
| 216 | | - retval = device_create_file(&interface->dev, &dev_attr_port0); |
|---|
| 217 | | - if (retval) |
|---|
| 218 | | - goto error; |
|---|
| 219 | | - retval = device_create_file(&interface->dev, &dev_attr_port1); |
|---|
| 220 | | - if (retval) |
|---|
| 221 | | - goto error; |
|---|
| 222 | | - |
|---|
| 223 | 219 | /* let the user know that the device is now attached */ |
|---|
| 224 | 220 | dev_info(&interface->dev, |
|---|
| 225 | 221 | "Cypress CY7C63xxx device now attached\n"); |
|---|
| 226 | 222 | return 0; |
|---|
| 227 | | - |
|---|
| 228 | | -error: |
|---|
| 229 | | - device_remove_file(&interface->dev, &dev_attr_port0); |
|---|
| 230 | | - device_remove_file(&interface->dev, &dev_attr_port1); |
|---|
| 231 | | - usb_set_intfdata(interface, NULL); |
|---|
| 232 | | - usb_put_dev(dev->udev); |
|---|
| 233 | | - kfree(dev); |
|---|
| 234 | 223 | |
|---|
| 235 | 224 | error_mem: |
|---|
| 236 | 225 | return retval; |
|---|
| .. | .. |
|---|
| 242 | 231 | |
|---|
| 243 | 232 | dev = usb_get_intfdata(interface); |
|---|
| 244 | 233 | |
|---|
| 245 | | - /* remove device attribute files */ |
|---|
| 246 | | - device_remove_file(&interface->dev, &dev_attr_port0); |
|---|
| 247 | | - device_remove_file(&interface->dev, &dev_attr_port1); |
|---|
| 248 | 234 | /* the intfdata can be set to NULL only after the |
|---|
| 249 | 235 | * device files have been removed */ |
|---|
| 250 | 236 | usb_set_intfdata(interface, NULL); |
|---|
| .. | .. |
|---|
| 262 | 248 | .probe = cypress_probe, |
|---|
| 263 | 249 | .disconnect = cypress_disconnect, |
|---|
| 264 | 250 | .id_table = cypress_table, |
|---|
| 251 | + .dev_groups = cypress_groups, |
|---|
| 265 | 252 | }; |
|---|
| 266 | 253 | |
|---|
| 267 | 254 | module_usb_driver(cypress_driver); |
|---|