Commit 50112a63 authored by Jeff Garzik's avatar Jeff Garzik

[libata] internal cleanups

Remove unused 'done_late' arg to ata_qc_complete(), which was never
useful in 2.4, and never used at all in 2.6.

This allows us to eliminate the same arg from ata_dma_complete(),
and also make it more correct by passing the command rather than
the ATA port structure as arg0.
parent 1ad2c4d1
...@@ -50,8 +50,7 @@ static unsigned int ata_busy_sleep (struct ata_port *ap, ...@@ -50,8 +50,7 @@ static unsigned int ata_busy_sleep (struct ata_port *ap,
unsigned long tmout_pat, unsigned long tmout_pat,
unsigned long tmout); unsigned long tmout);
static void __ata_dev_select (struct ata_port *ap, unsigned int device); static void __ata_dev_select (struct ata_port *ap, unsigned int device);
static void ata_dma_complete(struct ata_port *ap, u8 host_stat, static void ata_dma_complete(struct ata_queued_cmd *qc, u8 host_stat);
unsigned int done_late);
static void ata_host_set_pio(struct ata_port *ap); static void ata_host_set_pio(struct ata_port *ap);
static void ata_host_set_udma(struct ata_port *ap); static void ata_host_set_udma(struct ata_port *ap);
static void ata_dev_set_pio(struct ata_port *ap, unsigned int device); static void ata_dev_set_pio(struct ata_port *ap, unsigned int device);
...@@ -2066,7 +2065,7 @@ static void ata_pio_complete (struct ata_port *ap) ...@@ -2066,7 +2065,7 @@ static void ata_pio_complete (struct ata_port *ap)
ata_irq_on(ap); ata_irq_on(ap);
ata_qc_complete(qc, drv_stat, 0); ata_qc_complete(qc, drv_stat);
} }
/** /**
...@@ -2239,7 +2238,7 @@ void ata_eng_timeout(struct ata_port *ap) ...@@ -2239,7 +2238,7 @@ void ata_eng_timeout(struct ata_port *ap)
printk(KERN_ERR "ata%u: DMA timeout, stat 0x%x\n", printk(KERN_ERR "ata%u: DMA timeout, stat 0x%x\n",
ap->id, host_stat); ap->id, host_stat);
ata_dma_complete(ap, host_stat, 1); ata_dma_complete(qc, host_stat);
break; break;
case ATA_PROT_NODATA: case ATA_PROT_NODATA:
...@@ -2248,7 +2247,7 @@ void ata_eng_timeout(struct ata_port *ap) ...@@ -2248,7 +2247,7 @@ void ata_eng_timeout(struct ata_port *ap)
printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n", printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n",
ap->id, qc->tf.command, drv_stat); ap->id, qc->tf.command, drv_stat);
ata_qc_complete(qc, drv_stat, 1); ata_qc_complete(qc, drv_stat);
break; break;
default: default:
...@@ -2257,7 +2256,7 @@ void ata_eng_timeout(struct ata_port *ap) ...@@ -2257,7 +2256,7 @@ void ata_eng_timeout(struct ata_port *ap)
printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
ap->id, qc->tf.command, drv_stat); ap->id, qc->tf.command, drv_stat);
ata_qc_complete(qc, drv_stat, 1); ata_qc_complete(qc, drv_stat);
break; break;
} }
...@@ -2328,13 +2327,12 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, ...@@ -2328,13 +2327,12 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
* ata_qc_complete - * ata_qc_complete -
* @qc: * @qc:
* @drv_stat: * @drv_stat:
* @done_late:
* *
* LOCKING: * LOCKING:
* *
*/ */
void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat, unsigned int done_late) void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
struct scsi_cmnd *cmd = qc->scsicmd; struct scsi_cmnd *cmd = qc->scsicmd;
...@@ -2596,16 +2594,15 @@ void ata_bmdma_start_pio (struct ata_queued_cmd *qc) ...@@ -2596,16 +2594,15 @@ void ata_bmdma_start_pio (struct ata_queued_cmd *qc)
/** /**
* ata_dma_complete - * ata_dma_complete -
* @ap: * @qc:
* @host_stat: * @host_stat:
* @done_late:
* *
* LOCKING: * LOCKING:
*/ */
static void ata_dma_complete(struct ata_port *ap, u8 host_stat, static void ata_dma_complete(struct ata_queued_cmd *qc, u8 host_stat)
unsigned int done_late)
{ {
struct ata_port *ap = qc->ap;
VPRINTK("ENTER\n"); VPRINTK("ENTER\n");
if (ap->flags & ATA_FLAG_MMIO) { if (ap->flags & ATA_FLAG_MMIO) {
...@@ -2636,8 +2633,7 @@ static void ata_dma_complete(struct ata_port *ap, u8 host_stat, ...@@ -2636,8 +2633,7 @@ static void ata_dma_complete(struct ata_port *ap, u8 host_stat,
ap->id, (u32) host_stat, (u32) ata_chk_status(ap)); ap->id, (u32) host_stat, (u32) ata_chk_status(ap));
/* get drive status; clear intr; complete txn */ /* get drive status; clear intr; complete txn */
ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag), ata_qc_complete(qc, ata_wait_idle(ap));
ata_wait_idle(ap), done_late);
} }
/** /**
...@@ -2676,14 +2672,14 @@ inline unsigned int ata_host_intr (struct ata_port *ap, ...@@ -2676,14 +2672,14 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
break; break;
} }
ata_dma_complete(ap, host_stat, 0); ata_dma_complete(qc, host_stat);
handled = 1; handled = 1;
break; break;
case ATA_PROT_NODATA: /* command completion, but no data xfer */ case ATA_PROT_NODATA: /* command completion, but no data xfer */
status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
ata_qc_complete(qc, status, 0); ata_qc_complete(qc, status);
handled = 1; handled = 1;
break; break;
...@@ -2850,7 +2846,7 @@ static void atapi_packet_task(void *_data) ...@@ -2850,7 +2846,7 @@ static void atapi_packet_task(void *_data)
return; return;
err_out: err_out:
ata_qc_complete(qc, ATA_ERR, 0); ata_qc_complete(qc, ATA_ERR);
} }
int ata_port_start (struct ata_port *ap) int ata_port_start (struct ata_port *ap)
......
...@@ -287,8 +287,7 @@ static inline void pdc_dma_complete (struct ata_port *ap, ...@@ -287,8 +287,7 @@ static inline void pdc_dma_complete (struct ata_port *ap,
u8 err_bit = have_err ? ATA_ERR : 0; u8 err_bit = have_err ? ATA_ERR : 0;
/* get drive status; clear intr; complete txn */ /* get drive status; clear intr; complete txn */
ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag), ata_qc_complete(qc, ata_wait_idle(ap) | err_bit);
ata_wait_idle(ap) | err_bit, 0);
} }
static void pdc_eng_timeout(struct ata_port *ap) static void pdc_eng_timeout(struct ata_port *ap)
...@@ -316,8 +315,7 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -316,8 +315,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
switch (qc->tf.protocol) { switch (qc->tf.protocol) {
case ATA_PROT_DMA: case ATA_PROT_DMA:
printk(KERN_ERR "ata%u: DMA timeout\n", ap->id); printk(KERN_ERR "ata%u: DMA timeout\n", ap->id);
ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag), ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR);
ata_wait_idle(ap) | ATA_ERR, 0);
break; break;
case ATA_PROT_NODATA: case ATA_PROT_NODATA:
...@@ -326,7 +324,7 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -326,7 +324,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n", printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n",
ap->id, qc->tf.command, drv_stat); ap->id, qc->tf.command, drv_stat);
ata_qc_complete(qc, drv_stat, 1); ata_qc_complete(qc, drv_stat);
break; break;
default: default:
...@@ -335,7 +333,7 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -335,7 +333,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
ap->id, qc->tf.command, drv_stat); ap->id, qc->tf.command, drv_stat);
ata_qc_complete(qc, drv_stat, 1); ata_qc_complete(qc, drv_stat);
break; break;
} }
...@@ -368,7 +366,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap, ...@@ -368,7 +366,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
if (have_err) if (have_err)
status |= ATA_ERR; status |= ATA_ERR;
ata_qc_complete(qc, status, 0); ata_qc_complete(qc, status);
handled = 1; handled = 1;
break; break;
......
...@@ -689,7 +689,7 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, ...@@ -689,7 +689,7 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
ata_qc_complete(qc, status, 0); ata_qc_complete(qc, status);
handled = 1; handled = 1;
} else { } else {
...@@ -770,8 +770,7 @@ static inline void pdc_dma_complete (struct ata_port *ap, ...@@ -770,8 +770,7 @@ static inline void pdc_dma_complete (struct ata_port *ap,
u8 err_bit = have_err ? ATA_ERR : 0; u8 err_bit = have_err ? ATA_ERR : 0;
/* get drive status; clear intr; complete txn */ /* get drive status; clear intr; complete txn */
ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag), ata_qc_complete(qc, ata_wait_idle(ap) | err_bit);
ata_wait_idle(ap) | err_bit, 0);
} }
static void pdc_eng_timeout(struct ata_port *ap) static void pdc_eng_timeout(struct ata_port *ap)
...@@ -799,8 +798,7 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -799,8 +798,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
switch (qc->tf.protocol) { switch (qc->tf.protocol) {
case ATA_PROT_DMA: case ATA_PROT_DMA:
printk(KERN_ERR "ata%u: DMA timeout\n", ap->id); printk(KERN_ERR "ata%u: DMA timeout\n", ap->id);
ata_qc_complete(ata_qc_from_tag(ap, ap->active_tag), ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR);
ata_wait_idle(ap) | ATA_ERR, 0);
break; break;
case ATA_PROT_NODATA: case ATA_PROT_NODATA:
...@@ -809,7 +807,7 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -809,7 +807,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n", printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x\n",
ap->id, qc->tf.command, drv_stat); ap->id, qc->tf.command, drv_stat);
ata_qc_complete(qc, drv_stat, 1); ata_qc_complete(qc, drv_stat);
break; break;
default: default:
...@@ -818,7 +816,7 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -818,7 +816,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
ap->id, qc->tf.command, drv_stat); ap->id, qc->tf.command, drv_stat);
ata_qc_complete(qc, drv_stat, 1); ata_qc_complete(qc, drv_stat);
break; break;
} }
......
...@@ -402,7 +402,7 @@ extern void ata_bmdma_start_mmio (struct ata_queued_cmd *qc); ...@@ -402,7 +402,7 @@ extern void ata_bmdma_start_mmio (struct ata_queued_cmd *qc);
extern void ata_bmdma_setup_pio (struct ata_queued_cmd *qc); extern void ata_bmdma_setup_pio (struct ata_queued_cmd *qc);
extern void ata_bmdma_start_pio (struct ata_queued_cmd *qc); extern void ata_bmdma_start_pio (struct ata_queued_cmd *qc);
extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits);
extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat, unsigned int done_late); extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat);
extern void ata_eng_timeout(struct ata_port *ap); extern void ata_eng_timeout(struct ata_port *ap);
extern int ata_std_bios_param(struct scsi_device *sdev, extern int ata_std_bios_param(struct scsi_device *sdev,
struct block_device *bdev, struct block_device *bdev,
......
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