Lines Matching +full:attr +full:- +full:cnt +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-only
32 struct device_attribute *attr, char *buf) in id_show() argument
37 return -ENODEV; in id_show()
38 return sprintf(buf, "%d\n", mdev->id); in id_show()
43 struct device_attribute *attr, char *buf) in nrbchan_show() argument
48 return -ENODEV; in nrbchan_show()
49 return sprintf(buf, "%d\n", mdev->nrbchan); in nrbchan_show()
54 struct device_attribute *attr, char *buf) in d_protocols_show() argument
59 return -ENODEV; in d_protocols_show()
60 return sprintf(buf, "%d\n", mdev->Dprotocols); in d_protocols_show()
65 struct device_attribute *attr, char *buf) in b_protocols_show() argument
70 return -ENODEV; in b_protocols_show()
71 return sprintf(buf, "%d\n", mdev->Bprotocols | get_all_Bprotocols()); in b_protocols_show()
76 struct device_attribute *attr, char *buf) in protocol_show() argument
81 return -ENODEV; in protocol_show()
82 return sprintf(buf, "%d\n", mdev->D.protocol); in protocol_show()
87 struct device_attribute *attr, char *buf) in name_show() argument
92 static DEVICE_ATTR_RO(name);
95 static ssize_t name_set(struct device *dev, struct device_attribute *attr,
102 return -ENOMEM;
105 if (count && out[count - 1] == '\n')
106 out[--count] = 0;
113 static DEVICE_ATTR_RW(name);
117 struct device_attribute *attr, char *buf) in channelmap_show() argument
123 for (i = 0; i <= mdev->nrbchan; i++) in channelmap_show()
124 *bp++ = test_channelmap(i, mdev->channelmap) ? '1' : '0'; in channelmap_show()
126 return bp - buf; in channelmap_show()
131 &dev_attr_id.attr,
132 &dev_attr_d_protocols.attr,
133 &dev_attr_b_protocols.attr,
134 &dev_attr_protocol.attr,
135 &dev_attr_channelmap.attr,
136 &dev_attr_nrbchan.attr,
137 &dev_attr_name.attr,
149 if (add_uevent_var(env, "nchans=%d", mdev->nrbchan)) in mISDN_uevent()
150 return -ENOMEM; in mISDN_uevent()
156 .name = "mISDN",
169 if (mdev->id != *(const u_int *)id) in _get_mdevice()
182 _get_mdevice_count(struct device *dev, void *cnt) in _get_mdevice_count() argument
184 *(int *)cnt += 1; in _get_mdevice_count()
191 int cnt = 0; in get_mdevice_count() local
193 class_for_each_device(&mISDN_class, NULL, &cnt, _get_mdevice_count); in get_mdevice_count()
194 return cnt; in get_mdevice_count()
206 return -EBUSY; in get_free_devid()
212 struct device *parent, char *name) in mISDN_register_device() argument
219 dev->id = err; in mISDN_register_device()
221 device_initialize(&dev->dev); in mISDN_register_device()
222 if (name && name[0]) in mISDN_register_device()
223 dev_set_name(&dev->dev, "%s", name); in mISDN_register_device()
225 dev_set_name(&dev->dev, "mISDN%d", dev->id); in mISDN_register_device()
228 dev_name(&dev->dev), dev->id); in mISDN_register_device()
229 dev->dev.class = &mISDN_class; in mISDN_register_device()
235 dev->dev.platform_data = dev; in mISDN_register_device()
236 dev->dev.parent = parent; in mISDN_register_device()
237 dev_set_drvdata(&dev->dev, dev); in mISDN_register_device()
239 err = device_add(&dev->dev); in mISDN_register_device()
247 put_device(&dev->dev); in mISDN_register_device()
257 dev_name(&dev->dev), dev->id); in mISDN_unregister_device()
258 /* sysfs_remove_link(&dev->dev.kobj, "device"); */ in mISDN_unregister_device()
259 device_del(&dev->dev); in mISDN_unregister_device()
260 dev_set_drvdata(&dev->dev, NULL); in mISDN_unregister_device()
262 test_and_clear_bit(dev->id, (u_long *)&device_ids); in mISDN_unregister_device()
264 put_device(&dev->dev); in mISDN_unregister_device()
276 m |= bp->Bprotocols; in get_all_Bprotocols()
288 if (bp->Bprotocols & m) { in get_Bprotocol4mask()
318 bp->name, bp->Bprotocols); in mISDN_register_Bprotocol()
319 old = get_Bprotocol4mask(bp->Bprotocols); in mISDN_register_Bprotocol()
323 old->name, old->Bprotocols, bp->name, bp->Bprotocols); in mISDN_register_Bprotocol()
324 return -EBUSY; in mISDN_register_Bprotocol()
327 list_add_tail(&bp->list, &Bprotocols); in mISDN_register_Bprotocol()
339 printk(KERN_DEBUG "%s: %s/%x\n", __func__, bp->name, in mISDN_unregister_Bprotocol()
340 bp->Bprotocols); in mISDN_unregister_Bprotocol()
342 list_del(&bp->list); in mISDN_unregister_Bprotocol()
355 if (!ch->st) in mISDNDevName4ch()
357 if (!ch->st->dev) in mISDNDevName4ch()
359 return dev_name(&ch->st->dev->dev); in mISDNDevName4ch()