public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: torvalds@osdl.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] mark ftape un-removable
Date: Wed, 18 Feb 2004 15:23:43 +0100	[thread overview]
Message-ID: <20040218142343.GA11147@lst.de> (raw)

I've just grepped over the tree for reamining MOD_INC_USE_COUNT users,
and ftape is a really horrible one, it relies on MOD_{INC,DEV}_USE_COUNT
in the most horrible places + it's own bookkepping and the <= 2.4 may
unload hooks.  And although I don't have the hardware I can guarantee it
doesn't work as expected.

So let's just remove the module_exit handler and mark it unremovable,
if someone wants to fix up ftape later it's fine with me, but it's
a really scary driver..


--- 1.8/drivers/char/ftape/compressor/zftape-compress.c	Mon Feb  3 21:19:37 2003
+++ edited/drivers/char/ftape/compressor/zftape-compress.c	Sun Oct  5 16:13:32 2003
@@ -59,8 +59,6 @@
 
 /* local variables 
  */
-static int keep_module_locked = 1;
-
 static void *zftc_wrk_mem = NULL;
 static __u8 *zftc_buf     = NULL;
 static void *zftc_scratch_buf  = NULL;
@@ -267,10 +265,6 @@
 
 static void zftc_lock(void)
 {
-	MOD_INC_USE_COUNT; /*  sets MOD_VISITED and MOD_USED_ONCE,
-			    *  locking is done with can_unload()
-			    */
-	keep_module_locked = 1;
 }
 
 /*  this function is needed for zftape_reset_position in zftape-io.c 
@@ -281,7 +275,6 @@
 
 	memset((void *)&cseg, '\0', sizeof(cseg));
 	zftc_stats();
-	keep_module_locked = 0;
 	TRACE_EXIT;
 }
 
@@ -554,10 +547,6 @@
 	int buf_pos_write = pos->seg_byte_pos;
 	TRACE_FUN(ft_t_flow);
 	
-	keep_module_locked = 1;
-	MOD_INC_USE_COUNT; /*  sets MOD_VISITED and MOD_USED_ONCE,
-			    *  locking is done with can_unload()
-			    */
 	/* Note: we do not unlock the module because
 	 * there are some values cached in that `cseg' variable.  We
 	 * don't don't want to use this information when being
@@ -675,10 +664,6 @@
 	int remaining = to_do;
 	TRACE_FUN(ft_t_flow);
 
-	keep_module_locked = 1;
-	MOD_INC_USE_COUNT; /*  sets MOD_VISITED and MOD_USED_ONCE,
-			    *  locking is done with can_unload()
-			    */
 	TRACE_CATCH(zft_allocate_cmpr_mem(volume->blk_sz),);
 	if (pos->seg_byte_pos == 0) {
 		/* new segment just read
@@ -799,10 +784,6 @@
 	int fast_seek_trials = 0;
 	TRACE_FUN(ft_t_flow);
 
-	keep_module_locked = 1;
-	MOD_INC_USE_COUNT; /*  sets MOD_VISITED and MOD_USED_ONCE,
-			    *  locking is done with can_unload()
-			    */
 	if (new_block_pos == 0) {
 		pos->seg_pos      = volume->start_seg;
 		pos->seg_byte_pos = 0;
@@ -1221,31 +1202,7 @@
  */
 int init_module(void)
 {
-	int result;
-
-#if 0 /* FIXME --RR */
-	if (!mod_member_present(&__this_module, can_unload))
-		return -EBUSY;
-	__this_module.can_unload = can_unload;
-#endif
-	result = zft_compressor_init();
-	keep_module_locked = 0;
-	return result;
+	return zft_compressor_init();
 }
 
-/* Called by modules package when removing the driver 
- */
-void cleanup_module(void)
-{
-	TRACE_FUN(ft_t_flow);
-
-	if (zft_cmpr_unregister() != &cmpr_ops) {
-		TRACE(ft_t_info, "failed");
-	} else {
-		TRACE(ft_t_info, "successful");
-	}
-	zftc_cleanup();
-        printk(KERN_INFO "zft-compressor successfully unloaded.\n");
-	TRACE_EXIT;
-}
 #endif /* MODULE */

                 reply	other threads:[~2004-02-18 14:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20040218142343.GA11147@lst.de \
    --to=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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