All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Subject: [PATCH 6/15] ide: fix registers loading order for IDE_NSECTOR_REG in execute_drive_cmd()
Date: Sat, 27 Oct 2007 19:46:12 +0200	[thread overview]
Message-ID: <200710271946.12258.bzolnier@gmail.com> (raw)


Move loading of IDE_NSECTOR_REG from ide_cmd() to execute_drive_cmd()
(load the IDE_NSECTOR_REG just after IDE_FEATURE_REG).

This also allows us to drop 'nsect' argument from ide_cmd() and simplify
execute_drive_cmd() code for REQ_TYPE_ATA_CMD case a bit.

It shouldn't affect anything (just a usual paranoia to separate changes
which change the way in which hardware is accessed from code cleanups).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-io.c |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -624,21 +624,18 @@ ide_startstop_t ide_abort(ide_drive_t *d
  *	ide_cmd		-	issue a simple drive command
  *	@drive: drive the command is for
  *	@cmd: command byte
- *	@nsect: sector byte
  *	@handler: handler for the command completion
  *
  *	Issue a simple drive command with interrupts.
  *	The drive must be selected beforehand.
  */
 
-static void ide_cmd (ide_drive_t *drive, u8 cmd, u8 nsect,
-		ide_handler_t *handler)
+static void ide_cmd(ide_drive_t *drive, u8 cmd, ide_handler_t *handler)
 {
 	ide_hwif_t *hwif = HWIF(drive);
 	if (IDE_CONTROL_REG)
 		hwif->OUTB(drive->ctl,IDE_CONTROL_REG);	/* clear nIEN */
 	SELECT_MASK(drive,0);
-	hwif->OUTB(nsect,IDE_NSECTOR_REG);
 	ide_execute_command(drive, cmd, handler, WAIT_CMD, NULL);
 }
 
@@ -913,11 +910,12 @@ static ide_startstop_t execute_drive_cmd
  		printk("sel=0x%02x\n", args[6]);
 #endif
  		hwif->OUTB(args[1], IDE_FEATURE_REG);
+		hwif->OUTB(args[2], IDE_NSECTOR_REG);
  		hwif->OUTB(args[3], IDE_SECTOR_REG);
  		hwif->OUTB(args[4], IDE_LCYL_REG);
  		hwif->OUTB(args[5], IDE_HCYL_REG);
  		hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG);
- 		ide_cmd(drive, args[0], args[2], &drive_cmd_intr);
+		ide_cmd(drive, args[0], &drive_cmd_intr);
  		return ide_started;
  	} else if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
  		u8 *args = rq->buffer;
@@ -931,16 +929,15 @@ static ide_startstop_t execute_drive_cmd
  		printk("fr=0x%02x ", args[2]);
  		printk("xx=0x%02x\n", args[3]);
 #endif
+		hwif->OUTB(args[2], IDE_FEATURE_REG);
  		if (args[0] == WIN_SMART) {
- 			hwif->OUTB(args[2],IDE_FEATURE_REG);
+			hwif->OUTB(args[3],IDE_NSECTOR_REG);
  			hwif->OUTB(args[1],IDE_SECTOR_REG);
 			hwif->OUTB(0x4f, IDE_LCYL_REG);
 			hwif->OUTB(0xc2, IDE_HCYL_REG);
- 			ide_cmd(drive, args[0], args[3], &drive_cmd_intr);
- 			return ide_started;
- 		}
- 		hwif->OUTB(args[2],IDE_FEATURE_REG);
- 		ide_cmd(drive, args[0], args[1], &drive_cmd_intr);
+		} else
+			hwif->OUTB(args[1], IDE_NSECTOR_REG);
+		ide_cmd(drive, args[0], &drive_cmd_intr);
  		return ide_started;
  	}
 

                 reply	other threads:[~2007-10-27 17:46 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=200710271946.12258.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@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.