mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: lvm-devel@sistina.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] remove __MOD_* from dm
Date: Fri, 20 Dec 2002 15:38:56 -0800	[thread overview]
Message-ID: <20021220233855.GA13962@kroah.com> (raw)

Here's another patch against 2.5.52-bk that gets rid of the old __MOD_*
functions for the newer module api.  This also allows the modules to be
unloaded.

Joe, please add this to your next round of patches.

thanks,

greg k-h


# DM: convert old __MOD_INC and __MOD_DEC calls to the new style.

diff -Nru a/drivers/md/dm-target.c b/drivers/md/dm-target.c
--- a/drivers/md/dm-target.c	Fri Dec 20 15:38:41 2002
+++ b/drivers/md/dm-target.c	Fri Dec 20 15:38:41 2002
@@ -46,10 +46,14 @@
 	ti = __find_target_type(name);
 
 	if (ti) {
-		if (ti->use == 0 && ti->tt.module)
-			__MOD_INC_USE_COUNT(ti->tt.module);
+		if (ti->use == 0)
+			if (!try_module_get(ti->tt.module)) {
+				ti = NULL;
+				goto exit;
+			}
 		ti->use++;
 	}
+exit:
 	read_unlock(&_lock);
 
 	return ti;
@@ -86,8 +90,8 @@
 	struct tt_internal *ti = (struct tt_internal *) t;
 
 	read_lock(&_lock);
-	if (--ti->use == 0 && ti->tt.module)
-		__MOD_DEC_USE_COUNT(ti->tt.module);
+	if (--ti->use == 0)
+		module_put(ti->tt.module);
 
 	if (ti->use < 0)
 		BUG();

             reply	other threads:[~2002-12-20 23:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-20 23:38 Greg KH [this message]
2002-12-30 14:24 ` [lvm-devel] " Joe Thornber

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=20021220233855.GA13962@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvm-devel@sistina.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome