diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-02-05 05:15:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-05 18:51:38 -0500 |
commit | 4134069f3ea6cd96903e426bd3dfb9bb44165357 (patch) | |
tree | 4e203e3080e6a3b88f64a9213deb819a5394ce40 | |
parent | b0ebfaea4a21cb92a984030fa80501b44bf1bbf4 (diff) |
hso: Use static attribute groups for sysfs entry
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/hso.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 7833bd1d9791..6b8efcabb816 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -531,6 +531,13 @@ static ssize_t hso_sysfs_show_porttype(struct device *dev, | |||
531 | } | 531 | } |
532 | static DEVICE_ATTR(hsotype, S_IRUGO, hso_sysfs_show_porttype, NULL); | 532 | static DEVICE_ATTR(hsotype, S_IRUGO, hso_sysfs_show_porttype, NULL); |
533 | 533 | ||
534 | static struct attribute *hso_serial_dev_attrs[] = { | ||
535 | &dev_attr_hsotype.attr, | ||
536 | NULL | ||
537 | }; | ||
538 | |||
539 | ATTRIBUTE_GROUPS(hso_serial_dev); | ||
540 | |||
534 | static int hso_urb_to_index(struct hso_serial *serial, struct urb *urb) | 541 | static int hso_urb_to_index(struct hso_serial *serial, struct urb *urb) |
535 | { | 542 | { |
536 | int idx; | 543 | int idx; |
@@ -2236,9 +2243,6 @@ static int hso_stop_serial_device(struct hso_device *hso_dev) | |||
2236 | 2243 | ||
2237 | static void hso_serial_tty_unregister(struct hso_serial *serial) | 2244 | static void hso_serial_tty_unregister(struct hso_serial *serial) |
2238 | { | 2245 | { |
2239 | if (serial->parent->dev) | ||
2240 | device_remove_file(serial->parent->dev, &dev_attr_hsotype); | ||
2241 | |||
2242 | tty_unregister_device(tty_drv, serial->minor); | 2246 | tty_unregister_device(tty_drv, serial->minor); |
2243 | } | 2247 | } |
2244 | 2248 | ||
@@ -2274,11 +2278,10 @@ static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, | |||
2274 | goto exit; | 2278 | goto exit; |
2275 | 2279 | ||
2276 | /* register our minor number */ | 2280 | /* register our minor number */ |
2277 | serial->parent->dev = tty_port_register_device(&serial->port, tty_drv, | 2281 | serial->parent->dev = tty_port_register_device_attr(&serial->port, |
2278 | minor, &serial->parent->interface->dev); | 2282 | tty_drv, minor, &serial->parent->interface->dev, |
2283 | serial->parent, hso_serial_dev_groups); | ||
2279 | dev = serial->parent->dev; | 2284 | dev = serial->parent->dev; |
2280 | dev_set_drvdata(dev, serial->parent); | ||
2281 | i = device_create_file(dev, &dev_attr_hsotype); | ||
2282 | 2285 | ||
2283 | /* fill in specific data for later use */ | 2286 | /* fill in specific data for later use */ |
2284 | serial->minor = minor; | 2287 | serial->minor = minor; |