Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: aiptek - switch to using dev_groups for driver-specific attributes

The driver core now has the ability to handle the creation and removal
of device-specific sysfs files, let's use it instead of registering and
unregistering attributes by hand.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20220903051119.1332808-3-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+4 -16
+4 -16
drivers/input/tablet/aiptek.c
··· 1617 1617 1618 1618 static DEVICE_ATTR(firmware_code, S_IRUGO, show_firmwareCode, NULL); 1619 1619 1620 - static struct attribute *aiptek_attributes[] = { 1620 + static struct attribute *aiptek_dev_attrs[] = { 1621 1621 &dev_attr_size.attr, 1622 1622 &dev_attr_pointer_mode.attr, 1623 1623 &dev_attr_coordinate_mode.attr, ··· 1641 1641 NULL 1642 1642 }; 1643 1643 1644 - static const struct attribute_group aiptek_attribute_group = { 1645 - .attrs = aiptek_attributes, 1646 - }; 1644 + ATTRIBUTE_GROUPS(aiptek_dev); 1647 1645 1648 1646 /*********************************************************************** 1649 1647 * This routine is called when a tablet has been identified. It basically ··· 1840 1842 */ 1841 1843 usb_set_intfdata(intf, aiptek); 1842 1844 1843 - /* Set up the sysfs files 1844 - */ 1845 - err = sysfs_create_group(&intf->dev.kobj, &aiptek_attribute_group); 1846 - if (err) { 1847 - dev_warn(&intf->dev, "cannot create sysfs group err: %d\n", 1848 - err); 1849 - goto fail3; 1850 - } 1851 - 1852 1845 /* Register the tablet as an Input Device 1853 1846 */ 1854 1847 err = input_register_device(aiptek->inputdev); 1855 1848 if (err) { 1856 1849 dev_warn(&intf->dev, 1857 1850 "input_register_device returned err: %d\n", err); 1858 - goto fail4; 1851 + goto fail3; 1859 1852 } 1860 1853 return 0; 1861 1854 1862 - fail4: sysfs_remove_group(&intf->dev.kobj, &aiptek_attribute_group); 1863 1855 fail3: usb_free_urb(aiptek->urb); 1864 1856 fail2: usb_free_coherent(usbdev, AIPTEK_PACKET_LENGTH, aiptek->data, 1865 1857 aiptek->data_dma); ··· 1874 1886 */ 1875 1887 usb_kill_urb(aiptek->urb); 1876 1888 input_unregister_device(aiptek->inputdev); 1877 - sysfs_remove_group(&intf->dev.kobj, &aiptek_attribute_group); 1878 1889 usb_free_urb(aiptek->urb); 1879 1890 usb_free_coherent(interface_to_usbdev(intf), 1880 1891 AIPTEK_PACKET_LENGTH, ··· 1887 1900 .probe = aiptek_probe, 1888 1901 .disconnect = aiptek_disconnect, 1889 1902 .id_table = aiptek_ids, 1903 + .dev_groups = aiptek_dev_groups, 1890 1904 }; 1891 1905 1892 1906 module_usb_driver(aiptek_driver);