Replace mod_inc_use_count with __module_get for watchdog drivers

From: Jan Dittmer (j.dittmer@portrix.net)
Date: Sat Jul 12 2003 - 17:14:15 EST


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

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

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 15 2003 - 22:00:46 EST