diff options
author | Tilman Schmidt <tilman@imap.cc> | 2008-02-06 04:38:29 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:12 -0500 |
commit | e468c04894f36045cf93d1384183a461014b6840 (patch) | |
tree | b734bbc4ee65f8282de5299dc200f47ea466067a /drivers/isdn/gigaset/interface.c | |
parent | 9d4bee2b9de9e30057a860d2d6794f874caffc5e (diff) |
Gigaset: permit module unload
Fix the initialization and reference counting of the Gigaset driver modules
so that they can be unloaded when they are not actually in use.
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Cc: Hansjoerg Lipp <hjlipp@web.de>
Cc: Greg KH <gregkh@suse.de>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/isdn/gigaset/interface.c')
-rw-r--r-- | drivers/isdn/gigaset/interface.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index f4731c9984f6..af195b07c191 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -161,7 +161,7 @@ static int if_open(struct tty_struct *tty, struct file *filp) | |||
161 | tty->driver_data = NULL; | 161 | tty->driver_data = NULL; |
162 | 162 | ||
163 | cs = gigaset_get_cs_by_tty(tty); | 163 | cs = gigaset_get_cs_by_tty(tty); |
164 | if (!cs) | 164 | if (!cs || !try_module_get(cs->driver->owner)) |
165 | return -ENODEV; | 165 | return -ENODEV; |
166 | 166 | ||
167 | if (mutex_lock_interruptible(&cs->mutex)) | 167 | if (mutex_lock_interruptible(&cs->mutex)) |
@@ -207,6 +207,8 @@ static void if_close(struct tty_struct *tty, struct file *filp) | |||
207 | } | 207 | } |
208 | 208 | ||
209 | mutex_unlock(&cs->mutex); | 209 | mutex_unlock(&cs->mutex); |
210 | |||
211 | module_put(cs->driver->owner); | ||
210 | } | 212 | } |
211 | 213 | ||
212 | static int if_ioctl(struct tty_struct *tty, struct file *file, | 214 | static int if_ioctl(struct tty_struct *tty, struct file *file, |