All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Subject: [PATCH 15/15] ide: remove 'tf_in_flags' field from ide_task_t
Date: Wed, 31 Oct 2007 00:55:22 +0100	[thread overview]
Message-ID: <200710310055.22468.bzolnier@gmail.com> (raw)


* Add IDE_TFLAG_IN_DATA taskfile flag to indicate the need of reading
  IDE_DATA_REG in ide_end_drive_cmd().

  Set the new flag in ide_taskfile_ioctl() if ->in_flags.b.data is set.

* Add IDE_TFLAG_FLAGGED_SET_IN_FLAGS taskfile flag to indicate the
  need of modifying ->in_flags in ide_taskfile_ioctl().

  Set the new flag in flagged_taskfile() and move the code modifying
  ->tf_in_flags to ide_taskfile_ioctl().

  While at it remove the bogus comment: ->tf_in_flags (except .b.data)
  have no effect on selection of registers to read.

* Remove no longer needed 'tf_in_flags' field from ide_task_t.

As the result we finally have the internals of HDIO_DRIVE_TASKFILE ioctl
separated from the core IDE code.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide-io.c       |    2 +-
 drivers/ide/ide-taskfile.c |   29 +++++++++++++----------------
 include/linux/ide.h        |    5 +++--
 3 files changed, 17 insertions(+), 19 deletions(-)

Index: b/drivers/ide/ide-io.c
===================================================================
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -340,7 +340,7 @@ void ide_end_drive_cmd (ide_drive_t *dri
 		if (args) {
 			struct ide_taskfile *tf = &args->tf;
 
-			if (args->tf_in_flags.b.data) {
+			if (args->tf_flags & IDE_TFLAG_IN_DATA) {
 				u16 data = hwif->INW(IDE_DATA_REG);
 
 				tf->data = data & 0xff;
Index: b/drivers/ide/ide-taskfile.c
===================================================================
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -599,8 +599,8 @@ int ide_taskfile_ioctl (ide_drive_t *dri
 
 	memcpy(&args.tf_array[0], req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2);
 	memcpy(&args.tf_array[6], req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE);
-	args.tf_in_flags  = req_task->in_flags;
-	args.data_phase   = req_task->data_phase;
+
+	args.data_phase = req_task->data_phase;
 
 	args.tf_flags = IDE_TFLAG_OUT_DEVICE;
 	if (drive->addressing == 1)
@@ -637,6 +637,9 @@ int ide_taskfile_ioctl (ide_drive_t *dri
 			args.tf_flags |= IDE_TFLAG_OUT_HOB;
 	}
 
+	if (req_task->in_flags.b.data)
+		args.tf_flags |= IDE_TFLAG_IN_DATA;
+
 	drive->io_32bit = 0;
 	switch(req_task->data_phase) {
 		case TASKFILE_MULTI_OUT:
@@ -704,7 +707,13 @@ int ide_taskfile_ioctl (ide_drive_t *dri
 
 	memcpy(req_task->hob_ports, &args.tf_array[0], HDIO_DRIVE_HOB_HDR_SIZE - 2);
 	memcpy(req_task->io_ports, &args.tf_array[6], HDIO_DRIVE_TASK_HDR_SIZE);
-	req_task->in_flags  = args.tf_in_flags;
+
+	if ((args.tf_flags & IDE_TFLAG_FLAGGED_SET_IN_FLAGS) &&
+	    req_task->in_flags.all == 0) {
+		req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS;
+		if (drive->addressing == 1)
+			req_task->in_flags.all |= (IDE_HOB_STD_IN_FLAGS << 8);
+	}
 
 	if (copy_to_user(buf, req_task, tasksize)) {
 		err = -EFAULT;
@@ -845,19 +854,7 @@ ide_startstop_t flagged_taskfile (ide_dr
 		}
 	}
 
-	/*
-	 * (ks) Check taskfile in flags.
-	 * If set, then execute as it is defined.
-	 * If not set, then define default settings.
-	 * The default values are:
-	 *	read all taskfile registers (except data)
-	 *	read the hob registers (sector, nsector, lcyl, hcyl)
-	 */
-	if (task->tf_in_flags.all == 0) {
-		task->tf_in_flags.all = IDE_TASKFILE_STD_IN_FLAGS;
-		if (drive->addressing == 1)
-			task->tf_in_flags.all |= (IDE_HOB_STD_IN_FLAGS  << 8);
-        }
+	task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS;
 
 	return do_rw_taskfile(drive, task);
 }
Index: b/include/linux/ide.h
===================================================================
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -917,6 +917,8 @@ enum {
 					  IDE_TFLAG_OUT_LBAH,
 	IDE_TFLAG_OUT_DEVICE		= (1 << 14),
 	IDE_TFLAG_WRITE			= (1 << 15),
+	IDE_TFLAG_FLAGGED_SET_IN_FLAGS	= (1 << 16),
+	IDE_TFLAG_IN_DATA		= (1 << 17),
 };
 
 struct ide_taskfile {
@@ -953,8 +955,7 @@ typedef struct ide_task_s {
 		struct ide_taskfile	tf;
 		u8			tf_array[14];
 	};
-	u16			tf_flags;
-	ide_reg_valid_t		tf_in_flags;
+	u32			tf_flags;
 	int			data_phase;
 	ide_pre_handler_t	*prehandler;
 	ide_handler_t		*handler;

             reply	other threads:[~2007-10-30 23:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 23:55 Bartlomiej Zolnierkiewicz [this message]
2007-11-09 13:59 ` [PATCH 15/15] ide: remove 'tf_in_flags' field from ide_task_t Sergei Shtylyov

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=200710310055.22468.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.