X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Ftelephony%2Fphonedev.c;h=bcea8d9b718ce782da7f1e3fdb20d4d278d9d00e;hb=f8a9efb52847433c6a2e1598d78e49c42a9aa3c5;hp=7a6db1c5c8c5bf491f8f9b237d18b2b812e0dcf3;hpb=14cc3e2b633bb64063698980974df4535368e98f;p=linux-2.6 diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index 7a6db1c5c8..bcea8d9b71 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c @@ -28,7 +28,6 @@ #include #include -#include #include #define PHONE_NUM_DEVICES 256 @@ -49,7 +48,7 @@ static int phone_open(struct inode *inode, struct file *file) unsigned int minor = iminor(inode); int err = 0; struct phone_device *p; - struct file_operations *old_fops, *new_fops = NULL; + const struct file_operations *old_fops, *new_fops = NULL; if (minor >= PHONE_NUM_DEVICES) return -ENODEV; @@ -106,8 +105,6 @@ int phone_register_device(struct phone_device *p, int unit) if (phone_device[i] == NULL) { phone_device[i] = p; p->minor = i; - devfs_mk_cdev(MKDEV(PHONE_MAJOR,i), - S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i); mutex_unlock(&phone_lock); return 0; } @@ -123,15 +120,13 @@ int phone_register_device(struct phone_device *p, int unit) void phone_unregister_device(struct phone_device *pfd) { mutex_lock(&phone_lock); - if (phone_device[pfd->minor] != pfd) - panic("phone: bad unregister"); - devfs_remove("phone/%d", pfd->minor); - phone_device[pfd->minor] = NULL; + if (likely(phone_device[pfd->minor] == pfd)) + phone_device[pfd->minor] = NULL; mutex_unlock(&phone_lock); } -static struct file_operations phone_fops = +static const struct file_operations phone_fops = { .owner = THIS_MODULE, .open = phone_open,