Lines Matching +full:attr +full:- +full:cnt +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-only
33 struct device_attribute *attr, char *buf) in id_show() argument
38 return -ENODEV; in id_show()
39 return sprintf(buf, "%d\n", mdev->id); in id_show()
44 struct device_attribute *attr, char *buf) in nrbchan_show() argument
49 return -ENODEV; in nrbchan_show()
50 return sprintf(buf, "%d\n", mdev->nrbchan); in nrbchan_show()
55 struct device_attribute *attr, char *buf) in d_protocols_show() argument
60 return -ENODEV; in d_protocols_show()
61 return sprintf(buf, "%d\n", mdev->Dprotocols); in d_protocols_show()
66 struct device_attribute *attr, char *buf) in b_protocols_show() argument
71 return -ENODEV; in b_protocols_show()
72 return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols()); in b_protocols_show()
77 struct device_attribute *attr, char *buf) in protocol_show() argument
82 return -ENODEV; in protocol_show()
83 return sprintf(buf, "%d\n", mdev->D.protocol); in protocol_show()
88 struct device_attribute *attr, char *buf) in name_show() argument
93 static DEVICE_ATTR_RO(name);
96 static ssize_t name_set(struct device *dev, struct device_attribute *attr,
103 return -ENOMEM;
106 if (count && out[count - 1] == '\n')
107 out[--count] = 0;
114 static DEVICE_ATTR_RW(name);
118 struct device_attribute *attr, char *buf) in channelmap_show() argument
124 for (i = 0; i <= mdev->nrbchan; i++) in channelmap_show()
125 *bp++ = test_channelmap(i, mdev->channelmap) ? '1' : '0'; in channelmap_show()
127 return bp - buf; in channelmap_show()
132 &dev_attr_id.attr,
133 &dev_attr_d_protocols.attr,
134 &dev_attr_b_protocols.attr,
135 &dev_attr_protocol.attr,
136 &dev_attr_channelmap.attr,
137 &dev_attr_nrbchan.attr,
138 &dev_attr_name.attr,
150 if (add_uevent_var(env, "nchans=%d", mdev->nrbchan)) in mISDN_uevent()
151 return -ENOMEM; in mISDN_uevent()
157 .name = "mISDN",
170 if (mdev->id != *(const u_int *)id) in _get_mdevice()
183 _get_mdevice_count(struct device *dev, void *cnt) in _get_mdevice_count() argument
185 *(int *)cnt += 1; in _get_mdevice_count()
192 int cnt = 0; in get_mdevice_count() local
194 class_for_each_device(&mISDN_class, NULL, &cnt, _get_mdevice_count); in get_mdevice_count()
195 return cnt; in get_mdevice_count()
207 return -EBUSY; in get_free_devid()
213 struct device *parent, char *name) in mISDN_register_device() argument
220 dev->id = err; in mISDN_register_device()
222 device_initialize(&dev->dev); in mISDN_register_device()
223 if (name && name[0]) in mISDN_register_device()
224 dev_set_name(&dev->dev, "%s", name); in mISDN_register_device()
226 dev_set_name(&dev->dev, "mISDN%d", dev->id); in mISDN_register_device()
229 dev_name(&dev->dev), dev->id); in mISDN_register_device()
230 dev->dev.class = &mISDN_class; in mISDN_register_device()
236 dev->dev.platform_data = dev; in mISDN_register_device()
237 dev->dev.parent = parent; in mISDN_register_device()
238 dev_set_drvdata(&dev->dev, dev); in mISDN_register_device()
240 err = device_add(&dev->dev); in mISDN_register_device()
248 put_device(&dev->dev); in mISDN_register_device()
258 dev_name(&dev->dev), dev->id); in mISDN_unregister_device()
259 /* sysfs_remove_link(&dev->dev.kobj, "device"); */ in mISDN_unregister_device()
260 device_del(&dev->dev); in mISDN_unregister_device()
261 dev_set_drvdata(&dev->dev, NULL); in mISDN_unregister_device()
263 test_and_clear_bit(dev->id, (u_long *)&device_ids); in mISDN_unregister_device()
265 put_device(&dev->dev); in mISDN_unregister_device()
277 m |= bp->Bprotocols; in get_all_Bprotocols()
289 if (bp->Bprotocols & m) { in get_Bprotocol4mask()
305 bp->name, bp->Bprotocols); in mISDN_register_Bprotocol()
306 old = get_Bprotocol4mask(bp->Bprotocols); in mISDN_register_Bprotocol()
310 old->name, old->Bprotocols, bp->name, bp->Bprotocols); in mISDN_register_Bprotocol()
311 return -EBUSY; in mISDN_register_Bprotocol()
314 list_add_tail(&bp->list, &Bprotocols); in mISDN_register_Bprotocol()
326 printk(KERN_DEBUG "%s: %s/%x\n", __func__, bp->name, in mISDN_unregister_Bprotocol()
327 bp->Bprotocols); in mISDN_unregister_Bprotocol()
329 list_del(&bp->list); in mISDN_unregister_Bprotocol()
342 if (!ch->st) in mISDNDevName4ch()
344 if (!ch->st->dev) in mISDNDevName4ch()
346 return dev_name(&ch->st->dev->dev); in mISDNDevName4ch()