From: Felipe W Damasio <felipewd@terra.com.br>
To: unlisted-recipients:; (no To-header on input)
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Fix SMP support on cdu535 cdrom driver
Date: Tue, 02 Sep 2003 18:39:26 -0300 [thread overview]
Message-ID: <3F550E0E.7020502@terra.com.br> (raw)
[-- Attachment #1: Type: text/plain, Size: 408 bytes --]
Hi,
Patch against 2.6-test4.
I'm not sure this is the right fix, since my knowledge on cdrom
drivers tends to /dev/zero...but, here we go:
Replace cli/sti on sony_sleep with wait_queue, using a device
spinlock to lock 'enable_interrupts' and the queueing stuff.
Compile fine, but I don't have the hardware.
Feedback is welcome, since I'm pretty sure I did something wrong.. :)
Thanks,
Felipe
[-- Attachment #2: cdu535-cli_sti_removal.patch --]
[-- Type: text/plain, Size: 1429 bytes --]
--- linux-2.6.0-test4/drivers/cdrom/sonycd535.c Fri Aug 22 20:54:17 2003
+++ linux-2.6.0-test4-fwd/drivers/cdrom/sonycd535.c Tue Sep 2 18:24:10 2003
@@ -36,6 +36,10 @@
* module_init & module_exit.
* Torben Mathiasen <tmm@image.dk>
*
+ * September 2003 - Fix SMP support by removing cli/sti calls.
+ * Using spinlocks with a wait_queue instead
+ * Felipe Damasio <felipewd@terra.com.br>
+ *
* Things to do:
* - handle errors and status better, put everything into a single word
* - use interrupts (code mostly there, but a big hole still missing)
@@ -219,6 +223,9 @@
static unsigned short data_reg;
static spinlock_t sonycd535_lock = SPIN_LOCK_UNLOCKED; /* queue lock */
+
+static spinlock_t cdu535_lock = SPIN_LOCK_UNLOCKED; /* Device lock */
+
static struct request_queue *sonycd535_queue;
static int initialized; /* Has the drive been initialized? */
@@ -340,10 +347,16 @@
if (sony535_irq_used <= 0) { /* poll */
yield();
} else { /* Interrupt driven */
- cli();
+ DEFINE_WAIT(wait);
+
+ spin_lock_irq(&cdu535_lock);
enable_interrupts();
- interruptible_sleep_on(&cdu535_irq_wait);
- sti();
+ prepare_to_wait(&cdu535_irq_wait, &wait, TASK_INTERRUPTIBLE);
+ spin_unlock_irq(&cdu535_lock);
+ schedule();
+ spin_lock_irq(&cdu535_lock);
+ finish_wait(&cdu535_irq_wait, &wait);
+ spin_unlock_irq(&cdu535_lock);
}
}
next reply other threads:[~2003-09-02 23:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-02 21:39 Felipe W Damasio [this message]
2003-09-03 13:46 ` [PATCH] Fix SMP support on cdu535 cdrom driver Felipe W Damasio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F550E0E.7020502@terra.com.br \
--to=felipewd@terra.com.br \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.