Skip to contentSkip to conversation

swim3.c - convert cli to spinlock

PATCH In review Timmy Yee 2 participants 2 messages Jan 24, 2004 – Jan 27, 2004

Subsystems (2)
lore
Share & tools
lore

Timmy Yee

author
#0 lore raw

PATCH 1/1 swim3.c - convert cli to spinlock

Hi,

This patch replaces the cli function calls with the spinlock function calls for the swim3 driver.

drivers/block/swim3.c +6 -8
@@ -360,7 +360,7 @@
 {
 	unsigned long flags;
 
-	save_flags(flags); cli();
+	spin_lock_irqsave(&swim3_lock, flags);
 	if (fs->timeout_pending)
 		del_timer(&fs->timeout);
 	fs->timeout.expires = jiffies + nticks;
@@ -368,7 +368,7 @@
 	fs->timeout.data = (unsigned long) fs;
 	add_timer(&fs->timeout);
 	fs->timeout_pending = 1;
-	restore_flags(flags);
+	spin_unlock_irqrestore(&swim3_lock, flags);
 }
 
 static inline void scan_track(struct floppy_state *fs)
@@ -755,8 +755,7 @@
 {
 	unsigned long flags;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&swim3_lock, flags);
 	if (fs->state != idle) {
 		++fs->wanted;
 		while (fs->state != available) {
@@ -770,7 +769,7 @@
 		--fs->wanted;
 	}
 	fs->state = state;
-	restore_flags(flags);
+	spin_unlock_irqrestore(&swim3_lock, flags);
 	return 0;
 }
 
@@ -778,11 +777,10 @@
 {
 	unsigned long flags;
 
-	save_flags(flags);
-	cli();
+	spin_lock_irqsave(&swim3_lock, flags);
 	fs->state = idle;
 	start_request(fs);
-	restore_flags(flags);
+	spin_unlock_irqrestore(&swim3_lock, flags);
 }
 
 static int fd_eject(struct floppy_state *fs)

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

On Fri, 23 Jan 2004 19:53:12 -0800 Timmy Yee <[email protected]> wrote:

| Hi,
| 
| This patch replaces the cli function calls with the spinlock function calls
| for the swim3 driver.

Timmy,

I'm not going to use this. I checked with the powermac people and much more is needed to make swim3 work and they have patched code already.

Thanks,
--
~Randy
kernel-janitors project: http://janitor.kernelnewbies.org/
_______________________________________________
Kernel-janitors mailing list [email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors