All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: rusty@rustcorp.com.au
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [RFC PATCH 3/3] Update dvb use of symbol_(get|put)
Date: Sat, 10 Mar 2007 02:32:08 -0200	[thread overview]
Message-ID: <1173501128.26213.407.camel@localhost> (raw)

From: Trent Piepho <xyzzy@speakeasy.org>

Make the dvb sub-system use the ability of symbol_(put|get) to keep track
of what module did the putting or getting.  In the dvb sub-system,
symbol_put is called through the macro dvb_attach().  A driver for a
bridge or card will attach frontends, tuners, or other helper drivers,
and this card driver will be listed as the user of the helper drivers.

When the card driver unloads, a single function in dvb-core,
dvb_frontend_detach(), will release all the helper drivers.  Since the
get() happened in the card driver, but the put() is happening in
dvb-core, it is necessary to use __symbol_put_addr() so that a user other
than THIS_MODULE (which would be dvb-core, while we want the card driver)
can be specified.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>

diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -1718,12 +1718,9 @@ static void dst_release(struct dvb_front
 	if (state->dst_ca) {
 		dvb_unregister_device(state->dst_ca);
 #ifdef CONFIG_DVB_CORE_ATTACH
-		symbol_put(dst_ca_attach);
+		symbol_put_user(dst_ca_attach, fe->dvb->module);
 #endif
 	}
-#ifdef CONFIG_DVB_CORE_ATTACH
-	symbol_put(dst_attach);
-#endif
 	kfree(state);
 }
 
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1127,19 +1127,20 @@ void dvb_frontend_detach(struct dvb_fron
 void dvb_frontend_detach(struct dvb_frontend* fe)
 {
 	void *ptr;
+	struct module *mod = fe->dvb->module;
 
 	if (fe->ops.release_sec) {
 		fe->ops.release_sec(fe);
-		symbol_put_addr(fe->ops.release_sec);
+		__symbol_put_addr(fe->ops.release_sec, mod);
 	}
 	if (fe->ops.tuner_ops.release) {
 		fe->ops.tuner_ops.release(fe);
-		symbol_put_addr(fe->ops.tuner_ops.release);
+		__symbol_put_addr(fe->ops.tuner_ops.release, mod);
 	}
 	ptr = (void*)fe->ops.release;
 	if (ptr) {
-		fe->ops.release(fe);
-		symbol_put_addr(ptr);
+		fe->ops.release(fe); /* This call will de-allocate fe! */
+		__symbol_put_addr(ptr, mod);
 	}
 }
 #else




                 reply	other threads:[~2007-03-10  4:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1173501128.26213.407.camel@localhost \
    --to=mchehab@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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.