mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-29 22:26:44 +07:00
USB: usblp: 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: Pete Zaitcev <zaitcev@redhat.com> Link: https://lore.kernel.org/r/20190806144502.17792-6-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
04a0625e3b
commit
02c4d45d83
@ -1082,6 +1082,12 @@ static ssize_t ieee1284_id_show(struct device *dev, struct device_attribute *att
|
|||||||
|
|
||||||
static DEVICE_ATTR_RO(ieee1284_id);
|
static DEVICE_ATTR_RO(ieee1284_id);
|
||||||
|
|
||||||
|
static struct attribute *usblp_attrs[] = {
|
||||||
|
&dev_attr_ieee1284_id.attr,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
ATTRIBUTE_GROUPS(usblp);
|
||||||
|
|
||||||
static int usblp_probe(struct usb_interface *intf,
|
static int usblp_probe(struct usb_interface *intf,
|
||||||
const struct usb_device_id *id)
|
const struct usb_device_id *id)
|
||||||
{
|
{
|
||||||
@ -1156,9 +1162,6 @@ static int usblp_probe(struct usb_interface *intf,
|
|||||||
|
|
||||||
/* Retrieve and store the device ID string. */
|
/* Retrieve and store the device ID string. */
|
||||||
usblp_cache_device_id_string(usblp);
|
usblp_cache_device_id_string(usblp);
|
||||||
retval = device_create_file(&intf->dev, &dev_attr_ieee1284_id);
|
|
||||||
if (retval)
|
|
||||||
goto abort_intfdata;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
usblp_check_status(usblp, 0);
|
usblp_check_status(usblp, 0);
|
||||||
@ -1189,7 +1192,6 @@ static int usblp_probe(struct usb_interface *intf,
|
|||||||
|
|
||||||
abort_intfdata:
|
abort_intfdata:
|
||||||
usb_set_intfdata(intf, NULL);
|
usb_set_intfdata(intf, NULL);
|
||||||
device_remove_file(&intf->dev, &dev_attr_ieee1284_id);
|
|
||||||
abort:
|
abort:
|
||||||
kfree(usblp->readbuf);
|
kfree(usblp->readbuf);
|
||||||
kfree(usblp->statusbuf);
|
kfree(usblp->statusbuf);
|
||||||
@ -1360,8 +1362,6 @@ static void usblp_disconnect(struct usb_interface *intf)
|
|||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
|
||||||
device_remove_file(&intf->dev, &dev_attr_ieee1284_id);
|
|
||||||
|
|
||||||
mutex_lock(&usblp_mutex);
|
mutex_lock(&usblp_mutex);
|
||||||
mutex_lock(&usblp->mut);
|
mutex_lock(&usblp->mut);
|
||||||
usblp->present = 0;
|
usblp->present = 0;
|
||||||
@ -1421,6 +1421,7 @@ static struct usb_driver usblp_driver = {
|
|||||||
.suspend = usblp_suspend,
|
.suspend = usblp_suspend,
|
||||||
.resume = usblp_resume,
|
.resume = usblp_resume,
|
||||||
.id_table = usblp_ids,
|
.id_table = usblp_ids,
|
||||||
|
.dev_groups = usblp_groups,
|
||||||
.supports_autosuspend = 1,
|
.supports_autosuspend = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user