linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcin Dalecki <dalecki@evision.ag>
To: Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH] 2.5.29 IDE 111
Date: Thu, 01 Aug 2002 03:08:58 +0200	[thread overview]
Message-ID: <3D488A2A.7050503@evision.ag> (raw)

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

- Change over queuedata to carry the device instead of the channel
   information.

[-- Attachment #2: ide-111.diff --]
[-- Type: text/plain, Size: 4503 bytes --]

diff -durNp -X /tmp/diff.904AxP linux-2.5.29/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.29/drivers/ide/ide.c	2002-08-01 02:38:35.000000000 +0200
+++ linux/drivers/ide/ide.c	2002-08-01 02:46:53.000000000 +0200
@@ -505,27 +505,13 @@ ide_startstop_t ata_error(struct ata_dev
  */
 void do_ide_request(request_queue_t *q)
 {
-	/* FIXME: queuedata should contain the device instead.
-	 */
-	struct ata_channel *channel = q->queuedata;
+	struct ata_device *drive = q->queuedata;
+	struct ata_channel *ch = drive->channel;
 
-	while (!test_and_set_bit(IDE_BUSY, channel->active)) {
-		struct ata_device *drive = NULL;
+	while (!test_and_set_bit(IDE_BUSY, ch->active)) {
 		unsigned int unit;
 		ide_startstop_t ret;
 
-		/*
-		 * Select the device corresponding to the queue.
-		 */
-		for (unit = 0; unit < MAX_DRIVES; ++unit) {
-			struct ata_device *tmp = &channel->drives[unit];
-
-			if (&tmp->queue == q) {
-				drive = tmp;
-				break;
-			}
-		}
-
 		if (drive) {
 			/* No request pending?! */
 			if (blk_queue_empty(&drive->queue))
@@ -542,7 +528,7 @@ void do_ide_request(request_queue_t *q)
 			 */
 			// printk(KERN_INFO "no device found!\n");
 			for (unit = 0; unit < MAX_DRIVES; ++unit) {
-				struct ata_device *tmp = &channel->drives[unit];
+				struct ata_device *tmp = &ch->drives[unit];
 
 				if (!tmp->present)
 					continue;
@@ -567,7 +553,7 @@ void do_ide_request(request_queue_t *q)
 			 */
 
 			ide_release_lock(&ide_irq_lock);/* for atari only */
-			clear_bit(IDE_BUSY, channel->active);
+			clear_bit(IDE_BUSY, ch->active);
 
 			/* All requests are done.
 			 *
@@ -576,15 +562,15 @@ void do_ide_request(request_queue_t *q)
 			 * are not prepared to take them.
 			 */
 
-			if (channel->drive && !channel->drive->using_tcq)
-				ata_irq_enable(channel->drive, 0);
+			if (ch->drive && !ch->drive->using_tcq)
+				ata_irq_enable(ch->drive, 0);
 
 			return;
 		}
 
 		/* Remember the last drive we where acting on.
 		 */
-		channel->drive = drive;
+		ch->drive = drive;
 
 		/* Feed commands to a drive until it barfs.
 		 */
@@ -598,14 +584,14 @@ void do_ide_request(request_queue_t *q)
 
 			if (!ata_can_queue(drive)) {
 				if (!ata_pending_commands(drive)) {
-					clear_bit(IDE_BUSY, channel->active);
+					clear_bit(IDE_BUSY, ch->active);
 					if (drive->using_tcq)
 						ata_irq_enable(drive, 0);
 				}
 				break;
 			}
 
-			if (test_bit(IDE_DMA, channel->active)) {
+			if (test_bit(IDE_DMA, ch->active)) {
 				printk(KERN_ERR "%s: error: DMA in progress...\n", drive->name);
 				break;
 			}
@@ -624,7 +610,7 @@ void do_ide_request(request_queue_t *q)
 
 			if (!(rq = elv_next_request(&drive->queue))) {
 				if (!ata_pending_commands(drive)) {
-					clear_bit(IDE_BUSY, channel->active);
+					clear_bit(IDE_BUSY, ch->active);
 					if (drive->using_tcq)
 						ata_irq_enable(drive, 0);
 				}
@@ -642,7 +628,7 @@ void do_ide_request(request_queue_t *q)
 
 			drive->rq = rq;
 
-			spin_unlock(channel->lock);
+			spin_unlock(ch->lock);
 			/* allow other IRQs while we start this request */
 			local_irq_enable();
 
@@ -687,7 +673,7 @@ kill_rq:
 				ret = ATA_OP_FINISHED;
 
 			}
-			spin_lock_irq(channel->lock);
+			spin_lock_irq(ch->lock);
 			/* continue if command started, so we are busy */
 		} while (ret != ATA_OP_CONTINUES);
 	}
diff -durNp -X /tmp/diff.904AxP linux-2.5.29/drivers/ide/probe.c linux/drivers/ide/probe.c
--- linux-2.5.29/drivers/ide/probe.c	2002-08-01 02:38:36.000000000 +0200
+++ linux/drivers/ide/probe.c	2002-08-01 02:41:57.000000000 +0200
@@ -977,23 +977,24 @@ static int init_irq(struct ata_channel *
 			ch->drive = drive;
 
 		/*
-		 * Init the per device request queue
+		 * Init the per device request queue.
 		 */
 
 		q = &drive->queue;
-		q->queuedata = drive->channel;
+		q->queuedata = drive;
 		blk_init_queue(q, do_ide_request, drive->channel->lock);
 		blk_queue_segment_boundary(q, ch->seg_boundary_mask);
 		blk_queue_max_segment_size(q, ch->max_segment_size);
 
-		/* ATA can do up to 128K per request, pdc4030 needs smaller limit */
+		/* ATA can do up to 128K per request, pdc4030 needs smaller
+		 * limit. */
 #ifdef CONFIG_BLK_DEV_PDC4030
 		if (drive->channel->chipset == ide_pdc4030)
 			max_sectors = 127;
 #endif
 		blk_queue_max_sectors(q, max_sectors);
 
-		/* IDE DMA can do PRD_ENTRIES number of segments. */
+		/* ATA DMA can do PRD_ENTRIES number of segments. */
 		blk_queue_max_hw_segments(q, PRD_ENTRIES);
 
 		/* FIXME: This is a driver limit and could be eliminated. */

                 reply	other threads:[~2002-08-01  9:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3D488A2A.7050503@evision.ag \
    --to=dalecki@evision.ag \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@dalecki.de \
    --cc=torvalds@transmeta.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).