public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Dittmer <j.dittmer@portrix.net>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Replace mod_inc_use_count with __module_get for watchdog drivers
Date: Sun, 13 Jul 2003 00:14:15 +0200	[thread overview]
Message-ID: <3F108837.8060604@portrix.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

Hi,

I found this comment in mixcomwd.c and proceeded accordingly.
This prevents the watchdog drivers from being unloaded after initialized and 
gets rid of the warnings. This doesn't just remove any occurance of 
MOD_INC_USE_COUNT, but replaces it with __module_get().
Is this correct?

Jan

/** fops_get() code via open() has already done
* a try_module_get() so it is safe to do the
* __module_get().
*/

--
Linux rubicon 2.5.75-mm1-jd10 #1 SMP Sat Jul 12 19:40:28 CEST 2003 i686

[-- Attachment #2: watchdogs_replace_mod_inc_with_mod_get --]
[-- Type: text/plain, Size: 4986 bytes --]

The watchdog drivers use MOD_INC_USE_COUNT for not being unloaded accidently.
Therefore this call cannot be removed totally, but instead I replaced it 
with __module_get(THIS_MODULE) as other watchdog drivers seem to do it.

Jan

diff -urN -X exclude linux-bk/drivers/char/watchdog/acquirewdt.c 2.5.75-bk1/drivers/char/watchdog/acquirewdt.c
--- linux-bk/drivers/char/watchdog/acquirewdt.c	Mon May  5 01:53:32 2003
+++ 2.5.75-bk1/drivers/char/watchdog/acquirewdt.c	Sat Jul 12 10:51:30 2003
@@ -143,7 +143,7 @@
 			return -EBUSY;
 		}
 		if (nowayout)
-			MOD_INC_USE_COUNT;
+			__module_get(THIS_MODULE);
 
 		/* Activate */
 		acq_is_open=1;
diff -urN -X exclude linux-bk/drivers/char/watchdog/ib700wdt.c 2.5.75-bk1/drivers/char/watchdog/ib700wdt.c
--- linux-bk/drivers/char/watchdog/ib700wdt.c	Mon May  5 01:53:41 2003
+++ 2.5.75-bk1/drivers/char/watchdog/ib700wdt.c	Sat Jul 12 10:51:46 2003
@@ -230,7 +230,7 @@
 			return -EBUSY;
 		}
 		if (nowayout)
-			MOD_INC_USE_COUNT;
+			__module_get(THIS_MODULE);
 
 		/* Activate */
 		ibwdt_is_open = 1;
diff -urN -X exclude linux-bk/drivers/char/watchdog/indydog.c 2.5.75-bk1/drivers/char/watchdog/indydog.c
--- linux-bk/drivers/char/watchdog/indydog.c	Mon May  5 01:53:41 2003
+++ 2.5.75-bk1/drivers/char/watchdog/indydog.c	Sat Jul 12 10:52:03 2003
@@ -54,7 +54,7 @@
 		return -EBUSY;
 
 	if (nowayout)
