linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Replace mod_inc_use_count with __module_get for watchdog drivers
@ 2003-07-12 22:14 Jan Dittmer
  2003-07-13  8:05 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Dittmer @ 2003-07-12 22:14 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

[-- 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 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Replace mod_inc_use_count with __module_get for watchdog drivers
  2003-07-12 22:14 Replace mod_inc_use_count with __module_get for watchdog drivers Jan Dittmer
@ 2003-07-13  8:05 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2003-07-13  8:05 UTC (permalink / raw)
  To: Jan Dittmer; +Cc: Linux Kernel Mailing List

On Sad, 2003-07-12 at 23:14, Jan Dittmer wrote:
> 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?

Looks good to me.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-13  7:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-12 22:14 Replace mod_inc_use_count with __module_get for watchdog drivers Jan Dittmer
2003-07-13  8:05 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).