.. | .. |
---|
36 | 36 | }; |
---|
37 | 37 | |
---|
38 | 38 | |
---|
39 | | -/* local function prototypes */ |
---|
40 | | -static int cytherm_probe(struct usb_interface *interface, |
---|
41 | | - const struct usb_device_id *id); |
---|
42 | | -static void cytherm_disconnect(struct usb_interface *interface); |
---|
43 | | - |
---|
44 | | - |
---|
45 | | -/* usb specific object needed to register this driver with the usb subsystem */ |
---|
46 | | -static struct usb_driver cytherm_driver = { |
---|
47 | | - .name = "cytherm", |
---|
48 | | - .probe = cytherm_probe, |
---|
49 | | - .disconnect = cytherm_disconnect, |
---|
50 | | - .id_table = id_table, |
---|
51 | | -}; |
---|
52 | | - |
---|
53 | 39 | /* Vendor requests */ |
---|
54 | 40 | /* They all operate on one byte at a time */ |
---|
55 | 41 | #define PING 0x00 |
---|
.. | .. |
---|
304 | 290 | } |
---|
305 | 291 | static DEVICE_ATTR_RW(port1); |
---|
306 | 292 | |
---|
| 293 | +static struct attribute *cytherm_attrs[] = { |
---|
| 294 | + &dev_attr_brightness.attr, |
---|
| 295 | + &dev_attr_temp.attr, |
---|
| 296 | + &dev_attr_button.attr, |
---|
| 297 | + &dev_attr_port0.attr, |
---|
| 298 | + &dev_attr_port1.attr, |
---|
| 299 | + NULL, |
---|
| 300 | +}; |
---|
| 301 | +ATTRIBUTE_GROUPS(cytherm); |
---|
307 | 302 | |
---|
308 | 303 | static int cytherm_probe(struct usb_interface *interface, |
---|
309 | 304 | const struct usb_device_id *id) |
---|
.. | .. |
---|
322 | 317 | |
---|
323 | 318 | dev->brightness = 0xFF; |
---|
324 | 319 | |
---|
325 | | - retval = device_create_file(&interface->dev, &dev_attr_brightness); |
---|
326 | | - if (retval) |
---|
327 | | - goto error; |
---|
328 | | - retval = device_create_file(&interface->dev, &dev_attr_temp); |
---|
329 | | - if (retval) |
---|
330 | | - goto error; |
---|
331 | | - retval = device_create_file(&interface->dev, &dev_attr_button); |
---|
332 | | - if (retval) |
---|
333 | | - goto error; |
---|
334 | | - retval = device_create_file(&interface->dev, &dev_attr_port0); |
---|
335 | | - if (retval) |
---|
336 | | - goto error; |
---|
337 | | - retval = device_create_file(&interface->dev, &dev_attr_port1); |
---|
338 | | - if (retval) |
---|
339 | | - goto error; |
---|
340 | | - |
---|
341 | 320 | dev_info (&interface->dev, |
---|
342 | 321 | "Cypress thermometer device now attached\n"); |
---|
343 | 322 | return 0; |
---|
344 | | -error: |
---|
345 | | - device_remove_file(&interface->dev, &dev_attr_brightness); |
---|
346 | | - device_remove_file(&interface->dev, &dev_attr_temp); |
---|
347 | | - device_remove_file(&interface->dev, &dev_attr_button); |
---|
348 | | - device_remove_file(&interface->dev, &dev_attr_port0); |
---|
349 | | - device_remove_file(&interface->dev, &dev_attr_port1); |
---|
350 | | - usb_set_intfdata (interface, NULL); |
---|
351 | | - usb_put_dev(dev->udev); |
---|
352 | | - kfree(dev); |
---|
| 323 | + |
---|
353 | 324 | error_mem: |
---|
354 | 325 | return retval; |
---|
355 | 326 | } |
---|
.. | .. |
---|
360 | 331 | |
---|
361 | 332 | dev = usb_get_intfdata (interface); |
---|
362 | 333 | |
---|
363 | | - device_remove_file(&interface->dev, &dev_attr_brightness); |
---|
364 | | - device_remove_file(&interface->dev, &dev_attr_temp); |
---|
365 | | - device_remove_file(&interface->dev, &dev_attr_button); |
---|
366 | | - device_remove_file(&interface->dev, &dev_attr_port0); |
---|
367 | | - device_remove_file(&interface->dev, &dev_attr_port1); |
---|
368 | | - |
---|
369 | 334 | /* first remove the files, then NULL the pointer */ |
---|
370 | 335 | usb_set_intfdata (interface, NULL); |
---|
371 | 336 | |
---|
.. | .. |
---|
376 | 341 | dev_info(&interface->dev, "Cypress thermometer now disconnected\n"); |
---|
377 | 342 | } |
---|
378 | 343 | |
---|
| 344 | +/* usb specific object needed to register this driver with the usb subsystem */ |
---|
| 345 | +static struct usb_driver cytherm_driver = { |
---|
| 346 | + .name = "cytherm", |
---|
| 347 | + .probe = cytherm_probe, |
---|
| 348 | + .disconnect = cytherm_disconnect, |
---|
| 349 | + .id_table = id_table, |
---|
| 350 | + .dev_groups = cytherm_groups, |
---|
| 351 | +}; |
---|
| 352 | + |
---|
379 | 353 | module_usb_driver(cytherm_driver); |
---|
380 | 354 | |
---|
381 | 355 | MODULE_AUTHOR(DRIVER_AUTHOR); |
---|