-		MOD_INC_USE_COUNT;
+		__module_get(THIS_MODULE);
 
 	/*
 	 *	Activate timer
diff -urN -X exclude linux-bk/drivers/char/watchdog/machzwd.c 2.5.75-bk1/drivers/char/watchdog/machzwd.c
--- linux-bk/drivers/char/watchdog/machzwd.c	Mon May  5 01:53:03 2003
+++ 2.5.75-bk1/drivers/char/watchdog/machzwd.c	Sat Jul 12 10:52:22 2003
@@ -392,7 +392,7 @@
 			}
 
 			if (nowayout)
-				MOD_INC_USE_COUNT;
+				__module_get(THIS_MODULE);
 
 			zf_is_open = 1;
 
diff -urN -X exclude linux-bk/drivers/char/watchdog/pcwd.c 2.5.75-bk1/drivers/char/watchdog/pcwd.c
--- linux-bk/drivers/char/watchdog/pcwd.c	Fri May 30 20:29:33 2003
+++ 2.5.75-bk1/drivers/char/watchdog/pcwd.c	Sat Jul 12 10:52:37 2003
@@ -431,7 +431,7 @@
 			atomic_inc( &open_allowed );
 			return -EBUSY;
 		}
-		MOD_INC_USE_COUNT;
+		__module_get(THIS_MODULE);
 		/*  Enable the port  */
 		if (revision == PCWD_REVISION_C) {
 			spin_lock(&io_lock);
diff -urN -X exclude linux-bk/drivers/char/watchdog/sbc60xxwdt.c 2.5.75-bk1/drivers/char/watchdog/sbc60xxwdt.c
--- linux-bk/drivers/char/watchdog/sbc60xxwdt.c	Mon May  5 01:53:35 2003
+++ 2.5.75-bk1/drivers/char/watchdog/sbc60xxwdt.c	Sat Jul 12 10:52:53 2003
@@ -207,9 +207,8 @@
 			/* Just in case we're already talking to someone... */
 			if(wdt_is_open)
 				return -EBUSY;
-			if (nowayout) {
-				MOD_INC_USE_COUNT;
-			}
+			if (nowayout) 
+				__module_get(THIS_MODULE);
 			/* Good, fire up the show */
 			wdt_is_open = 1;
 			wdt_startup();
diff -urN -X exclude linux-bk/drivers/char/watchdog/sc520_wdt.c 2.5.75-bk1/drivers/char/watchdog/sc520_wdt.c
--- linux-bk/drivers/char/watchdog/sc520_wdt.c	Mon May  5 01:53:14 2003
+++ 2.5.75-bk1/drivers/char/watchdog/sc520_wdt.c	Sat Jul 12 10:53:12 2003
@@ -231,7 +231,7 @@
 			/* Good, fire up the show */
 			wdt_startup();
 			if (nowayout)
-				MOD_INC_USE_COUNT;
+				__module_get(THIS_MODULE);
 
 			return 0;
 		default:
diff -urN -X exclude linux-bk/drivers/char/watchdog/shwdt.c 2.5.75-bk1/drivers/char/watchdog/shwdt.c
--- linux-bk/drivers/char/watchdog/shwdt.c	Mon May  5 01:53:09 2003
+++ 2.5.75-bk1/drivers/char/watchdog/shwdt.c	Sat Jul 12 10:53:28 2003
@@ -189,9 +189,8 @@
 			if (test_and_set_bit(0, &sh_is_open))
 				return -EBUSY;
 
-			if (nowayout) {
-				MOD_INC_USE_COUNT;
-			}
+			if (nowayout) 
+				__module_get(THIS_MODULE);
 
 			sh_wdt_start();
 
diff -urN -X exclude linux-bk/drivers/char/watchdog/softdog.c 2.5.75-bk1/drivers/char/watchdog/softdog.c
--- linux-bk/drivers/char/watchdog/softdog.c	Mon May  5 01:53:13 2003
+++ 2.5.75-bk1/drivers/char/watchdog/softdog.c	Sat Jul 12 10:53:42 2003
@@ -104,9 +104,8 @@
 {
 	if(test_and_set_bit(0, &timer_alive))
 		return -EBUSY;
-	if (nowayout) {
-		MOD_INC_USE_COUNT;
-	}
+	if (nowayout) 
+		__module_get(THIS_MODULE);
 	/*
 	 *	Activate timer
 	 */
diff -urN -X exclude linux-bk/drivers/char/watchdog/wdt977.c 2.5.75-bk1/drivers/char/watchdog/wdt977.c
--- linux-bk/drivers/char/watchdog/wdt977.c	Mon May  5 01:53:37 2003
+++ 2.5.75-bk1/drivers/char/watchdog/wdt977.c	Sat Jul 12 10:53:55 2003
@@ -99,7 +99,7 @@
 
 	if (nowayout)
 	{
-		MOD_INC_USE_COUNT;
+		__module_get(THIS_MODULE);
 
 		/* do not permit disabling the watchdog by writing 0 to reg. 0xF2 */
 		if (!timeoutM) timeoutM = DEFAULT_TIMEOUT;
diff -urN -X exclude linux-bk/drivers/char/watchdog/wdt_pci.c 2.5.75-bk1/drivers/char/watchdog/wdt_pci.c
--- linux-bk/drivers/char/watchdog/wdt_pci.c	Mon May  5 01:53:32 2003
+++ 2.5.75-bk1/drivers/char/watchdog/wdt_pci.c	Sat Jul 12 10:54:10 2003
@@ -367,7 +367,7 @@
 				return -EBUSY;
 
 			if (nowayout) {
-				MOD_INC_USE_COUNT;
+				__module_get(THIS_MODULE);
 			}
 			/*
 			 *	Activate 

             reply	other threads:[~2003-07-12 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-12 22:14 Jan Dittmer [this message]
2003-07-13  8:05 ` Replace mod_inc_use_count with __module_get for watchdog drivers Alan Cox

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=3F108837.8060604@portrix.net \
    --to=j.dittmer@portrix.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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