Commit ce93d33c authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

TTY: isdn, do not play with module refcounts

The module which called allocate_tty_driver is already refcounted by
the TTY layer automatically. And since THIS_MODULE is isdn_tty and it
allocated the tty_driver, there is no need to do the counts in isdn's
tty->ops->open/close.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6776a2f0
...@@ -1584,10 +1584,6 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp) ...@@ -1584,10 +1584,6 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
info = &dev->mdm.info[tty->index]; info = &dev->mdm.info[tty->index];
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open")) if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_open"))
return -ENODEV; return -ENODEV;
if (!try_module_get(info->owner)) {
printk(KERN_WARNING "%s: cannot reserve module\n", __func__);
return -ENODEV;
}
#ifdef ISDN_DEBUG_MODEM_OPEN #ifdef ISDN_DEBUG_MODEM_OPEN
printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name, printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name,
info->count); info->count);
...@@ -1603,7 +1599,6 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp) ...@@ -1603,7 +1599,6 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
#ifdef ISDN_DEBUG_MODEM_OPEN #ifdef ISDN_DEBUG_MODEM_OPEN
printk(KERN_DEBUG "isdn_tty_open return after startup\n"); printk(KERN_DEBUG "isdn_tty_open return after startup\n");
#endif #endif
module_put(info->owner);
return retval; return retval;
} }
retval = isdn_tty_block_til_ready(tty, filp, info); retval = isdn_tty_block_til_ready(tty, filp, info);
...@@ -1611,7 +1606,6 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp) ...@@ -1611,7 +1606,6 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
#ifdef ISDN_DEBUG_MODEM_OPEN #ifdef ISDN_DEBUG_MODEM_OPEN
printk(KERN_DEBUG "isdn_tty_open return after isdn_tty_block_til_ready \n"); printk(KERN_DEBUG "isdn_tty_open return after isdn_tty_block_til_ready \n");
#endif #endif
module_put(info->owner);
return retval; return retval;
} }
#ifdef ISDN_DEBUG_MODEM_OPEN #ifdef ISDN_DEBUG_MODEM_OPEN
...@@ -1659,7 +1653,6 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp) ...@@ -1659,7 +1653,6 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
#ifdef ISDN_DEBUG_MODEM_OPEN #ifdef ISDN_DEBUG_MODEM_OPEN
printk(KERN_DEBUG "isdn_tty_close after info->count != 0\n"); printk(KERN_DEBUG "isdn_tty_close after info->count != 0\n");
#endif #endif
module_put(info->owner);
return; return;
} }
info->flags |= ASYNC_CLOSING; info->flags |= ASYNC_CLOSING;
...@@ -1692,7 +1685,6 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp) ...@@ -1692,7 +1685,6 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
info->tty = NULL; info->tty = NULL;
info->ncarrier = 0; info->ncarrier = 0;
tty->closing = 0; tty->closing = 0;
module_put(info->owner);
if (info->blocked_open) { if (info->blocked_open) {
msleep_interruptible(500); msleep_interruptible(500);
wake_up_interruptible(&info->open_wait); wake_up_interruptible(&info->open_wait);
...@@ -1879,9 +1871,6 @@ isdn_tty_modem_init(void) ...@@ -1879,9 +1871,6 @@ isdn_tty_modem_init(void)
retval = -ENOMEM; retval = -ENOMEM;
goto err_unregister; goto err_unregister;
} }
#endif
#ifdef MODULE
info->owner = THIS_MODULE;
#endif #endif
spin_lock_init(&info->readlock); spin_lock_init(&info->readlock);
sprintf(info->last_cause, "0000"); sprintf(info->last_cause, "0000");
......
...@@ -435,7 +435,6 @@ typedef struct atemu { ...@@ -435,7 +435,6 @@ typedef struct atemu {
/* Private data (similar to async_struct in <linux/serial.h>) */ /* Private data (similar to async_struct in <linux/serial.h>) */
typedef struct modem_info { typedef struct modem_info {
int magic; int magic;
struct module *owner;
int flags; /* defined in tty.h */ int flags; /* defined in tty.h */
int x_char; /* xon/xoff character */ int x_char; /* xon/xoff character */
int mcr; /* Modem control register */ int mcr; /* Modem control register */
......
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