Replace mod_inc_use_count with __module_get for watchdog drivers

Jan Dittmer (j.dittmer@portrix.net)
Sun, 13 Jul 2003 00:14:15 +0200


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-14592-1058048294-0001-2
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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

--=_courier-14592-1058048294-0001-2 Content-Type: text/plain; name="watchdogs_replace_mod_inc_with_mod_get"; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="watchdogs_replace_mod_inc_with_mod_get"

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

--=_courier-14592-1058048294-0001-2--