* [PATCH] hso: Use static attribute groups for sysfs entry
@ 2015-02-04 13:39 Takashi Iwai
2015-02-05 8:33 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Takashi Iwai @ 2015-02-04 13:39 UTC (permalink / raw)
To: Jan Dumon; +Cc: linux-usb, netdev
Pass the static attribute groups and the driver data via
tty_port_register_device_attr() instead of manual device_create_file()
and device_remove_file() calls.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/net/usb/hso.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 9c5aa922a9f4..1ecca185510d 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -533,6 +533,13 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev,
}
static DEVICE_ATTR(hsotype, S_IRUGO, hso_sysfs_show_porttype, NULL);
+static struct attribute *hso_serial_dev_attrs[] = {
+ &dev_attr_hsotype.attr,
+ NULL
+};
+
+ATTRIBUTE_GROUPS(hso_serial_dev);
+
static int hso_urb_to_index(struct hso_serial *serial, struct urb *urb)
{
int idx;
@@ -2232,9 +2239,6 @@ static void hso_serial_common_free(struct hso_serial *serial)
{
int i;
- if (serial->parent->dev)
- device_remove_file(serial->parent->dev, &dev_attr_hsotype);
-
tty_unregister_device(tty_drv, serial->minor);
for (i = 0; i < serial->num_rx_urbs; i++) {
@@ -2264,11 +2268,10 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
goto exit;
/* register our minor number */
- serial->parent->dev = tty_port_register_device(&serial->port, tty_drv,
- minor, &serial->parent->interface->dev);
+ serial->parent->dev = tty_port_register_device_attr(&serial->port,
+ tty_drv, minor, &serial->parent->interface->dev,
+ serial->parent, hso_serial_dev_groups);
dev = serial->parent->dev;
- dev_set_drvdata(dev, serial->parent);
- i = device_create_file(dev, &dev_attr_hsotype);
/* fill in specific data for later use */
serial->minor = minor;
--
2.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hso: Use static attribute groups for sysfs entry
2015-02-04 13:39 [PATCH] hso: Use static attribute groups for sysfs entry Takashi Iwai
@ 2015-02-05 8:33 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-05 8:33 UTC (permalink / raw)
To: tiwai; +Cc: j.dumon, linux-usb, netdev
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 4 Feb 2015 14:39:33 +0100
> Pass the static attribute groups and the driver data via
> tty_port_register_device_attr() instead of manual device_create_file()
> and device_remove_file() calls.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This does not apply cleanly to the net-next tree, please respin.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-05 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04 13:39 [PATCH] hso: Use static attribute groups for sysfs entry Takashi Iwai
2015-02-05 8:33 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).