Messages in this thread Patch in this message | | | Date | Mon, 22 Aug 2005 21:12:24 +0000 | From | "M.Baris Demiray" <> | Subject | [PATCH -mm] Replace cli()/sti() pair with spinlocks in cmd206 driver |
| |
Hi Andrew, Following patch replaces the deprecated cli()/sti() pair with spinlocks and fixes the following warning:
<snipped> gcc -m32 -Wp,-MD,drivers/cdrom/.cm206.o.d -nostdinc -isystem /usr/lib/gcc-lib/i486-slackware-linux/3.3.4/include -D__KERNEL__ -Iinclude -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -ffreestanding -O2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pipe -msoft-float -mpreferred-stack-boundary=2 -march=i686 -mregparm=3 -Iinclude/asm-i386/mach-default -DMODULE -DKBUILD_BASENAME=cm206 -DKBUILD_MODNAME=cm206 -c -o drivers/cdrom/.tmp_cm206.o drivers/cdrom/cm206.c drivers/cdrom/cm206.c: In function `send_command': drivers/cdrom/cm206.c:473: warning: implicit declaration of function `cli' drivers/cdrom/cm206.c: In function `receive_byte': drivers/cdrom/cm206.c:494: warning: implicit declaration of function `sti' </snipped>
o Replace the deprecated cli()/sti() pair with spinlocks and fix a warning in cmd206 cdrom driver
Signed-off-by: M.Baris Demiray <baris@labristeknoloji.com>
--- linux-2.6.13-rc6-mm1/drivers/cdrom/cm206.c.orig 2005-08-20 11:24:32.000000000 +0000 +++ linux-2.6.13-rc6-mm1/drivers/cdrom/cm206.c 2005-08-22 18:31:05.000000000 +0000 @@ -192,6 +192,7 @@ #include <linux/mm.h> #include <linux/slab.h> #include <linux/init.h> +#include <linux/spinlock.h>
/* #include <linux/ucdrom.h> */
@@ -303,6 +304,7 @@ static struct cm206_struct *cd; /* the main memory structure */ static struct request_queue *cm206_queue; static DEFINE_SPINLOCK(cm206_lock); +static DEFINE_SPINLOCK(cm206_lock_port);
/* First, we define some polling functions. These are actually only being used in the initialization. */ @@ -470,7 +472,8 @@ debug(("Sending 0x%x\n", command)); if (!(inw(r_line_status) & ls_transmitter_buffer_empty)) { cd->command = command; - cli(); /* don't interrupt before sleep */ + /* don't interrupt before sleep */ + spin_lock_irq(&cm206_lock_port); outw(dc_mask_sync_error | dc_no_stop_on_error | (inw(r_data_status) & 0x7f), r_data_control); /* interrupt routine sends command */ @@ -487,11 +490,11 @@ static uch receive_byte(int timeout) { uch ret; - cli(); - debug(("cli\n")); + spin_lock_irq(&cm206_lock_port); + debug(("cm206_lock_port locked\n")); ret = cd->ur[cd->ur_r]; if (cd->ur_r != cd->ur_w) { - sti(); + spin_unlock_irq(&cm206_lock_port); debug(("returning #%d: 0x%x\n", cd->ur_r, cd->ur[cd->ur_r])); cd->ur_r++; @@ -1407,7 +1410,7 @@ { int irqs, irq; outw(dc_normal | READ_AHEAD, r_data_control); /* disable irq-generation */ - sti(); + spin_unlock_irq(&cm206_lock_port); irqs = probe_irq_on(); reset_cm260(); /* causes interrupt */ udelay(100); /* wait for it */ @@ -1447,14 +1450,14 @@ } else printk(" IRQ %d found\n", cm206_irq); #else - cli(); + spin_lock_irq(&cm206_lock_port); reset_cm260(); /* Now, the problem here is that reset_cm260 can generate an interrupt. It seems that this can cause a kernel oops some time later. So we wait a while and `service' this interrupt. */ mdelay(1); outw(dc_normal | READ_AHEAD, r_data_control); - sti(); + spin_unlock_irq(&cm206_lock_port); printk(" using IRQ %d\n", cm206_irq); #endif if (send_receive_polled(c_drive_configuration) !=
-- "You have to understand, most of these people are not ready to be unplugged. And many of them are no inert, so hopelessly dependent on the system, that they will fight to protect it." Morpheus
begin:vcard fn:M.Baris Demiray n:Demiray;M.Baris org:Labris Teknoloji adr:;;Teknokent Silikon Bina No:24 ODTU;Ankara;;06531;Turkey email;internet:baris@labristeknoloji.com title:Yazilim Gelistirme Uzmani tel;work:+903122101490 tel;fax:+903122101492 x-mozilla-html:FALSE url:http://www.labristeknoloji.com/~baris/ version:2.1 end:vcard
| |