All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] ataflop: remove buggy IRQ disable from do_fd_request()
@ 2009-10-09  9:53 Jiri Kosina
  2009-10-09  9:58 ` Jens Axboe
  2009-10-10  9:01 ` Fwd: " Geert Uytterhoeven
  0 siblings, 2 replies; 17+ messages in thread
From: Jiri Kosina @ 2009-10-09  9:53 UTC (permalink / raw)
  To: Geert Uytterhoeven, Tejun Heo, Jens Axboe; +Cc: linux-kernel

There is a nice gem in drivers/block/ataflop.c::do_fd_request()

	void do_fd_request(struct request_queue * q)
	{
		unsigned long flags;

		DPRINT(("do_fd_request for pid %d\n",current->pid));
		while( fdc_busy ) sleep_on( &fdc_wait );
		fdc_busy = 1;
		stdma_lock(floppy_irq, NULL);

		atari_disable_irq( IRQ_MFP_FDC );
		local_save_flags(flags);        /* The request function is called with ints
		local_irq_disable();             * disabled... so must save the IPL for later */
		redo_fd_request();
		local_irq_restore(flags);
		atari_enable_irq( IRQ_MFP_FDC );
	}

If you look at the code long enough, you will notioce that the 
local_irq_disable() call is actually commented out. This has been 
introduced back in 2002 in [1], but as you can see, the same bug has been 
there even before, with the sti() call being commented out in the very 
same way :)

I am not familiar with the code myself at all, but I guess that the whole 
stuff can just be removed. Why do we need save_flags/restore_flags at all, 
without actually disabling the local IRQs afterwards? The 
redo_fd_request() doesn't seem to do anything that would mess with flags 
inconsistently.

But I'd rather anyone who has touched the surrounding code in past years 
Ack it. I can then take it through trivial tree or submit to akpm.

[1] http://lkml.org/lkml/2002/12/27/58

Signed-off-by: Jiri Kosina <jkosina@suse.cz>

---
 drivers/block/ataflop.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 847a9e5..a5af1d6 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1478,10 +1478,7 @@ void do_fd_request(struct request_queue * q)
 	stdma_lock(floppy_irq, NULL);
 
 	atari_disable_irq( IRQ_MFP_FDC );
-	local_save_flags(flags);	/* The request function is called with ints
-	local_irq_disable();		 * disabled... so must save the IPL for later */ 
 	redo_fd_request();
-	local_irq_restore(flags);
 	atari_enable_irq( IRQ_MFP_FDC );
 }
 
-- 
1.5.6


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

end of thread, other threads:[~2009-10-31  3:58 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-09  9:53 [PATCH] [RFC] ataflop: remove buggy IRQ disable from do_fd_request() Jiri Kosina
2009-10-09  9:58 ` Jens Axboe
2009-10-09 10:08   ` Jiri Kosina
2009-10-10  9:01 ` Fwd: " Geert Uytterhoeven
2009-10-11  7:01   ` Michael Schmitz
2009-10-12  7:58     ` Jens Axboe
2009-10-18  8:24       ` Michael Schmitz
2009-10-12  9:19     ` Jiri Kosina
2009-10-12  9:19     ` Jiri Kosina
2009-10-18 21:14       ` Michael Schmitz
2009-10-18 21:14         ` Michael Schmitz
2009-10-19  7:35         ` Jiri Kosina
2009-10-19  7:35           ` Jiri Kosina
2009-10-20  6:51           ` Michael Schmitz
2009-10-20  6:51           ` Michael Schmitz
2009-10-20  9:24             ` Andreas Schwab
2009-10-31  3:58               ` Michael Schmitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.