Skip to contentSkip to conversation

ide: remove 'command_type' field from ide_task_t

PATCH In review Bartlomiej Zolnierkiewicz 2 participants 2 messages Oct 30, 2007 – Nov 29, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 14/15 ide: remove 'command_type' field from ide_task_t

* Add 'data_buf' and 'nsect' variables in ide_taskfile_ioctl() to cache data buffer pointer and number of sectors to transfer (this allows us to have only one ide_diag_taskfile() call).

* Add IDE_TFLAG_WRITE taskfile flag and use it to check whether the REQ_RW request flag should be set.

* Move ->command_type handling from ide_diag_taskfile() to ide_taskfile_ioctl() and use ->req_cmd instead of ->command_type.

* Add 'nsect' parameter to ide_raw_taskfile().

* Merge ide_diag_taskfile() into ide_raw_taskfile().

* Initialize ->data_phase explicitly in idedisk_prepare_flush(), ide_start_power_step() and ide_disk_special().

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

* Add #ifndef/#endif __KERNEL__ to <linux/hdreg.h> around no longer used by kernel IDE_DRIVE_TASK_* and TASKFILE_* defines.

There should be no functionality changes caused by this patch.

---
 drivers/ide/ide-disk.c     |   15 +++----
 drivers/ide/ide-io.c       |    8 ++--
 drivers/ide/ide-taskfile.c |   89 ++++++++++++++++++++++-----------------------
 include/linux/hdreg.h      |   13 +++---
 include/linux/ide.h        |    5 +-
 5 files changed, 64 insertions(+), 66 deletions(-)
drivers/ide/ide-disk.c +7 -8
Index: b/drivers/ide/ide-disk.c
===================================================================
@@ -542,12 +542,11 @@ static int get_smart_data(ide_drive_t *d
 	tf->lbam    = SMART_LCYL_PASS;
 	tf->lbah    = SMART_HCYL_PASS;
 	tf->command = WIN_SMART;
-	args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
-	args.command_type			= IDE_DRIVE_TASK_IN;
-	args.data_phase				= TASKFILE_IN;
-	args.handler				= &task_in_intr;
+	args.tf_flags	= IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
+	args.data_phase	= TASKFILE_IN;
+	args.handler	= task_in_intr;
 	(void) smart_enable(drive);
-	return ide_raw_taskfile(drive, &args, buf);
+	return ide_raw_taskfile(drive, &args, buf, 1);
 }
 
 static int proc_idedisk_read_cache
@@ -633,9 +632,9 @@ static void idedisk_prepare_flush(struct
 		task.tf.command = WIN_FLUSH_CACHE_EXT;
 	else
 		task.tf.command = WIN_FLUSH_CACHE;
-	task.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
-	task.command_type = IDE_DRIVE_TASK_NO_DATA;
-	task.handler = task_no_data_intr;
+	task.tf_flags	= IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
+	task.data_phase	= TASKFILE_NO_DATA;
+	task.handler	= task_no_data_intr;
 
 	rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
 	rq->cmd_flags |= REQ_SOFTBARRIER;
drivers/ide/ide-io.c +4 -4
Index: b/drivers/ide/ide-io.c
===================================================================
@@ -232,9 +232,9 @@ static ide_startstop_t ide_start_power_s
 	return ide_stopped;
 
 out_do_tf:
-	args->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
-	args->command_type = IDE_DRIVE_TASK_NO_DATA;
-	args->handler      = task_no_data_intr;
+	args->tf_flags	 = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
+	args->data_phase = TASKFILE_NO_DATA;
+	args->handler	 = task_no_data_intr;
 	return do_rw_taskfile(drive, args);
 }
 
