diff options
author | Simon Arlott <simon@arlott.org> | 2007-03-06 05:47:43 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-04-27 16:28:34 -0400 |
commit | e9b8daf31b459acb440647a651b1bda3b30e6188 (patch) | |
tree | 6ac500a77eb7bd2b2915566d982b5b40c24ff47b /drivers/usb/atm | |
parent | c2cf3f6ec58cf1d9e2a92cd74506dcf2265b31a1 (diff) |
usbatm: create sysfs link "device" from atm class device to usb interface
There is currently no path from the ATM device in /sys to the USB device's
interface that the driver is using; this patch creates a "device" symlink. It
is then possible to get to the cxacru ADSL statistics
(http://lkml.org/lkml/2007/2/23/328):
/sys/class/atm/cxacru0/device $ ls *_rate *_margin *_attenuation
downstream_attenuation downstream_snr_margin upstream_rate
downstream_rate upstream_attenuation upstream_snr_margin
If this link is not appropriate I'd have to create device files in
/sys/class/atm/cxacru0 instead - which seems less appropriate since the ADSL
statistics are for the USB device not ATM (which is running over the ADSL).
[akpm@linux-foundation.org: cleanups]
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Cc: Duncan Sands <duncan.sands@math.u-psud.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/atm')
-rw-r--r-- | drivers/usb/atm/usbatm.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index d3e2c5f90a26..746d30ffb732 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -968,6 +968,14 @@ static int usbatm_atm_init(struct usbatm_data *instance) | |||
968 | /* temp init ATM device, set to 128kbit */ | 968 | /* temp init ATM device, set to 128kbit */ |
969 | atm_dev->link_rate = 128 * 1000 / 424; | 969 | atm_dev->link_rate = 128 * 1000 / 424; |
970 | 970 | ||
971 | ret = sysfs_create_link(&atm_dev->class_dev.kobj, | ||
972 | &instance->usb_intf->dev.kobj, "device"); | ||
973 | if (ret) { | ||
974 | atm_err(instance, "%s: sysfs_create_link failed: %d\n", | ||
975 | __func__, ret); | ||
976 | goto fail_sysfs; | ||
977 | } | ||
978 | |||
971 | if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { | 979 | if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { |
972 | atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret); | 980 | atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret); |
973 | goto fail; | 981 | goto fail; |
@@ -986,6 +994,8 @@ static int usbatm_atm_init(struct usbatm_data *instance) | |||
986 | return 0; | 994 | return 0; |
987 | 995 | ||
988 | fail: | 996 | fail: |
997 | sysfs_remove_link(&atm_dev->class_dev.kobj, "device"); | ||
998 | fail_sysfs: | ||
989 | instance->atm_dev = NULL; | 999 | instance->atm_dev = NULL; |
990 | atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */ | 1000 | atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */ |
991 | return ret; | 1001 | return ret; |
@@ -1318,8 +1328,10 @@ void usbatm_usb_disconnect(struct usb_interface *intf) | |||
1318 | kfree(instance->cell_buf); | 1328 | kfree(instance->cell_buf); |
1319 | 1329 | ||
1320 | /* ATM finalize */ | 1330 | /* ATM finalize */ |
1321 | if (instance->atm_dev) | 1331 | if (instance->atm_dev) { |
1332 | sysfs_remove_link(&instance->atm_dev->class_dev.kobj, "device"); | ||
1322 | atm_dev_deregister(instance->atm_dev); | 1333 | atm_dev_deregister(instance->atm_dev); |
1334 | } | ||
1323 | 1335 | ||
1324 | usbatm_put_instance(instance); /* taken in usbatm_usb_probe */ | 1336 | usbatm_put_instance(instance); /* taken in usbatm_usb_probe */ |
1325 | } | 1337 | } |