ide: replace special_t typedef by IDE_SFLAG_* flags

Replace:
- special_t typedef by IDE_SFLAG_* flags
- 'special_t special' ide_drive_t's field by 'u8 special_flags' one

There should be no functional changes caused by this patch.
Acked-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 582078ee
...@@ -428,14 +428,14 @@ static int set_multcount(ide_drive_t *drive, int arg) ...@@ -428,14 +428,14 @@ static int set_multcount(ide_drive_t *drive, int arg)
if (arg < 0 || arg > (drive->id[ATA_ID_MAX_MULTSECT] & 0xff)) if (arg < 0 || arg > (drive->id[ATA_ID_MAX_MULTSECT] & 0xff))
return -EINVAL; return -EINVAL;
if (drive->special.b.set_multmode) if (drive->special_flags & IDE_SFLAG_SET_MULTMODE)
return -EBUSY; return -EBUSY;
rq = blk_get_request(drive->queue, READ, __GFP_WAIT); rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
rq->cmd_type = REQ_TYPE_ATA_TASKFILE; rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
drive->mult_req = arg; drive->mult_req = arg;
drive->special.b.set_multmode = 1; drive->special_flags |= IDE_SFLAG_SET_MULTMODE;
error = blk_execute_rq(drive->queue, NULL, rq, 0); error = blk_execute_rq(drive->queue, NULL, rq, 0);
blk_put_request(rq); blk_put_request(rq);
......
...@@ -52,7 +52,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, ...@@ -52,7 +52,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq,
} }
if ((rq->errors & ERROR_RECAL) == ERROR_RECAL) if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
drive->special.b.recalibrate = 1; drive->special_flags |= IDE_SFLAG_RECALIBRATE;
++rq->errors; ++rq->errors;
...@@ -268,9 +268,8 @@ static void ide_disk_pre_reset(ide_drive_t *drive) ...@@ -268,9 +268,8 @@ static void ide_disk_pre_reset(ide_drive_t *drive)
{ {
int legacy = (drive->id[ATA_ID_CFS_ENABLE_2] & 0x0400) ? 0 : 1; int legacy = (drive->id[ATA_ID_CFS_ENABLE_2] & 0x0400) ? 0 : 1;
drive->special.all = 0; drive->special_flags =
drive->special.b.set_geometry = legacy; legacy ? (IDE_SFLAG_SET_GEOMETRY | IDE_SFLAG_RECALIBRATE) : 0;
drive->special.b.recalibrate = legacy;
drive->mult_count = 0; drive->mult_count = 0;
drive->dev_flags &= ~IDE_DFLAG_PARKED; drive->dev_flags &= ~IDE_DFLAG_PARKED;
...@@ -280,7 +279,7 @@ static void ide_disk_pre_reset(ide_drive_t *drive) ...@@ -280,7 +279,7 @@ static void ide_disk_pre_reset(ide_drive_t *drive)
drive->mult_req = 0; drive->mult_req = 0;
if (drive->mult_req != drive->mult_count) if (drive->mult_req != drive->mult_count)
drive->special.b.set_multmode = 1; drive->special_flags |= IDE_SFLAG_SET_MULTMODE;
} }
static void pre_reset(ide_drive_t *drive) static void pre_reset(ide_drive_t *drive)
......
...@@ -194,14 +194,14 @@ static void ide_tf_set_setmult_cmd(ide_drive_t *drive, struct ide_taskfile *tf) ...@@ -194,14 +194,14 @@ static void ide_tf_set_setmult_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
static ide_startstop_t do_special(ide_drive_t *drive) static ide_startstop_t do_special(ide_drive_t *drive)
{ {
special_t *s = &drive->special;
struct ide_cmd cmd; struct ide_cmd cmd;
#ifdef DEBUG #ifdef DEBUG
printk(KERN_DEBUG "%s: %s: 0x%02x\n", drive->name, __func__, s->all); printk(KERN_DEBUG "%s: %s: 0x%02x\n", drive->name, __func__,
drive->special_flags);
#endif #endif
if (drive->media != ide_disk) { if (drive->media != ide_disk) {
s->all = 0; drive->special_flags = 0;
drive->mult_req = 0; drive->mult_req = 0;
return ide_stopped; return ide_stopped;
} }
...@@ -209,14 +209,14 @@ static ide_startstop_t do_special(ide_drive_t *drive) ...@@ -209,14 +209,14 @@ static ide_startstop_t do_special(ide_drive_t *drive)
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.protocol = ATA_PROT_NODATA; cmd.protocol = ATA_PROT_NODATA;
if (s->b.set_geometry) { if (drive->special_flags & IDE_SFLAG_SET_GEOMETRY) {
s->b.set_geometry = 0; drive->special_flags &= ~IDE_SFLAG_SET_GEOMETRY;
ide_tf_set_specify_cmd(drive, &cmd.tf); ide_tf_set_specify_cmd(drive, &cmd.tf);
} else if (s->b.recalibrate) { } else if (drive->special_flags & IDE_SFLAG_RECALIBRATE) {
s->b.recalibrate = 0; drive->special_flags &= ~IDE_SFLAG_RECALIBRATE;
ide_tf_set_restore_cmd(drive, &cmd.tf); ide_tf_set_restore_cmd(drive, &cmd.tf);
} else if (s->b.set_multmode) { } else if (drive->special_flags & IDE_SFLAG_SET_MULTMODE) {
s->b.set_multmode = 0; drive->special_flags &= ~IDE_SFLAG_SET_MULTMODE;
ide_tf_set_setmult_cmd(drive, &cmd.tf); ide_tf_set_setmult_cmd(drive, &cmd.tf);
} else } else
BUG(); BUG();
...@@ -339,7 +339,8 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) ...@@ -339,7 +339,8 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
printk(KERN_ERR "%s: drive not ready for command\n", drive->name); printk(KERN_ERR "%s: drive not ready for command\n", drive->name);
return startstop; return startstop;
} }
if (!drive->special.all) {
if (drive->special_flags == 0) {
struct ide_driver *drv; struct ide_driver *drv;
/* /*
......
...@@ -97,7 +97,7 @@ static void ide_disk_init_mult_count(ide_drive_t *drive) ...@@ -97,7 +97,7 @@ static void ide_disk_init_mult_count(ide_drive_t *drive)
drive->mult_req = id[ATA_ID_MULTSECT] & 0xff; drive->mult_req = id[ATA_ID_MULTSECT] & 0xff;
if (drive->mult_req) if (drive->mult_req)
drive->special.b.set_multmode = 1; drive->special_flags |= IDE_SFLAG_SET_MULTMODE;
} }
} }
...@@ -1138,8 +1138,8 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif) ...@@ -1138,8 +1138,8 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif)
drive->hwif = hwif; drive->hwif = hwif;
drive->ready_stat = ATA_DRDY; drive->ready_stat = ATA_DRDY;
drive->bad_wstat = BAD_W_STAT; drive->bad_wstat = BAD_W_STAT;
drive->special.b.recalibrate = 1; drive->special_flags = IDE_SFLAG_RECALIBRATE |
drive->special.b.set_geometry = 1; IDE_SFLAG_SET_GEOMETRY;
drive->name[0] = 'h'; drive->name[0] = 'h';
drive->name[1] = 'd'; drive->name[1] = 'd';
drive->name[2] = 'a' + j; drive->name[2] = 'a' + j;
......
...@@ -166,7 +166,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) ...@@ -166,7 +166,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) { if (!OK_STAT(stat, ATA_DRDY, BAD_STAT)) {
if (custom && tf->command == ATA_CMD_SET_MULTI) { if (custom && tf->command == ATA_CMD_SET_MULTI) {
drive->mult_req = drive->mult_count = 0; drive->mult_req = drive->mult_count = 0;
drive->special.b.recalibrate = 1; drive->special_flags |= IDE_SFLAG_RECALIBRATE;
(void)ide_dump_status(drive, __func__, stat); (void)ide_dump_status(drive, __func__, stat);
return ide_stopped; return ide_stopped;
} else if (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) { } else if (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) {
......
...@@ -451,8 +451,8 @@ static int sil_sata_reset_poll(ide_drive_t *drive) ...@@ -451,8 +451,8 @@ static int sil_sata_reset_poll(ide_drive_t *drive)
static void sil_sata_pre_reset(ide_drive_t *drive) static void sil_sata_pre_reset(ide_drive_t *drive)
{ {
if (drive->media == ide_disk) { if (drive->media == ide_disk) {
drive->special.b.set_geometry = 0; drive->special_flags &=
drive->special.b.recalibrate = 0; ~(IDE_SFLAG_SET_GEOMETRY | IDE_SFLAG_RECALIBRATE);
} }
} }
......
...@@ -218,21 +218,12 @@ static inline void ide_std_init_ports(hw_regs_t *hw, ...@@ -218,21 +218,12 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
/* /*
* Special Driver Flags * Special Driver Flags
*
* set_geometry : respecify drive geometry
* recalibrate : seek to cyl 0
* set_multmode : set multmode count
* reserved : unused
*/ */
typedef union { enum {
unsigned all : 8; IDE_SFLAG_SET_GEOMETRY = (1 << 0),
struct { IDE_SFLAG_RECALIBRATE = (1 << 1),
unsigned set_geometry : 1; IDE_SFLAG_SET_MULTMODE = (1 << 2),
unsigned recalibrate : 1; };
unsigned set_multmode : 1;
unsigned reserved : 5;
} b;
} special_t;
/* /*
* Status returned from various ide_ functions * Status returned from various ide_ functions
...@@ -530,7 +521,7 @@ struct ide_drive_s { ...@@ -530,7 +521,7 @@ struct ide_drive_s {
unsigned long sleep; /* sleep until this time */ unsigned long sleep; /* sleep until this time */
unsigned long timeout; /* max time to wait for irq */ unsigned long timeout; /* max time to wait for irq */
special_t special; /* special action flags */ u8 special_flags; /* special action flags */
u8 select; /* basic drive/head select reg value */ u8 select; /* basic drive/head select reg value */
u8 retry_pio; /* retrying dma capable host in pio */ u8 retry_pio; /* retrying dma capable host in pio */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment