mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 05:30:53 +07:00
USB: usbtmc: 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: Guido Kiener <guido.kiener@rohde-schwarz.com> Cc: Steve Bayless <steve_bayless@keysight.com> Link: https://lore.kernel.org/r/20190806144502.17792-7-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c847a36521
commit
04a0625e3b
@ -1836,17 +1836,14 @@ capability_attribute(device_capabilities);
|
||||
capability_attribute(usb488_interface_capabilities);
|
||||
capability_attribute(usb488_device_capabilities);
|
||||
|
||||
static struct attribute *capability_attrs[] = {
|
||||
static struct attribute *usbtmc_attrs[] = {
|
||||
&dev_attr_interface_capabilities.attr,
|
||||
&dev_attr_device_capabilities.attr,
|
||||
&dev_attr_usb488_interface_capabilities.attr,
|
||||
&dev_attr_usb488_device_capabilities.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group capability_attr_grp = {
|
||||
.attrs = capability_attrs,
|
||||
};
|
||||
ATTRIBUTE_GROUPS(usbtmc);
|
||||
|
||||
static int usbtmc_ioctl_indicator_pulse(struct usbtmc_device_data *data)
|
||||
{
|
||||
@ -2383,9 +2380,6 @@ static int usbtmc_probe(struct usb_interface *intf,
|
||||
retcode = get_capabilities(data);
|
||||
if (retcode)
|
||||
dev_err(&intf->dev, "can't read capabilities\n");
|
||||
else
|
||||
retcode = sysfs_create_group(&intf->dev.kobj,
|
||||
&capability_attr_grp);
|
||||
|
||||
if (data->iin_ep_present) {
|
||||
/* allocate int urb */
|
||||
@ -2432,7 +2426,6 @@ static int usbtmc_probe(struct usb_interface *intf,
|
||||
return 0;
|
||||
|
||||
error_register:
|
||||
sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp);
|
||||
usbtmc_free_int(data);
|
||||
err_put:
|
||||
kref_put(&data->kref, usbtmc_delete);
|
||||
@ -2445,7 +2438,6 @@ static void usbtmc_disconnect(struct usb_interface *intf)
|
||||
struct list_head *elem;
|
||||
|
||||
usb_deregister_dev(intf, &usbtmc_class);
|
||||
sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp);
|
||||
mutex_lock(&data->io_mutex);
|
||||
data->zombie = 1;
|
||||
wake_up_interruptible_all(&data->waitq);
|
||||
@ -2551,6 +2543,7 @@ static struct usb_driver usbtmc_driver = {
|
||||
.resume = usbtmc_resume,
|
||||
.pre_reset = usbtmc_pre_reset,
|
||||
.post_reset = usbtmc_post_reset,
|
||||
.dev_groups = usbtmc_groups,
|
||||
};
|
||||
|
||||
module_usb_driver(usbtmc_driver);
|
||||
|
Loading…
Reference in New Issue
Block a user