All of lore.kernel.org
 help / color / mirror / Atom feed
* cleanup of linux-2.5/drivers/block/swim3.c
@ 2003-07-04 10:46 Jasper Spaans
  2003-07-04 22:53 ` Paul Mackerras
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jasper Spaans @ 2003-07-04 10:46 UTC (permalink / raw)
  To: paulus, benh; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

Hello,

Attached is a patch which should solve compilation issues related to the new
irqhandler interface, and the deprecation of cli()/sti() for the
swim3-driver.

Can you take a look, and possibly, apply this? (I don't have any hardware to
test this on, however it compiles)

VrGr,
--
Jasper Spaans [not on the linuxppc-dev list, so please Cc me]


<==          ``Got no clue? Too bad for you''          ==>
<==                                                    ==>

[-- Attachment #2: swim3.c.diff --]
[-- Type: text/plain, Size: 3455 bytes --]

--- linux-2.5-ppc/drivers/block/swim3.c	2003-07-04 12:36:52.000000000 +0200
+++ linux-2.5-ppc/drivers/block/swim3.c-new	2003-07-04 12:32:32.000000000 +0200
@@ -26,6 +26,9 @@
 #include <linux/ioctl.h>
 #include <linux/blk.h>
 #include <linux/devfs_fs_kernel.h>
+#include <linux/interrupt.h>
+#include <linux/spinlock.h>
+
 #include <asm/io.h>
 #include <asm/dbdma.h>
 #include <asm/prom.h>
@@ -234,7 +237,7 @@
 static void scan_timeout(unsigned long data);
 static void seek_timeout(unsigned long data);
 static void xfer_timeout(unsigned long data);
-static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 /*static void fd_dma_interrupt(int irq, void *dev_id, struct pt_regs *regs);*/
 static int grab_drive(struct floppy_state *fs, enum swim_state state,
 		      int interruptible);
@@ -300,7 +303,6 @@
 			continue;
 		start_request(&floppy_states[i]);
 	}
-	sti();
 }

 static void start_request(struct floppy_state *fs)
@@ -359,9 +361,7 @@
 static void set_timeout(struct floppy_state *fs, int nticks,
 			void (*proc)(unsigned long))
 {
-	unsigned long flags;
-
-	save_flags(flags); cli();
+	spin_lock_irq(&swim3_lock);
 	if (fs->timeout_pending)
 		del_timer(&fs->timeout);
 	fs->timeout.expires = jiffies + nticks;
@@ -369,7 +369,7 @@
 	fs->timeout.data = (unsigned long) fs;
 	add_timer(&fs->timeout);
 	fs->timeout_pending = 1;
-	restore_flags(flags);
+	spin_unlock_irq(&swim3_lock);
 }

 static inline void scan_track(struct floppy_state *fs)
@@ -605,7 +605,7 @@
 	start_request(fs);
 }

-static void swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t swim3_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct floppy_state *fs = (struct floppy_state *) dev_id;
 	volatile struct swim3 *sw = fs->swim3;
@@ -613,6 +613,9 @@
 	int stat, resid;
 	struct dbdma_regs *dr;
 	struct dbdma_cmd *cp;
+	unsigned long flags;
+
+	spin_lock_irqsave(&swim3_lock, flags);

 	err = in_8(&sw->error);
 	intr = in_8(&sw->intr);
@@ -742,7 +745,13 @@
 		break;
 	default:
 		printk(KERN_ERR "swim3: don't know what to do in state %d\n", fs->state);
+#if 0
+		spin_unlock_irqrestore(&swim3_lock, flags);
+		return IRQ_NONE;
+#endif
 	}
+	spin_unlock_irqrestore(&swim3_lock, flags);
+	return IRQ_HANDLED;
 }

 /*
@@ -754,16 +763,14 @@
 static int grab_drive(struct floppy_state *fs, enum swim_state state,
 		      int interruptible)
 {
-	unsigned long flags;
-
-	save_flags(flags);
-	cli();
+	spin_lock_irq(&swim3_lock);
+
 	if (fs->state != idle) {
 		++fs->wanted;
 		while (fs->state != available) {
 			if (interruptible && signal_pending(current)) {
 				--fs->wanted;
-				restore_flags(flags);
+				spin_unlock_irq(&swim3_lock);
 				return -EINTR;
 			}
 			interruptible_sleep_on(&fs->wait);
@@ -771,19 +778,17 @@
 		--fs->wanted;
 	}
 	fs->state = state;
-	restore_flags(flags);
+	spin_unlock_irq(&swim3_lock);
 	return 0;
 }

 static void release_drive(struct floppy_state *fs)
 {
-	unsigned long flags;
+	spin_lock_irq(&swim3_lock);

-	save_flags(flags);
-	cli();
 	fs->state = idle;
 	start_request(fs);
-	restore_flags(flags);
+	spin_unlock_irq(&swim3_lock);
 }

 static int fd_eject(struct floppy_state *fs)
@@ -959,10 +964,6 @@
 	return ret;
 }

-static void floppy_off(unsigned int nr)
-{
-}
-
 static struct block_device_operations floppy_fops = {
 	.open		= floppy_open,
 	.release	= floppy_release,

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

* Re: cleanup of linux-2.5/drivers/block/swim3.c
  2003-07-04 10:46 cleanup of linux-2.5/drivers/block/swim3.c Jasper Spaans
@ 2003-07-04 22:53 ` Paul Mackerras
  2003-07-06 19:04 ` Benjamin Herrenschmidt
  2003-07-12 18:15 ` Boris Bezlaj
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2003-07-04 22:53 UTC (permalink / raw)
  To: Jasper Spaans; +Cc: benh, linuxppc-dev


