Replace mod_inc_use_count with __module_get for watchdog drivers
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
drivers/char/watchdog/acquirewdt.c +1 -1
@@ -143,7 +143,7 @@return -EBUSY ; }if (nowayout) -MOD_INC_USE_COUNT ; +__module_get (THIS_MODULE );/* Activate */ acq_is_open=1 ;
drivers/char/watchdog/ib700wdt.c +1 -1
@@ -230,7 +230,7 @@return -EBUSY ; }if (nowayout) -MOD_INC_USE_COUNT ; +__module_get (THIS_MODULE );/* Activate */ ibwdt_is_open =1 ;
drivers/char/watchdog/indydog.c +1 -1
@@ -54,7 +54,7 @@return -EBUSY ;if (nowayout) -MOD_INC_USE_COUNT ; +__module_get (THIS_MODULE );/* * Activate timer
drivers/char/watchdog/machzwd.c +1 -1
@@ -392,7 +392,7 @@ }if (nowayout) -MOD_INC_USE_COUNT ; +__module_get (THIS_MODULE ); zf_is_open =1 ;
drivers/char/watchdog/pcwd.c +1 -1
@@ -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);
drivers/char/watchdog/sbc60xxwdt.c +2 -3
@@ -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 ();
drivers/char/watchdog/sc520_wdt.c +1 -1
@@ -231,7 +231,7 @@/* Good, fire up the show */ wdt_startup ();if (nowayout) -MOD_INC_USE_COUNT ; +__module_get (THIS_MODULE );return 0 ;default :
drivers/char/watchdog/shwdt.c +2 -3
@@ -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 ();
drivers/char/watchdog/softdog.c +2 -3
@@ -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 */
drivers/char/watchdog/wdt977.c +1 -1
@@ -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 ;
drivers/char/watchdog/wdt_pci.c +1 -1
@@ -367,7 +367,7 @@return -EBUSY ;if (nowayout) { -MOD_INC_USE_COUNT ; +__module_get (THIS_MODULE ); }/* * Activate
Quoted 7 lines · Jan Dittmer
Hi,
I found this comment in
mixcomwd.cand 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 ofMOD_INC_USE_COUNT, but replaces it with__module_get().
Is this correct?
Looks good to me.