Skip to content

Commit 295b89a

Browse files
committed
Input: yealink - use driver core to instantiate device attributes
Instead of manually creating driver-specific device attributes set struct usb_driver->dev_groups pointer to have the driver core do it. Reviewed-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent b20d6bf commit 295b89a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/input/misc/yealink.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ static DEVICE_ATTR(show_icon , _M220, NULL , show_icon );
771771
static DEVICE_ATTR(hide_icon , _M220, NULL , hide_icon );
772772
static DEVICE_ATTR(ringtone , _M220, NULL , store_ringtone);
773773

774-
static struct attribute *yld_attributes[] = {
774+
static struct attribute *yld_attrs[] = {
775775
&dev_attr_line1.attr,
776776
&dev_attr_line2.attr,
777777
&dev_attr_line3.attr,
@@ -782,10 +782,7 @@ static struct attribute *yld_attributes[] = {
782782
&dev_attr_ringtone.attr,
783783
NULL
784784
};
785-
786-
static const struct attribute_group yld_attr_group = {
787-
.attrs = yld_attributes
788-
};
785+
ATTRIBUTE_GROUPS(yld);
789786

790787
/*******************************************************************************
791788
* Linux interface and usb initialisation
@@ -842,7 +839,6 @@ static void usb_disconnect(struct usb_interface *intf)
842839

843840
down_write(&sysfs_rwsema);
844841
yld = usb_get_intfdata(intf);
845-
sysfs_remove_group(&intf->dev.kobj, &yld_attr_group);
846842
usb_set_intfdata(intf, NULL);
847843
up_write(&sysfs_rwsema);
848844

@@ -975,8 +971,6 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
975971
store_line3(&intf->dev, NULL,
976972
DRIVER_VERSION, sizeof(DRIVER_VERSION));
977973

978-
/* Register sysfs hooks (don't care about failure) */
979-
ret = sysfs_create_group(&intf->dev.kobj, &yld_attr_group);
980974
return 0;
981975
}
982976

@@ -985,6 +979,7 @@ static struct usb_driver yealink_driver = {
985979
.probe = usb_probe,
986980
.disconnect = usb_disconnect,
987981
.id_table = usb_table,
982+
.dev_groups = yld_groups,
988983
};
989984

990985
module_usb_driver(yealink_driver);

0 commit comments

Comments
 (0)