]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.38.8/atm-expose-atm-device-index-in-sysfs.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 2.6.38.8 / atm-expose-atm-device-index-in-sysfs.patch
CommitLineData
9e44e803
GKH
1From e7a46b4d0839c2a3aa2e0ae0b145f293f6738498 Mon Sep 17 00:00:00 2001
2From: Dan Williams <dcbw@redhat.com>
3Date: Fri, 27 May 2011 04:51:54 +0000
4Subject: atm: expose ATM device index in sysfs
5
6From: Dan Williams <dcbw@redhat.com>
7
8commit e7a46b4d0839c2a3aa2e0ae0b145f293f6738498 upstream.
9
10It's currently exposed only through /proc which, besides requiring
11screen-scraping, doesn't allow userspace to distinguish between two
12identical ATM adapters with different ATM indexes. The ATM device index
13is required when using PPPoATM on a system with multiple ATM adapters.
14
15Signed-off-by: Dan Williams <dcbw@redhat.com>
16Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
17Tested-by: David Woodhouse <dwmw2@infradead.org>
18Signed-off-by: David S. Miller <davem@davemloft.net>
19Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
20
21---
22 net/atm/atm_sysfs.c | 10 ++++++++++
23 1 file changed, 10 insertions(+)
24
25--- a/net/atm/atm_sysfs.c
26+++ b/net/atm/atm_sysfs.c
27@@ -59,6 +59,14 @@ static ssize_t show_atmaddress(struct de
28 return pos - buf;
29 }
30
31+static ssize_t show_atmindex(struct device *cdev,
32+ struct device_attribute *attr, char *buf)
33+{
34+ struct atm_dev *adev = to_atm_dev(cdev);
35+
36+ return sprintf(buf, "%d\n", adev->number);
37+}
38+
39 static ssize_t show_carrier(struct device *cdev,
40 struct device_attribute *attr, char *buf)
41 {
42@@ -99,6 +107,7 @@ static ssize_t show_link_rate(struct dev
43
44 static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
45 static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
46+static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
47 static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
48 static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
49 static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
50@@ -106,6 +115,7 @@ static DEVICE_ATTR(link_rate, S_IRUGO, s
51 static struct device_attribute *atm_attrs[] = {
52 &dev_attr_atmaddress,
53 &dev_attr_address,
54+ &dev_attr_atmindex,
55 &dev_attr_carrier,
56 &dev_attr_type,
57 &dev_attr_link_rate,