Commit afa8053d authored by Paul King's avatar Paul King Committed by Linus Torvalds

[PATCH] telephony: support devfs

Add devfs support to telephony devices.  Only tested with a single
telephony device.  Devices name phone/<minor>.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4a48e29f
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/sem.h> #include <linux/sem.h>
#include <linux/devfs_fs_kernel.h>
#define PHONE_NUM_DEVICES 256 #define PHONE_NUM_DEVICES 256
...@@ -105,6 +105,8 @@ int phone_register_device(struct phone_device *p, int unit) ...@@ -105,6 +105,8 @@ int phone_register_device(struct phone_device *p, int unit)
if (phone_device[i] == NULL) { if (phone_device[i] == NULL) {
phone_device[i] = p; phone_device[i] = p;
p->minor = i; p->minor = i;
devfs_mk_cdev(MKDEV(PHONE_MAJOR,i),
S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i);
up(&phone_lock); up(&phone_lock);
return 0; return 0;
} }
...@@ -122,6 +124,7 @@ void phone_unregister_device(struct phone_device *pfd) ...@@ -122,6 +124,7 @@ void phone_unregister_device(struct phone_device *pfd)
down(&phone_lock); down(&phone_lock);
if (phone_device[pfd->minor] != pfd) if (phone_device[pfd->minor] != pfd)
panic("phone: bad unregister"); panic("phone: bad unregister");
devfs_remove("phone/%d", pfd->minor);
phone_device[pfd->minor] = NULL; phone_device[pfd->minor] = NULL;
up(&phone_lock); up(&phone_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment