Instead of manual device_create_file() and device_remove_file() calls, pass the static attribute groups to tty_register_device_attr(). Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> --- drivers/usb/serial/bus.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 9374bd2aba20..b730366d524f 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c @@ -47,6 +47,13 @@ static ssize_t port_number_show(struct device *dev, } static DEVICE_ATTR_RO(port_number); +static struct attribute *usb_serial_dev_attrs[] = { + &dev_attr_port_number.attr, + NULL +}; + +ATTRIBUTE_GROUPS(usb_serial_dev); + static int usb_serial_device_probe(struct device *dev) { struct usb_serial_driver *driver; @@ -72,15 +79,9 @@ static int usb_serial_device_probe(struct device *dev) goto exit_with_autopm; } - retval = device_create_file(dev, &dev_attr_port_number); - if (retval) { - if (driver->port_remove) - retval = driver->port_remove(port); - goto exit_with_autopm; - } - minor = port->minor; - tty_register_device(usb_serial_tty_driver, minor, dev); + tty_register_device_attr(usb_serial_tty_driver, minor, dev, NULL, + usb_serial_dev_groups); dev_info(&port->serial->dev->dev, "%s converter now attached to ttyUSB%d\n", driver->description, minor); @@ -114,8 +115,6 @@ static int usb_serial_device_remove(struct device *dev) minor = port->minor; tty_unregister_device(usb_serial_tty_driver, minor); - device_remove_file(&port->dev, &dev_attr_port_number); - driver = port->serial->type; if (driver->port_remove) retval = driver->port_remove(port); -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html