aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/mISDN/core.c64
1 files changed, 36 insertions, 28 deletions
diff --git a/drivers/isdn/mISDN/core.c b/drivers/isdn/mISDN/core.c
index da30c5cb9609..faf505462a4f 100644
--- a/drivers/isdn/mISDN/core.c
+++ b/drivers/isdn/mISDN/core.c
@@ -37,8 +37,8 @@ static void mISDN_dev_release(struct device *dev)
37 /* nothing to do: the device is part of its parent's data structure */ 37 /* nothing to do: the device is part of its parent's data structure */
38} 38}
39 39
40static ssize_t _show_id(struct device *dev, 40static ssize_t id_show(struct device *dev,
41 struct device_attribute *attr, char *buf) 41 struct device_attribute *attr, char *buf)
42{ 42{
43 struct mISDNdevice *mdev = dev_to_mISDN(dev); 43 struct mISDNdevice *mdev = dev_to_mISDN(dev);
44 44
@@ -46,9 +46,10 @@ static ssize_t _show_id(struct device *dev,
46 return -ENODEV; 46 return -ENODEV;
47 return sprintf(buf, "%d\n", mdev->id); 47 return sprintf(buf, "%d\n", mdev->id);
48} 48}
49static DEVICE_ATTR_RO(id);
49 50
50static ssize_t _show_nrbchan(struct device *dev, 51static ssize_t nrbchan_show(struct device *dev,
51 struct device_attribute *attr, char *buf) 52 struct device_attribute *attr, char *buf)
52{ 53{
53 struct mISDNdevice *mdev = dev_to_mISDN(dev); 54 struct mISDNdevice *mdev = dev_to_mISDN(dev);
54 55
@@ -56,9 +57,10 @@ static ssize_t _show_nrbchan(struct device *dev,
56 return -ENODEV; 57 return -ENODEV;
57 return sprintf(buf, "%d\n", mdev->nrbchan); 58 return sprintf(buf, "%d\n", mdev->nrbchan);
58} 59}
60static DEVICE_ATTR_RO(nrbchan);
59 61
60static ssize_t _show_d_protocols(struct device *dev, 62static ssize_t d_protocols_show(struct device *dev,
61 struct device_attribute *attr, char *buf) 63 struct device_attribute *attr, char *buf)
62{ 64{
63 struct mISDNdevice *mdev = dev_to_mISDN(dev); 65 struct mISDNdevice *mdev = dev_to_mISDN(dev);
64 66
@@ -66,9 +68,10 @@ static ssize_t _show_d_protocols(struct device *dev,
66 return -ENODEV; 68 return -ENODEV;
67 return sprintf(buf, "%d\n", mdev->Dprotocols); 69 return sprintf(buf, "%d\n", mdev->Dprotocols);
68} 70}
71static DEVICE_ATTR_RO(d_protocols);
69 72
70static ssize_t _show_b_protocols(struct device *dev, 73static ssize_t b_protocols_show(struct device *dev,
71 struct device_attribute *attr, char *buf) 74 struct device_attribute *attr, char *buf)
72{ 75{
73 struct mISDNdevice *mdev = dev_to_mISDN(dev); 76 struct mISDNdevice *mdev = dev_to_mISDN(dev);
74 77
@@ -76,9 +79,10 @@ static ssize_t _show_b_protocols(struct device *dev,
76 return -ENODEV; 79 return -ENODEV;
77 return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols()); 80 return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols());
78} 81}
82static DEVICE_ATTR_RO(b_protocols);
79 83
80static ssize_t _show_protocol(struct device *dev, 84static ssize_t protocol_show(struct device *dev,
81 struct device_attribute *attr, char *buf) 85 struct device_attribute *attr, char *buf)
82{ 86{
83 struct mISDNdevice *mdev = dev_to_mISDN(dev); 87 struct mISDNdevice *mdev = dev_to_mISDN(dev);
84 88
@@ -86,17 +90,19 @@ static ssize_t _show_protocol(struct device *dev,
86 return -ENODEV; 90 return -ENODEV;
87 return sprintf(buf, "%d\n", mdev->D.protocol); 91 return sprintf(buf, "%d\n", mdev->D.protocol);
88} 92}
93static DEVICE_ATTR_RO(protocol);
89 94
90static ssize_t _show_name(struct device *dev, 95static ssize_t name_show(struct device *dev,
91 struct device_attribute *attr, char *buf) 96 struct device_attribute *attr, char *buf)
92{ 97{
93 strcpy(buf, dev_name(dev)); 98 strcpy(buf, dev_name(dev));
94 return strlen(buf); 99 return strlen(buf);
95} 100}
101static DEVICE_ATTR_RO(name);
96 102
97#if 0 /* hangs */ 103#if 0 /* hangs */
98static ssize_t _set_name(struct device *dev, struct device_attribute *attr, 104static ssize_t name_set(struct device *dev, struct device_attribute *attr,
99 const char *buf, size_t count) 105 const char *buf, size_t count)
100{ 106{
101 int err = 0; 107 int err = 0;
102 char *out = kmalloc(count + 1, GFP_KERNEL); 108 char *out = kmalloc(count + 1, GFP_KERNEL);
@@ -113,10 +119,11 @@ static ssize_t _set_name(struct device *dev, struct device_attribute *attr,
113 119
114 return (err < 0) ? err : count; 120 return (err < 0) ? err : count;
115} 121}
122static DEVICE_ATTR_RW(name);
116#endif 123#endif
117 124
118static ssize_t _show_channelmap(struct device *dev, 125static ssize_t channelmap_show(struct device *dev,
119 struct device_attribute *attr, char *buf) 126 struct device_attribute *attr, char *buf)
120{ 127{
121 struct mISDNdevice *mdev = dev_to_mISDN(dev); 128 struct mISDNdevice *mdev = dev_to_mISDN(dev);
122 char *bp = buf; 129 char *bp = buf;
@@ -127,18 +134,19 @@ static ssize_t _show_channelmap(struct device *dev,
127 134
128 return bp - buf; 135 return bp - buf;
129} 136}
130 137static DEVICE_ATTR_RO(channelmap);
131static struct device_attribute mISDN_dev_attrs[] = { 138
132 __ATTR(id, S_IRUGO, _show_id, NULL), 139static struct attribute *mISDN_attrs[] = {
133 __ATTR(d_protocols, S_IRUGO, _show_d_protocols, NULL), 140 &dev_attr_id.attr,
134 __ATTR(b_protocols, S_IRUGO, _show_b_protocols, NULL), 141 &dev_attr_d_protocols.attr,
135 __ATTR(protocol, S_IRUGO, _show_protocol, NULL), 142 &dev_attr_b_protocols.attr,
136 __ATTR(channelmap, S_IRUGO, _show_channelmap, NULL), 143 &dev_attr_protocol.attr,
137 __ATTR(nrbchan, S_IRUGO, _show_nrbchan, NULL), 144 &dev_attr_channelmap.attr,
138 __ATTR(name, S_IRUGO, _show_name, NULL), 145 &dev_attr_nrbchan.attr,
139/* __ATTR(name, S_IRUGO | S_IWUSR, _show_name, _set_name), */ 146 &dev_attr_name.attr,
140 {} 147 NULL,
141}; 148};
149ATTRIBUTE_GROUPS(mISDN);
142 150
143static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env) 151static int mISDN_uevent(struct device *dev, struct kobj_uevent_env *env)
144{ 152{
@@ -162,7 +170,7 @@ static struct class mISDN_class = {
162 .name = "mISDN", 170 .name = "mISDN",
163 .owner = THIS_MODULE, 171 .owner = THIS_MODULE,
164 .dev_uevent = mISDN_uevent, 172 .dev_uevent = mISDN_uevent,
165 .dev_attrs = mISDN_dev_attrs, 173 .dev_groups = mISDN_groups,
166 .dev_release = mISDN_dev_release, 174 .dev_release = mISDN_dev_release,
167 .class_release = mISDN_class_release, 175 .class_release = mISDN_class_release,
168}; 176};