@@ -672,7 +672,7 @@ static ide_startstop_t ide_disk_special(
 	ide_task_t args;
 
 	memset(&args, 0, sizeof(ide_task_t));
-	args.command_type = IDE_DRIVE_TASK_NO_DATA;
+	args.data_phase = TASKFILE_NO_DATA;
 
 	if (s->b.set_geometry) {
 		s->b.set_geometry = 0;
drivers/ide/ide-taskfile.c +44 -45

161 lines not on this page · raw message

include/linux/hdreg.h +7 -6
Index: b/include/linux/hdreg.h
===================================================================
@@ -70,13 +70,13 @@
 #define HDIO_DRIVE_HOB_HDR_SIZE		(8 * sizeof(__u8))
 #define HDIO_DRIVE_TASK_HDR_SIZE	(8 * sizeof(__u8))
 
-#define IDE_DRIVE_TASK_INVALID		-1
 #define IDE_DRIVE_TASK_NO_DATA		0
+#ifndef __KERNEL__
+#define IDE_DRIVE_TASK_INVALID		-1
 #define IDE_DRIVE_TASK_SET_XFER		1
-
 #define IDE_DRIVE_TASK_IN		2
-
 #define IDE_DRIVE_TASK_OUT		3
+#endif
 #define IDE_DRIVE_TASK_RAW_WRITE	4
 
 /*
@@ -163,9 +163,6 @@ typedef struct hd_drive_hob_hdr {
 } hob_struct_t;
 #endif
 
-#define TASKFILE_INVALID		0x7fff
-#define TASKFILE_48			0x8000
-
 #define TASKFILE_NO_DATA		0x0000
 
 #define TASKFILE_IN			0x0001
@@ -180,12 +177,16 @@ typedef struct hd_drive_hob_hdr {
 #define TASKFILE_IN_DMAQ		0x0080
 #define TASKFILE_OUT_DMAQ		0x0100
 
+#ifndef __KERNEL__
 #define TASKFILE_P_IN			0x0200
 #define TASKFILE_P_OUT			0x0400
 #define TASKFILE_P_IN_DMA		0x0800
 #define TASKFILE_P_OUT_DMA		0x1000
 #define TASKFILE_P_IN_DMAQ		0x2000
 #define TASKFILE_P_OUT_DMAQ		0x4000
+#define TASKFILE_48			0x8000
+#define TASKFILE_INVALID		0x7fff
+#endif
 
 /* ATA/ATAPI Commands pre T13 Spec */
 #define WIN_NOP				0x00
include/linux/ide.h +2 -3
Index: b/include/linux/ide.h
===================================================================
@@ -916,6 +916,7 @@ enum {
 					  IDE_TFLAG_OUT_LBAM |
 					  IDE_TFLAG_OUT_LBAH,
 	IDE_TFLAG_OUT_DEVICE		= (1 << 14),
+	IDE_TFLAG_WRITE			= (1 << 15),
 };
 
 struct ide_taskfile {
@@ -955,7 +956,6 @@ typedef struct ide_task_s {
 	u16			tf_flags;
 	ide_reg_valid_t		tf_in_flags;
 	int			data_phase;
-	int			command_type;
 	ide_pre_handler_t	*prehandler;
 	ide_handler_t		*handler;
 	struct request		*rq;		/* copy of request */
@@ -990,8 +990,7 @@ extern ide_startstop_t task_no_data_intr
 extern ide_startstop_t task_in_intr(ide_drive_t *);
 extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
 
-extern int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *);
-
+int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16);
 int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
 
 int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
Acked-by on v1 14/15
#1 lore raw
Quoted 17 lines · Bartlomiej Zolnierkiewicz

* Add 'data_buf' and 'nsect' variables in ide_taskfile_ioctl() to cache data buffer pointer and number of sectors to transfer (this allows us to have only one ide_diag_taskfile() call).

* Add IDE_TFLAG_WRITE taskfile flag and use it to check whether the REQ_RW request flag should be set.

* Move ->command_type handling from ide_diag_taskfile() to ide_taskfile_ioctl() and use ->req_cmd instead of ->command_type.

* Add 'nsect' parameter to ide_raw_taskfile().

* Merge ide_diag_taskfile() into ide_raw_taskfile().

* Initialize ->data_phase explicitly in idedisk_prepare_flush(), ide_start_power_step() and ide_disk_special().

Quoted 8 lines

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

* Add #ifndef/#endif __KERNEL__ to <linux/hdreg.h> around no longer used by kernel IDE_DRIVE_TASK_* and TASKFILE_* defines.

There should be no functionality changes caused by this patch.

MBR, Sergei