Jasper Spaans writes:

> Attached is a patch which should solve compilation issues related to the new
> irqhandler interface, and the deprecation of cli()/sti() for the
> swim3-driver.

Have you audited the driver with respect to changes in the block
device layer?  I haven't, but I think it needs to be done.  It's
possible that the necessary changes have already been done but I'm not
sure.  And I don't want to send Linus a patch that would change it
from broken and non-compiling to broken but compiling.

Paul.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: cleanup of linux-2.5/drivers/block/swim3.c
  2003-07-04 10:46 cleanup of linux-2.5/drivers/block/swim3.c Jasper Spaans
  2003-07-04 22:53 ` Paul Mackerras
@ 2003-07-06 19:04 ` Benjamin Herrenschmidt
  2003-07-12 18:15 ` Boris Bezlaj
  2 siblings, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2003-07-06 19:04 UTC (permalink / raw)
  To: Jasper Spaans; +Cc: Paul Mackerras, linuxppc-dev


On Fri, 2003-07-04 at 12:46, Jasper Spaans wrote:
> Hello,
>
> Attached is a patch which should solve compilation issues related to the new
> irqhandler interface, and the deprecation of cli()/sti() for the
> swim3-driver.
>
> Can you take a look, and possibly, apply this? (I don't have any hardware to
> test this on, however it compiles)

I'll take a look, but swim3 need more drastic updates for the new
BIO stuff, the new macio device interface, etc... It's on my list
once I'm done with a few other things.

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

* Re: cleanup of linux-2.5/drivers/block/swim3.c
  2003-07-04 10:46 cleanup of linux-2.5/drivers/block/swim3.c Jasper Spaans
  2003-07-04 22:53 ` Paul Mackerras
  2003-07-06 19:04 ` Benjamin Herrenschmidt
@ 2003-07-12 18:15 ` Boris Bezlaj
  2 siblings, 0 replies; 4+ messages in thread
From: Boris Bezlaj @ 2003-07-12 18:15 UTC (permalink / raw)
  To: Jasper Spaans; +Cc: paulus, benh, linuxppc-dev


On Fri, Jul 04, 2003 at 12:46:16PM +0200, Jasper Spaans wrote:
> Hello,
>
> Attached is a patch which should solve compilation issues related to the new
> irqhandler interface, and the deprecation of cli()/sti() for the
> swim3-driver.
>
> Can you take a look, and possibly, apply this? (I don't have any hardware to
> test this on, however it compiles)

You did not take into account the changes made to swim3 driver in 2.4
kernel (fixing write operation) made by Paul.

I will try to merge the two and update BIO stuff. I'm not so sure about
the new macio device interface..should be fun :)

--

		Boris


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2003-07-12 18:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-04 10:46 cleanup of linux-2.5/drivers/block/swim3.c Jasper Spaans
2003-07-04 22:53 ` Paul Mackerras
2003-07-06 19:04 ` Benjamin Herrenschmidt
2003-07-12 18:15 ` Boris Bezlaj

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.