Commit f15a1daf authored by Tejun Heo's avatar Tejun Heo

[PATCH] libata: use ATA printk helpers

Use ATA printk helpers.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
parent 61440db6
...@@ -655,8 +655,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class) ...@@ -655,8 +655,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class)
fail_restart: fail_restart:
ahci_start_engine(ap); ahci_start_engine(ap);
fail: fail:
printk(KERN_ERR "ata%u: softreset failed (%s)\n", ata_port_printk(ap, KERN_ERR, "softreset failed (%s)\n", reason);
ap->id, reason);
return rc; return rc;
} }
...@@ -798,9 +797,8 @@ static void ahci_restart_port(struct ata_port *ap, u32 irq_stat) ...@@ -798,9 +797,8 @@ static void ahci_restart_port(struct ata_port *ap, u32 irq_stat)
if ((ap->device[0].class != ATA_DEV_ATAPI) || if ((ap->device[0].class != ATA_DEV_ATAPI) ||
((irq_stat & PORT_IRQ_TF_ERR) == 0)) ((irq_stat & PORT_IRQ_TF_ERR) == 0))
printk(KERN_WARNING "ata%u: port reset, " ata_port_printk(ap, KERN_WARNING, "port reset, "
"p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n", "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n",
ap->id,
irq_stat, irq_stat,
readl(mmio + HOST_IRQ_STAT), readl(mmio + HOST_IRQ_STAT),
readl(port_mmio + PORT_IRQ_STAT), readl(port_mmio + PORT_IRQ_STAT),
...@@ -840,7 +838,7 @@ static void ahci_eng_timeout(struct ata_port *ap) ...@@ -840,7 +838,7 @@ static void ahci_eng_timeout(struct ata_port *ap)
struct ata_queued_cmd *qc; struct ata_queued_cmd *qc;
unsigned long flags; unsigned long flags;
printk(KERN_WARNING "ata%u: handling error/timeout\n", ap->id); ata_port_printk(ap, KERN_WARNING, "handling error/timeout\n");
spin_lock_irqsave(&host_set->lock, flags); spin_lock_irqsave(&host_set->lock, flags);
......
...@@ -484,7 +484,7 @@ static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes) ...@@ -484,7 +484,7 @@ static int piix_pata_probe_reset(struct ata_port *ap, unsigned int *classes)
struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); struct pci_dev *pdev = to_pci_dev(ap->host_set->dev);
if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) { if (!pci_test_config_bits(pdev, &piix_enable_bits[ap->hard_port_no])) {
printk(KERN_INFO "ata%u: port disabled. ignoring.\n", ap->id); ata_port_printk(ap, KERN_INFO, "port disabled. ignoring.\n");
return 0; return 0;
} }
...@@ -565,7 +565,7 @@ static unsigned int piix_sata_probe (struct ata_port *ap) ...@@ -565,7 +565,7 @@ static unsigned int piix_sata_probe (struct ata_port *ap)
static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes) static int piix_sata_probe_reset(struct ata_port *ap, unsigned int *classes)
{ {
if (!piix_sata_probe(ap)) { if (!piix_sata_probe(ap)) {
printk(KERN_INFO "ata%u: SATA port has no device.\n", ap->id); ata_port_printk(ap, KERN_INFO, "SATA port has no device.\n");
return 0; return 0;
} }
......
...@@ -412,8 +412,7 @@ static const char *sata_spd_string(unsigned int spd) ...@@ -412,8 +412,7 @@ static const char *sata_spd_string(unsigned int spd)
void ata_dev_disable(struct ata_device *dev) void ata_dev_disable(struct ata_device *dev)
{ {
if (ata_dev_enabled(dev)) { if (ata_dev_enabled(dev)) {
printk(KERN_WARNING "ata%u: dev %u disabled\n", ata_dev_printk(dev, KERN_WARNING, "disabled\n");
dev->ap->id, dev->devno);
dev->class++; dev->class++;
} }
} }
...@@ -1021,8 +1020,9 @@ unsigned ata_exec_internal(struct ata_device *dev, ...@@ -1021,8 +1020,9 @@ unsigned ata_exec_internal(struct ata_device *dev,
if (qc->flags & ATA_QCFLAG_ACTIVE) { if (qc->flags & ATA_QCFLAG_ACTIVE) {
qc->err_mask = AC_ERR_TIMEOUT; qc->err_mask = AC_ERR_TIMEOUT;
ata_qc_complete(qc); ata_qc_complete(qc);
printk(KERN_WARNING "ata%u: qc timeout (cmd 0x%x)\n",
ap->id, command); ata_dev_printk(dev, KERN_WARNING,
"qc timeout (cmd 0x%x)\n", command);
} }
spin_unlock_irqrestore(&ap->host_set->lock, flags); spin_unlock_irqrestore(&ap->host_set->lock, flags);
...@@ -1187,8 +1187,8 @@ static int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, ...@@ -1187,8 +1187,8 @@ static int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
return 0; return 0;
err_out: err_out:
printk(KERN_WARNING "ata%u: dev %u failed to IDENTIFY (%s)\n", ata_dev_printk(dev, KERN_WARNING, "failed to IDENTIFY "
ap->id, dev->devno, reason); "(%s, err_mask=0x%x)\n", reason, err_mask);
return rc; return rc;
} }
...@@ -1228,10 +1228,10 @@ static int ata_dev_configure(struct ata_device *dev, int print_info) ...@@ -1228,10 +1228,10 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
/* print device capabilities */ /* print device capabilities */
if (print_info) if (print_info)
printk(KERN_DEBUG "ata%u: dev %u cfg 49:%04x 82:%04x 83:%04x " ata_dev_printk(dev, KERN_DEBUG, "cfg 49:%04x 82:%04x 83:%04x "
"84:%04x 85:%04x 86:%04x 87:%04x 88:%04x\n", "84:%04x 85:%04x 86:%04x 87:%04x 88:%04x\n",
ap->id, dev->devno, id[49], id[82], id[83], id[49], id[82], id[83], id[84],
id[84], id[85], id[86], id[87], id[88]); id[85], id[86], id[87], id[88]);
/* initialize to-be-configured parameters */ /* initialize to-be-configured parameters */
dev->flags &= ~ATA_DFLAG_CFG_MASK; dev->flags &= ~ATA_DFLAG_CFG_MASK;
...@@ -1267,9 +1267,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info) ...@@ -1267,9 +1267,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
/* print device info to dmesg */ /* print device info to dmesg */
if (print_info) if (print_info)
printk(KERN_INFO "ata%u: dev %u ATA-%d, " ata_dev_printk(dev, KERN_INFO, "ATA-%d, "
"max %s, %Lu sectors: %s\n", "max %s, %Lu sectors: %s\n",
ap->id, dev->devno,
ata_id_major_version(id), ata_id_major_version(id),
ata_mode_string(xfer_mask), ata_mode_string(xfer_mask),
(unsigned long long)dev->n_sectors, (unsigned long long)dev->n_sectors,
...@@ -1291,9 +1290,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info) ...@@ -1291,9 +1290,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
/* print device info to dmesg */ /* print device info to dmesg */
if (print_info) if (print_info)
printk(KERN_INFO "ata%u: dev %u ATA-%d, " ata_dev_printk(dev, KERN_INFO, "ATA-%d, "
"max %s, %Lu sectors: CHS %u/%u/%u\n", "max %s, %Lu sectors: CHS %u/%u/%u\n",
ap->id, dev->devno,
ata_id_major_version(id), ata_id_major_version(id),
ata_mode_string(xfer_mask), ata_mode_string(xfer_mask),
(unsigned long long)dev->n_sectors, (unsigned long long)dev->n_sectors,
...@@ -1307,7 +1305,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info) ...@@ -1307,7 +1305,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
else if (dev->class == ATA_DEV_ATAPI) { else if (dev->class == ATA_DEV_ATAPI) {
rc = atapi_cdb_len(id); rc = atapi_cdb_len(id);
if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { if ((rc < 12) || (rc > ATAPI_CDB_LEN)) {
printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id); ata_dev_printk(dev, KERN_WARNING,
"unsupported CDB len\n");
rc = -EINVAL; rc = -EINVAL;
goto err_out_nosup; goto err_out_nosup;
} }
...@@ -1315,8 +1314,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info) ...@@ -1315,8 +1314,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
/* print device info to dmesg */ /* print device info to dmesg */
if (print_info) if (print_info)
printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n", ata_dev_printk(dev, KERN_INFO, "ATAPI, max %s\n",
ap->id, dev->devno, ata_mode_string(xfer_mask)); ata_mode_string(xfer_mask));
} }
ap->host->max_cmd_len = 0; ap->host->max_cmd_len = 0;
...@@ -1328,8 +1327,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info) ...@@ -1328,8 +1327,8 @@ static int ata_dev_configure(struct ata_device *dev, int print_info)
/* limit bridge transfers to udma5, 200 sectors */ /* limit bridge transfers to udma5, 200 sectors */
if (ata_dev_knobble(dev)) { if (ata_dev_knobble(dev)) {
if (print_info) if (print_info)
printk(KERN_INFO "ata%u(%u): applying bridge limits\n", ata_dev_printk(dev, KERN_INFO,
ap->id, dev->devno); "applying bridge limits\n");
dev->udma_mask &= ATA_UDMA5; dev->udma_mask &= ATA_UDMA5;
dev->max_sectors = ATA_MAX_SECTORS; dev->max_sectors = ATA_MAX_SECTORS;
} }
...@@ -1382,7 +1381,8 @@ static int ata_bus_probe(struct ata_port *ap) ...@@ -1382,7 +1381,8 @@ static int ata_bus_probe(struct ata_port *ap)
if (ap->ops->probe_reset) { if (ap->ops->probe_reset) {
rc = ap->ops->probe_reset(ap, classes); rc = ap->ops->probe_reset(ap, classes);
if (rc) { if (rc) {
printk("ata%u: reset failed (errno=%d)\n", ap->id, rc); ata_port_printk(ap, KERN_ERR,
"reset failed (errno=%d)\n", rc);
return rc; return rc;
} }
} else { } else {
...@@ -1495,13 +1495,13 @@ static void sata_print_link_status(struct ata_port *ap) ...@@ -1495,13 +1495,13 @@ static void sata_print_link_status(struct ata_port *ap)
if (ata_port_online(ap)) { if (ata_port_online(ap)) {
tmp = (sstatus >> 4) & 0xf; tmp = (sstatus >> 4) & 0xf;
printk(KERN_INFO ata_port_printk(ap, KERN_INFO,
"ata%u: SATA link up %s (SStatus %X SControl %X)\n", "SATA link up %s (SStatus %X SControl %X)\n",
ap->id, sata_spd_string(tmp), sstatus, scontrol); sata_spd_string(tmp), sstatus, scontrol);
} else { } else {
printk(KERN_INFO ata_port_printk(ap, KERN_INFO,
"ata%u: SATA link down (SStatus %X SControl %X)\n", "SATA link down (SStatus %X SControl %X)\n",
ap->id, sstatus, scontrol); sstatus, scontrol);
} }
} }
...@@ -1655,8 +1655,8 @@ int sata_down_spd_limit(struct ata_port *ap) ...@@ -1655,8 +1655,8 @@ int sata_down_spd_limit(struct ata_port *ap)
ap->sata_spd_limit = mask; ap->sata_spd_limit = mask;
printk(KERN_WARNING "ata%u: limiting SATA link speed to %s\n", ata_port_printk(ap, KERN_WARNING, "limiting SATA link speed to %s\n",
ap->id, sata_spd_string(fls(mask))); sata_spd_string(fls(mask)));
return 0; return 0;
} }
...@@ -1896,7 +1896,6 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, ...@@ -1896,7 +1896,6 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
*/ */
int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0) int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0)
{ {
struct ata_port *ap = dev->ap;
unsigned long xfer_mask; unsigned long xfer_mask;
int highbit; int highbit;
...@@ -1919,8 +1918,8 @@ int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0) ...@@ -1919,8 +1918,8 @@ int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0)
ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask, ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask,
&dev->udma_mask); &dev->udma_mask);
printk(KERN_WARNING "ata%u: dev %u limiting speed to %s\n", ata_dev_printk(dev, KERN_WARNING, "limiting speed to %s\n",
ap->id, dev->devno, ata_mode_string(xfer_mask)); ata_mode_string(xfer_mask));
return 0; return 0;
...@@ -1930,7 +1929,6 @@ int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0) ...@@ -1930,7 +1929,6 @@ int ata_down_xfermask_limit(struct ata_device *dev, int force_pio0)
static int ata_dev_set_mode(struct ata_device *dev) static int ata_dev_set_mode(struct ata_device *dev)
{ {
struct ata_port *ap = dev->ap;
unsigned int err_mask; unsigned int err_mask;
int rc; int rc;
...@@ -1940,9 +1938,8 @@ static int ata_dev_set_mode(struct ata_device *dev) ...@@ -1940,9 +1938,8 @@ static int ata_dev_set_mode(struct ata_device *dev)
err_mask = ata_dev_set_xfermode(dev); err_mask = ata_dev_set_xfermode(dev);
if (err_mask) { if (err_mask) {
printk(KERN_ERR ata_dev_printk(dev, KERN_ERR, "failed to set xfermode "
"ata%u: failed to set xfermode (err_mask=0x%x)\n", "(err_mask=0x%x)\n", err_mask);
ap->id, err_mask);
return -EIO; return -EIO;
} }
...@@ -1953,8 +1950,7 @@ static int ata_dev_set_mode(struct ata_device *dev) ...@@ -1953,8 +1950,7 @@ static int ata_dev_set_mode(struct ata_device *dev)
DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n", DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n",
dev->xfer_shift, (int)dev->xfer_mode); dev->xfer_shift, (int)dev->xfer_mode);
printk(KERN_INFO "ata%u: dev %u configured for %s\n", ata_dev_printk(dev, KERN_INFO, "configured for %s\n",
ap->id, dev->devno,
ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode))); ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)));
return 0; return 0;
} }
...@@ -2023,8 +2019,7 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev) ...@@ -2023,8 +2019,7 @@ int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
continue; continue;
if (!dev->pio_mode) { if (!dev->pio_mode) {
printk(KERN_WARNING "ata%u: dev %u no PIO support\n", ata_dev_printk(dev, KERN_WARNING, "no PIO support\n");
ap->id, dev->devno);
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
...@@ -2123,8 +2118,8 @@ unsigned int ata_busy_sleep (struct ata_port *ap, ...@@ -2123,8 +2118,8 @@ unsigned int ata_busy_sleep (struct ata_port *ap,
} }
if (status & ATA_BUSY) if (status & ATA_BUSY)
printk(KERN_WARNING "ata%u is slow to respond, " ata_port_printk(ap, KERN_WARNING,
"please be patient\n", ap->id); "port is slow to respond, please be patient\n");
timeout = timer_start + tmout; timeout = timer_start + tmout;
while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) { while ((status & ATA_BUSY) && (time_before(jiffies, timeout))) {
...@@ -2133,8 +2128,8 @@ unsigned int ata_busy_sleep (struct ata_port *ap, ...@@ -2133,8 +2128,8 @@ unsigned int ata_busy_sleep (struct ata_port *ap,
} }
if (status & ATA_BUSY) { if (status & ATA_BUSY) {
printk(KERN_ERR "ata%u failed to respond (%lu secs)\n", ata_port_printk(ap, KERN_ERR, "port failed to respond "
ap->id, tmout / HZ); "(%lu secs)\n", tmout / HZ);
return 1; return 1;
} }
...@@ -2227,7 +2222,7 @@ static unsigned int ata_bus_softreset(struct ata_port *ap, ...@@ -2227,7 +2222,7 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
* pulldown resistor. * pulldown resistor.
*/ */
if (ata_check_status(ap) == 0xFF) { if (ata_check_status(ap) == 0xFF) {
printk(KERN_ERR "ata%u: SRST failed (status 0xFF)\n", ap->id); ata_port_printk(ap, KERN_ERR, "SRST failed (status 0xFF)\n");
return AC_ERR_OTHER; return AC_ERR_OTHER;
} }
...@@ -2321,7 +2316,7 @@ void ata_bus_reset(struct ata_port *ap) ...@@ -2321,7 +2316,7 @@ void ata_bus_reset(struct ata_port *ap)
return; return;
err_out: err_out:
printk(KERN_ERR "ata%u: disabling port\n", ap->id); ata_port_printk(ap, KERN_ERR, "disabling port\n");
ap->ops->port_disable(ap); ap->ops->port_disable(ap);
DPRINTK("EXIT\n"); DPRINTK("EXIT\n");
...@@ -2424,8 +2419,8 @@ int ata_std_softreset(struct ata_port *ap, unsigned int *classes) ...@@ -2424,8 +2419,8 @@ int ata_std_softreset(struct ata_port *ap, unsigned int *classes)
DPRINTK("about to softreset, devmask=%x\n", devmask); DPRINTK("about to softreset, devmask=%x\n", devmask);
err_mask = ata_bus_softreset(ap, devmask); err_mask = ata_bus_softreset(ap, devmask);
if (err_mask) { if (err_mask) {
printk(KERN_ERR "ata%u: SRST failed (err_mask=0x%x)\n", ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n",
ap->id, err_mask); err_mask);
return -EIO; return -EIO;
} }
...@@ -2503,8 +2498,8 @@ int sata_std_hardreset(struct ata_port *ap, unsigned int *class) ...@@ -2503,8 +2498,8 @@ int sata_std_hardreset(struct ata_port *ap, unsigned int *class)
} }
if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) { if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
printk(KERN_ERR ata_port_printk(ap, KERN_ERR,
"ata%u: COMRESET failed (device not ready)\n", ap->id); "COMRESET failed (device not ready)\n");
return -EIO; return -EIO;
} }
...@@ -2662,8 +2657,8 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit, ...@@ -2662,8 +2657,8 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
rc = ata_do_reset(ap, softreset, classes); rc = ata_do_reset(ap, softreset, classes);
if (rc == 0 && classes[0] != ATA_DEV_UNKNOWN) if (rc == 0 && classes[0] != ATA_DEV_UNKNOWN)
goto done; goto done;
printk(KERN_INFO "ata%u: softreset failed, will try " ata_port_printk(ap, KERN_INFO, "softreset failed, "
"hardreset in 5 secs\n", ap->id); "will try hardreset in 5 secs\n");
ssleep(5); ssleep(5);
} }
...@@ -2681,15 +2676,15 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit, ...@@ -2681,15 +2676,15 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
if (sata_down_spd_limit(ap)) if (sata_down_spd_limit(ap))
goto done; goto done;
printk(KERN_INFO "ata%u: hardreset failed, will retry " ata_port_printk(ap, KERN_INFO, "hardreset failed, "
"in 5 secs\n", ap->id); "will retry in 5 secs\n");
ssleep(5); ssleep(5);
} }
if (softreset) { if (softreset) {
printk(KERN_INFO "ata%u: hardreset succeeded without " ata_port_printk(ap, KERN_INFO,
"classification, will retry softreset in 5 secs\n", "hardreset succeeded without classification, "
ap->id); "will retry softreset in 5 secs\n");
ssleep(5); ssleep(5);
rc = ata_do_reset(ap, softreset, classes); rc = ata_do_reset(ap, softreset, classes);
...@@ -2724,15 +2719,13 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit, ...@@ -2724,15 +2719,13 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
const u16 *new_id) const u16 *new_id)
{ {
struct ata_port *ap = dev->ap;
const u16 *old_id = dev->id; const u16 *old_id = dev->id;
unsigned char model[2][41], serial[2][21]; unsigned char model[2][41], serial[2][21];
u64 new_n_sectors; u64 new_n_sectors;
if (dev->class != new_class) { if (dev->class != new_class) {
printk(KERN_INFO ata_dev_printk(dev, KERN_INFO, "class mismatch %d != %d\n",
"ata%u: dev %u class mismatch %d != %d\n", dev->class, new_class);
ap->id, dev->devno, dev->class, new_class);
return 0; return 0;
} }
...@@ -2743,23 +2736,21 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, ...@@ -2743,23 +2736,21 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
new_n_sectors = ata_id_n_sectors(new_id); new_n_sectors = ata_id_n_sectors(new_id);
if (strcmp(model[0], model[1])) { if (strcmp(model[0], model[1])) {
printk(KERN_INFO ata_dev_printk(dev, KERN_INFO, "model number mismatch "
"ata%u: dev %u model number mismatch '%s' != '%s'\n", "'%s' != '%s'\n", model[0], model[1]);
ap->id, dev->devno, model[0], model[1]);
return 0; return 0;
} }
if (strcmp(serial[0], serial[1])) { if (strcmp(serial[0], serial[1])) {
printk(KERN_INFO ata_dev_printk(dev, KERN_INFO, "serial number mismatch "
"ata%u: dev %u serial number mismatch '%s' != '%s'\n", "'%s' != '%s'\n", serial[0], serial[1]);
ap->id, dev->devno, serial[0], serial[1]);
return 0; return 0;
} }
if (dev->class == ATA_DEV_ATA && dev->n_sectors != new_n_sectors) { if (dev->class == ATA_DEV_ATA && dev->n_sectors != new_n_sectors) {
printk(KERN_INFO ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch "
"ata%u: dev %u n_sectors mismatch %llu != %llu\n", "%llu != %llu\n",
ap->id, dev->devno, (unsigned long long)dev->n_sectors, (unsigned long long)dev->n_sectors,
(unsigned long long)new_n_sectors); (unsigned long long)new_n_sectors);
return 0; return 0;
} }
...@@ -2783,9 +2774,8 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class, ...@@ -2783,9 +2774,8 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
*/ */
int ata_dev_revalidate(struct ata_device *dev, int post_reset) int ata_dev_revalidate(struct ata_device *dev, int post_reset)
{ {
struct ata_port *ap = dev->ap;
unsigned int class = dev->class; unsigned int class = dev->class;
u16 *id = (void *)ap->sector_buf; u16 *id = (void *)dev->ap->sector_buf;
int rc; int rc;
if (!ata_dev_enabled(dev)) { if (!ata_dev_enabled(dev)) {
...@@ -2812,8 +2802,7 @@ int ata_dev_revalidate(struct ata_device *dev, int post_reset) ...@@ -2812,8 +2802,7 @@ int ata_dev_revalidate(struct ata_device *dev, int post_reset)
return 0; return 0;
fail: fail:
printk(KERN_ERR "ata%u: dev %u revalidation failed (errno=%d)\n", ata_dev_printk(dev, KERN_ERR, "revalidation failed (errno=%d)\n", rc);
ap->id, dev->devno, rc);
return rc; return rc;
} }
...@@ -2941,8 +2930,8 @@ static void ata_dev_xfermask(struct ata_device *dev) ...@@ -2941,8 +2930,8 @@ static void ata_dev_xfermask(struct ata_device *dev)
} }
if (ata_dma_blacklisted(dev)) if (ata_dma_blacklisted(dev))
printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, " ata_dev_printk(dev, KERN_WARNING,
"disabling DMA\n", ap->id, dev->devno); "device is on DMA blacklist, disabling DMA\n");
if (hs->flags & ATA_HOST_SIMPLEX) { if (hs->flags & ATA_HOST_SIMPLEX) {
if (hs->simplex_claimed) if (hs->simplex_claimed)
...@@ -3733,8 +3722,8 @@ next_sg: ...@@ -3733,8 +3722,8 @@ next_sg:
unsigned int i; unsigned int i;
if (words) /* warning if bytes > 1 */ if (words) /* warning if bytes > 1 */
printk(KERN_WARNING "ata%u: %u bytes trailing data\n", ata_dev_printk(qc->dev, KERN_WARNING,
ap->id, bytes); "%u bytes trailing data\n", bytes);
for (i = 0; i < words; i++) for (i = 0; i < words; i++)
ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write); ata_data_xfer(ap, (unsigned char*)pad_buf, 2, do_write);
...@@ -3817,8 +3806,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc) ...@@ -3817,8 +3806,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
return; return;
err_out: err_out:
printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", ata_dev_printk(dev, KERN_INFO, "ATAPI check failed\n");
ap->id, dev->devno);
qc->err_mask |= AC_ERR_HSM; qc->err_mask |= AC_ERR_HSM;
ap->hsm_task_state = HSM_ST_ERR; ap->hsm_task_state = HSM_ST_ERR;
} }
...@@ -3887,8 +3875,7 @@ static void ata_pio_error(struct ata_queued_cmd *qc) ...@@ -3887,8 +3875,7 @@ static void ata_pio_error(struct ata_queued_cmd *qc)
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
if (qc->tf.command != ATA_CMD_PACKET) if (qc->tf.command != ATA_CMD_PACKET)
printk(KERN_WARNING "ata%u: dev %u PIO error\n", ata_dev_printk(qc->dev, KERN_WARNING, "PIO error\n");
ap->id, qc->dev->devno);
/* make sure qc->err_mask is available to /* make sure qc->err_mask is available to
* know what's wrong and recover * know what's wrong and recover
...@@ -4314,7 +4301,7 @@ idle_irq: ...@@ -4314,7 +4301,7 @@ idle_irq:
#ifdef ATA_IRQ_TRAP #ifdef ATA_IRQ_TRAP
if ((ap->stats.idle_irq % 1000) == 0) { if ((ap->stats.idle_irq % 1000) == 0) {
ata_irq_ack(ap, 0); /* debug trap */ ata_irq_ack(ap, 0); /* debug trap */
printk(KERN_WARNING "ata%d: irq trap\n", ap->id); ata_port_printk(ap, KERN_WARNING, "irq trap\n");
return 1; return 1;
} }
#endif #endif
...@@ -4522,7 +4509,7 @@ static int ata_do_simple_cmd(struct ata_device *dev, u8 cmd) ...@@ -4522,7 +4509,7 @@ static int ata_do_simple_cmd(struct ata_device *dev, u8 cmd)
err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
if (err) if (err)
printk(KERN_ERR "%s: ata command failed: %d\n", ata_dev_printk(dev, KERN_ERR, "%s: ata command failed: %d\n",
__FUNCTION__, err); __FUNCTION__, err);
return err; return err;
...@@ -4863,9 +4850,8 @@ int ata_device_add(const struct ata_probe_ent *ent) ...@@ -4863,9 +4850,8 @@ int ata_device_add(const struct ata_probe_ent *ent)
(ap->pio_mask << ATA_SHIFT_PIO); (ap->pio_mask << ATA_SHIFT_PIO);
/* print per-port info to dmesg */ /* print per-port info to dmesg */
printk(KERN_INFO "ata%u: %cATA max %s cmd 0x%lX ctl 0x%lX " ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%lX "
"bmdma 0x%lX irq %lu\n", "ctl 0x%lX bmdma 0x%lX irq %lu\n",
ap->id,
ap->flags & ATA_FLAG_SATA ? 'S' : 'P', ap->flags & ATA_FLAG_SATA ? 'S' : 'P',
ata_mode_string(xfer_mode_mask), ata_mode_string(xfer_mode_mask),
ap->ioaddr.cmd_addr, ap->ioaddr.cmd_addr,
...@@ -4909,8 +4895,7 @@ int ata_device_add(const struct ata_probe_ent *ent) ...@@ -4909,8 +4895,7 @@ int ata_device_add(const struct ata_probe_ent *ent)
rc = scsi_add_host(ap->host, dev); rc = scsi_add_host(ap->host, dev);
if (rc) { if (rc) {
printk(KERN_ERR "ata%u: scsi_add_host failed\n", ata_port_printk(ap, KERN_ERR, "scsi_add_host failed\n");
ap->id);
/* FIXME: do something useful here */ /* FIXME: do something useful here */
/* FIXME: handle unconditional calls to /* FIXME: handle unconditional calls to
* scsi_scan_host and ata_host_remove, below, * scsi_scan_host and ata_host_remove, below,
......
...@@ -167,8 +167,9 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) ...@@ -167,8 +167,9 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc)
/* ack bmdma irq events */ /* ack bmdma irq events */
ap->ops->irq_clear(ap); ap->ops->irq_clear(ap);
printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x host_stat 0x%x\n", ata_dev_printk(qc->dev, KERN_ERR, "command 0x%x timeout, "
ap->id, qc->tf.command, drv_stat, host_stat); "stat 0x%x host_stat 0x%x\n",
qc->tf.command, drv_stat, host_stat);
/* complete taskfile transaction */ /* complete taskfile transaction */
qc->err_mask |= ac_err_mask(drv_stat); qc->err_mask |= ac_err_mask(drv_stat);
......
...@@ -1261,8 +1261,8 @@ static void ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd, ...@@ -1261,8 +1261,8 @@ static void ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
if (cmd->sc_data_direction == DMA_FROM_DEVICE || if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
cmd->sc_data_direction == DMA_TO_DEVICE) { cmd->sc_data_direction == DMA_TO_DEVICE) {
if (unlikely(cmd->request_bufflen < 1)) { if (unlikely(cmd->request_bufflen < 1)) {
printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n", ata_dev_printk(dev, KERN_WARNING,
dev->ap->id, dev->devno); "WARNING: zero len r/w req\n");
goto err_did; goto err_did;
} }
...@@ -2200,8 +2200,9 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev) ...@@ -2200,8 +2200,9 @@ ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) { if (!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) {
if (unlikely(dev->class == ATA_DEV_ATAPI)) { if (unlikely(dev->class == ATA_DEV_ATAPI)) {
printk(KERN_WARNING "ata%u(%u): WARNING: ATAPI is %s, device ignored.\n", ata_dev_printk(dev, KERN_WARNING,
ap->id, dev->devno, atapi_enabled ? "not supported with this driver" : "disabled"); "WARNING: ATAPI is %s, device ignored.\n",
atapi_enabled ? "not supported with this driver" : "disabled");
return NULL; return NULL;
} }
} }
......
...@@ -680,7 +680,7 @@ static void mv_stop_dma(struct ata_port *ap) ...@@ -680,7 +680,7 @@ static void mv_stop_dma(struct ata_port *ap)
} }
if (EDMA_EN & reg) { if (EDMA_EN & reg) {
printk(KERN_ERR "ata%u: Unable to stop eDMA\n", ap->id); ata_port_printk(ap, KERN_ERR, "Unable to stop eDMA\n");
/* FIXME: Consider doing a reset here to recover */ /* FIXME: Consider doing a reset here to recover */
} }
} }
...@@ -1964,8 +1964,8 @@ comreset_retry: ...@@ -1964,8 +1964,8 @@ comreset_retry:
ata_port_probe(ap); ata_port_probe(ap);
} else { } else {
sata_scr_read(ap, SCR_STATUS, &sstatus); sata_scr_read(ap, SCR_STATUS, &sstatus);
printk(KERN_INFO "ata%u: no device found (phy stat %08x)\n", ata_port_printk(ap, KERN_INFO,
ap->id, sstatus); "no device found (phy stat %08x)\n", sstatus);
ata_port_disable(ap); ata_port_disable(ap);
return; return;
} }
...@@ -2023,7 +2023,7 @@ static void mv_eng_timeout(struct ata_port *ap) ...@@ -2023,7 +2023,7 @@ static void mv_eng_timeout(struct ata_port *ap)
{ {
struct ata_queued_cmd *qc; struct ata_queued_cmd *qc;
printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); ata_port_printk(ap, KERN_ERR, "Entering mv_eng_timeout\n");
DPRINTK("All regs @ start of eng_timeout\n"); DPRINTK("All regs @ start of eng_timeout\n");
mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no,
to_pci_dev(ap->host_set->dev)); to_pci_dev(ap->host_set->dev));
......
...@@ -435,7 +435,7 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -435,7 +435,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:
case ATA_PROT_NODATA: case ATA_PROT_NODATA:
printk(KERN_ERR "ata%u: command timeout\n", ap->id); ata_port_printk(ap, KERN_ERR, "command timeout\n");
drv_stat = ata_wait_idle(ap); drv_stat = ata_wait_idle(ap);
qc->err_mask |= __ac_err_mask(drv_stat); qc->err_mask |= __ac_err_mask(drv_stat);
break; break;
...@@ -443,8 +443,9 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -443,8 +443,9 @@ static void pdc_eng_timeout(struct ata_port *ap)
default: default:
drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", ata_port_printk(ap, KERN_ERR,
ap->id, qc->tf.command, drv_stat); "unknown timeout, cmd 0x%x stat 0x%x\n",
qc->tf.command, drv_stat);
qc->err_mask |= ac_err_mask(drv_stat); qc->err_mask |= ac_err_mask(drv_stat);
break; break;
......
...@@ -360,16 +360,16 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev) ...@@ -360,16 +360,16 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
if (slow_down || if (slow_down ||
((ap->flags & SIL_FLAG_MOD15WRITE) && ((ap->flags & SIL_FLAG_MOD15WRITE) &&
(quirks & SIL_QUIRK_MOD15WRITE))) { (quirks & SIL_QUIRK_MOD15WRITE))) {
printk(KERN_INFO "ata%u(%u): applying Seagate errata fix (mod15write workaround)\n", ata_dev_printk(dev, KERN_INFO, "applying Seagate errata fix "
ap->id, dev->devno); "(mod15write workaround)\n");
dev->max_sectors = 15; dev->max_sectors = 15;
return; return;
} }
/* limit to udma5 */ /* limit to udma5 */
if (quirks & SIL_QUIRK_UDMA5MAX) { if (quirks & SIL_QUIRK_UDMA5MAX) {
printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n", ata_dev_printk(dev, KERN_INFO,
ap->id, dev->devno, model_num); "applying Maxtor errata fix %s\n", model_num);
dev->udma_mask &= ATA_UDMA5; dev->udma_mask &= ATA_UDMA5;
return; return;
} }
......
...@@ -516,7 +516,7 @@ static int sil24_softreset(struct ata_port *ap, unsigned int *class) ...@@ -516,7 +516,7 @@ static int sil24_softreset(struct ata_port *ap, unsigned int *class)
return 0; return 0;
err: err:
printk(KERN_ERR "ata%u: softreset failed (%s)\n", ap->id, reason); ata_port_printk(ap, KERN_ERR, "softreset failed (%s)\n", reason);
return -EIO; return -EIO;
} }
...@@ -561,7 +561,7 @@ static int sil24_hardreset(struct ata_port *ap, unsigned int *class) ...@@ -561,7 +561,7 @@ static int sil24_hardreset(struct ata_port *ap, unsigned int *class)
return 0; return 0;
err: err:
printk(KERN_ERR "ata%u: hardreset failed (%s)\n", ap->id, reason); ata_port_printk(ap, KERN_ERR, "hardreset failed (%s)\n", reason);
return -EIO; return -EIO;
} }
...@@ -721,7 +721,7 @@ static void sil24_eng_timeout(struct ata_port *ap) ...@@ -721,7 +721,7 @@ static void sil24_eng_timeout(struct ata_port *ap)
qc = ata_qc_from_tag(ap, ap->active_tag); qc = ata_qc_from_tag(ap, ap->active_tag);
printk(KERN_ERR "ata%u: command timeout\n", ap->id); ata_port_printk(ap, KERN_ERR, "command timeout\n");
qc->err_mask |= AC_ERR_TIMEOUT; qc->err_mask |= AC_ERR_TIMEOUT;
ata_eh_qc_complete(qc); ata_eh_qc_complete(qc);
......
...@@ -868,15 +868,16 @@ static void pdc_eng_timeout(struct ata_port *ap) ...@@ -868,15 +868,16 @@ 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:
case ATA_PROT_NODATA: case ATA_PROT_NODATA:
printk(KERN_ERR "ata%u: command timeout\n", ap->id); ata_port_printk(ap, KERN_ERR, "command timeout\n");
qc->err_mask |= __ac_err_mask(ata_wait_idle(ap)); qc->err_mask |= __ac_err_mask(ata_wait_idle(ap));
break; break;
default: default:
drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", ata_port_printk(ap, KERN_ERR,
ap->id, qc->tf.command, drv_stat); "unknown timeout, cmd 0x%x stat 0x%x\n",
qc->tf.command, drv_stat);
qc->err_mask |= ac_err_mask(drv_stat); qc->err_mask |= ac_err_mask(drv_stat);
break; break;
......
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