17 #include <linux/module.h>
18 #include <linux/types.h>
19 #include <linux/kernel.h>
22 #include <linux/string.h>
23 #include <linux/errno.h>
26 #include <asm/uaccess.h>
29 #include <linux/sem.h>
32 #define PHONE_NUM_DEVICES 256
47 unsigned int minor = iminor(inode);
49 struct phone_device *
p;
56 p = phone_device[minor];
61 request_module(
"char-major-%d-%d",
PHONE_MAJOR, minor);
63 p = phone_device[minor];
70 old_fops = file->
f_op;
71 file->
f_op = new_fops;
73 err = p->
open(p, file);
97 if (unit != PHONE_UNIT_ANY) {
103 for (i = base; i <
end; i++) {
104 if (phone_device[i] ==
NULL) {
122 if (
likely(phone_device[pfd->minor] == pfd))
123 phone_device[pfd->minor] =
NULL;
144 static int __init telephony_init(
void)
147 if (register_chrdev(
PHONE_MAJOR,
"telephony", &phone_fops)) {
155 static void __exit telephony_exit(
void)