aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-11-07 20:15:36 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-07 20:15:36 -0500
commit515729ece1e515546e9f49713b012cfbc41747ed (patch)
treee5fe23953e33236efc21c66898c8be07acc2760f /drivers/block
parent3fb62b5148bd9df6b8a734988f5cf330251abdb4 (diff)
powermac: Use a spinlock in swim3.c (floppy driver) instead of cli
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/swim3.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index e425ad3eebba..af7cb2bfd670 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -28,6 +28,7 @@
28#include <linux/devfs_fs_kernel.h> 28#include <linux/devfs_fs_kernel.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/spinlock.h>
31#include <asm/io.h> 32#include <asm/io.h>
32#include <asm/dbdma.h> 33#include <asm/dbdma.h>
33#include <asm/prom.h> 34#include <asm/prom.h>
@@ -176,6 +177,7 @@ struct swim3 {
176 177
177struct floppy_state { 178struct floppy_state {
178 enum swim_state state; 179 enum swim_state state;
180 spinlock_t lock;
179 struct swim3 __iomem *swim3; /* hardware registers */ 181 struct swim3 __iomem *swim3; /* hardware registers */
180 struct dbdma_regs __iomem *dma; /* DMA controller registers */ 182 struct dbdma_regs __iomem *dma; /* DMA controller registers */
181 int swim3_intr; /* interrupt number for SWIM3 */ 183 int swim3_intr; /* interrupt number for SWIM3 */
@@ -304,7 +306,6 @@ static void do_fd_request(request_queue_t * q)
304#endif /* CONFIG_PMAC_MEDIABAY */ 306#endif /* CONFIG_PMAC_MEDIABAY */
305 start_request(&floppy_states[i]); 307 start_request(&floppy_states[i]);
306 } 308 }
307 sti();
308} 309}
309 310
310static void start_request(struct floppy_state *fs) 311static void start_request(struct floppy_state *fs)
@@ -370,7 +371,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
370{ 371{
371 unsigned long flags; 372 unsigned long flags;
372 373
373 save_flags(flags); cli(); 374 spin_lock_irqsave(&fs->lock, flags);
374 if (fs->timeout_pending) 375 if (fs->timeout_pending)
375 del_timer(&fs->timeout); 376 del_timer(&fs->timeout);
376 fs->timeout.expires = jiffies + nticks; 377 fs->timeout.expires = jiffies + nticks;
@@ -378,7 +379,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
378 fs->timeout.data = (unsigned long) fs; 379 fs->timeout.data = (unsigned long) fs;
379 add_timer(&fs->timeout); 380 add_timer(&fs->timeout);
380 fs->timeout_pending = 1; 381 fs->timeout_pending = 1;
381 restore_flags(flags); 382 spin_unlock_irqrestore(&fs->lock, flags);
382} 383}
383 384
384static inline void scan_track(struct floppy_state *fs) 385static inline void scan_track(struct floppy_state *fs)
@@ -790,14 +791,13 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
790{ 791{
791 unsigned long flags; 792 unsigned long flags;
792 793
793 save_flags(flags); 794 spin_lock_irqsave(&fs->lock, flags);
794 cli();
795 if (fs->state != idle) { 795 if (fs->state != idle) {
796 ++fs->wanted; 796 ++fs->wanted;
797 while (fs->state != available) { 797 while (fs->state != available) {
798 if (interruptible && signal_pending(current)) { 798 if (interruptible && signal_pending(current)) {
799 --fs->wanted; 799 --fs->wanted;
800 restore_flags(flags); 800 spin_unlock_irqrestore(&fs->lock, flags);
801 return -EINTR; 801 return -EINTR;
802 } 802 }
803 interruptible_sleep_on(&fs->wait); 803 interruptible_sleep_on(&fs->wait);
@@ -805,7 +805,7 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
805 --fs->wanted; 805 --fs->wanted;
806 } 806 }
807 fs->state = state; 807 fs->state = state;
808 restore_flags(flags); 808 spin_unlock_irqrestore(&fs->lock, flags);
809 return 0; 809 return 0;
810} 810}
811 811
@@ -813,11 +813,10 @@ static void release_drive(struct floppy_state *fs)
813{ 813{
814 unsigned long flags; 814 unsigned long flags;
815 815
816 save_flags(flags); 816 spin_lock_irqsave(&fs->lock, flags);
817 cli();
818 fs->state = idle; 817 fs->state = idle;
819 start_request(fs); 818 start_request(fs);
820 restore_flags(flags); 819 spin_unlock_irqrestore(&fs->lock, flags);
821} 820}
822 821
823static int fd_eject(struct floppy_state *fs) 822static int fd_eject(struct floppy_state *fs)
@@ -1109,6 +1108,7 @@ static int swim3_add_device(struct device_node *swim)
1109 pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 1); 1108 pmac_call_feature(PMAC_FTR_SWIM3_ENABLE, swim, 0, 1);
1110 1109
1111 memset(fs, 0, sizeof(*fs)); 1110 memset(fs, 0, sizeof(*fs));
1111 spin_lock_init(&fs->lock);
1112 fs->state = idle; 1112 fs->state = idle;
1113 fs->swim3 = (struct swim3 __iomem *) 1113 fs->swim3 = (struct swim3 __iomem *)
1114 ioremap(swim->addrs[0].address, 0x200); 1114 ioremap(swim->addrs[0].address, 0x200);