15 #include <linux/slab.h>
16 #include <linux/types.h>
17 #include <linux/stddef.h>
18 #include <linux/module.h>
29 static u64 device_ids;
30 #define MAX_DEVICE_ID 63
35 static void mISDN_dev_release(
struct device *
dev)
43 struct mISDNdevice *mdev = dev_to_mISDN(dev);
47 return sprintf(buf,
"%d\n", mdev->id);
53 struct mISDNdevice *mdev = dev_to_mISDN(dev);
57 return sprintf(buf,
"%d\n", mdev->nrbchan);
63 struct mISDNdevice *mdev = dev_to_mISDN(dev);
67 return sprintf(buf,
"%d\n", mdev->Dprotocols);
73 struct mISDNdevice *mdev = dev_to_mISDN(dev);
83 struct mISDNdevice *mdev = dev_to_mISDN(dev);
87 return sprintf(buf,
"%d\n", mdev->D.protocol);
93 strcpy(buf, dev_name(dev));
99 const char *buf,
size_t count)
108 if (count && out[count - 1] ==
'\n')
114 return (err < 0) ? err :
count;
121 struct mISDNdevice *mdev = dev_to_mISDN(dev);
125 for (i = 0; i <= mdev->nrbchan; i++)
126 *bp++ = test_channelmap(i, mdev->channelmap) ?
'1' :
'0';
143 #ifdef CONFIG_HOTPLUG
146 struct mISDNdevice *mdev = dev_to_mISDN(dev);
158 static void mISDN_class_release(
struct class *cls)
163 static struct class mISDN_class = {
166 #ifdef CONFIG_HOTPLUG
167 .dev_uevent = mISDN_uevent,
169 .dev_attrs = mISDN_dev_attrs,
170 .dev_release = mISDN_dev_release,
171 .class_release = mISDN_class_release,
175 _get_mdevice(
struct device *dev,
void *
id)
177 struct mISDNdevice *mdev = dev_to_mISDN(dev);
181 if (mdev->id != *(
u_int *)
id)
194 _get_mdevice_count(
struct device *dev,
void *
cnt)
228 err = get_free_devid();
238 if (
debug & DEBUG_CORE)
240 dev_name(&dev->dev), dev->id);
245 dev->dev.class = &mISDN_class;
246 dev->dev.platform_data =
dev;
247 dev->dev.parent = parent;
266 if (
debug & DEBUG_CORE)
268 dev_name(&dev->dev), dev->id);
282 struct Bprotocol *bp;
295 struct Bprotocol *bp;
299 if (bp->Bprotocols & m) {
325 struct Bprotocol *old;
327 if (
debug & DEBUG_CORE)
329 bp->name, bp->Bprotocols);
333 "register duplicate protocol old %s/%x new %s/%x\n",
334 old->name, old->Bprotocols, bp->name, bp->Bprotocols);
349 if (
debug & DEBUG_CORE)
358 static const char *msg_no_channel =
"<no channel>";
359 static const char *msg_no_stack =
"<no stack>";
360 static const char *msg_no_stackdev =
"<no stack device>";
365 return msg_no_channel;
369 return msg_no_stackdev;
370 return dev_name(&ch->st->dev->dev);
412 static void mISDN_cleanup(
void)