Commit ec935791 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: ueagle-atm: convert to use dev_groups

USB drivers now support the ability for the driver core to handle the
creation and removal of device-specific sysfs files in a race-free
manner.  Take advantage of that by converting the driver to use this by
moving the sysfs attributes into a group and assigning the dev_groups
pointer to it.

Cc: Matthieu CASTET <castet.matthieu@free.fr>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Link: https://lore.kernel.org/r/20190806144502.17792-5-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 02c4d45d
...@@ -2458,7 +2458,7 @@ static int claim_interface(struct usb_device *usb_dev, ...@@ -2458,7 +2458,7 @@ static int claim_interface(struct usb_device *usb_dev,
return ret; return ret;
} }
static struct attribute *attrs[] = { static struct attribute *uea_attrs[] = {
&dev_attr_stat_status.attr, &dev_attr_stat_status.attr,
&dev_attr_stat_mflags.attr, &dev_attr_stat_mflags.attr,
&dev_attr_stat_human_status.attr, &dev_attr_stat_human_status.attr,
...@@ -2479,9 +2479,7 @@ static struct attribute *attrs[] = { ...@@ -2479,9 +2479,7 @@ static struct attribute *attrs[] = {
&dev_attr_stat_firmid.attr, &dev_attr_stat_firmid.attr,
NULL, NULL,
}; };
static const struct attribute_group attr_grp = { ATTRIBUTE_GROUPS(uea);
.attrs = attrs,
};
static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
const struct usb_device_id *id) const struct usb_device_id *id)
...@@ -2550,18 +2548,12 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, ...@@ -2550,18 +2548,12 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
} }
} }
ret = sysfs_create_group(&intf->dev.kobj, &attr_grp);
if (ret < 0)
goto error;
ret = uea_boot(sc); ret = uea_boot(sc);
if (ret < 0) if (ret < 0)
goto error_rm_grp; goto error;
return 0; return 0;
error_rm_grp:
sysfs_remove_group(&intf->dev.kobj, &attr_grp);
error: error:
kfree(sc); kfree(sc);
return ret; return ret;
...@@ -2571,7 +2563,6 @@ static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf) ...@@ -2571,7 +2563,6 @@ static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf)
{ {
struct uea_softc *sc = usbatm->driver_data; struct uea_softc *sc = usbatm->driver_data;
sysfs_remove_group(&intf->dev.kobj, &attr_grp);
uea_stop(sc); uea_stop(sc);
kfree(sc); kfree(sc);
} }
...@@ -2721,6 +2712,7 @@ static struct usb_driver uea_driver = { ...@@ -2721,6 +2712,7 @@ static struct usb_driver uea_driver = {
.id_table = uea_ids, .id_table = uea_ids,
.probe = uea_probe, .probe = uea_probe,
.disconnect = uea_disconnect, .disconnect = uea_disconnect,
.dev_groups = uea_groups,
}; };
MODULE_DEVICE_TABLE(usb, uea_ids); MODULE_DEVICE_TABLE(usb, uea_ids);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment