#include <linux/slab.h>
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/mISDNif.h>
#include "core.h"
static u_int debug;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_param(debug, uint, S_IRUGO | S_IWUSR);
static u64 device_ids;
#define MAX_DEVICE_ID …
static LIST_HEAD(Bprotocols);
static DEFINE_RWLOCK(bp_lock);
static void mISDN_dev_release(struct device *dev)
{ … }
static ssize_t id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(id);
static ssize_t nrbchan_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(nrbchan);
static ssize_t d_protocols_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(d_protocols);
static ssize_t b_protocols_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(b_protocols);
static ssize_t protocol_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(protocol);
static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(name);
#if 0
static ssize_t name_set(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
int err = 0;
char *out = kmalloc(count + 1, GFP_KERNEL);
if (!out)
return -ENOMEM;
memcpy(out, buf, count);
if (count && out[count - 1] == '\n')
out[--count] = 0;
if (count)
err = device_rename(dev, out);
kfree(out);
return (err < 0) ? err : count;
}
static DEVICE_ATTR_RW(name);
#endif
static ssize_t channelmap_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(channelmap);
static struct attribute *mISDN_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int mISDN_uevent(const struct device *dev, struct kobj_uevent_env *env)
{ … }
static struct class mISDN_class = …;
static int
_get_mdevice(struct device *dev, const void *id)
{ … }
struct mISDNdevice
*get_mdevice(u_int id)
{ … }
static int
_get_mdevice_count(struct device *dev, void *cnt)
{ … }
int
get_mdevice_count(void)
{ … }
static int
get_free_devid(void)
{ … }
int
mISDN_register_device(struct mISDNdevice *dev,
struct device *parent, char *name)
{ … }
EXPORT_SYMBOL(…);
void
mISDN_unregister_device(struct mISDNdevice *dev) { … }
EXPORT_SYMBOL(…);
u_int
get_all_Bprotocols(void)
{ … }
struct Bprotocol *
get_Bprotocol4mask(u_int m)
{ … }
struct Bprotocol *
get_Bprotocol4id(u_int id)
{ … }
int
mISDN_register_Bprotocol(struct Bprotocol *bp)
{ … }
EXPORT_SYMBOL(…);
void
mISDN_unregister_Bprotocol(struct Bprotocol *bp)
{ … }
EXPORT_SYMBOL(…);
static const char *msg_no_channel = …;
static const char *msg_no_stack = …;
static const char *msg_no_stackdev = …;
const char *mISDNDevName4ch(struct mISDNchannel *ch)
{
if (!ch)
return msg_no_channel;
if (!ch->st)
return msg_no_stack;
if (!ch->st->dev)
return msg_no_stackdev;
return dev_name(&ch->st->dev->dev);
};
EXPORT_SYMBOL(…);
static int
mISDNInit(void)
{ … }
static void mISDN_cleanup(void)
{ … }
module_init(…) …;
module_exit(mISDN_cleanup);