ide: refactor tf_read() method
Simplify tf_read() method, making it deal only with 'struct ide_taskfile' and the validity flags that the upper layer passes, and factoring out the code that deals with the high order bytes into ide_tf_readback() to be called from the only two functions interested, ide_complete_cmd() and ide_dump_sector(). This should stop the needless code duplication in this method and so make it about twice smaller than it was; along with simplifying the setup for the method call, this should save both time and space... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
这个提交包含在:

提交者
Bartlomiej Zolnierkiewicz

父节点
c9ff9e7b64
当前提交
3153c26b54
@@ -254,15 +254,13 @@ EXPORT_SYMBOL_GPL(ide_cd_get_xferlen);
|
||||
|
||||
void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason)
|
||||
{
|
||||
struct ide_cmd cmd;
|
||||
struct ide_taskfile tf;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.valid.in.tf = IDE_VALID_LBAH | IDE_VALID_LBAM | IDE_VALID_NSECT;
|
||||
drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_NSECT |
|
||||
IDE_VALID_LBAM | IDE_VALID_LBAH);
|
||||
|
||||
drive->hwif->tp_ops->tf_read(drive, &cmd);
|
||||
|
||||
*bcount = (cmd.tf.lbah << 8) | cmd.tf.lbam;
|
||||
*ireason = cmd.tf.nsect & 3;
|
||||
*bcount = (tf.lbah << 8) | tf.lbam;
|
||||
*ireason = tf.nsect & 3;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason);
|
||||
|
||||
@@ -452,14 +450,11 @@ static void ide_init_packet_cmd(struct ide_cmd *cmd, u8 valid_tf,
|
||||
|
||||
static u8 ide_read_ireason(ide_drive_t *drive)
|
||||
{
|
||||
struct ide_cmd cmd;
|
||||
struct ide_taskfile tf;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.valid.in.tf = IDE_VALID_NSECT;
|
||||
drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_NSECT);
|
||||
|
||||
drive->hwif->tp_ops->tf_read(drive, &cmd);
|
||||
|
||||
return cmd.tf.nsect & 3;
|
||||
return tf.nsect & 3;
|
||||
}
|
||||
|
||||
static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason)
|
||||
|
在新工单中引用
屏蔽一个用户