From: Andreas Herrmann <aherrman@arcor.de>
To: Tilmann Schmidt <tilman@imap.cc>, Hansjoerg Lipp <hjlipp@web.de>
Cc: gigaset307x-common@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH] gigaset: fix module reference counting
Date: Sat, 7 Jun 2008 00:39:18 +0200 [thread overview]
Message-ID: <20080606223918.GA10348@kodscha> (raw)
bas_gigaset can't be unloaded due to wrong module reference counting.
Ensure that module_put is called whenever a channel is freed.
Signed-off-by: Andreas Herrmann <aherrman@arcor.de>
---
drivers/isdn/gigaset/common.c | 5 +----
drivers/isdn/gigaset/gigaset.h | 1 -
2 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 827c32c..8498317 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -184,7 +184,6 @@ int gigaset_get_channel(struct bc_state *bcs)
return 0;
}
++bcs->use_count;
- bcs->busy = 1;
gig_dbg(DEBUG_ANY, "allocated channel %d", bcs->channel);
spin_unlock_irqrestore(&bcs->cs->lock, flags);
return 1;
@@ -195,13 +194,12 @@ void gigaset_free_channel(struct bc_state *bcs)
unsigned long flags;
spin_lock_irqsave(&bcs->cs->lock, flags);
- if (!bcs->busy) {
+ if (!bcs->use_count) {
gig_dbg(DEBUG_ANY, "could not free channel %d", bcs->channel);
spin_unlock_irqrestore(&bcs->cs->lock, flags);
return;
}
--bcs->use_count;
- bcs->busy = 0;
module_put(bcs->cs->driver->owner);
gig_dbg(DEBUG_ANY, "freed channel %d", bcs->channel);
spin_unlock_irqrestore(&bcs->cs->lock, flags);
@@ -589,7 +587,6 @@ static struct bc_state *gigaset_initbcs(struct bc_state *bcs,
bcs->chstate = 0;
bcs->use_count = 1;
- bcs->busy = 0;
bcs->ignore = cs->ignoreframes;
for (i = 0; i < AT_NUM; ++i)
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index f365993..ef1bc17 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -419,7 +419,6 @@ struct bc_state {
#ifdef CONFIG_GIGASET_DEBUG
int emptycount;
#endif
- int busy;
int use_count;
/* private data of hardware drivers */
--
1.5.3.7
next reply other threads:[~2008-06-06 20:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-06 22:39 Andreas Herrmann [this message]
2008-06-15 23:09 ` [PATCH] gigaset: fix module reference counting Tilman Schmidt
2008-06-23 7:32 ` Andreas Herrmann
2008-06-23 7:38 ` Tilman Schmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080606223918.GA10348@kodscha \
--to=aherrman@arcor.de \
--cc=gigaset307x-common@lists.sourceforge.net \
--cc=hjlipp@web.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tilman@imap.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.