From: Simon Arlott <simon@arlott.org>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Duncan Sands <duncan.sands@math.u-psud.fr>
Subject: [PATCH] usbatm: Create sysfs link "device" from atm class device to usb interface.
Date: Sat, 24 Feb 2007 11:22:23 +0000 [thread overview]
Message-ID: <45E01FEF.5040705@simon.arlott.org.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]
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).
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
---
drivers/usb/atm/usbatm.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index d91ed11..d0f1976 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -969,6 +969,12 @@ static int usbatm_atm_init(struct usbatm
/* temp init ATM device, set to 128kbit */
atm_dev->link_rate = 128 * 1000 / 424;
+ ret = sysfs_create_link(&atm_dev->class_dev.kobj, &instance->usb_intf->dev.kobj, "device");
+ if (ret) {
+ atm_err(instance, "%s: sysfs_create_link failed: %d\n", __func__, ret);
+ goto fail_sysfs;
+ }
+
if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) {
atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret);
goto fail;
@@ -987,6 +993,8 @@ static int usbatm_atm_init(struct usbatm
return 0;
fail:
+ sysfs_remove_link(&atm_dev->class_dev.kobj, "device");
+ fail_sysfs:
instance->atm_dev = NULL;
atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */
return ret;
@@ -1319,8 +1327,10 @@ void usbatm_usb_disconnect(struct usb_in
kfree(instance->cell_buf);
/* ATM finalize */
- if (instance->atm_dev)
+ if (instance->atm_dev) {
+ sysfs_remove_link(&instance->atm_dev->class_dev.kobj, "device");
atm_dev_deregister(instance->atm_dev);
+ }
usbatm_put_instance(instance); /* taken in usbatm_usb_probe */
}
--
1.4.3.1
--
Simon Arlott
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 829 bytes --]
reply other threads:[~2007-02-24 11:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45E01FEF.5040705@simon.arlott.org.uk \
--to=simon@arlott.org \
--cc=9dfdc7cb9aecd747d41hkuyv0007hc1q@thunder.lp0.eu \
--cc=duncan.sands@math.u-psud.fr \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome