aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-24 17:34:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-24 17:34:01 -0400
commitf1f3b8eab7491b6d9c2f03dfaaa7cb66a156f94c (patch)
tree966bef9cd316854a451f224b6e696aa132c8a196
parentb6844e8f64920cdee620157252169ba63afb0c89 (diff)
parent3b5ec274daae9165e0fe101e85e13060e5d78dae (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev: ata: PATA_ARASAN_CF depends on DMADEVICES ata: remove unnecessary code [libata] Prevent warning during PMP error recovery ahci: RAID-mode SATA patch for Intel Panther Point DeviceIDs pata_it821x: Fix RAID type display, by adding missing comma sata_dwc_460ex: fix error path ahci: Enable SB600 64bit DMA on Asus M3A libata: report link resume failure as KERN_WARNING instead of ERR ahci: move ahci_sb600_softreset to libahci.c and rename it libata: leave port thawed after reset failure ata: sata_via: Use dev_dbg ata: Add and use ata_print_version_once ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> ata: Convert dev_printk(KERN_<LEVEL> to dev_<level>(
-rw-r--r--drivers/ata/Kconfig1
-rw-r--r--drivers/ata/acard-ahci.c27
-rw-r--r--drivers/ata/ahci.c122
-rw-r--r--drivers/ata/ahci.h1
-rw-r--r--drivers/ata/ata_generic.c5
-rw-r--r--drivers/ata/ata_piix.c44
-rw-r--r--drivers/ata/libahci.c152
-rw-r--r--drivers/ata/libata-acpi.c66
-rw-r--r--drivers/ata/libata-core.c400
-rw-r--r--drivers/ata/libata-eh.c154
-rw-r--r--drivers/ata/libata-pmp.c123
-rw-r--r--drivers/ata/libata-scsi.c22
-rw-r--r--drivers/ata/libata-sff.c53
-rw-r--r--drivers/ata/pata_acpi.c8
-rw-r--r--drivers/ata/pata_ali.c8
-rw-r--r--drivers/ata/pata_amd.c8
-rw-r--r--drivers/ata/pata_artop.c5
-rw-r--r--drivers/ata/pata_atp867x.c13
-rw-r--r--drivers/ata/pata_bf54x.c4
-rw-r--r--drivers/ata/pata_cs5520.c3
-rw-r--r--drivers/ata/pata_efar.c5
-rw-r--r--drivers/ata/pata_hpt3x3.c4
-rw-r--r--drivers/ata/pata_icside.c4
-rw-r--r--drivers/ata/pata_it8213.c5
-rw-r--r--drivers/ata/pata_it821x.c16
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c4
-rw-r--r--drivers/ata/pata_legacy.c2
-rw-r--r--drivers/ata/pata_macio.c10
-rw-r--r--drivers/ata/pata_mpiix.c4
-rw-r--r--drivers/ata/pata_netcell.c5
-rw-r--r--drivers/ata/pata_ns87410.c2
-rw-r--r--drivers/ata/pata_ns87415.c5
-rw-r--r--drivers/ata/pata_octeon_cf.c8
-rw-r--r--drivers/ata/pata_oldpiix.c5
-rw-r--r--drivers/ata/pata_opti.c4
-rw-r--r--drivers/ata/pata_optidma.c4
-rw-r--r--drivers/ata/pata_pcmcia.c5
-rw-r--r--drivers/ata/pata_pdc2027x.c6
-rw-r--r--drivers/ata/pata_platform.c2
-rw-r--r--drivers/ata/pata_radisys.c5
-rw-r--r--drivers/ata/pata_rdc.c5
-rw-r--r--drivers/ata/pata_rz1000.c4
-rw-r--r--drivers/ata/pata_samsung_cf.c2
-rw-r--r--drivers/ata/pata_scc.c8
-rw-r--r--drivers/ata/pata_sch.c5
-rw-r--r--drivers/ata/pata_sil680.c4
-rw-r--r--drivers/ata/pata_sis.c5
-rw-r--r--drivers/ata/pata_sl82c105.c6
-rw-r--r--drivers/ata/pata_triflex.c4
-rw-r--r--drivers/ata/pata_via.c8
-rw-r--r--drivers/ata/pdc_adma.c10
-rw-r--r--drivers/ata/sata_dwc_460ex.c21
-rw-r--r--drivers/ata/sata_fsl.c43
-rw-r--r--drivers/ata/sata_inic162x.c31
-rw-r--r--drivers/ata/sata_mv.c94
-rw-r--r--drivers/ata/sata_nv.c79
-rw-r--r--drivers/ata/sata_promise.c6
-rw-r--r--drivers/ata/sata_qstor.c13
-rw-r--r--drivers/ata/sata_sil.c21
-rw-r--r--drivers/ata/sata_sil24.c43
-rw-r--r--drivers/ata/sata_sis.c26
-rw-r--r--drivers/ata/sata_svw.c4
-rw-r--r--drivers/ata/sata_sx4.c4
-rw-r--r--drivers/ata/sata_uli.c4
-rw-r--r--drivers/ata/sata_via.c42
-rw-r--r--drivers/ata/sata_vsc.c9
-rw-r--r--include/linux/libata.h68
67 files changed, 920 insertions, 973 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 75afa75a515e..ca3e6be44a04 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -313,6 +313,7 @@ config PATA_AMD
313 313
314config PATA_ARASAN_CF 314config PATA_ARASAN_CF
315 tristate "ARASAN CompactFlash PATA Controller Support" 315 tristate "ARASAN CompactFlash PATA Controller Support"
316 depends on DMADEVICES
316 select DMA_ENGINE 317 select DMA_ENGINE
317 help 318 help
318 Say Y here to support the ARASAN CompactFlash PATA controller 319 Say Y here to support the ARASAN CompactFlash PATA controller
diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c
index ae22be4157b5..3bc8c79bf2c7 100644
--- a/drivers/ata/acard-ahci.c
+++ b/drivers/ata/acard-ahci.c
@@ -135,8 +135,8 @@ static int acard_ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg
135 135
136 if (mesg.event & PM_EVENT_SUSPEND && 136 if (mesg.event & PM_EVENT_SUSPEND &&
137 hpriv->flags & AHCI_HFLAG_NO_SUSPEND) { 137 hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
138 dev_printk(KERN_ERR, &pdev->dev, 138 dev_err(&pdev->dev,
139 "BIOS update required for suspend/resume\n"); 139 "BIOS update required for suspend/resume\n");
140 return -EIO; 140 return -EIO;
141 } 141 }
142 142
@@ -187,7 +187,7 @@ static int acard_ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
187 if (rc) { 187 if (rc) {
188 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 188 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
189 if (rc) { 189 if (rc) {
190 dev_printk(KERN_ERR, &pdev->dev, 190 dev_err(&pdev->dev,
191 "64-bit DMA enable failed\n"); 191 "64-bit DMA enable failed\n");
192 return rc; 192 return rc;
193 } 193 }
@@ -195,14 +195,13 @@ static int acard_ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
195 } else { 195 } else {
196 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 196 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
197 if (rc) { 197 if (rc) {
198 dev_printk(KERN_ERR, &pdev->dev, 198 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
199 "32-bit DMA enable failed\n");
200 return rc; 199 return rc;
201 } 200 }
202 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 201 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
203 if (rc) { 202 if (rc) {
204 dev_printk(KERN_ERR, &pdev->dev, 203 dev_err(&pdev->dev,
205 "32-bit consistent DMA enable failed\n"); 204 "32-bit consistent DMA enable failed\n");
206 return rc; 205 return rc;
207 } 206 }
208 } 207 }
@@ -343,14 +342,12 @@ static int acard_ahci_port_start(struct ata_port *ap)
343 if (cmd & PORT_CMD_FBSCP) 342 if (cmd & PORT_CMD_FBSCP)
344 pp->fbs_supported = true; 343 pp->fbs_supported = true;
345 else if (hpriv->flags & AHCI_HFLAG_YES_FBS) { 344 else if (hpriv->flags & AHCI_HFLAG_YES_FBS) {
346 dev_printk(KERN_INFO, dev, 345 dev_info(dev, "port %d can do FBS, forcing FBSCP\n",
347 "port %d can do FBS, forcing FBSCP\n", 346 ap->port_no);
348 ap->port_no);
349 pp->fbs_supported = true; 347 pp->fbs_supported = true;
350 } else 348 } else
351 dev_printk(KERN_WARNING, dev, 349 dev_warn(dev, "port %d is not capable of FBS\n",
352 "port %d is not capable of FBS\n", 350 ap->port_no);
353 ap->port_no);
354 } 351 }
355 352
356 if (pp->fbs_supported) { 353 if (pp->fbs_supported) {
@@ -406,7 +403,6 @@ static int acard_ahci_port_start(struct ata_port *ap)
406 403
407static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 404static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
408{ 405{
409 static int printed_version;
410 unsigned int board_id = ent->driver_data; 406 unsigned int board_id = ent->driver_data;
411 struct ata_port_info pi = acard_ahci_port_info[board_id]; 407 struct ata_port_info pi = acard_ahci_port_info[board_id];
412 const struct ata_port_info *ppi[] = { &pi, NULL }; 408 const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -419,8 +415,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id
419 415
420 WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS); 416 WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
421 417
422 if (!printed_version++) 418 ata_print_version_once(&pdev->dev, DRV_VERSION);
423 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
424 419
425 /* acquire resources */ 420 /* acquire resources */
426 rc = pcim_enable_device(pdev); 421 rc = pcim_enable_device(pdev);
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 71afe0371311..fb7b90b05922 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -79,8 +79,6 @@ enum board_ids {
79}; 79};
80 80
81static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 81static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
82static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
83 unsigned long deadline);
84static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, 82static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
85 unsigned long deadline); 83 unsigned long deadline);
86static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class, 84static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
@@ -104,12 +102,6 @@ static struct ata_port_operations ahci_p5wdh_ops = {
104 .hardreset = ahci_p5wdh_hardreset, 102 .hardreset = ahci_p5wdh_hardreset,
105}; 103};
106 104
107static struct ata_port_operations ahci_sb600_ops = {
108 .inherits = &ahci_ops,
109 .softreset = ahci_sb600_softreset,
110 .pmp_softreset = ahci_sb600_softreset,
111};
112
113#define AHCI_HFLAGS(flags) .private_data = (void *)(flags) 105#define AHCI_HFLAGS(flags) .private_data = (void *)(flags)
114 106
115static const struct ata_port_info ahci_port_info[] = { 107static const struct ata_port_info ahci_port_info[] = {
@@ -188,7 +180,7 @@ static const struct ata_port_info ahci_port_info[] = {
188 .flags = AHCI_FLAG_COMMON, 180 .flags = AHCI_FLAG_COMMON,
189 .pio_mask = ATA_PIO4, 181 .pio_mask = ATA_PIO4,
190 .udma_mask = ATA_UDMA6, 182 .udma_mask = ATA_UDMA6,
191 .port_ops = &ahci_sb600_ops, 183 .port_ops = &ahci_pmp_retry_srst_ops,
192 }, 184 },
193 [board_ahci_sb700] = /* for SB700 and SB800 */ 185 [board_ahci_sb700] = /* for SB700 and SB800 */
194 { 186 {
@@ -196,7 +188,7 @@ static const struct ata_port_info ahci_port_info[] = {
196 .flags = AHCI_FLAG_COMMON, 188 .flags = AHCI_FLAG_COMMON,
197 .pio_mask = ATA_PIO4, 189 .pio_mask = ATA_PIO4,
198 .udma_mask = ATA_UDMA6, 190 .udma_mask = ATA_UDMA6,
199 .port_ops = &ahci_sb600_ops, 191 .port_ops = &ahci_pmp_retry_srst_ops,
200 }, 192 },
201 [board_ahci_vt8251] = 193 [board_ahci_vt8251] =
202 { 194 {
@@ -267,6 +259,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
267 { PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */ 259 { PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */
268 { PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */ 260 { PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */
269 { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point RAID */ 261 { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point RAID */
262 { PCI_VDEVICE(INTEL, 0x1e0e), board_ahci }, /* Panther Point RAID */
270 263
271 /* JMicron 360/1/3/5/6, match class to avoid IDE function */ 264 /* JMicron 360/1/3/5/6, match class to avoid IDE function */
272 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 265 { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -502,55 +495,6 @@ static void ahci_pci_init_controller(struct ata_host *host)
502 ahci_init_controller(host); 495 ahci_init_controller(host);
503} 496}
504 497
505static int ahci_sb600_check_ready(struct ata_link *link)
506{
507 void __iomem *port_mmio = ahci_port_base(link->ap);
508 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
509 u32 irq_status = readl(port_mmio + PORT_IRQ_STAT);
510
511 /*
512 * There is no need to check TFDATA if BAD PMP is found due to HW bug,
513 * which can save timeout delay.
514 */
515 if (irq_status & PORT_IRQ_BAD_PMP)
516 return -EIO;
517
518 return ata_check_ready(status);
519}
520
521static int ahci_sb600_softreset(struct ata_link *link, unsigned int *class,
522 unsigned long deadline)
523{
524 struct ata_port *ap = link->ap;
525 void __iomem *port_mmio = ahci_port_base(ap);
526 int pmp = sata_srst_pmp(link);
527 int rc;
528 u32 irq_sts;
529
530 DPRINTK("ENTER\n");
531
532 rc = ahci_do_softreset(link, class, pmp, deadline,
533 ahci_sb600_check_ready);
534
535 /*
536 * Soft reset fails on some ATI chips with IPMS set when PMP
537 * is enabled but SATA HDD/ODD is connected to SATA port,
538 * do soft reset again to port 0.
539 */
540 if (rc == -EIO) {
541 irq_sts = readl(port_mmio + PORT_IRQ_STAT);
542 if (irq_sts & PORT_IRQ_BAD_PMP) {
543 ata_link_printk(link, KERN_WARNING,
544 "applying SB600 PMP SRST workaround "
545 "and retrying\n");
546 rc = ahci_do_softreset(link, class, 0, deadline,
547 ahci_check_ready);
548 }
549 }
550
551 return rc;
552}
553
554static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class, 498static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
555 unsigned long deadline) 499 unsigned long deadline)
556{ 500{
@@ -629,8 +573,8 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
629 573
630 if (mesg.event & PM_EVENT_SUSPEND && 574 if (mesg.event & PM_EVENT_SUSPEND &&
631 hpriv->flags & AHCI_HFLAG_NO_SUSPEND) { 575 hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
632 dev_printk(KERN_ERR, &pdev->dev, 576 dev_err(&pdev->dev,
633 "BIOS update required for suspend/resume\n"); 577 "BIOS update required for suspend/resume\n");
634 return -EIO; 578 return -EIO;
635 } 579 }
636 580
@@ -681,22 +625,21 @@ static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
681 if (rc) { 625 if (rc) {
682 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 626 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
683 if (rc) { 627 if (rc) {
684 dev_printk(KERN_ERR, &pdev->dev, 628 dev_err(&pdev->dev,
685 "64-bit DMA enable failed\n"); 629 "64-bit DMA enable failed\n");
686 return rc; 630 return rc;
687 } 631 }
688 } 632 }
689 } else { 633 } else {
690 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 634 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
691 if (rc) { 635 if (rc) {
692 dev_printk(KERN_ERR, &pdev->dev, 636 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
693 "32-bit DMA enable failed\n");
694 return rc; 637 return rc;
695 } 638 }
696 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 639 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
697 if (rc) { 640 if (rc) {
698 dev_printk(KERN_ERR, &pdev->dev, 641 dev_err(&pdev->dev,
699 "32-bit consistent DMA enable failed\n"); 642 "32-bit consistent DMA enable failed\n");
700 return rc; 643 return rc;
701 } 644 }
702 } 645 }
@@ -759,8 +702,8 @@ static void ahci_p5wdh_workaround(struct ata_host *host)
759 dmi_check_system(sysids)) { 702 dmi_check_system(sysids)) {
760 struct ata_port *ap = host->ports[1]; 703 struct ata_port *ap = host->ports[1];
761 704
762 dev_printk(KERN_INFO, &pdev->dev, "enabling ASUS P5W DH " 705 dev_info(&pdev->dev,
763 "Deluxe on-board SIMG4726 workaround\n"); 706 "enabling ASUS P5W DH Deluxe on-board SIMG4726 workaround\n");
764 707
765 ap->ops = &ahci_p5wdh_ops; 708 ap->ops = &ahci_p5wdh_ops;
766 ap->link.flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA; 709 ap->link.flags |= ATA_LFLAG_NO_SRST | ATA_LFLAG_ASSUME_ATA;
@@ -811,6 +754,18 @@ static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
811 DMI_MATCH(DMI_BOARD_NAME, "MS-7376"), 754 DMI_MATCH(DMI_BOARD_NAME, "MS-7376"),
812 }, 755 },
813 }, 756 },
757 /*
758 * All BIOS versions for the Asus M3A support 64bit DMA.
759 * (all release versions from 0301 to 1206 were tested)
760 */
761 {
762 .ident = "ASUS M3A",
763 .matches = {
764 DMI_MATCH(DMI_BOARD_VENDOR,
765 "ASUSTeK Computer INC."),
766 DMI_MATCH(DMI_BOARD_NAME, "M3A"),
767 },
768 },
814 { } 769 { }
815 }; 770 };
816 const struct dmi_system_id *match; 771 const struct dmi_system_id *match;
@@ -831,14 +786,14 @@ static bool ahci_sb600_enable_64bit(struct pci_dev *pdev)
831 if (strcmp(buf, match->driver_data) >= 0) 786 if (strcmp(buf, match->driver_data) >= 0)
832 goto enable_64bit; 787 goto enable_64bit;
833 else { 788 else {
834 dev_printk(KERN_WARNING, &pdev->dev, "%s: BIOS too old, " 789 dev_warn(&pdev->dev,
835 "forcing 32bit DMA, update BIOS\n", match->ident); 790 "%s: BIOS too old, forcing 32bit DMA, update BIOS\n",
791 match->ident);
836 return false; 792 return false;
837 } 793 }
838 794
839enable_64bit: 795enable_64bit:
840 dev_printk(KERN_WARNING, &pdev->dev, "%s: enabling 64bit DMA\n", 796 dev_warn(&pdev->dev, "%s: enabling 64bit DMA\n", match->ident);
841 match->ident);
842 return true; 797 return true;
843} 798}
844 799
@@ -1041,9 +996,8 @@ static void ahci_gtf_filter_workaround(struct ata_host *host)
1041 return; 996 return;
1042 997
1043 filter = (unsigned long)dmi->driver_data; 998 filter = (unsigned long)dmi->driver_data;
1044 dev_printk(KERN_INFO, host->dev, 999 dev_info(host->dev, "applying extra ACPI _GTF filter 0x%x for %s\n",
1045 "applying extra ACPI _GTF filter 0x%x for %s\n", 1000 filter, dmi->ident);
1046 filter, dmi->ident);
1047 1001
1048 for (i = 0; i < host->n_ports; i++) { 1002 for (i = 0; i < host->n_ports; i++) {
1049 struct ata_port *ap = host->ports[i]; 1003 struct ata_port *ap = host->ports[i];
@@ -1062,7 +1016,6 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host)
1062 1016
1063static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1017static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1064{ 1018{
1065 static int printed_version;
1066 unsigned int board_id = ent->driver_data; 1019 unsigned int board_id = ent->driver_data;
1067 struct ata_port_info pi = ahci_port_info[board_id]; 1020 struct ata_port_info pi = ahci_port_info[board_id];
1068 const struct ata_port_info *ppi[] = { &pi, NULL }; 1021 const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -1075,8 +1028,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1075 1028
1076 WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS); 1029 WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
1077 1030
1078 if (!printed_version++) 1031 ata_print_version_once(&pdev->dev, DRV_VERSION);
1079 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1080 1032
1081 /* The AHCI driver can only drive the SATA ports, the PATA driver 1033 /* The AHCI driver can only drive the SATA ports, the PATA driver
1082 can drive them all so if both drivers are selected make sure 1034 can drive them all so if both drivers are selected make sure
@@ -1099,8 +1051,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1099 * that for SAS drives they're out of luck. 1051 * that for SAS drives they're out of luck.
1100 */ 1052 */
1101 if (pdev->vendor == PCI_VENDOR_ID_PROMISE) 1053 if (pdev->vendor == PCI_VENDOR_ID_PROMISE)
1102 dev_printk(KERN_INFO, &pdev->dev, "PDC42819 " 1054 dev_info(&pdev->dev,
1103 "can only drive SATA devices with this driver\n"); 1055 "PDC42819 can only drive SATA devices with this driver\n");
1104 1056
1105 /* acquire resources */ 1057 /* acquire resources */
1106 rc = pcim_enable_device(pdev); 1058 rc = pcim_enable_device(pdev);
@@ -1126,8 +1078,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1126 */ 1078 */
1127 pci_read_config_byte(pdev, ICH_MAP, &map); 1079 pci_read_config_byte(pdev, ICH_MAP, &map);
1128 if (map & 0x3) { 1080 if (map & 0x3) {
1129 dev_printk(KERN_INFO, &pdev->dev, "controller is in " 1081 dev_info(&pdev->dev,
1130 "combined mode, can't enable AHCI mode\n"); 1082 "controller is in combined mode, can't enable AHCI mode\n");
1131 return -ENODEV; 1083 return -ENODEV;
1132 } 1084 }
1133 } 1085 }
@@ -1184,8 +1136,8 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1184 1136
1185 if (ahci_broken_suspend(pdev)) { 1137 if (ahci_broken_suspend(pdev)) {
1186 hpriv->flags |= AHCI_HFLAG_NO_SUSPEND; 1138 hpriv->flags |= AHCI_HFLAG_NO_SUSPEND;
1187 dev_printk(KERN_WARNING, &pdev->dev, 1139 dev_warn(&pdev->dev,
1188 "BIOS update required for suspend/resume\n"); 1140 "BIOS update required for suspend/resume\n");
1189 } 1141 }
1190 1142
1191 if (ahci_broken_online(pdev)) { 1143 if (ahci_broken_online(pdev)) {
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 12c5282e7fca..b1750007c8dc 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -312,6 +312,7 @@ extern struct device_attribute *ahci_sdev_attrs[];
312 .sdev_attrs = ahci_sdev_attrs 312 .sdev_attrs = ahci_sdev_attrs
313 313
314extern struct ata_port_operations ahci_ops; 314extern struct ata_port_operations ahci_ops;
315extern struct ata_port_operations ahci_pmp_retry_srst_ops;
315 316
316void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag, 317void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
317 u32 opts); 318 u32 opts);
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 721d38bfa339..7df56ec31819 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -81,14 +81,13 @@ static int generic_set_mode(struct ata_link *link, struct ata_device **unused)
81 xfer_mask |= ata_xfer_mode2mask(XFER_MW_DMA_0); 81 xfer_mask |= ata_xfer_mode2mask(XFER_MW_DMA_0);
82 } 82 }
83 83
84 ata_dev_printk(dev, KERN_INFO, "configured for %s\n", 84 ata_dev_info(dev, "configured for %s\n", name);
85 name);
86 85
87 dev->xfer_mode = ata_xfer_mask2mode(xfer_mask); 86 dev->xfer_mode = ata_xfer_mask2mode(xfer_mask);
88 dev->xfer_shift = ata_xfer_mode2shift(dev->xfer_mode); 87 dev->xfer_shift = ata_xfer_mode2shift(dev->xfer_mode);
89 dev->flags &= ~ATA_DFLAG_PIO; 88 dev->flags &= ~ATA_DFLAG_PIO;
90 } else { 89 } else {
91 ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); 90 ata_dev_info(dev, "configured for PIO\n");
92 dev->xfer_mode = XFER_PIO_0; 91 dev->xfer_mode = XFER_PIO_0;
93 dev->xfer_shift = ATA_SHIFT_PIO; 92 dev->xfer_shift = ATA_SHIFT_PIO;
94 dev->flags |= ATA_DFLAG_PIO; 93 dev->flags |= ATA_DFLAG_PIO;
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 6f6e7718b05c..43107e9415da 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1225,8 +1225,9 @@ static int piix_pci_device_resume(struct pci_dev *pdev)
1225 */ 1225 */
1226 rc = pci_reenable_device(pdev); 1226 rc = pci_reenable_device(pdev);
1227 if (rc) 1227 if (rc)
1228 dev_printk(KERN_ERR, &pdev->dev, "failed to enable " 1228 dev_err(&pdev->dev,
1229 "device after resume (%d)\n", rc); 1229 "failed to enable device after resume (%d)\n",
1230 rc);
1230 } else 1231 } else
1231 rc = ata_pci_device_do_resume(pdev); 1232 rc = ata_pci_device_do_resume(pdev);
1232 1233
@@ -1303,9 +1304,11 @@ static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev)
1303 no_piix_dma = 2; 1304 no_piix_dma = 2;
1304 } 1305 }
1305 if (no_piix_dma) 1306 if (no_piix_dma)
1306 dev_printk(KERN_WARNING, &ata_dev->dev, "450NX errata present, disabling IDE DMA.\n"); 1307 dev_warn(&ata_dev->dev,
1307 if (no_piix_dma == 2) 1308 "450NX errata present, disabling IDE DMA%s\n",
1308 dev_printk(KERN_WARNING, &ata_dev->dev, "A BIOS update may resolve this.\n"); 1309 no_piix_dma == 2 ? " - a BIOS update may resolve this"
1310 : "");
1311
1309 return no_piix_dma; 1312 return no_piix_dma;
1310} 1313}
1311 1314
@@ -1338,37 +1341,36 @@ static const int *__devinit piix_init_sata_map(struct pci_dev *pdev,
1338 1341
1339 map = map_db->map[map_value & map_db->mask]; 1342 map = map_db->map[map_value & map_db->mask];
1340 1343
1341 dev_printk(KERN_INFO, &pdev->dev, "MAP ["); 1344 dev_info(&pdev->dev, "MAP [");
1342 for (i = 0; i < 4; i++) { 1345 for (i = 0; i < 4; i++) {
1343 switch (map[i]) { 1346 switch (map[i]) {
1344 case RV: 1347 case RV:
1345 invalid_map = 1; 1348 invalid_map = 1;
1346 printk(" XX"); 1349 pr_cont(" XX");
1347 break; 1350 break;
1348 1351
1349 case NA: 1352 case NA:
1350 printk(" --"); 1353 pr_cont(" --");
1351 break; 1354 break;
1352 1355
1353 case IDE: 1356 case IDE:
1354 WARN_ON((i & 1) || map[i + 1] != IDE); 1357 WARN_ON((i & 1) || map[i + 1] != IDE);
1355 pinfo[i / 2] = piix_port_info[ich_pata_100]; 1358 pinfo[i / 2] = piix_port_info[ich_pata_100];
1356 i++; 1359 i++;
1357 printk(" IDE IDE"); 1360 pr_cont(" IDE IDE");
1358 break; 1361 break;
1359 1362
1360 default: 1363 default:
1361 printk(" P%d", map[i]); 1364 pr_cont(" P%d", map[i]);
1362 if (i & 1) 1365 if (i & 1)
1363 pinfo[i / 2].flags |= ATA_FLAG_SLAVE_POSS; 1366 pinfo[i / 2].flags |= ATA_FLAG_SLAVE_POSS;
1364 break; 1367 break;
1365 } 1368 }
1366 } 1369 }
1367 printk(" ]\n"); 1370 pr_cont(" ]\n");
1368 1371
1369 if (invalid_map) 1372 if (invalid_map)
1370 dev_printk(KERN_ERR, &pdev->dev, 1373 dev_err(&pdev->dev, "invalid MAP value %u\n", map_value);
1371 "invalid MAP value %u\n", map_value);
1372 1374
1373 return map; 1375 return map;
1374} 1376}
@@ -1398,8 +1400,8 @@ static bool piix_no_sidpr(struct ata_host *host)
1398 if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2920 && 1400 if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2920 &&
1399 pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG && 1401 pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG &&
1400 pdev->subsystem_device == 0xb049) { 1402 pdev->subsystem_device == 0xb049) {
1401 dev_printk(KERN_WARNING, host->dev, 1403 dev_warn(host->dev,
1402 "Samsung DB-P70 detected, disabling SIDPR\n"); 1404 "Samsung DB-P70 detected, disabling SIDPR\n");
1403 return true; 1405 return true;
1404 } 1406 }
1405 1407
@@ -1451,8 +1453,8 @@ static int __devinit piix_init_sidpr(struct ata_host *host)
1451 piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol); 1453 piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol);
1452 1454
1453 if ((scontrol & 0xf00) != 0x300) { 1455 if ((scontrol & 0xf00) != 0x300) {
1454 dev_printk(KERN_INFO, host->dev, "SCR access via " 1456 dev_info(host->dev,
1455 "SIDPR is available but doesn't work\n"); 1457 "SCR access via SIDPR is available but doesn't work\n");
1456 return 0; 1458 return 0;
1457 } 1459 }
1458 } 1460 }
@@ -1501,8 +1503,7 @@ static void piix_iocfg_bit18_quirk(struct ata_host *host)
1501 * affected systems. 1503 * affected systems.
1502 */ 1504 */
1503 if (hpriv->saved_iocfg & (1 << 18)) { 1505 if (hpriv->saved_iocfg & (1 << 18)) {
1504 dev_printk(KERN_INFO, &pdev->dev, 1506 dev_info(&pdev->dev, "applying IOCFG bit18 quirk\n");
1505 "applying IOCFG bit18 quirk\n");
1506 pci_write_config_dword(pdev, PIIX_IOCFG, 1507 pci_write_config_dword(pdev, PIIX_IOCFG,
1507 hpriv->saved_iocfg & ~(1 << 18)); 1508 hpriv->saved_iocfg & ~(1 << 18));
1508 } 1509 }
@@ -1561,7 +1562,6 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev)
1561static int __devinit piix_init_one(struct pci_dev *pdev, 1562static int __devinit piix_init_one(struct pci_dev *pdev,
1562 const struct pci_device_id *ent) 1563 const struct pci_device_id *ent)
1563{ 1564{
1564 static int printed_version;
1565 struct device *dev = &pdev->dev; 1565 struct device *dev = &pdev->dev;
1566 struct ata_port_info port_info[2]; 1566 struct ata_port_info port_info[2];
1567 const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; 1567 const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
@@ -1571,9 +1571,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
1571 struct piix_host_priv *hpriv; 1571 struct piix_host_priv *hpriv;
1572 int rc; 1572 int rc;
1573 1573
1574 if (!printed_version++) 1574 ata_print_version_once(&pdev->dev, DRV_VERSION);
1575 dev_printk(KERN_DEBUG, &pdev->dev,
1576 "version " DRV_VERSION "\n");
1577 1575
1578 /* no hotplugging support for later devices (FIXME) */ 1576 /* no hotplugging support for later devices (FIXME) */
1579 if (!in_module_init && ent->driver_data >= ich5_sata) 1577 if (!in_module_init && ent->driver_data >= ich5_sata)
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 41223c7f0206..3c92dbd751e0 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -82,6 +82,8 @@ static void ahci_pmp_attach(struct ata_port *ap);
82static void ahci_pmp_detach(struct ata_port *ap); 82static void ahci_pmp_detach(struct ata_port *ap);
83static int ahci_softreset(struct ata_link *link, unsigned int *class, 83static int ahci_softreset(struct ata_link *link, unsigned int *class,
84 unsigned long deadline); 84 unsigned long deadline);
85static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
86 unsigned long deadline);
85static int ahci_hardreset(struct ata_link *link, unsigned int *class, 87static int ahci_hardreset(struct ata_link *link, unsigned int *class,
86 unsigned long deadline); 88 unsigned long deadline);
87static void ahci_postreset(struct ata_link *link, unsigned int *class); 89static void ahci_postreset(struct ata_link *link, unsigned int *class);
@@ -178,6 +180,12 @@ struct ata_port_operations ahci_ops = {
178}; 180};
179EXPORT_SYMBOL_GPL(ahci_ops); 181EXPORT_SYMBOL_GPL(ahci_ops);
180 182
183struct ata_port_operations ahci_pmp_retry_srst_ops = {
184 .inherits = &ahci_ops,
185 .softreset = ahci_pmp_retry_softreset,
186};
187EXPORT_SYMBOL_GPL(ahci_pmp_retry_srst_ops);
188
181int ahci_em_messages = 1; 189int ahci_em_messages = 1;
182EXPORT_SYMBOL_GPL(ahci_em_messages); 190EXPORT_SYMBOL_GPL(ahci_em_messages);
183module_param(ahci_em_messages, int, 0444); 191module_param(ahci_em_messages, int, 0444);
@@ -286,10 +294,10 @@ static ssize_t ahci_read_em_buffer(struct device *dev,
286 /* the count should not be larger than PAGE_SIZE */ 294 /* the count should not be larger than PAGE_SIZE */
287 if (count > PAGE_SIZE) { 295 if (count > PAGE_SIZE) {
288 if (printk_ratelimit()) 296 if (printk_ratelimit())
289 ata_port_printk(ap, KERN_WARNING, 297 ata_port_warn(ap,
290 "EM read buffer size too large: " 298 "EM read buffer size too large: "
291 "buffer size %u, page size %lu\n", 299 "buffer size %u, page size %lu\n",
292 hpriv->em_buf_sz, PAGE_SIZE); 300 hpriv->em_buf_sz, PAGE_SIZE);
293 count = PAGE_SIZE; 301 count = PAGE_SIZE;
294 } 302 }
295 303
@@ -410,51 +418,46 @@ void ahci_save_initial_config(struct device *dev,
410 418
411 /* some chips have errata preventing 64bit use */ 419 /* some chips have errata preventing 64bit use */
412 if ((cap & HOST_CAP_64) && (hpriv->flags & AHCI_HFLAG_32BIT_ONLY)) { 420 if ((cap & HOST_CAP_64) && (hpriv->flags & AHCI_HFLAG_32BIT_ONLY)) {
413 dev_printk(KERN_INFO, dev, 421 dev_info(dev, "controller can't do 64bit DMA, forcing 32bit\n");
414 "controller can't do 64bit DMA, forcing 32bit\n");
415 cap &= ~HOST_CAP_64; 422 cap &= ~HOST_CAP_64;
416 } 423 }
417 424
418 if ((cap & HOST_CAP_NCQ) && (hpriv->flags & AHCI_HFLAG_NO_NCQ)) { 425 if ((cap & HOST_CAP_NCQ) && (hpriv->flags & AHCI_HFLAG_NO_NCQ)) {
419 dev_printk(KERN_INFO, dev, 426 dev_info(dev, "controller can't do NCQ, turning off CAP_NCQ\n");
420 "controller can't do NCQ, turning off CAP_NCQ\n");
421 cap &= ~HOST_CAP_NCQ; 427 cap &= ~HOST_CAP_NCQ;
422 } 428 }
423 429
424 if (!(cap & HOST_CAP_NCQ) && (hpriv->flags & AHCI_HFLAG_YES_NCQ)) { 430 if (!(cap & HOST_CAP_NCQ) && (hpriv->flags & AHCI_HFLAG_YES_NCQ)) {
425 dev_printk(KERN_INFO, dev, 431 dev_info(dev, "controller can do NCQ, turning on CAP_NCQ\n");
426 "controller can do NCQ, turning on CAP_NCQ\n");
427 cap |= HOST_CAP_NCQ; 432 cap |= HOST_CAP_NCQ;
428 } 433 }
429 434
430 if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) { 435 if ((cap & HOST_CAP_PMP) && (hpriv->flags & AHCI_HFLAG_NO_PMP)) {
431 dev_printk(KERN_INFO, dev, 436 dev_info(dev, "controller can't do PMP, turning off CAP_PMP\n");
432 "controller can't do PMP, turning off CAP_PMP\n");
433 cap &= ~HOST_CAP_PMP; 437 cap &= ~HOST_CAP_PMP;
434 } 438 }
435 439
436 if ((cap & HOST_CAP_SNTF) && (hpriv->flags & AHCI_HFLAG_NO_SNTF)) { 440 if ((cap & HOST_CAP_SNTF) && (hpriv->flags & AHCI_HFLAG_NO_SNTF)) {
437 dev_printk(KERN_INFO, dev, 441 dev_info(dev,
438 "controller can't do SNTF, turning off CAP_SNTF\n"); 442 "controller can't do SNTF, turning off CAP_SNTF\n");
439 cap &= ~HOST_CAP_SNTF; 443 cap &= ~HOST_CAP_SNTF;
440 } 444 }
441 445
442 if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) { 446 if (!(cap & HOST_CAP_FBS) && (hpriv->flags & AHCI_HFLAG_YES_FBS)) {
443 dev_printk(KERN_INFO, dev, 447 dev_info(dev, "controller can do FBS, turning on CAP_FBS\n");
444 "controller can do FBS, turning on CAP_FBS\n");
445 cap |= HOST_CAP_FBS; 448 cap |= HOST_CAP_FBS;
446 } 449 }
447 450
448 if (force_port_map && port_map != force_port_map) { 451 if (force_port_map && port_map != force_port_map) {
449 dev_printk(KERN_INFO, dev, "forcing port_map 0x%x -> 0x%x\n", 452 dev_info(dev, "forcing port_map 0x%x -> 0x%x\n",
450 port_map, force_port_map); 453 port_map, force_port_map);
451 port_map = force_port_map; 454 port_map = force_port_map;
452 } 455 }
453 456
454 if (mask_port_map) { 457 if (mask_port_map) {
455 dev_printk(KERN_WARNING, dev, "masking port_map 0x%x -> 0x%x\n", 458 dev_warn(dev, "masking port_map 0x%x -> 0x%x\n",
456 port_map, 459 port_map,
457 port_map & mask_port_map); 460 port_map & mask_port_map);
458 port_map &= mask_port_map; 461 port_map &= mask_port_map;
459 } 462 }
460 463
@@ -470,10 +473,9 @@ void ahci_save_initial_config(struct device *dev,
470 * port_map and let it be generated from n_ports. 473 * port_map and let it be generated from n_ports.
471 */ 474 */
472 if (map_ports > ahci_nr_ports(cap)) { 475 if (map_ports > ahci_nr_ports(cap)) {
473 dev_printk(KERN_WARNING, dev, 476 dev_warn(dev,
474 "implemented port map (0x%x) contains more " 477 "implemented port map (0x%x) contains more ports than nr_ports (%u), using nr_ports\n",
475 "ports than nr_ports (%u), using nr_ports\n", 478 port_map, ahci_nr_ports(cap));
476 port_map, ahci_nr_ports(cap));
477 port_map = 0; 479 port_map = 0;
478 } 480 }
479 } 481 }
@@ -481,8 +483,7 @@ void ahci_save_initial_config(struct device *dev,
481 /* fabricate port_map from cap.nr_ports */ 483 /* fabricate port_map from cap.nr_ports */
482 if (!port_map) { 484 if (!port_map) {
483 port_map = (1 << ahci_nr_ports(cap)) - 1; 485 port_map = (1 << ahci_nr_ports(cap)) - 1;
484 dev_printk(KERN_WARNING, dev, 486 dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map);
485 "forcing PORTS_IMPL to 0x%x\n", port_map);
486 487
487 /* write the fixed up value to the PI register */ 488 /* write the fixed up value to the PI register */
488 hpriv->saved_port_map = port_map; 489 hpriv->saved_port_map = port_map;
@@ -822,8 +823,8 @@ int ahci_reset_controller(struct ata_host *host)
822 HOST_RESET, 10, 1000); 823 HOST_RESET, 10, 1000);
823 824
824 if (tmp & HOST_RESET) { 825 if (tmp & HOST_RESET) {
825 dev_printk(KERN_ERR, host->dev, 826 dev_err(host->dev, "controller reset failed (0x%x)\n",
826 "controller reset failed (0x%x)\n", tmp); 827 tmp);
827 return -EIO; 828 return -EIO;
828 } 829 }
829 830
@@ -835,8 +836,7 @@ int ahci_reset_controller(struct ata_host *host)
835 */ 836 */
836 ahci_restore_initial_config(host); 837 ahci_restore_initial_config(host);
837 } else 838 } else
838 dev_printk(KERN_INFO, host->dev, 839 dev_info(host->dev, "skipping global host reset\n");
839 "skipping global host reset\n");
840 840
841 return 0; 841 return 0;
842} 842}
@@ -1132,8 +1132,8 @@ static void ahci_dev_config(struct ata_device *dev)
1132 1132
1133 if (hpriv->flags & AHCI_HFLAG_SECT255) { 1133 if (hpriv->flags & AHCI_HFLAG_SECT255) {
1134 dev->max_sectors = 255; 1134 dev->max_sectors = 255;
1135 ata_dev_printk(dev, KERN_INFO, 1135 ata_dev_info(dev,
1136 "SB600 AHCI: limiting to 255 sectors per cmd\n"); 1136 "SB600 AHCI: limiting to 255 sectors per cmd\n");
1137 } 1137 }
1138} 1138}
1139 1139
@@ -1257,8 +1257,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1257 /* prepare for SRST (AHCI-1.1 10.4.1) */ 1257 /* prepare for SRST (AHCI-1.1 10.4.1) */
1258 rc = ahci_kick_engine(ap); 1258 rc = ahci_kick_engine(ap);
1259 if (rc && rc != -EOPNOTSUPP) 1259 if (rc && rc != -EOPNOTSUPP)
1260 ata_link_printk(link, KERN_WARNING, 1260 ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc);
1261 "failed to reset engine (errno=%d)\n", rc);
1262 1261
1263 ata_tf_init(link->device, &tf); 1262 ata_tf_init(link->device, &tf);
1264 1263
@@ -1291,8 +1290,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1291 * be trusted. Treat device readiness timeout as link 1290 * be trusted. Treat device readiness timeout as link
1292 * offline. 1291 * offline.
1293 */ 1292 */
1294 ata_link_printk(link, KERN_INFO, 1293 ata_link_info(link, "device not ready, treating as offline\n");
1295 "device not ready, treating as offline\n");
1296 *class = ATA_DEV_NONE; 1294 *class = ATA_DEV_NONE;
1297 } else if (rc) { 1295 } else if (rc) {
1298 /* link occupied, -ENODEV too is an error */ 1296 /* link occupied, -ENODEV too is an error */
@@ -1305,7 +1303,7 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
1305 return 0; 1303 return 0;
1306 1304
1307 fail: 1305 fail:
1308 ata_link_printk(link, KERN_ERR, "softreset failed (%s)\n", reason); 1306 ata_link_err(link, "softreset failed (%s)\n", reason);
1309 return rc; 1307 return rc;
1310} 1308}
1311 1309
@@ -1329,6 +1327,55 @@ static int ahci_softreset(struct ata_link *link, unsigned int *class,
1329} 1327}
1330EXPORT_SYMBOL_GPL(ahci_do_softreset); 1328EXPORT_SYMBOL_GPL(ahci_do_softreset);
1331 1329
1330static int ahci_bad_pmp_check_ready(struct ata_link *link)
1331{
1332 void __iomem *port_mmio = ahci_port_base(link->ap);
1333 u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF;
1334 u32 irq_status = readl(port_mmio + PORT_IRQ_STAT);
1335
1336 /*
1337 * There is no need to check TFDATA if BAD PMP is found due to HW bug,
1338 * which can save timeout delay.
1339 */
1340 if (irq_status & PORT_IRQ_BAD_PMP)
1341 return -EIO;
1342
1343 return ata_check_ready(status);
1344}
1345
1346int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
1347 unsigned long deadline)
1348{
1349 struct ata_port *ap = link->ap;
1350 void __iomem *port_mmio = ahci_port_base(ap);
1351 int pmp = sata_srst_pmp(link);
1352 int rc;
1353 u32 irq_sts;
1354
1355 DPRINTK("ENTER\n");
1356
1357 rc = ahci_do_softreset(link, class, pmp, deadline,
1358 ahci_bad_pmp_check_ready);
1359
1360 /*
1361 * Soft reset fails with IPMS set when PMP is enabled but
1362 * SATA HDD/ODD is connected to SATA port, do soft reset
1363 * again to port 0.
1364 */
1365 if (rc == -EIO) {
1366 irq_sts = readl(port_mmio + PORT_IRQ_STAT);
1367 if (irq_sts & PORT_IRQ_BAD_PMP) {
1368 ata_link_printk(link, KERN_WARNING,
1369 "applying PMP SRST workaround "
1370 "and retrying\n");
1371 rc = ahci_do_softreset(link, class, 0, deadline,
1372 ahci_check_ready);
1373 }
1374 }
1375
1376 return rc;
1377}
1378
1332static int ahci_hardreset(struct ata_link *link, unsigned int *class, 1379static int ahci_hardreset(struct ata_link *link, unsigned int *class,
1333 unsigned long deadline) 1380 unsigned long deadline)
1334{ 1381{
@@ -1474,8 +1521,7 @@ static void ahci_fbs_dec_intr(struct ata_port *ap)
1474 } 1521 }
1475 1522
1476 if (fbs & PORT_FBS_DEC) 1523 if (fbs & PORT_FBS_DEC)
1477 dev_printk(KERN_ERR, ap->host->dev, 1524 dev_err(ap->host->dev, "failed to clear device error\n");
1478 "failed to clear device error\n");
1479} 1525}
1480 1526
1481static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) 1527static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
@@ -1713,8 +1759,8 @@ irqreturn_t ahci_interrupt(int irq, void *dev_instance)
1713 } else { 1759 } else {
1714 VPRINTK("port %u (no irq)\n", i); 1760 VPRINTK("port %u (no irq)\n", i);
1715 if (ata_ratelimit()) 1761 if (ata_ratelimit())
1716 dev_printk(KERN_WARNING, host->dev, 1762 dev_warn(host->dev,
1717 "interrupt on disabled port %u\n", i); 1763 "interrupt on disabled port %u\n", i);
1718 } 1764 }
1719 1765
1720 handled = 1; 1766 handled = 1;
@@ -1865,11 +1911,11 @@ static void ahci_enable_fbs(struct ata_port *ap)
1865 writel(fbs | PORT_FBS_EN, port_mmio + PORT_FBS); 1911 writel(fbs | PORT_FBS_EN, port_mmio + PORT_FBS);
1866 fbs = readl(port_mmio + PORT_FBS); 1912 fbs = readl(port_mmio + PORT_FBS);
1867 if (fbs & PORT_FBS_EN) { 1913 if (fbs & PORT_FBS_EN) {
1868 dev_printk(KERN_INFO, ap->host->dev, "FBS is enabled.\n"); 1914 dev_info(ap->host->dev, "FBS is enabled\n");
1869 pp->fbs_enabled = true; 1915 pp->fbs_enabled = true;
1870 pp->fbs_last_dev = -1; /* initialization */ 1916 pp->fbs_last_dev = -1; /* initialization */
1871 } else 1917 } else
1872 dev_printk(KERN_ERR, ap->host->dev, "Failed to enable FBS\n"); 1918 dev_err(ap->host->dev, "Failed to enable FBS\n");
1873 1919
1874 ahci_start_engine(ap); 1920 ahci_start_engine(ap);
1875} 1921}
@@ -1897,9 +1943,9 @@ static void ahci_disable_fbs(struct ata_port *ap)
1897 writel(fbs & ~PORT_FBS_EN, port_mmio + PORT_FBS); 1943 writel(fbs & ~PORT_FBS_EN, port_mmio + PORT_FBS);
1898 fbs = readl(port_mmio + PORT_FBS); 1944 fbs = readl(port_mmio + PORT_FBS);
1899 if (fbs & PORT_FBS_EN) 1945 if (fbs & PORT_FBS_EN)
1900 dev_printk(KERN_ERR, ap->host->dev, "Failed to disable FBS\n"); 1946 dev_err(ap->host->dev, "Failed to disable FBS\n");
1901 else { 1947 else {
1902 dev_printk(KERN_INFO, ap->host->dev, "FBS is disabled.\n"); 1948 dev_info(ap->host->dev, "FBS is disabled\n");
1903 pp->fbs_enabled = false; 1949 pp->fbs_enabled = false;
1904 } 1950 }
1905 1951
@@ -1975,7 +2021,7 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
1975 if (rc == 0) 2021 if (rc == 0)
1976 ahci_power_down(ap); 2022 ahci_power_down(ap);
1977 else { 2023 else {
1978 ata_port_printk(ap, KERN_ERR, "%s (%d)\n", emsg, rc); 2024 ata_port_err(ap, "%s (%d)\n", emsg, rc);
1979 ahci_start_port(ap); 2025 ahci_start_port(ap);
1980 } 2026 }
1981 2027
@@ -2003,14 +2049,12 @@ static int ahci_port_start(struct ata_port *ap)
2003 if (cmd & PORT_CMD_FBSCP) 2049 if (cmd & PORT_CMD_FBSCP)
2004 pp->fbs_supported = true; 2050 pp->fbs_supported = true;
2005 else if (hpriv->flags & AHCI_HFLAG_YES_FBS) { 2051 else if (hpriv->flags & AHCI_HFLAG_YES_FBS) {
2006 dev_printk(KERN_INFO, dev, 2052 dev_info(dev, "port %d can do FBS, forcing FBSCP\n",
2007 "port %d can do FBS, forcing FBSCP\n", 2053 ap->port_no);
2008 ap->port_no);
2009 pp->fbs_supported = true; 2054 pp->fbs_supported = true;
2010 } else 2055 } else
2011 dev_printk(KERN_WARNING, dev, 2056 dev_warn(dev, "port %d is not capable of FBS\n",
2012 "port %d is not capable of FBS\n", 2057 ap->port_no);
2013 ap->port_no);
2014 } 2058 }
2015 2059
2016 if (pp->fbs_supported) { 2060 if (pp->fbs_supported) {
@@ -2072,7 +2116,7 @@ static void ahci_port_stop(struct ata_port *ap)
2072 /* de-initialize port */ 2116 /* de-initialize port */
2073 rc = ahci_deinit_port(ap, &emsg); 2117 rc = ahci_deinit_port(ap, &emsg);
2074 if (rc) 2118 if (rc)
2075 ata_port_printk(ap, KERN_WARNING, "%s (%d)\n", emsg, rc); 2119 ata_port_warn(ap, "%s (%d)\n", emsg, rc);
2076} 2120}
2077 2121
2078void ahci_print_info(struct ata_host *host, const char *scc_s) 2122void ahci_print_info(struct ata_host *host, const char *scc_s)
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index a791b8ce6294..e0a5b555cee1 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -332,25 +332,22 @@ int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm)
332 332
333 rc = -EINVAL; 333 rc = -EINVAL;
334 if (ACPI_FAILURE(status)) { 334 if (ACPI_FAILURE(status)) {
335 ata_port_printk(ap, KERN_ERR, 335 ata_port_err(ap, "ACPI get timing mode failed (AE 0x%x)\n",
336 "ACPI get timing mode failed (AE 0x%x)\n", 336 status);
337 status);
338 goto out_free; 337 goto out_free;
339 } 338 }
340 339
341 out_obj = output.pointer; 340 out_obj = output.pointer;
342 if (out_obj->type != ACPI_TYPE_BUFFER) { 341 if (out_obj->type != ACPI_TYPE_BUFFER) {
343 ata_port_printk(ap, KERN_WARNING, 342 ata_port_warn(ap, "_GTM returned unexpected object type 0x%x\n",
344 "_GTM returned unexpected object type 0x%x\n", 343 out_obj->type);
345 out_obj->type);
346 344
347 goto out_free; 345 goto out_free;
348 } 346 }
349 347
350 if (out_obj->buffer.length != sizeof(struct ata_acpi_gtm)) { 348 if (out_obj->buffer.length != sizeof(struct ata_acpi_gtm)) {
351 ata_port_printk(ap, KERN_ERR, 349 ata_port_err(ap, "_GTM returned invalid length %d\n",
352 "_GTM returned invalid length %d\n", 350 out_obj->buffer.length);
353 out_obj->buffer.length);
354 goto out_free; 351 goto out_free;
355 } 352 }
356 353
@@ -402,8 +399,8 @@ int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm)
402 if (status == AE_NOT_FOUND) 399 if (status == AE_NOT_FOUND)
403 return -ENOENT; 400 return -ENOENT;
404 if (ACPI_FAILURE(status)) { 401 if (ACPI_FAILURE(status)) {
405 ata_port_printk(ap, KERN_ERR, 402 ata_port_err(ap, "ACPI set timing mode failed (status=0x%x)\n",
406 "ACPI set timing mode failed (status=0x%x)\n", status); 403 status);
407 return -EINVAL; 404 return -EINVAL;
408 } 405 }
409 return 0; 406 return 0;
@@ -450,8 +447,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
450 output.pointer = NULL; /* ACPI-CA sets this; save/free it later */ 447 output.pointer = NULL; /* ACPI-CA sets this; save/free it later */
451 448
452 if (ata_msg_probe(ap)) 449 if (ata_msg_probe(ap))
453 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", 450 ata_dev_dbg(dev, "%s: ENTER: port#: %d\n",
454 __func__, ap->port_no); 451 __func__, ap->port_no);
455 452
456 /* _GTF has no input parameters */ 453 /* _GTF has no input parameters */
457 status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); 454 status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output);
@@ -459,9 +456,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
459 456
460 if (ACPI_FAILURE(status)) { 457 if (ACPI_FAILURE(status)) {
461 if (status != AE_NOT_FOUND) { 458 if (status != AE_NOT_FOUND) {
462 ata_dev_printk(dev, KERN_WARNING, 459 ata_dev_warn(dev, "_GTF evaluation failed (AE 0x%x)\n",
463 "_GTF evaluation failed (AE 0x%x)\n", 460 status);
464 status);
465 rc = -EINVAL; 461 rc = -EINVAL;
466 } 462 }
467 goto out_free; 463 goto out_free;
@@ -469,27 +465,24 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
469 465
470 if (!output.length || !output.pointer) { 466 if (!output.length || !output.pointer) {
471 if (ata_msg_probe(ap)) 467 if (ata_msg_probe(ap))
472 ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " 468 ata_dev_dbg(dev, "%s: Run _GTF: length or ptr is NULL (0x%llx, 0x%p)\n",
473 "length or ptr is NULL (0x%llx, 0x%p)\n", 469 __func__,
474 __func__, 470 (unsigned long long)output.length,
475 (unsigned long long)output.length, 471 output.pointer);
476 output.pointer);
477 rc = -EINVAL; 472 rc = -EINVAL;
478 goto out_free; 473 goto out_free;
479 } 474 }
480 475
481 if (out_obj->type != ACPI_TYPE_BUFFER) { 476 if (out_obj->type != ACPI_TYPE_BUFFER) {
482 ata_dev_printk(dev, KERN_WARNING, 477 ata_dev_warn(dev, "_GTF unexpected object type 0x%x\n",
483 "_GTF unexpected object type 0x%x\n", 478 out_obj->type);
484 out_obj->type);
485 rc = -EINVAL; 479 rc = -EINVAL;
486 goto out_free; 480 goto out_free;
487 } 481 }
488 482
489 if (out_obj->buffer.length % REGS_PER_GTF) { 483 if (out_obj->buffer.length % REGS_PER_GTF) {
490 ata_dev_printk(dev, KERN_WARNING, 484 ata_dev_warn(dev, "unexpected _GTF length (%d)\n",
491 "unexpected _GTF length (%d)\n", 485 out_obj->buffer.length);
492 out_obj->buffer.length);
493 rc = -EINVAL; 486 rc = -EINVAL;
494 goto out_free; 487 goto out_free;
495 } 488 }
@@ -499,9 +492,8 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
499 if (gtf) { 492 if (gtf) {
500 *gtf = (void *)out_obj->buffer.pointer; 493 *gtf = (void *)out_obj->buffer.pointer;
501 if (ata_msg_probe(ap)) 494 if (ata_msg_probe(ap))
502 ata_dev_printk(dev, KERN_DEBUG, 495 ata_dev_dbg(dev, "%s: returning gtf=%p, gtf_count=%d\n",
503 "%s: returning gtf=%p, gtf_count=%d\n", 496 __func__, *gtf, rc);
504 __func__, *gtf, rc);
505 } 497 }
506 return rc; 498 return rc;
507 499
@@ -811,8 +803,8 @@ static int ata_acpi_push_id(struct ata_device *dev)
811 union acpi_object in_params[1]; 803 union acpi_object in_params[1];
812 804
813 if (ata_msg_probe(ap)) 805 if (ata_msg_probe(ap))
814 ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", 806 ata_dev_dbg(dev, "%s: ix = %d, port#: %d\n",
815 __func__, dev->devno, ap->port_no); 807 __func__, dev->devno, ap->port_no);
816 808
817 /* Give the drive Identify data to the drive via the _SDD method */ 809 /* Give the drive Identify data to the drive via the _SDD method */
818 /* _SDD: set up input parameters */ 810 /* _SDD: set up input parameters */
@@ -832,8 +824,7 @@ static int ata_acpi_push_id(struct ata_device *dev)
832 return -ENOENT; 824 return -ENOENT;
833 825
834 if (ACPI_FAILURE(status)) { 826 if (ACPI_FAILURE(status)) {
835 ata_dev_printk(dev, KERN_WARNING, 827 ata_dev_warn(dev, "ACPI _SDD failed (AE 0x%x)\n", status);
836 "ACPI _SDD failed (AE 0x%x)\n", status);
837 return -EIO; 828 return -EIO;
838 } 829 }
839 830
@@ -983,8 +974,8 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
983 if (nr_executed) { 974 if (nr_executed) {
984 rc = ata_dev_reread_id(dev, 0); 975 rc = ata_dev_reread_id(dev, 0);
985 if (rc < 0) { 976 if (rc < 0) {
986 ata_dev_printk(dev, KERN_ERR, "failed to IDENTIFY " 977 ata_dev_err(dev,
987 "after ACPI commands\n"); 978 "failed to IDENTIFY after ACPI commands\n");
988 return rc; 979 return rc;
989 } 980 }
990 } 981 }
@@ -1002,8 +993,7 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
1002 return rc; 993 return rc;
1003 } 994 }
1004 995
1005 ata_dev_printk(dev, KERN_WARNING, 996 ata_dev_warn(dev, "ACPI: failed the second time, disabled\n");
1006 "ACPI: failed the second time, disabled\n");
1007 dev->acpi_handle = NULL; 997 dev->acpi_handle = NULL;
1008 998
1009 /* We can safely continue if no _GTF command has been executed 999 /* We can safely continue if no _GTF command has been executed
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 000d03ae6653..4a3a5ae7bb45 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -335,8 +335,7 @@ void ata_force_cbl(struct ata_port *ap)
335 continue; 335 continue;
336 336
337 ap->cbl = fe->param.cbl; 337 ap->cbl = fe->param.cbl;
338 ata_port_printk(ap, KERN_NOTICE, 338 ata_port_notice(ap, "FORCE: cable set to %s\n", fe->param.name);
339 "FORCE: cable set to %s\n", fe->param.name);
340 return; 339 return;
341 } 340 }
342} 341}
@@ -378,8 +377,7 @@ static void ata_force_link_limits(struct ata_link *link)
378 /* only honor the first spd limit */ 377 /* only honor the first spd limit */
379 if (!did_spd && fe->param.spd_limit) { 378 if (!did_spd && fe->param.spd_limit) {
380 link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1; 379 link->hw_sata_spd_limit = (1 << fe->param.spd_limit) - 1;
381 ata_link_printk(link, KERN_NOTICE, 380 ata_link_notice(link, "FORCE: PHY spd limit set to %s\n",
382 "FORCE: PHY spd limit set to %s\n",
383 fe->param.name); 381 fe->param.name);
384 did_spd = true; 382 did_spd = true;
385 } 383 }
@@ -387,7 +385,7 @@ static void ata_force_link_limits(struct ata_link *link)
387 /* let lflags stack */ 385 /* let lflags stack */
388 if (fe->param.lflags) { 386 if (fe->param.lflags) {
389 link->flags |= fe->param.lflags; 387 link->flags |= fe->param.lflags;
390 ata_link_printk(link, KERN_NOTICE, 388 ata_link_notice(link,
391 "FORCE: link flag 0x%x forced -> 0x%x\n", 389 "FORCE: link flag 0x%x forced -> 0x%x\n",
392 fe->param.lflags, link->flags); 390 fe->param.lflags, link->flags);
393 } 391 }
@@ -442,8 +440,8 @@ static void ata_force_xfermask(struct ata_device *dev)
442 dev->pio_mask = pio_mask; 440 dev->pio_mask = pio_mask;
443 } 441 }
444 442
445 ata_dev_printk(dev, KERN_NOTICE, 443 ata_dev_notice(dev, "FORCE: xfer_mask set to %s\n",
446 "FORCE: xfer_mask set to %s\n", fe->param.name); 444 fe->param.name);
447 return; 445 return;
448 } 446 }
449} 447}
@@ -486,8 +484,8 @@ static void ata_force_horkage(struct ata_device *dev)
486 dev->horkage |= fe->param.horkage_on; 484 dev->horkage |= fe->param.horkage_on;
487 dev->horkage &= ~fe->param.horkage_off; 485 dev->horkage &= ~fe->param.horkage_off;
488 486
489 ata_dev_printk(dev, KERN_NOTICE, 487 ata_dev_notice(dev, "FORCE: horkage modified (%s)\n",
490 "FORCE: horkage modified (%s)\n", fe->param.name); 488 fe->param.name);
491 } 489 }
492} 490}
493 491
@@ -711,8 +709,8 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev)
711 sect = tf->lbal; 709 sect = tf->lbal;
712 710
713 if (!sect) { 711 if (!sect) {
714 ata_dev_printk(dev, KERN_WARNING, "device reported " 712 ata_dev_warn(dev,
715 "invalid CHS sector 0\n"); 713 "device reported invalid CHS sector 0\n");
716 sect = 1; /* oh well */ 714 sect = 1; /* oh well */
717 } 715 }
718 716
@@ -1230,8 +1228,9 @@ static int ata_read_native_max_address(struct ata_device *dev, u64 *max_sectors)
1230 1228
1231 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); 1229 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1232 if (err_mask) { 1230 if (err_mask) {
1233 ata_dev_printk(dev, KERN_WARNING, "failed to read native " 1231 ata_dev_warn(dev,
1234 "max address (err_mask=0x%x)\n", err_mask); 1232 "failed to read native max address (err_mask=0x%x)\n",
1233 err_mask);
1235 if (err_mask == AC_ERR_DEV && (tf.feature & ATA_ABORTED)) 1234 if (err_mask == AC_ERR_DEV && (tf.feature & ATA_ABORTED))
1236 return -EACCES; 1235 return -EACCES;
1237 return -EIO; 1236 return -EIO;
@@ -1292,8 +1291,9 @@ static int ata_set_max_sectors(struct ata_device *dev, u64 new_sectors)
1292 1291
1293 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); 1292 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
1294 if (err_mask) { 1293 if (err_mask) {
1295 ata_dev_printk(dev, KERN_WARNING, "failed to set " 1294 ata_dev_warn(dev,
1296 "max address (err_mask=0x%x)\n", err_mask); 1295 "failed to set max address (err_mask=0x%x)\n",
1296 err_mask);
1297 if (err_mask == AC_ERR_DEV && 1297 if (err_mask == AC_ERR_DEV &&
1298 (tf.feature & (ATA_ABORTED | ATA_IDNF))) 1298 (tf.feature & (ATA_ABORTED | ATA_IDNF)))
1299 return -EACCES; 1299 return -EACCES;
@@ -1336,8 +1336,8 @@ static int ata_hpa_resize(struct ata_device *dev)
1336 * be unlocked, skip HPA resizing. 1336 * be unlocked, skip HPA resizing.
1337 */ 1337 */
1338 if (rc == -EACCES || !unlock_hpa) { 1338 if (rc == -EACCES || !unlock_hpa) {
1339 ata_dev_printk(dev, KERN_WARNING, "HPA support seems " 1339 ata_dev_warn(dev,
1340 "broken, skipping HPA handling\n"); 1340 "HPA support seems broken, skipping HPA handling\n");
1341 dev->horkage |= ATA_HORKAGE_BROKEN_HPA; 1341 dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
1342 1342
1343 /* we can continue if device aborted the command */ 1343 /* we can continue if device aborted the command */
@@ -1355,14 +1355,13 @@ static int ata_hpa_resize(struct ata_device *dev)
1355 return 0; 1355 return 0;
1356 1356
1357 if (native_sectors > sectors) 1357 if (native_sectors > sectors)
1358 ata_dev_printk(dev, KERN_INFO, 1358 ata_dev_info(dev,
1359 "HPA detected: current %llu, native %llu\n", 1359 "HPA detected: current %llu, native %llu\n",
1360 (unsigned long long)sectors, 1360 (unsigned long long)sectors,
1361 (unsigned long long)native_sectors); 1361 (unsigned long long)native_sectors);
1362 else if (native_sectors < sectors) 1362 else if (native_sectors < sectors)
1363 ata_dev_printk(dev, KERN_WARNING, 1363 ata_dev_warn(dev,
1364 "native sectors (%llu) is smaller than " 1364 "native sectors (%llu) is smaller than sectors (%llu)\n",
1365 "sectors (%llu)\n",
1366 (unsigned long long)native_sectors, 1365 (unsigned long long)native_sectors,
1367 (unsigned long long)sectors); 1366 (unsigned long long)sectors);
1368 return 0; 1367 return 0;
@@ -1372,10 +1371,10 @@ static int ata_hpa_resize(struct ata_device *dev)
1372 rc = ata_set_max_sectors(dev, native_sectors); 1371 rc = ata_set_max_sectors(dev, native_sectors);
1373 if (rc == -EACCES) { 1372 if (rc == -EACCES) {
1374 /* if device aborted the command, skip HPA resizing */ 1373 /* if device aborted the command, skip HPA resizing */
1375 ata_dev_printk(dev, KERN_WARNING, "device aborted resize " 1374 ata_dev_warn(dev,
1376 "(%llu -> %llu), skipping HPA handling\n", 1375 "device aborted resize (%llu -> %llu), skipping HPA handling\n",
1377 (unsigned long long)sectors, 1376 (unsigned long long)sectors,
1378 (unsigned long long)native_sectors); 1377 (unsigned long long)native_sectors);
1379 dev->horkage |= ATA_HORKAGE_BROKEN_HPA; 1378 dev->horkage |= ATA_HORKAGE_BROKEN_HPA;
1380 return 0; 1379 return 0;
1381 } else if (rc) 1380 } else if (rc)
@@ -1384,14 +1383,14 @@ static int ata_hpa_resize(struct ata_device *dev)
1384 /* re-read IDENTIFY data */ 1383 /* re-read IDENTIFY data */
1385 rc = ata_dev_reread_id(dev, 0); 1384 rc = ata_dev_reread_id(dev, 0);
1386 if (rc) { 1385 if (rc) {
1387 ata_dev_printk(dev, KERN_ERR, "failed to re-read IDENTIFY " 1386 ata_dev_err(dev,
1388 "data after HPA resizing\n"); 1387 "failed to re-read IDENTIFY data after HPA resizing\n");
1389 return rc; 1388 return rc;
1390 } 1389 }
1391 1390
1392 if (print_info) { 1391 if (print_info) {
1393 u64 new_sectors = ata_id_n_sectors(dev->id); 1392 u64 new_sectors = ata_id_n_sectors(dev->id);
1394 ata_dev_printk(dev, KERN_INFO, 1393 ata_dev_info(dev,
1395 "HPA unlocked: %llu -> %llu, native %llu\n", 1394 "HPA unlocked: %llu -> %llu, native %llu\n",
1396 (unsigned long long)sectors, 1395 (unsigned long long)sectors,
1397 (unsigned long long)new_sectors, 1396 (unsigned long long)new_sectors,
@@ -1655,8 +1654,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
1655 ata_qc_complete(qc); 1654 ata_qc_complete(qc);
1656 1655
1657 if (ata_msg_warn(ap)) 1656 if (ata_msg_warn(ap))
1658 ata_dev_printk(dev, KERN_WARNING, 1657 ata_dev_warn(dev, "qc timeout (cmd 0x%x)\n",
1659 "qc timeout (cmd 0x%x)\n", command); 1658 command);
1660 } 1659 }
1661 1660
1662 spin_unlock_irqrestore(ap->lock, flags); 1661 spin_unlock_irqrestore(ap->lock, flags);
@@ -1870,7 +1869,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1870 int rc; 1869 int rc;
1871 1870
1872 if (ata_msg_ctl(ap)) 1871 if (ata_msg_ctl(ap))
1873 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); 1872 ata_dev_dbg(dev, "%s: ENTER\n", __func__);
1874 1873
1875retry: 1874retry:
1876 ata_tf_init(dev, &tf); 1875 ata_tf_init(dev, &tf);
@@ -1909,14 +1908,13 @@ retry:
1909 1908
1910 if (err_mask) { 1909 if (err_mask) {
1911 if (err_mask & AC_ERR_NODEV_HINT) { 1910 if (err_mask & AC_ERR_NODEV_HINT) {
1912 ata_dev_printk(dev, KERN_DEBUG, 1911 ata_dev_dbg(dev, "NODEV after polling detection\n");
1913 "NODEV after polling detection\n");
1914 return -ENOENT; 1912 return -ENOENT;
1915 } 1913 }
1916 1914
1917 if (is_semb) { 1915 if (is_semb) {
1918 ata_dev_printk(dev, KERN_INFO, "IDENTIFY failed on " 1916 ata_dev_info(dev,
1919 "device w/ SEMB sig, disabled\n"); 1917 "IDENTIFY failed on device w/ SEMB sig, disabled\n");
1920 /* SEMB is not supported yet */ 1918 /* SEMB is not supported yet */
1921 *p_class = ATA_DEV_SEMB_UNSUP; 1919 *p_class = ATA_DEV_SEMB_UNSUP;
1922 return 0; 1920 return 0;
@@ -1942,8 +1940,8 @@ retry:
1942 * both flavors of IDENTIFYs which happens 1940 * both flavors of IDENTIFYs which happens
1943 * sometimes with phantom devices. 1941 * sometimes with phantom devices.
1944 */ 1942 */
1945 ata_dev_printk(dev, KERN_DEBUG, 1943 ata_dev_dbg(dev,
1946 "both IDENTIFYs aborted, assuming NODEV\n"); 1944 "both IDENTIFYs aborted, assuming NODEV\n");
1947 return -ENOENT; 1945 return -ENOENT;
1948 } 1946 }
1949 1947
@@ -1953,9 +1951,9 @@ retry:
1953 } 1951 }
1954 1952
1955 if (dev->horkage & ATA_HORKAGE_DUMP_ID) { 1953 if (dev->horkage & ATA_HORKAGE_DUMP_ID) {
1956 ata_dev_printk(dev, KERN_DEBUG, "dumping IDENTIFY data, " 1954 ata_dev_dbg(dev, "dumping IDENTIFY data, "
1957 "class=%d may_fallback=%d tried_spinup=%d\n", 1955 "class=%d may_fallback=%d tried_spinup=%d\n",
1958 class, may_fallback, tried_spinup); 1956 class, may_fallback, tried_spinup);
1959 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 1957 print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET,
1960 16, 2, id, ATA_ID_WORDS * sizeof(*id), true); 1958 16, 2, id, ATA_ID_WORDS * sizeof(*id), true);
1961 } 1959 }
@@ -2034,8 +2032,8 @@ retry:
2034 2032
2035 err_out: 2033 err_out:
2036 if (ata_msg_warn(ap)) 2034 if (ata_msg_warn(ap))
2037 ata_dev_printk(dev, KERN_WARNING, "failed to IDENTIFY " 2035 ata_dev_warn(dev, "failed to IDENTIFY (%s, err_mask=0x%x)\n",
2038 "(%s, err_mask=0x%x)\n", reason, err_mask); 2036 reason, err_mask);
2039 return rc; 2037 return rc;
2040} 2038}
2041 2039
@@ -2065,9 +2063,8 @@ static int ata_do_link_spd_horkage(struct ata_device *dev)
2065 * guaranteed by setting sata_spd_limit to target_limit above. 2063 * guaranteed by setting sata_spd_limit to target_limit above.
2066 */ 2064 */
2067 if (plink->sata_spd > target) { 2065 if (plink->sata_spd > target) {
2068 ata_dev_printk(dev, KERN_INFO, 2066 ata_dev_info(dev, "applying link speed limit horkage to %s\n",
2069 "applying link speed limit horkage to %s\n", 2067 sata_spd_string(target));
2070 sata_spd_string(target));
2071 return -EAGAIN; 2068 return -EAGAIN;
2072 } 2069 }
2073 return 0; 2070 return 0;
@@ -2110,8 +2107,9 @@ static int ata_dev_config_ncq(struct ata_device *dev,
2110 err_mask = ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE, 2107 err_mask = ata_dev_set_feature(dev, SETFEATURES_SATA_ENABLE,
2111 SATA_FPDMA_AA); 2108 SATA_FPDMA_AA);
2112 if (err_mask) { 2109 if (err_mask) {
2113 ata_dev_printk(dev, KERN_ERR, "failed to enable AA" 2110 ata_dev_err(dev,
2114 "(error_mask=0x%x)\n", err_mask); 2111 "failed to enable AA (error_mask=0x%x)\n",
2112 err_mask);
2115 if (err_mask != AC_ERR_DEV) { 2113 if (err_mask != AC_ERR_DEV) {
2116 dev->horkage |= ATA_HORKAGE_BROKEN_FPDMA_AA; 2114 dev->horkage |= ATA_HORKAGE_BROKEN_FPDMA_AA;
2117 return -EIO; 2115 return -EIO;
@@ -2154,31 +2152,28 @@ int ata_dev_configure(struct ata_device *dev)
2154 int rc; 2152 int rc;
2155 2153
2156 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) { 2154 if (!ata_dev_enabled(dev) && ata_msg_info(ap)) {
2157 ata_dev_printk(dev, KERN_INFO, "%s: ENTER/EXIT -- nodev\n", 2155 ata_dev_info(dev, "%s: ENTER/EXIT -- nodev\n", __func__);
2158 __func__);
2159 return 0; 2156 return 0;
2160 } 2157 }
2161 2158
2162 if (ata_msg_probe(ap)) 2159 if (ata_msg_probe(ap))
2163 ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __func__); 2160 ata_dev_dbg(dev, "%s: ENTER\n", __func__);
2164 2161
2165 /* set horkage */ 2162 /* set horkage */
2166 dev->horkage |= ata_dev_blacklisted(dev); 2163 dev->horkage |= ata_dev_blacklisted(dev);
2167 ata_force_horkage(dev); 2164 ata_force_horkage(dev);
2168 2165
2169 if (dev->horkage & ATA_HORKAGE_DISABLE) { 2166 if (dev->horkage & ATA_HORKAGE_DISABLE) {
2170 ata_dev_printk(dev, KERN_INFO, 2167 ata_dev_info(dev, "unsupported device, disabling\n");
2171 "unsupported device, disabling\n");
2172 ata_dev_disable(dev); 2168 ata_dev_disable(dev);
2173 return 0; 2169 return 0;
2174 } 2170 }
2175 2171
2176 if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) && 2172 if ((!atapi_enabled || (ap->flags & ATA_FLAG_NO_ATAPI)) &&
2177 dev->class == ATA_DEV_ATAPI) { 2173 dev->class == ATA_DEV_ATAPI) {
2178 ata_dev_printk(dev, KERN_WARNING, 2174 ata_dev_warn(dev, "WARNING: ATAPI is %s, device ignored\n",
2179 "WARNING: ATAPI is %s, device ignored.\n", 2175 atapi_enabled ? "not supported with this driver"
2180 atapi_enabled ? "not supported with this driver" 2176 : "disabled");
2181 : "disabled");
2182 ata_dev_disable(dev); 2177 ata_dev_disable(dev);
2183 return 0; 2178 return 0;
2184 } 2179 }
@@ -2199,12 +2194,12 @@ int ata_dev_configure(struct ata_device *dev)
2199 2194
2200 /* print device capabilities */ 2195 /* print device capabilities */
2201 if (ata_msg_probe(ap)) 2196 if (ata_msg_probe(ap))
2202 ata_dev_printk(dev, KERN_DEBUG, 2197 ata_dev_dbg(dev,
2203 "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x " 2198 "%s: cfg 49:%04x 82:%04x 83:%04x 84:%04x "
2204 "85:%04x 86:%04x 87:%04x 88:%04x\n", 2199 "85:%04x 86:%04x 87:%04x 88:%04x\n",
2205 __func__, 2200 __func__,
2206 id[49], id[82], id[83], id[84], 2201 id[49], id[82], id[83], id[84],
2207 id[85], id[86], id[87], id[88]); 2202 id[85], id[86], id[87], id[88]);
2208 2203
2209 /* initialize to-be-configured parameters */ 2204 /* initialize to-be-configured parameters */
2210 dev->flags &= ~ATA_DFLAG_CFG_MASK; 2205 dev->flags &= ~ATA_DFLAG_CFG_MASK;
@@ -2238,17 +2233,15 @@ int ata_dev_configure(struct ata_device *dev)
2238 if (ata_id_is_cfa(id)) { 2233 if (ata_id_is_cfa(id)) {
2239 /* CPRM may make this media unusable */ 2234 /* CPRM may make this media unusable */
2240 if (id[ATA_ID_CFA_KEY_MGMT] & 1) 2235 if (id[ATA_ID_CFA_KEY_MGMT] & 1)
2241 ata_dev_printk(dev, KERN_WARNING, 2236 ata_dev_warn(dev,
2242 "supports DRM functions and may " 2237 "supports DRM functions and may not be fully accessible\n");
2243 "not be fully accessible.\n");
2244 snprintf(revbuf, 7, "CFA"); 2238 snprintf(revbuf, 7, "CFA");
2245 } else { 2239 } else {
2246 snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id)); 2240 snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id));
2247 /* Warn the user if the device has TPM extensions */ 2241 /* Warn the user if the device has TPM extensions */
2248 if (ata_id_has_tpm(id)) 2242 if (ata_id_has_tpm(id))
2249 ata_dev_printk(dev, KERN_WARNING, 2243 ata_dev_warn(dev,
2250 "supports DRM functions and may " 2244 "supports DRM functions and may not be fully accessible\n");
2251 "not be fully accessible.\n");
2252 } 2245 }
2253 2246
2254 dev->n_sectors = ata_id_n_sectors(id); 2247 dev->n_sectors = ata_id_n_sectors(id);
@@ -2285,12 +2278,11 @@ int ata_dev_configure(struct ata_device *dev)
2285 2278
2286 /* print device info to dmesg */ 2279 /* print device info to dmesg */
2287 if (ata_msg_drv(ap) && print_info) { 2280 if (ata_msg_drv(ap) && print_info) {
2288 ata_dev_printk(dev, KERN_INFO, 2281 ata_dev_info(dev, "%s: %s, %s, max %s\n",
2289 "%s: %s, %s, max %s\n", 2282 revbuf, modelbuf, fwrevbuf,
2290 revbuf, modelbuf, fwrevbuf, 2283 ata_mode_string(xfer_mask));
2291 ata_mode_string(xfer_mask)); 2284 ata_dev_info(dev,
2292 ata_dev_printk(dev, KERN_INFO, 2285 "%llu sectors, multi %u: %s %s\n",
2293 "%Lu sectors, multi %u: %s %s\n",
2294 (unsigned long long)dev->n_sectors, 2286 (unsigned long long)dev->n_sectors,
2295 dev->multi_count, lba_desc, ncq_desc); 2287 dev->multi_count, lba_desc, ncq_desc);
2296 } 2288 }
@@ -2311,15 +2303,14 @@ int ata_dev_configure(struct ata_device *dev)
2311 2303
2312 /* print device info to dmesg */ 2304 /* print device info to dmesg */
2313 if (ata_msg_drv(ap) && print_info) { 2305 if (ata_msg_drv(ap) && print_info) {
2314 ata_dev_printk(dev, KERN_INFO, 2306 ata_dev_info(dev, "%s: %s, %s, max %s\n",
2315 "%s: %s, %s, max %s\n", 2307 revbuf, modelbuf, fwrevbuf,
2316 revbuf, modelbuf, fwrevbuf, 2308 ata_mode_string(xfer_mask));
2317 ata_mode_string(xfer_mask)); 2309 ata_dev_info(dev,
2318 ata_dev_printk(dev, KERN_INFO, 2310 "%llu sectors, multi %u, CHS %u/%u/%u\n",
2319 "%Lu sectors, multi %u, CHS %u/%u/%u\n", 2311 (unsigned long long)dev->n_sectors,
2320 (unsigned long long)dev->n_sectors, 2312 dev->multi_count, dev->cylinders,
2321 dev->multi_count, dev->cylinders, 2313 dev->heads, dev->sectors);
2322 dev->heads, dev->sectors);
2323 } 2314 }
2324 } 2315 }
2325 2316
@@ -2336,8 +2327,7 @@ int ata_dev_configure(struct ata_device *dev)
2336 rc = atapi_cdb_len(id); 2327 rc = atapi_cdb_len(id);
2337 if ((rc < 12) || (rc > ATAPI_CDB_LEN)) { 2328 if ((rc < 12) || (rc > ATAPI_CDB_LEN)) {
2338 if (ata_msg_warn(ap)) 2329 if (ata_msg_warn(ap))
2339 ata_dev_printk(dev, KERN_WARNING, 2330 ata_dev_warn(dev, "unsupported CDB len\n");
2340 "unsupported CDB len\n");
2341 rc = -EINVAL; 2331 rc = -EINVAL;
2342 goto err_out_nosup; 2332 goto err_out_nosup;
2343 } 2333 }
@@ -2358,9 +2348,9 @@ int ata_dev_configure(struct ata_device *dev)
2358 err_mask = ata_dev_set_feature(dev, 2348 err_mask = ata_dev_set_feature(dev,
2359 SETFEATURES_SATA_ENABLE, SATA_AN); 2349 SETFEATURES_SATA_ENABLE, SATA_AN);
2360 if (err_mask) 2350 if (err_mask)
2361 ata_dev_printk(dev, KERN_ERR, 2351 ata_dev_err(dev,
2362 "failed to enable ATAPI AN " 2352 "failed to enable ATAPI AN (err_mask=0x%x)\n",
2363 "(err_mask=0x%x)\n", err_mask); 2353 err_mask);
2364 else { 2354 else {
2365 dev->flags |= ATA_DFLAG_AN; 2355 dev->flags |= ATA_DFLAG_AN;
2366 atapi_an_string = ", ATAPI AN"; 2356 atapi_an_string = ", ATAPI AN";
@@ -2379,12 +2369,12 @@ int ata_dev_configure(struct ata_device *dev)
2379 2369
2380 /* print device info to dmesg */ 2370 /* print device info to dmesg */
2381 if (ata_msg_drv(ap) && print_info) 2371 if (ata_msg_drv(ap) && print_info)
2382 ata_dev_printk(dev, KERN_INFO, 2372 ata_dev_info(dev,
2383 "ATAPI: %s, %s, max %s%s%s%s\n", 2373 "ATAPI: %s, %s, max %s%s%s%s\n",
2384 modelbuf, fwrevbuf, 2374 modelbuf, fwrevbuf,
2385 ata_mode_string(xfer_mask), 2375 ata_mode_string(xfer_mask),
2386 cdb_intr_string, atapi_an_string, 2376 cdb_intr_string, atapi_an_string,
2387 dma_dir_string); 2377 dma_dir_string);
2388 } 2378 }
2389 2379
2390 /* determine max_sectors */ 2380 /* determine max_sectors */
@@ -2396,8 +2386,7 @@ int ata_dev_configure(struct ata_device *dev)
2396 200 sectors */ 2386 200 sectors */
2397 if (ata_dev_knobble(dev)) { 2387 if (ata_dev_knobble(dev)) {
2398 if (ata_msg_drv(ap) && print_info) 2388 if (ata_msg_drv(ap) && print_info)
2399 ata_dev_printk(dev, KERN_INFO, 2389 ata_dev_info(dev, "applying bridge limits\n");
2400 "applying bridge limits\n");
2401 dev->udma_mask &= ATA_UDMA5; 2390 dev->udma_mask &= ATA_UDMA5;
2402 dev->max_sectors = ATA_MAX_SECTORS; 2391 dev->max_sectors = ATA_MAX_SECTORS;
2403 } 2392 }
@@ -2423,26 +2412,23 @@ int ata_dev_configure(struct ata_device *dev)
2423 bugs */ 2412 bugs */
2424 2413
2425 if (print_info) { 2414 if (print_info) {
2426 ata_dev_printk(dev, KERN_WARNING, 2415 ata_dev_warn(dev,
2427"Drive reports diagnostics failure. This may indicate a drive\n"); 2416"Drive reports diagnostics failure. This may indicate a drive\n");
2428 ata_dev_printk(dev, KERN_WARNING, 2417 ata_dev_warn(dev,
2429"fault or invalid emulation. Contact drive vendor for information.\n"); 2418"fault or invalid emulation. Contact drive vendor for information.\n");
2430 } 2419 }
2431 } 2420 }
2432 2421
2433 if ((dev->horkage & ATA_HORKAGE_FIRMWARE_WARN) && print_info) { 2422 if ((dev->horkage & ATA_HORKAGE_FIRMWARE_WARN) && print_info) {
2434 ata_dev_printk(dev, KERN_WARNING, "WARNING: device requires " 2423 ata_dev_warn(dev, "WARNING: device requires firmware update to be fully functional\n");
2435 "firmware update to be fully functional.\n"); 2424 ata_dev_warn(dev, " contact the vendor or visit http://ata.wiki.kernel.org\n");
2436 ata_dev_printk(dev, KERN_WARNING, " contact the vendor "
2437 "or visit http://ata.wiki.kernel.org.\n");
2438 } 2425 }
2439 2426
2440 return 0; 2427 return 0;
2441 2428
2442err_out_nosup: 2429err_out_nosup:
2443 if (ata_msg_probe(ap)) 2430 if (ata_msg_probe(ap))
2444 ata_dev_printk(dev, KERN_DEBUG, 2431 ata_dev_dbg(dev, "%s: EXIT, err\n", __func__);
2445 "%s: EXIT, err\n", __func__);
2446 return rc; 2432 return rc;
2447} 2433}
2448 2434
@@ -2663,13 +2649,11 @@ static void sata_print_link_status(struct ata_link *link)
2663 2649
2664 if (ata_phys_link_online(link)) { 2650 if (ata_phys_link_online(link)) {
2665 tmp = (sstatus >> 4) & 0xf; 2651 tmp = (sstatus >> 4) & 0xf;
2666 ata_link_printk(link, KERN_INFO, 2652 ata_link_info(link, "SATA link up %s (SStatus %X SControl %X)\n",
2667 "SATA link up %s (SStatus %X SControl %X)\n", 2653 sata_spd_string(tmp), sstatus, scontrol);
2668 sata_spd_string(tmp), sstatus, scontrol);
2669 } else { 2654 } else {
2670 ata_link_printk(link, KERN_INFO, 2655 ata_link_info(link, "SATA link down (SStatus %X SControl %X)\n",
2671 "SATA link down (SStatus %X SControl %X)\n", 2656 sstatus, scontrol);
2672 sstatus, scontrol);
2673 } 2657 }
2674} 2658}
2675 2659
@@ -2758,8 +2742,8 @@ int sata_down_spd_limit(struct ata_link *link, u32 spd_limit)
2758 2742
2759 link->sata_spd_limit = mask; 2743 link->sata_spd_limit = mask;
2760 2744
2761 ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n", 2745 ata_link_warn(link, "limiting SATA link speed to %s\n",
2762 sata_spd_string(fls(mask))); 2746 sata_spd_string(fls(mask)));
2763 2747
2764 return 0; 2748 return 0;
2765} 2749}
@@ -3136,8 +3120,7 @@ int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel)
3136 snprintf(buf, sizeof(buf), "%s", 3120 snprintf(buf, sizeof(buf), "%s",
3137 ata_mode_string(xfer_mask)); 3121 ata_mode_string(xfer_mask));
3138 3122
3139 ata_dev_printk(dev, KERN_WARNING, 3123 ata_dev_warn(dev, "limiting speed to %s\n", buf);
3140 "limiting speed to %s\n", buf);
3141 } 3124 }
3142 3125
3143 ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask, 3126 ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask,
@@ -3164,9 +3147,9 @@ static int ata_dev_set_mode(struct ata_device *dev)
3164 dev_err_whine = " (SET_XFERMODE skipped)"; 3147 dev_err_whine = " (SET_XFERMODE skipped)";
3165 else { 3148 else {
3166 if (nosetxfer) 3149 if (nosetxfer)
3167 ata_dev_printk(dev, KERN_WARNING, 3150 ata_dev_warn(dev,
3168 "NOSETXFER but PATA detected - can't " 3151 "NOSETXFER but PATA detected - can't "
3169 "skip SETXFER, might malfunction\n"); 3152 "skip SETXFER, might malfunction\n");
3170 err_mask = ata_dev_set_xfermode(dev); 3153 err_mask = ata_dev_set_xfermode(dev);
3171 } 3154 }
3172 3155
@@ -3216,15 +3199,14 @@ static int ata_dev_set_mode(struct ata_device *dev)
3216 DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n", 3199 DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n",
3217 dev->xfer_shift, (int)dev->xfer_mode); 3200 dev->xfer_shift, (int)dev->xfer_mode);
3218 3201
3219 ata_dev_printk(dev, KERN_INFO, "configured for %s%s\n", 3202 ata_dev_info(dev, "configured for %s%s\n",
3220 ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)), 3203 ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)),
3221 dev_err_whine); 3204 dev_err_whine);
3222 3205
3223 return 0; 3206 return 0;
3224 3207
3225 fail: 3208 fail:
3226 ata_dev_printk(dev, KERN_ERR, "failed to set xfermode " 3209 ata_dev_err(dev, "failed to set xfermode (err_mask=0x%x)\n", err_mask);
3227 "(err_mask=0x%x)\n", err_mask);
3228 return -EIO; 3210 return -EIO;
3229} 3211}
3230 3212
@@ -3286,7 +3268,7 @@ int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
3286 /* step 2: always set host PIO timings */ 3268 /* step 2: always set host PIO timings */
3287 ata_for_each_dev(dev, link, ENABLED) { 3269 ata_for_each_dev(dev, link, ENABLED) {
3288 if (dev->pio_mode == 0xff) { 3270 if (dev->pio_mode == 0xff) {
3289 ata_dev_printk(dev, KERN_WARNING, "no PIO support\n"); 3271 ata_dev_warn(dev, "no PIO support\n");
3290 rc = -EINVAL; 3272 rc = -EINVAL;
3291 goto out; 3273 goto out;
3292 } 3274 }
@@ -3404,7 +3386,7 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline,
3404 3386
3405 if (!warned && time_after(now, start + 5 * HZ) && 3387 if (!warned && time_after(now, start + 5 * HZ) &&
3406 (deadline - now > 3 * HZ)) { 3388 (deadline - now > 3 * HZ)) {
3407 ata_link_printk(link, KERN_WARNING, 3389 ata_link_warn(link,
3408 "link is slow to respond, please be patient " 3390 "link is slow to respond, please be patient "
3409 "(ready=%d)\n", tmp); 3391 "(ready=%d)\n", tmp);
3410 warned = 1; 3392 warned = 1;
@@ -3552,16 +3534,14 @@ int sata_link_resume(struct ata_link *link, const unsigned long *params,
3552 } while ((scontrol & 0xf0f) != 0x300 && --tries); 3534 } while ((scontrol & 0xf0f) != 0x300 && --tries);
3553 3535
3554 if ((scontrol & 0xf0f) != 0x300) { 3536 if ((scontrol & 0xf0f) != 0x300) {
3555 ata_link_printk(link, KERN_ERR, 3537 ata_link_warn(link, "failed to resume link (SControl %X)\n",
3556 "failed to resume link (SControl %X)\n", 3538 scontrol);
3557 scontrol);
3558 return 0; 3539 return 0;
3559 } 3540 }
3560 3541
3561 if (tries < ATA_LINK_RESUME_TRIES) 3542 if (tries < ATA_LINK_RESUME_TRIES)
3562 ata_link_printk(link, KERN_WARNING, 3543 ata_link_warn(link, "link resume succeeded after %d retries\n",
3563 "link resume succeeded after %d retries\n", 3544 ATA_LINK_RESUME_TRIES - tries);
3564 ATA_LINK_RESUME_TRIES - tries);
3565 3545
3566 if ((rc = sata_link_debounce(link, params, deadline))) 3546 if ((rc = sata_link_debounce(link, params, deadline)))
3567 return rc; 3547 return rc;
@@ -3678,8 +3658,9 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
3678 rc = sata_link_resume(link, timing, deadline); 3658 rc = sata_link_resume(link, timing, deadline);
3679 /* whine about phy resume failure but proceed */ 3659 /* whine about phy resume failure but proceed */
3680 if (rc && rc != -EOPNOTSUPP) 3660 if (rc && rc != -EOPNOTSUPP)
3681 ata_link_printk(link, KERN_WARNING, "failed to resume " 3661 ata_link_warn(link,
3682 "link for reset (errno=%d)\n", rc); 3662 "failed to resume link for reset (errno=%d)\n",
3663 rc);
3683 } 3664 }
3684 3665
3685 /* no point in trying softreset on offline link */ 3666 /* no point in trying softreset on offline link */
@@ -3795,8 +3776,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
3795 /* online is set iff link is online && reset succeeded */ 3776 /* online is set iff link is online && reset succeeded */
3796 if (online) 3777 if (online)
3797 *online = false; 3778 *online = false;
3798 ata_link_printk(link, KERN_ERR, 3779 ata_link_err(link, "COMRESET failed (errno=%d)\n", rc);
3799 "COMRESET failed (errno=%d)\n", rc);
3800 } 3780 }
3801 DPRINTK("EXIT, rc=%d\n", rc); 3781 DPRINTK("EXIT, rc=%d\n", rc);
3802 return rc; 3782 return rc;
@@ -3880,8 +3860,8 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
3880 unsigned char serial[2][ATA_ID_SERNO_LEN + 1]; 3860 unsigned char serial[2][ATA_ID_SERNO_LEN + 1];
3881 3861
3882 if (dev->class != new_class) { 3862 if (dev->class != new_class) {
3883 ata_dev_printk(dev, KERN_INFO, "class mismatch %d != %d\n", 3863 ata_dev_info(dev, "class mismatch %d != %d\n",
3884 dev->class, new_class); 3864 dev->class, new_class);
3885 return 0; 3865 return 0;
3886 } 3866 }
3887 3867
@@ -3891,14 +3871,14 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
3891 ata_id_c_string(new_id, serial[1], ATA_ID_SERNO, sizeof(serial[1])); 3871 ata_id_c_string(new_id, serial[1], ATA_ID_SERNO, sizeof(serial[1]));
3892 3872
3893 if (strcmp(model[0], model[1])) { 3873 if (strcmp(model[0], model[1])) {
3894 ata_dev_printk(dev, KERN_INFO, "model number mismatch " 3874 ata_dev_info(dev, "model number mismatch '%s' != '%s'\n",
3895 "'%s' != '%s'\n", model[0], model[1]); 3875 model[0], model[1]);
3896 return 0; 3876 return 0;
3897 } 3877 }
3898 3878
3899 if (strcmp(serial[0], serial[1])) { 3879 if (strcmp(serial[0], serial[1])) {
3900 ata_dev_printk(dev, KERN_INFO, "serial number mismatch " 3880 ata_dev_info(dev, "serial number mismatch '%s' != '%s'\n",
3901 "'%s' != '%s'\n", serial[0], serial[1]); 3881 serial[0], serial[1]);
3902 return 0; 3882 return 0;
3903 } 3883 }
3904 3884
@@ -3968,8 +3948,8 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
3968 new_class != ATA_DEV_ATA && 3948 new_class != ATA_DEV_ATA &&
3969 new_class != ATA_DEV_ATAPI && 3949 new_class != ATA_DEV_ATAPI &&
3970 new_class != ATA_DEV_SEMB) { 3950 new_class != ATA_DEV_SEMB) {
3971 ata_dev_printk(dev, KERN_INFO, "class mismatch %u != %u\n", 3951 ata_dev_info(dev, "class mismatch %u != %u\n",
3972 dev->class, new_class); 3952 dev->class, new_class);
3973 rc = -ENODEV; 3953 rc = -ENODEV;
3974 goto fail; 3954 goto fail;
3975 } 3955 }
@@ -3990,9 +3970,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
3990 return 0; 3970 return 0;
3991 3971
3992 /* n_sectors has changed */ 3972 /* n_sectors has changed */
3993 ata_dev_printk(dev, KERN_WARNING, "n_sectors mismatch %llu != %llu\n", 3973 ata_dev_warn(dev, "n_sectors mismatch %llu != %llu\n",
3994 (unsigned long long)n_sectors, 3974 (unsigned long long)n_sectors,
3995 (unsigned long long)dev->n_sectors); 3975 (unsigned long long)dev->n_sectors);
3996 3976
3997 /* 3977 /*
3998 * Something could have caused HPA to be unlocked 3978 * Something could have caused HPA to be unlocked
@@ -4001,9 +3981,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
4001 */ 3981 */
4002 if (dev->n_native_sectors == n_native_sectors && 3982 if (dev->n_native_sectors == n_native_sectors &&
4003 dev->n_sectors > n_sectors && dev->n_sectors == n_native_sectors) { 3983 dev->n_sectors > n_sectors && dev->n_sectors == n_native_sectors) {
4004 ata_dev_printk(dev, KERN_WARNING, 3984 ata_dev_warn(dev,
4005 "new n_sectors matches native, probably " 3985 "new n_sectors matches native, probably "
4006 "late HPA unlock, n_sectors updated\n"); 3986 "late HPA unlock, n_sectors updated\n");
4007 /* use the larger n_sectors */ 3987 /* use the larger n_sectors */
4008 return 0; 3988 return 0;
4009 } 3989 }
@@ -4017,9 +3997,9 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
4017 if (dev->n_native_sectors == n_native_sectors && 3997 if (dev->n_native_sectors == n_native_sectors &&
4018 dev->n_sectors < n_sectors && n_sectors == n_native_sectors && 3998 dev->n_sectors < n_sectors && n_sectors == n_native_sectors &&
4019 !(dev->horkage & ATA_HORKAGE_BROKEN_HPA)) { 3999 !(dev->horkage & ATA_HORKAGE_BROKEN_HPA)) {
4020 ata_dev_printk(dev, KERN_WARNING, 4000 ata_dev_warn(dev,
4021 "old n_sectors matches native, probably " 4001 "old n_sectors matches native, probably "
4022 "late HPA lock, will try to unlock HPA\n"); 4002 "late HPA lock, will try to unlock HPA\n");
4023 /* try unlocking HPA */ 4003 /* try unlocking HPA */
4024 dev->flags |= ATA_DFLAG_UNLOCK_HPA; 4004 dev->flags |= ATA_DFLAG_UNLOCK_HPA;
4025 rc = -EIO; 4005 rc = -EIO;
@@ -4030,7 +4010,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
4030 dev->n_native_sectors = n_native_sectors; 4010 dev->n_native_sectors = n_native_sectors;
4031 dev->n_sectors = n_sectors; 4011 dev->n_sectors = n_sectors;
4032 fail: 4012 fail:
4033 ata_dev_printk(dev, KERN_ERR, "revalidation failed (errno=%d)\n", rc); 4013 ata_dev_err(dev, "revalidation failed (errno=%d)\n", rc);
4034 return rc; 4014 return rc;
4035} 4015}
4036 4016
@@ -4358,15 +4338,15 @@ static void ata_dev_xfermask(struct ata_device *dev)
4358 4338
4359 if (ata_dma_blacklisted(dev)) { 4339 if (ata_dma_blacklisted(dev)) {
4360 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 4340 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
4361 ata_dev_printk(dev, KERN_WARNING, 4341 ata_dev_warn(dev,
4362 "device is on DMA blacklist, disabling DMA\n"); 4342 "device is on DMA blacklist, disabling DMA\n");
4363 } 4343 }
4364 4344
4365 if ((host->flags & ATA_HOST_SIMPLEX) && 4345 if ((host->flags & ATA_HOST_SIMPLEX) &&
4366 host->simplex_claimed && host->simplex_claimed != ap) { 4346 host->simplex_claimed && host->simplex_claimed != ap) {
4367 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 4347 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
4368 ata_dev_printk(dev, KERN_WARNING, "simplex DMA is claimed by " 4348 ata_dev_warn(dev,
4369 "other device, disabling DMA\n"); 4349 "simplex DMA is claimed by other device, disabling DMA\n");
4370 } 4350 }
4371 4351
4372 if (ap->flags & ATA_FLAG_NO_IORDY) 4352 if (ap->flags & ATA_FLAG_NO_IORDY)
@@ -4386,8 +4366,8 @@ static void ata_dev_xfermask(struct ata_device *dev)
4386 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA)) 4366 if (xfer_mask & (0xF8 << ATA_SHIFT_UDMA))
4387 /* UDMA/44 or higher would be available */ 4367 /* UDMA/44 or higher would be available */
4388 if (cable_is_40wire(ap)) { 4368 if (cable_is_40wire(ap)) {
4389 ata_dev_printk(dev, KERN_WARNING, 4369 ata_dev_warn(dev,
4390 "limited to UDMA/33 due to 40-wire cable\n"); 4370 "limited to UDMA/33 due to 40-wire cable\n");
4391 xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA); 4371 xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA);
4392 } 4372 }
4393 4373
@@ -4954,8 +4934,8 @@ int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active)
4954 done_mask = ap->qc_active ^ qc_active; 4934 done_mask = ap->qc_active ^ qc_active;
4955 4935
4956 if (unlikely(done_mask & qc_active)) { 4936 if (unlikely(done_mask & qc_active)) {
4957 ata_port_printk(ap, KERN_ERR, "illegal qc_active transition " 4937 ata_port_err(ap, "illegal qc_active transition (%08x->%08x)\n",
4958 "(%08x->%08x)\n", ap->qc_active, qc_active); 4938 ap->qc_active, qc_active);
4959 return -EINVAL; 4939 return -EINVAL;
4960 } 4940 }
4961 4941
@@ -5847,9 +5827,9 @@ int ata_host_start(struct ata_host *host)
5847 rc = ap->ops->port_start(ap); 5827 rc = ap->ops->port_start(ap);
5848 if (rc) { 5828 if (rc) {
5849 if (rc != -ENODEV) 5829 if (rc != -ENODEV)
5850 dev_printk(KERN_ERR, host->dev, 5830 dev_err(host->dev,
5851 "failed to start port %d " 5831 "failed to start port %d (errno=%d)\n",
5852 "(errno=%d)\n", i, rc); 5832 i, rc);
5853 goto err_out; 5833 goto err_out;
5854 } 5834 }
5855 } 5835 }
@@ -5971,8 +5951,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
5971 5951
5972 /* host must have been started */ 5952 /* host must have been started */
5973 if (!(host->flags & ATA_HOST_STARTED)) { 5953 if (!(host->flags & ATA_HOST_STARTED)) {
5974 dev_printk(KERN_ERR, host->dev, 5954 dev_err(host->dev, "BUG: trying to register unstarted host\n");
5975 "BUG: trying to register unstarted host\n");
5976 WARN_ON(1); 5955 WARN_ON(1);
5977 return -EINVAL; 5956 return -EINVAL;
5978 } 5957 }
@@ -6023,14 +6002,13 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6023 ap->udma_mask); 6002 ap->udma_mask);
6024 6003
6025 if (!ata_port_is_dummy(ap)) { 6004 if (!ata_port_is_dummy(ap)) {
6026 ata_port_printk(ap, KERN_INFO, 6005 ata_port_info(ap, "%cATA max %s %s\n",
6027 "%cATA max %s %s\n", 6006 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P',
6028 (ap->flags & ATA_FLAG_SATA) ? 'S' : 'P', 6007 ata_mode_string(xfer_mask),
6029 ata_mode_string(xfer_mask), 6008 ap->link.eh_info.desc);
6030 ap->link.eh_info.desc);
6031 ata_ehi_clear_desc(&ap->link.eh_info); 6009 ata_ehi_clear_desc(&ap->link.eh_info);
6032 } else 6010 } else
6033 ata_port_printk(ap, KERN_INFO, "DUMMY\n"); 6011 ata_port_info(ap, "DUMMY\n");
6034 } 6012 }
6035 6013
6036 /* perform each probe asynchronously */ 6014 /* perform each probe asynchronously */
@@ -6242,8 +6220,8 @@ int ata_pci_device_do_resume(struct pci_dev *pdev)
6242 6220
6243 rc = pcim_enable_device(pdev); 6221 rc = pcim_enable_device(pdev);
6244 if (rc) { 6222 if (rc) {
6245 dev_printk(KERN_ERR, &pdev->dev, 6223 dev_err(&pdev->dev,
6246 "failed to enable device after resume (%d)\n", rc); 6224 "failed to enable device after resume (%d)\n", rc);
6247 return rc; 6225 return rc;
6248 } 6226 }
6249 6227
@@ -6600,6 +6578,82 @@ const struct ata_port_info ata_dummy_port_info = {
6600}; 6578};
6601 6579
6602/* 6580/*
6581 * Utility print functions
6582 */
6583int ata_port_printk(const struct ata_port *ap, const char *level,
6584 const char *fmt, ...)
6585{
6586 struct va_format vaf;
6587 va_list args;
6588 int r;
6589
6590 va_start(args, fmt);
6591
6592 vaf.fmt = fmt;
6593 vaf.va = &args;
6594
6595 r = printk("%sata%u: %pV", level, ap->print_id, &vaf);
6596
6597 va_end(args);
6598
6599 return r;
6600}
6601EXPORT_SYMBOL(ata_port_printk);
6602
6603int ata_link_printk(const struct ata_link *link, const char *level,
6604 const char *fmt, ...)
6605{
6606 struct va_format vaf;
6607 va_list args;
6608 int r;
6609
6610 va_start(args, fmt);
6611
6612 vaf.fmt = fmt;
6613 vaf.va = &args;
6614
6615 if (sata_pmp_attached(link->ap) || link->ap->slave_link)
6616 r = printk("%sata%u.%02u: %pV",
6617 level, link->ap->print_id, link->pmp, &vaf);
6618 else
6619 r = printk("%sata%u: %pV",
6620 level, link->ap->print_id, &vaf);
6621
6622 va_end(args);
6623
6624 return r;
6625}
6626EXPORT_SYMBOL(ata_link_printk);
6627
6628int ata_dev_printk(const struct ata_device *dev, const char *level,
6629 const char *fmt, ...)
6630{
6631 struct va_format vaf;
6632 va_list args;
6633 int r;
6634
6635 va_start(args, fmt);
6636
6637 vaf.fmt = fmt;
6638 vaf.va = &args;
6639
6640 r = printk("%sata%u.%02u: %pV",
6641 level, dev->link->ap->print_id, dev->link->pmp + dev->devno,
6642 &vaf);
6643
6644 va_end(args);
6645
6646 return r;
6647}
6648EXPORT_SYMBOL(ata_dev_printk);
6649
6650void ata_print_version(const struct device *dev, const char *version)
6651{
6652 dev_printk(KERN_DEBUG, dev, "version %s\n", version);
6653}
6654EXPORT_SYMBOL(ata_print_version);
6655
6656/*
6603 * libata is essentially a library of internal helper functions for 6657 * libata is essentially a library of internal helper functions for
6604 * low-level ATA host controller drivers. As such, the API/ABI is 6658 * low-level ATA host controller drivers. As such, the API/ABI is
6605 * likely to change as new drivers are added and updated. 6659 * likely to change as new drivers are added and updated.
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 7f099d6e4e0b..ed16fbedaabd 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -782,8 +782,9 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
782 spin_unlock_irqrestore(ap->lock, flags); 782 spin_unlock_irqrestore(ap->lock, flags);
783 goto repeat; 783 goto repeat;
784 } 784 }
785 ata_port_printk(ap, KERN_ERR, "EH pending after %d " 785 ata_port_err(ap,
786 "tries, giving up\n", ATA_EH_MAX_TRIES); 786 "EH pending after %d tries, giving up\n",
787 ATA_EH_MAX_TRIES);
787 ap->pflags &= ~ATA_PFLAG_EH_PENDING; 788 ap->pflags &= ~ATA_PFLAG_EH_PENDING;
788 } 789 }
789 790
@@ -816,7 +817,7 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
816 schedule_delayed_work(&ap->hotplug_task, 0); 817 schedule_delayed_work(&ap->hotplug_task, 0);
817 818
818 if (ap->pflags & ATA_PFLAG_RECOVERED) 819 if (ap->pflags & ATA_PFLAG_RECOVERED)
819 ata_port_printk(ap, KERN_INFO, "EH complete\n"); 820 ata_port_info(ap, "EH complete\n");
820 821
821 ap->pflags &= ~(ATA_PFLAG_SCSI_HOTPLUG | ATA_PFLAG_RECOVERED); 822 ap->pflags &= ~(ATA_PFLAG_SCSI_HOTPLUG | ATA_PFLAG_RECOVERED);
822 823
@@ -1310,7 +1311,7 @@ void ata_dev_disable(struct ata_device *dev)
1310 return; 1311 return;
1311 1312
1312 if (ata_msg_drv(dev->link->ap)) 1313 if (ata_msg_drv(dev->link->ap))
1313 ata_dev_printk(dev, KERN_WARNING, "disabled\n"); 1314 ata_dev_warn(dev, "disabled\n");
1314 ata_acpi_on_disable(dev); 1315 ata_acpi_on_disable(dev);
1315 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET); 1316 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET);
1316 dev->class++; 1317 dev->class++;
@@ -1515,8 +1516,8 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
1515 for (i = 0; i < ATA_SECT_SIZE; i++) 1516 for (i = 0; i < ATA_SECT_SIZE; i++)
1516 csum += buf[i]; 1517 csum += buf[i];
1517 if (csum) 1518 if (csum)
1518 ata_dev_printk(dev, KERN_WARNING, 1519 ata_dev_warn(dev, "invalid checksum 0x%x on log page 10h\n",
1519 "invalid checksum 0x%x on log page 10h\n", csum); 1520 csum);
1520 1521
1521 if (buf[0] & 0x80) 1522 if (buf[0] & 0x80)
1522 return -ENOENT; 1523 return -ENOENT;
@@ -1716,14 +1717,14 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
1716 memset(&tf, 0, sizeof(tf)); 1717 memset(&tf, 0, sizeof(tf));
1717 rc = ata_eh_read_log_10h(dev, &tag, &tf); 1718 rc = ata_eh_read_log_10h(dev, &tag, &tf);
1718 if (rc) { 1719 if (rc) {
1719 ata_link_printk(link, KERN_ERR, "failed to read log page 10h " 1720 ata_link_err(link, "failed to read log page 10h (errno=%d)\n",
1720 "(errno=%d)\n", rc); 1721 rc);
1721 return; 1722 return;
1722 } 1723 }
1723 1724
1724 if (!(link->sactive & (1 << tag))) { 1725 if (!(link->sactive & (1 << tag))) {
1725 ata_link_printk(link, KERN_ERR, "log page 10h reported " 1726 ata_link_err(link, "log page 10h reported inactive tag %d\n",
1726 "inactive tag %d\n", tag); 1727 tag);
1727 return; 1728 return;
1728 } 1729 }
1729 1730
@@ -1988,8 +1989,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev,
1988 (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ | 1989 (dev->flags & (ATA_DFLAG_PIO | ATA_DFLAG_NCQ |
1989 ATA_DFLAG_NCQ_OFF)) == ATA_DFLAG_NCQ) { 1990 ATA_DFLAG_NCQ_OFF)) == ATA_DFLAG_NCQ) {
1990 dev->flags |= ATA_DFLAG_NCQ_OFF; 1991 dev->flags |= ATA_DFLAG_NCQ_OFF;
1991 ata_dev_printk(dev, KERN_WARNING, 1992 ata_dev_warn(dev, "NCQ disabled due to excessive errors\n");
1992 "NCQ disabled due to excessive errors\n");
1993 goto done; 1993 goto done;
1994 } 1994 }
1995 1995
@@ -2374,24 +2374,24 @@ static void ata_eh_link_report(struct ata_link *link)
2374 ap->eh_tries); 2374 ap->eh_tries);
2375 2375
2376 if (ehc->i.dev) { 2376 if (ehc->i.dev) {
2377 ata_dev_printk(ehc->i.dev, KERN_ERR, "exception Emask 0x%x " 2377 ata_dev_err(ehc->i.dev, "exception Emask 0x%x "
2378 "SAct 0x%x SErr 0x%x action 0x%x%s%s\n", 2378 "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
2379 ehc->i.err_mask, link->sactive, ehc->i.serror, 2379 ehc->i.err_mask, link->sactive, ehc->i.serror,
2380 ehc->i.action, frozen, tries_buf); 2380 ehc->i.action, frozen, tries_buf);
2381 if (desc) 2381 if (desc)
2382 ata_dev_printk(ehc->i.dev, KERN_ERR, "%s\n", desc); 2382 ata_dev_err(ehc->i.dev, "%s\n", desc);
2383 } else { 2383 } else {
2384 ata_link_printk(link, KERN_ERR, "exception Emask 0x%x " 2384 ata_link_err(link, "exception Emask 0x%x "
2385 "SAct 0x%x SErr 0x%x action 0x%x%s%s\n", 2385 "SAct 0x%x SErr 0x%x action 0x%x%s%s\n",
2386 ehc->i.err_mask, link->sactive, ehc->i.serror, 2386 ehc->i.err_mask, link->sactive, ehc->i.serror,
2387 ehc->i.action, frozen, tries_buf); 2387 ehc->i.action, frozen, tries_buf);
2388 if (desc) 2388 if (desc)
2389 ata_link_printk(link, KERN_ERR, "%s\n", desc); 2389 ata_link_err(link, "%s\n", desc);
2390 } 2390 }
2391 2391
2392#ifdef CONFIG_ATA_VERBOSE_ERROR 2392#ifdef CONFIG_ATA_VERBOSE_ERROR
2393 if (ehc->i.serror) 2393 if (ehc->i.serror)
2394 ata_link_printk(link, KERN_ERR, 2394 ata_link_err(link,
2395 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n", 2395 "SError: { %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s}\n",
2396 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "", 2396 ehc->i.serror & SERR_DATA_RECOVERED ? "RecovData " : "",
2397 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "", 2397 ehc->i.serror & SERR_COMM_RECOVERED ? "RecovComm " : "",
@@ -2456,11 +2456,11 @@ static void ata_eh_link_report(struct ata_link *link)
2456 } else { 2456 } else {
2457 const char *descr = ata_get_cmd_descript(cmd->command); 2457 const char *descr = ata_get_cmd_descript(cmd->command);
2458 if (descr) 2458 if (descr)
2459 ata_dev_printk(qc->dev, KERN_ERR, 2459 ata_dev_err(qc->dev, "failed command: %s\n",
2460 "failed command: %s\n", descr); 2460 descr);
2461 } 2461 }
2462 2462
2463 ata_dev_printk(qc->dev, KERN_ERR, 2463 ata_dev_err(qc->dev,
2464 "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " 2464 "cmd %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
2465 "tag %d%s\n %s" 2465 "tag %d%s\n %s"
2466 "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x " 2466 "res %02x/%02x:%02x:%02x:%02x:%02x/%02x:%02x:%02x:%02x:%02x/%02x "
@@ -2481,11 +2481,9 @@ static void ata_eh_link_report(struct ata_link *link)
2481 if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | 2481 if (res->command & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ |
2482 ATA_ERR)) { 2482 ATA_ERR)) {
2483 if (res->command & ATA_BUSY) 2483 if (res->command & ATA_BUSY)
2484 ata_dev_printk(qc->dev, KERN_ERR, 2484 ata_dev_err(qc->dev, "status: { Busy }\n");
2485 "status: { Busy }\n");
2486 else 2485 else
2487 ata_dev_printk(qc->dev, KERN_ERR, 2486 ata_dev_err(qc->dev, "status: { %s%s%s%s}\n",
2488 "status: { %s%s%s%s}\n",
2489 res->command & ATA_DRDY ? "DRDY " : "", 2487 res->command & ATA_DRDY ? "DRDY " : "",
2490 res->command & ATA_DF ? "DF " : "", 2488 res->command & ATA_DF ? "DF " : "",
2491 res->command & ATA_DRQ ? "DRQ " : "", 2489 res->command & ATA_DRQ ? "DRQ " : "",
@@ -2495,8 +2493,7 @@ static void ata_eh_link_report(struct ata_link *link)
2495 if (cmd->command != ATA_CMD_PACKET && 2493 if (cmd->command != ATA_CMD_PACKET &&
2496 (res->feature & (ATA_ICRC | ATA_UNC | ATA_IDNF | 2494 (res->feature & (ATA_ICRC | ATA_UNC | ATA_IDNF |
2497 ATA_ABORTED))) 2495 ATA_ABORTED)))
2498 ata_dev_printk(qc->dev, KERN_ERR, 2496 ata_dev_err(qc->dev, "error: { %s%s%s%s}\n",
2499 "error: { %s%s%s%s}\n",
2500 res->feature & ATA_ICRC ? "ICRC " : "", 2497 res->feature & ATA_ICRC ? "ICRC " : "",
2501 res->feature & ATA_UNC ? "UNC " : "", 2498 res->feature & ATA_UNC ? "UNC " : "",
2502 res->feature & ATA_IDNF ? "IDNF " : "", 2499 res->feature & ATA_IDNF ? "IDNF " : "",
@@ -2650,8 +2647,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
2650 2647
2651 if (rc) { 2648 if (rc) {
2652 if (rc == -ENOENT) { 2649 if (rc == -ENOENT) {
2653 ata_link_printk(link, KERN_DEBUG, 2650 ata_link_dbg(link, "port disabled--ignoring\n");
2654 "port disabled. ignoring.\n");
2655 ehc->i.action &= ~ATA_EH_RESET; 2651 ehc->i.action &= ~ATA_EH_RESET;
2656 2652
2657 ata_for_each_dev(dev, link, ALL) 2653 ata_for_each_dev(dev, link, ALL)
@@ -2659,8 +2655,9 @@ int ata_eh_reset(struct ata_link *link, int classify,
2659 2655
2660 rc = 0; 2656 rc = 0;
2661 } else 2657 } else
2662 ata_link_printk(link, KERN_ERR, 2658 ata_link_err(link,
2663 "prereset failed (errno=%d)\n", rc); 2659 "prereset failed (errno=%d)\n",
2660 rc);
2664 goto out; 2661 goto out;
2665 } 2662 }
2666 2663
@@ -2689,8 +2686,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
2689 2686
2690 if (reset) { 2687 if (reset) {
2691 if (verbose) 2688 if (verbose)
2692 ata_link_printk(link, KERN_INFO, "%s resetting link\n", 2689 ata_link_info(link, "%s resetting link\n",
2693 reset == softreset ? "soft" : "hard"); 2690 reset == softreset ? "soft" : "hard");
2694 2691
2695 /* mark that this EH session started with reset */ 2692 /* mark that this EH session started with reset */
2696 ehc->last_reset = jiffies; 2693 ehc->last_reset = jiffies;
@@ -2710,8 +2707,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
2710 int tmp; 2707 int tmp;
2711 2708
2712 if (verbose) 2709 if (verbose)
2713 ata_link_printk(slave, KERN_INFO, 2710 ata_link_info(slave, "hard resetting link\n");
2714 "hard resetting link\n");
2715 2711
2716 ata_eh_about_to_do(slave, NULL, ATA_EH_RESET); 2712 ata_eh_about_to_do(slave, NULL, ATA_EH_RESET);
2717 tmp = ata_do_reset(slave, reset, classes, deadline, 2713 tmp = ata_do_reset(slave, reset, classes, deadline,
@@ -2734,9 +2730,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
2734 reset = softreset; 2730 reset = softreset;
2735 2731
2736 if (!reset) { 2732 if (!reset) {
2737 ata_link_printk(link, KERN_ERR, 2733 ata_link_err(link,
2738 "follow-up softreset required " 2734 "follow-up softreset required but no softreset available\n");
2739 "but no softreset available\n");
2740 failed_link = link; 2735 failed_link = link;
2741 rc = -EINVAL; 2736 rc = -EINVAL;
2742 goto fail; 2737 goto fail;
@@ -2751,8 +2746,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
2751 } 2746 }
2752 } else { 2747 } else {
2753 if (verbose) 2748 if (verbose)
2754 ata_link_printk(link, KERN_INFO, "no reset method " 2749 ata_link_info(link,
2755 "available, skipping reset\n"); 2750 "no reset method available, skipping reset\n");
2756 if (!(lflags & ATA_LFLAG_ASSUME_CLASS)) 2751 if (!(lflags & ATA_LFLAG_ASSUME_CLASS))
2757 lflags |= ATA_LFLAG_ASSUME_ATA; 2752 lflags |= ATA_LFLAG_ASSUME_ATA;
2758 } 2753 }
@@ -2830,36 +2825,35 @@ int ata_eh_reset(struct ata_link *link, int classify,
2830 ata_for_each_dev(dev, link, ALL) { 2825 ata_for_each_dev(dev, link, ALL) {
2831 if (ata_phys_link_online(ata_dev_phys_link(dev))) { 2826 if (ata_phys_link_online(ata_dev_phys_link(dev))) {
2832 if (classes[dev->devno] == ATA_DEV_UNKNOWN) { 2827 if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
2833 ata_dev_printk(dev, KERN_DEBUG, "link online " 2828 ata_dev_dbg(dev, "link online but device misclassified\n");
2834 "but device misclassifed\n");
2835 classes[dev->devno] = ATA_DEV_NONE; 2829 classes[dev->devno] = ATA_DEV_NONE;
2836 nr_unknown++; 2830 nr_unknown++;
2837 } 2831 }
2838 } else if (ata_phys_link_offline(ata_dev_phys_link(dev))) { 2832 } else if (ata_phys_link_offline(ata_dev_phys_link(dev))) {
2839 if (ata_class_enabled(classes[dev->devno])) 2833 if (ata_class_enabled(classes[dev->devno]))
2840 ata_dev_printk(dev, KERN_DEBUG, "link offline, " 2834 ata_dev_dbg(dev,
2841 "clearing class %d to NONE\n", 2835 "link offline, clearing class %d to NONE\n",
2842 classes[dev->devno]); 2836 classes[dev->devno]);
2843 classes[dev->devno] = ATA_DEV_NONE; 2837 classes[dev->devno] = ATA_DEV_NONE;
2844 } else if (classes[dev->devno] == ATA_DEV_UNKNOWN) { 2838 } else if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
2845 ata_dev_printk(dev, KERN_DEBUG, "link status unknown, " 2839 ata_dev_dbg(dev,
2846 "clearing UNKNOWN to NONE\n"); 2840 "link status unknown, clearing UNKNOWN to NONE\n");
2847 classes[dev->devno] = ATA_DEV_NONE; 2841 classes[dev->devno] = ATA_DEV_NONE;
2848 } 2842 }
2849 } 2843 }
2850 2844
2851 if (classify && nr_unknown) { 2845 if (classify && nr_unknown) {
2852 if (try < max_tries) { 2846 if (try < max_tries) {
2853 ata_link_printk(link, KERN_WARNING, "link online but " 2847 ata_link_warn(link,
2854 "%d devices misclassified, retrying\n", 2848 "link online but %d devices misclassified, retrying\n",
2855 nr_unknown); 2849 nr_unknown);
2856 failed_link = link; 2850 failed_link = link;
2857 rc = -EAGAIN; 2851 rc = -EAGAIN;
2858 goto fail; 2852 goto fail;
2859 } 2853 }
2860 ata_link_printk(link, KERN_WARNING, 2854 ata_link_warn(link,
2861 "link online but %d devices misclassified, " 2855 "link online but %d devices misclassified, "
2862 "device detection might fail\n", nr_unknown); 2856 "device detection might fail\n", nr_unknown);
2863 } 2857 }
2864 2858
2865 /* reset successful, schedule revalidation */ 2859 /* reset successful, schedule revalidation */
@@ -2889,14 +2883,23 @@ int ata_eh_reset(struct ata_link *link, int classify,
2889 sata_scr_read(link, SCR_STATUS, &sstatus)) 2883 sata_scr_read(link, SCR_STATUS, &sstatus))
2890 rc = -ERESTART; 2884 rc = -ERESTART;
2891 2885
2892 if (rc == -ERESTART || try >= max_tries) 2886 if (rc == -ERESTART || try >= max_tries) {
2887 /*
2888 * Thaw host port even if reset failed, so that the port
2889 * can be retried on the next phy event. This risks
2890 * repeated EH runs but seems to be a better tradeoff than
2891 * shutting down a port after a botched hotplug attempt.
2892 */
2893 if (ata_is_host_link(link))
2894 ata_eh_thaw_port(ap);
2893 goto out; 2895 goto out;
2896 }
2894 2897
2895 now = jiffies; 2898 now = jiffies;
2896 if (time_before(now, deadline)) { 2899 if (time_before(now, deadline)) {
2897 unsigned long delta = deadline - now; 2900 unsigned long delta = deadline - now;
2898 2901
2899 ata_link_printk(failed_link, KERN_WARNING, 2902 ata_link_warn(failed_link,
2900 "reset failed (errno=%d), retrying in %u secs\n", 2903 "reset failed (errno=%d), retrying in %u secs\n",
2901 rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000)); 2904 rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000));
2902 2905
@@ -2987,7 +2990,7 @@ static void ata_eh_park_issue_cmd(struct ata_device *dev, int park)
2987 tf.protocol |= ATA_PROT_NODATA; 2990 tf.protocol |= ATA_PROT_NODATA;
2988 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); 2991 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2989 if (park && (err_mask || tf.lbal != 0xc4)) { 2992 if (park && (err_mask || tf.lbal != 0xc4)) {
2990 ata_dev_printk(dev, KERN_ERR, "head unload failed!\n"); 2993 ata_dev_err(dev, "head unload failed!\n");
2991 ehc->unloaded_mask &= ~(1 << dev->devno); 2994 ehc->unloaded_mask &= ~(1 << dev->devno);
2992 } 2995 }
2993} 2996}
@@ -3198,8 +3201,9 @@ static int atapi_eh_clear_ua(struct ata_device *dev)
3198 3201
3199 err_mask = atapi_eh_tur(dev, &sense_key); 3202 err_mask = atapi_eh_tur(dev, &sense_key);
3200 if (err_mask != 0 && err_mask != AC_ERR_DEV) { 3203 if (err_mask != 0 && err_mask != AC_ERR_DEV) {
3201 ata_dev_printk(dev, KERN_WARNING, "TEST_UNIT_READY " 3204 ata_dev_warn(dev,
3202 "failed (err_mask=0x%x)\n", err_mask); 3205 "TEST_UNIT_READY failed (err_mask=0x%x)\n",
3206 err_mask);
3203 return -EIO; 3207 return -EIO;
3204 } 3208 }
3205 3209
@@ -3208,14 +3212,14 @@ static int atapi_eh_clear_ua(struct ata_device *dev)
3208 3212
3209 err_mask = atapi_eh_request_sense(dev, sense_buffer, sense_key); 3213 err_mask = atapi_eh_request_sense(dev, sense_buffer, sense_key);
3210 if (err_mask) { 3214 if (err_mask) {
3211 ata_dev_printk(dev, KERN_WARNING, "failed to clear " 3215 ata_dev_warn(dev, "failed to clear "
3212 "UNIT ATTENTION (err_mask=0x%x)\n", err_mask); 3216 "UNIT ATTENTION (err_mask=0x%x)\n", err_mask);
3213 return -EIO; 3217 return -EIO;
3214 } 3218 }
3215 } 3219 }
3216 3220
3217 ata_dev_printk(dev, KERN_WARNING, 3221 ata_dev_warn(dev, "UNIT ATTENTION persists after %d tries\n",
3218 "UNIT ATTENTION persists after %d tries\n", ATA_EH_UA_TRIES); 3222 ATA_EH_UA_TRIES);
3219 3223
3220 return 0; 3224 return 0;
3221} 3225}
@@ -3266,7 +3270,7 @@ static int ata_eh_maybe_retry_flush(struct ata_device *dev)
3266 tf.flags |= ATA_TFLAG_DEVICE; 3270 tf.flags |= ATA_TFLAG_DEVICE;
3267 tf.protocol = ATA_PROT_NODATA; 3271 tf.protocol = ATA_PROT_NODATA;
3268 3272
3269 ata_dev_printk(dev, KERN_WARNING, "retrying FLUSH 0x%x Emask 0x%x\n", 3273 ata_dev_warn(dev, "retrying FLUSH 0x%x Emask 0x%x\n",
3270 tf.command, qc->err_mask); 3274 tf.command, qc->err_mask);
3271 3275
3272 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); 3276 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
@@ -3281,7 +3285,7 @@ static int ata_eh_maybe_retry_flush(struct ata_device *dev)
3281 */ 3285 */
3282 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1); 3286 qc->scsicmd->allowed = max(qc->scsicmd->allowed, 1);
3283 } else { 3287 } else {
3284 ata_dev_printk(dev, KERN_WARNING, "FLUSH failed Emask 0x%x\n", 3288 ata_dev_warn(dev, "FLUSH failed Emask 0x%x\n",
3285 err_mask); 3289 err_mask);
3286 rc = -EIO; 3290 rc = -EIO;
3287 3291
@@ -3355,9 +3359,9 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3355 err_mask = ata_dev_set_feature(dev, 3359 err_mask = ata_dev_set_feature(dev,
3356 SETFEATURES_SATA_DISABLE, SATA_DIPM); 3360 SETFEATURES_SATA_DISABLE, SATA_DIPM);
3357 if (err_mask && err_mask != AC_ERR_DEV) { 3361 if (err_mask && err_mask != AC_ERR_DEV) {
3358 ata_dev_printk(dev, KERN_WARNING, 3362 ata_dev_warn(dev,
3359 "failed to disable DIPM, Emask 0x%x\n", 3363 "failed to disable DIPM, Emask 0x%x\n",
3360 err_mask); 3364 err_mask);
3361 rc = -EIO; 3365 rc = -EIO;
3362 goto fail; 3366 goto fail;
3363 } 3367 }
@@ -3399,7 +3403,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3399 err_mask = ata_dev_set_feature(dev, 3403 err_mask = ata_dev_set_feature(dev,
3400 SETFEATURES_SATA_ENABLE, SATA_DIPM); 3404 SETFEATURES_SATA_ENABLE, SATA_DIPM);
3401 if (err_mask && err_mask != AC_ERR_DEV) { 3405 if (err_mask && err_mask != AC_ERR_DEV) {
3402 ata_dev_printk(dev, KERN_WARNING, 3406 ata_dev_warn(dev,
3403 "failed to enable DIPM, Emask 0x%x\n", 3407 "failed to enable DIPM, Emask 0x%x\n",
3404 err_mask); 3408 err_mask);
3405 rc = -EIO; 3409 rc = -EIO;
@@ -3418,8 +3422,7 @@ fail:
3418 3422
3419 /* if no device or only one more chance is left, disable LPM */ 3423 /* if no device or only one more chance is left, disable LPM */
3420 if (!dev || ehc->tries[dev->devno] <= 2) { 3424 if (!dev || ehc->tries[dev->devno] <= 2) {
3421 ata_link_printk(link, KERN_WARNING, 3425 ata_link_warn(link, "disabling LPM on the link\n");
3422 "disabling LPM on the link\n");
3423 link->flags |= ATA_LFLAG_NO_LPM; 3426 link->flags |= ATA_LFLAG_NO_LPM;
3424 } 3427 }
3425 if (r_failed_dev) 3428 if (r_failed_dev)
@@ -3690,8 +3693,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
3690 rc = ata_eh_reset(link, ata_link_nr_vacant(link), 3693 rc = ata_eh_reset(link, ata_link_nr_vacant(link),
3691 prereset, softreset, hardreset, postreset); 3694 prereset, softreset, hardreset, postreset);
3692 if (rc) { 3695 if (rc) {
3693 ata_link_printk(link, KERN_ERR, 3696 ata_link_err(link, "reset failed, giving up\n");
3694 "reset failed, giving up\n");
3695 goto out; 3697 goto out;
3696 } 3698 }
3697 } 3699 }
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index f06b7ea590d3..3eb2b816eb2a 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -147,8 +147,8 @@ int sata_pmp_scr_read(struct ata_link *link, int reg, u32 *r_val)
147 147
148 err_mask = sata_pmp_read(link, reg, r_val); 148 err_mask = sata_pmp_read(link, reg, r_val);
149 if (err_mask) { 149 if (err_mask) {
150 ata_link_printk(link, KERN_WARNING, "failed to read SCR %d " 150 ata_link_warn(link, "failed to read SCR %d (Emask=0x%x)\n",
151 "(Emask=0x%x)\n", reg, err_mask); 151 reg, err_mask);
152 return -EIO; 152 return -EIO;
153 } 153 }
154 return 0; 154 return 0;
@@ -178,8 +178,8 @@ int sata_pmp_scr_write(struct ata_link *link, int reg, u32 val)
178 178
179 err_mask = sata_pmp_write(link, reg, val); 179 err_mask = sata_pmp_write(link, reg, val);
180 if (err_mask) { 180 if (err_mask) {
181 ata_link_printk(link, KERN_WARNING, "failed to write SCR %d " 181 ata_link_warn(link, "failed to write SCR %d (Emask=0x%x)\n",
182 "(Emask=0x%x)\n", reg, err_mask); 182 reg, err_mask);
183 return -EIO; 183 return -EIO;
184 } 184 }
185 return 0; 185 return 0;
@@ -231,8 +231,8 @@ static int sata_pmp_read_gscr(struct ata_device *dev, u32 *gscr)
231 231
232 err_mask = sata_pmp_read(dev->link, reg, &gscr[reg]); 232 err_mask = sata_pmp_read(dev->link, reg, &gscr[reg]);
233 if (err_mask) { 233 if (err_mask) {
234 ata_dev_printk(dev, KERN_ERR, "failed to read PMP " 234 ata_dev_err(dev, "failed to read PMP GSCR[%d] (Emask=0x%x)\n",
235 "GSCR[%d] (Emask=0x%x)\n", reg, err_mask); 235 reg, err_mask);
236 return -EIO; 236 return -EIO;
237 } 237 }
238 } 238 }
@@ -311,26 +311,25 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info)
311 } 311 }
312 312
313 if (print_info) { 313 if (print_info) {
314 ata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, " 314 ata_dev_info(dev, "Port Multiplier %s, "
315 "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n", 315 "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n",
316 sata_pmp_spec_rev_str(gscr), vendor, devid, 316 sata_pmp_spec_rev_str(gscr), vendor, devid,
317 sata_pmp_gscr_rev(gscr), 317 sata_pmp_gscr_rev(gscr),
318 nr_ports, gscr[SATA_PMP_GSCR_FEAT_EN], 318 nr_ports, gscr[SATA_PMP_GSCR_FEAT_EN],
319 gscr[SATA_PMP_GSCR_FEAT]); 319 gscr[SATA_PMP_GSCR_FEAT]);
320 320
321 if (!(dev->flags & ATA_DFLAG_AN)) 321 if (!(dev->flags & ATA_DFLAG_AN))
322 ata_dev_printk(dev, KERN_INFO, 322 ata_dev_info(dev,
323 "Asynchronous notification not supported, " 323 "Asynchronous notification not supported, "
324 "hotplug won't\n work on fan-out " 324 "hotplug won't work on fan-out ports. Use warm-plug instead.\n");
325 "ports. Use warm-plug instead.\n");
326 } 325 }
327 326
328 return 0; 327 return 0;
329 328
330 fail: 329 fail:
331 ata_dev_printk(dev, KERN_ERR, 330 ata_dev_err(dev,
332 "failed to configure Port Multiplier (%s, Emask=0x%x)\n", 331 "failed to configure Port Multiplier (%s, Emask=0x%x)\n",
333 reason, err_mask); 332 reason, err_mask);
334 return rc; 333 return rc;
335} 334}
336 335
@@ -485,20 +484,17 @@ int sata_pmp_attach(struct ata_device *dev)
485 484
486 /* is it hanging off the right place? */ 485 /* is it hanging off the right place? */
487 if (!sata_pmp_supported(ap)) { 486 if (!sata_pmp_supported(ap)) {
488 ata_dev_printk(dev, KERN_ERR, 487 ata_dev_err(dev, "host does not support Port Multiplier\n");
489 "host does not support Port Multiplier\n");
490 return -EINVAL; 488 return -EINVAL;
491 } 489 }
492 490
493 if (!ata_is_host_link(link)) { 491 if (!ata_is_host_link(link)) {
494 ata_dev_printk(dev, KERN_ERR, 492 ata_dev_err(dev, "Port Multipliers cannot be nested\n");
495 "Port Multipliers cannot be nested\n");
496 return -EINVAL; 493 return -EINVAL;
497 } 494 }
498 495
499 if (dev->devno) { 496 if (dev->devno) {
500 ata_dev_printk(dev, KERN_ERR, 497 ata_dev_err(dev, "Port Multiplier must be the first device\n");
501 "Port Multiplier must be the first device\n");
502 return -EINVAL; 498 return -EINVAL;
503 } 499 }
504 500
@@ -517,8 +513,7 @@ int sata_pmp_attach(struct ata_device *dev)
517 513
518 rc = sata_pmp_init_links(ap, sata_pmp_gscr_ports(dev->gscr)); 514 rc = sata_pmp_init_links(ap, sata_pmp_gscr_ports(dev->gscr));
519 if (rc) { 515 if (rc) {
520 ata_dev_printk(dev, KERN_INFO, 516 ata_dev_info(dev, "failed to initialize PMP links\n");
521 "failed to initialize PMP links\n");
522 goto fail; 517 goto fail;
523 } 518 }
524 519
@@ -562,7 +557,7 @@ static void sata_pmp_detach(struct ata_device *dev)
562 struct ata_link *tlink; 557 struct ata_link *tlink;
563 unsigned long flags; 558 unsigned long flags;
564 559
565 ata_dev_printk(dev, KERN_INFO, "Port Multiplier detaching\n"); 560 ata_dev_info(dev, "Port Multiplier detaching\n");
566 561
567 WARN_ON(!ata_is_host_link(link) || dev->devno || 562 WARN_ON(!ata_is_host_link(link) || dev->devno ||
568 link->pmp != SATA_PMP_CTRL_PORT); 563 link->pmp != SATA_PMP_CTRL_PORT);
@@ -609,23 +604,23 @@ static int sata_pmp_same_pmp(struct ata_device *dev, const u32 *new_gscr)
609 new_nr_ports = sata_pmp_gscr_ports(new_gscr); 604 new_nr_ports = sata_pmp_gscr_ports(new_gscr);
610 605
611 if (old_vendor != new_vendor) { 606 if (old_vendor != new_vendor) {
612 ata_dev_printk(dev, KERN_INFO, "Port Multiplier " 607 ata_dev_info(dev,
613 "vendor mismatch '0x%x' != '0x%x'\n", 608 "Port Multiplier vendor mismatch '0x%x' != '0x%x'\n",
614 old_vendor, new_vendor); 609 old_vendor, new_vendor);
615 return 0; 610 return 0;
616 } 611 }
617 612
618 if (old_devid != new_devid) { 613 if (old_devid != new_devid) {
619 ata_dev_printk(dev, KERN_INFO, "Port Multiplier " 614 ata_dev_info(dev,
620 "device ID mismatch '0x%x' != '0x%x'\n", 615 "Port Multiplier device ID mismatch '0x%x' != '0x%x'\n",
621 old_devid, new_devid); 616 old_devid, new_devid);
622 return 0; 617 return 0;
623 } 618 }
624 619
625 if (old_nr_ports != new_nr_ports) { 620 if (old_nr_ports != new_nr_ports) {
626 ata_dev_printk(dev, KERN_INFO, "Port Multiplier " 621 ata_dev_info(dev,
627 "nr_ports mismatch '0x%x' != '0x%x'\n", 622 "Port Multiplier nr_ports mismatch '0x%x' != '0x%x'\n",
628 old_nr_ports, new_nr_ports); 623 old_nr_ports, new_nr_ports);
629 return 0; 624 return 0;
630 } 625 }
631 626
@@ -691,8 +686,7 @@ static int sata_pmp_revalidate(struct ata_device *dev, unsigned int new_class)
691 return 0; 686 return 0;
692 687
693 fail: 688 fail:
694 ata_dev_printk(dev, KERN_ERR, 689 ata_dev_err(dev, "PMP revalidation failed (errno=%d)\n", rc);
695 "PMP revalidation failed (errno=%d)\n", rc);
696 DPRINTK("EXIT, rc=%d\n", rc); 690 DPRINTK("EXIT, rc=%d\n", rc);
697 return rc; 691 return rc;
698} 692}
@@ -716,13 +710,14 @@ static int sata_pmp_revalidate_quick(struct ata_device *dev)
716 710
717 err_mask = sata_pmp_read(dev->link, SATA_PMP_GSCR_PROD_ID, &prod_id); 711 err_mask = sata_pmp_read(dev->link, SATA_PMP_GSCR_PROD_ID, &prod_id);
718 if (err_mask) { 712 if (err_mask) {
719 ata_dev_printk(dev, KERN_ERR, "failed to read PMP product ID " 713 ata_dev_err(dev,
720 "(Emask=0x%x)\n", err_mask); 714 "failed to read PMP product ID (Emask=0x%x)\n",
715 err_mask);
721 return -EIO; 716 return -EIO;
722 } 717 }
723 718
724 if (prod_id != dev->gscr[SATA_PMP_GSCR_PROD_ID]) { 719 if (prod_id != dev->gscr[SATA_PMP_GSCR_PROD_ID]) {
725 ata_dev_printk(dev, KERN_ERR, "PMP product ID mismatch\n"); 720 ata_dev_err(dev, "PMP product ID mismatch\n");
726 /* something weird is going on, request full PMP recovery */ 721 /* something weird is going on, request full PMP recovery */
727 return -EIO; 722 return -EIO;
728 } 723 }
@@ -777,8 +772,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
777 rc = ata_eh_reset(link, 0, prereset, softreset, hardreset, 772 rc = ata_eh_reset(link, 0, prereset, softreset, hardreset,
778 postreset); 773 postreset);
779 if (rc) { 774 if (rc) {
780 ata_link_printk(link, KERN_ERR, 775 ata_link_err(link, "failed to reset PMP, giving up\n");
781 "failed to reset PMP, giving up\n");
782 goto fail; 776 goto fail;
783 } 777 }
784 778
@@ -819,9 +813,9 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
819 ehc->i.action |= ATA_EH_RESET; 813 ehc->i.action |= ATA_EH_RESET;
820 goto retry; 814 goto retry;
821 } else { 815 } else {
822 ata_dev_printk(dev, KERN_ERR, "failed to recover PMP " 816 ata_dev_err(dev,
823 "after %d tries, giving up\n", 817 "failed to recover PMP after %d tries, giving up\n",
824 ATA_EH_PMP_TRIES); 818 ATA_EH_PMP_TRIES);
825 goto fail; 819 goto fail;
826 } 820 }
827 } 821 }
@@ -867,8 +861,9 @@ static int sata_pmp_eh_handle_disabled_links(struct ata_port *ap)
867 /* unconditionally clear SError.N */ 861 /* unconditionally clear SError.N */
868 rc = sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG); 862 rc = sata_scr_write(link, SCR_ERROR, SERR_PHYRDY_CHG);
869 if (rc) { 863 if (rc) {
870 ata_link_printk(link, KERN_ERR, "failed to clear " 864 ata_link_err(link,
871 "SError.N (errno=%d)\n", rc); 865 "failed to clear SError.N (errno=%d)\n",
866 rc);
872 return rc; 867 return rc;
873 } 868 }
874 869
@@ -890,7 +885,7 @@ static int sata_pmp_handle_link_fail(struct ata_link *link, int *link_tries)
890 885
891 /* disable this link */ 886 /* disable this link */
892 if (!(link->flags & ATA_LFLAG_DISABLED)) { 887 if (!(link->flags & ATA_LFLAG_DISABLED)) {
893 ata_link_printk(link, KERN_WARNING, 888 ata_link_warn(link,
894 "failed to recover link after %d tries, disabling\n", 889 "failed to recover link after %d tries, disabling\n",
895 ATA_EH_PMP_LINK_TRIES); 890 ATA_EH_PMP_LINK_TRIES);
896 891
@@ -974,7 +969,7 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
974 err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN, 969 err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN,
975 gscr[SATA_PMP_GSCR_FEAT_EN]); 970 gscr[SATA_PMP_GSCR_FEAT_EN]);
976 if (err_mask) { 971 if (err_mask) {
977 ata_link_printk(pmp_link, KERN_WARNING, 972 ata_link_warn(pmp_link,
978 "failed to disable NOTIFY (err_mask=0x%x)\n", 973 "failed to disable NOTIFY (err_mask=0x%x)\n",
979 err_mask); 974 err_mask);
980 goto pmp_fail; 975 goto pmp_fail;
@@ -1018,8 +1013,9 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
1018 err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN, 1013 err_mask = sata_pmp_write(pmp_link, SATA_PMP_GSCR_FEAT_EN,
1019 gscr[SATA_PMP_GSCR_FEAT_EN]); 1014 gscr[SATA_PMP_GSCR_FEAT_EN]);
1020 if (err_mask) { 1015 if (err_mask) {
1021 ata_dev_printk(pmp_dev, KERN_ERR, "failed to write " 1016 ata_dev_err(pmp_dev,
1022 "PMP_FEAT_EN (Emask=0x%x)\n", err_mask); 1017 "failed to write PMP_FEAT_EN (Emask=0x%x)\n",
1018 err_mask);
1023 rc = -EIO; 1019 rc = -EIO;
1024 goto pmp_fail; 1020 goto pmp_fail;
1025 } 1021 }
@@ -1028,8 +1024,9 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
1028 /* check GSCR_ERROR */ 1024 /* check GSCR_ERROR */
1029 err_mask = sata_pmp_read(pmp_link, SATA_PMP_GSCR_ERROR, &gscr_error); 1025 err_mask = sata_pmp_read(pmp_link, SATA_PMP_GSCR_ERROR, &gscr_error);
1030 if (err_mask) { 1026 if (err_mask) {
1031 ata_dev_printk(pmp_dev, KERN_ERR, "failed to read " 1027 ata_dev_err(pmp_dev,
1032 "PMP_GSCR_ERROR (Emask=0x%x)\n", err_mask); 1028 "failed to read PMP_GSCR_ERROR (Emask=0x%x)\n",
1029 err_mask);
1033 rc = -EIO; 1030 rc = -EIO;
1034 goto pmp_fail; 1031 goto pmp_fail;
1035 } 1032 }
@@ -1043,17 +1040,16 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
1043 ata_ehi_hotplugged(&link->eh_context.i); 1040 ata_ehi_hotplugged(&link->eh_context.i);
1044 cnt++; 1041 cnt++;
1045 } else { 1042 } else {
1046 ata_link_printk(link, KERN_WARNING, 1043 ata_link_warn(link,
1047 "PHY status changed but maxed out on retries, " 1044 "PHY status changed but maxed out on retries, giving up\n");
1048 "giving up\n"); 1045 ata_link_warn(link,
1049 ata_link_printk(link, KERN_WARNING, 1046 "Manually issue scan to resume this link\n");
1050 "Manully issue scan to resume this link\n");
1051 } 1047 }
1052 } 1048 }
1053 1049
1054 if (cnt) { 1050 if (cnt) {
1055 ata_port_printk(ap, KERN_INFO, "PMP SError.N set for some " 1051 ata_port_info(ap,
1056 "ports, repeating recovery\n"); 1052 "PMP SError.N set for some ports, repeating recovery\n");
1057 goto retry; 1053 goto retry;
1058 } 1054 }
1059 1055
@@ -1081,9 +1077,8 @@ static int sata_pmp_eh_recover(struct ata_port *ap)
1081 goto retry; 1077 goto retry;
1082 } 1078 }
1083 1079
1084 ata_port_printk(ap, KERN_ERR, 1080 ata_port_err(ap, "failed to recover PMP after %d tries, giving up\n",
1085 "failed to recover PMP after %d tries, giving up\n", 1081 ATA_EH_PMP_TRIES);
1086 ATA_EH_PMP_TRIES);
1087 sata_pmp_detach(pmp_dev); 1082 sata_pmp_detach(pmp_dev);
1088 ata_dev_disable(pmp_dev); 1083 ata_dev_disable(pmp_dev);
1089 1084
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 927f968e99d9..46d087f08607 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1108,8 +1108,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
1108 /* configure draining */ 1108 /* configure draining */
1109 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL); 1109 buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
1110 if (!buf) { 1110 if (!buf) {
1111 ata_dev_printk(dev, KERN_ERR, 1111 ata_dev_err(dev, "drain buffer allocation failed\n");
1112 "drain buffer allocation failed\n");
1113 return -ENOMEM; 1112 return -ENOMEM;
1114 } 1113 }
1115 1114
@@ -1127,7 +1126,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev,
1127 * IDENTIFY_PACKET is executed as ATA_PROT_PIO. 1126 * IDENTIFY_PACKET is executed as ATA_PROT_PIO.
1128 */ 1127 */
1129 if (sdev->sector_size > PAGE_SIZE) 1128 if (sdev->sector_size > PAGE_SIZE)
1130 ata_dev_printk(dev, KERN_WARNING, 1129 ata_dev_warn(dev,
1131 "sector_size=%u > PAGE_SIZE, PIO may malfunction\n", 1130 "sector_size=%u > PAGE_SIZE, PIO may malfunction\n",
1132 sdev->sector_size); 1131 sdev->sector_size);
1133 1132
@@ -1784,8 +1783,7 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
1784 if (cmd->sc_data_direction == DMA_FROM_DEVICE || 1783 if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
1785 cmd->sc_data_direction == DMA_TO_DEVICE) { 1784 cmd->sc_data_direction == DMA_TO_DEVICE) {
1786 if (unlikely(scsi_bufflen(cmd) < 1)) { 1785 if (unlikely(scsi_bufflen(cmd) < 1)) {
1787 ata_dev_printk(dev, KERN_WARNING, 1786 ata_dev_warn(dev, "WARNING: zero len r/w req\n");
1788 "WARNING: zero len r/w req\n");
1789 goto err_did; 1787 goto err_did;
1790 } 1788 }
1791 1789
@@ -2969,9 +2967,8 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2969 * with the cached multi_count of libata 2967 * with the cached multi_count of libata
2970 */ 2968 */
2971 if (multi_count != dev->multi_count) 2969 if (multi_count != dev->multi_count)
2972 ata_dev_printk(dev, KERN_WARNING, 2970 ata_dev_warn(dev, "invalid multi_count %u ignored\n",
2973 "invalid multi_count %u ignored\n", 2971 multi_count);
2974 multi_count);
2975 } 2972 }
2976 2973
2977 /* 2974 /*
@@ -3466,9 +3463,8 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
3466 goto repeat; 3463 goto repeat;
3467 } 3464 }
3468 3465
3469 ata_port_printk(ap, KERN_ERR, "WARNING: synchronous SCSI scan " 3466 ata_port_err(ap,
3470 "failed without making any progress,\n" 3467 "WARNING: synchronous SCSI scan failed without making any progress, switching to async\n");
3471 " switching to async\n");
3472 } 3468 }
3473 3469
3474 queue_delayed_work(system_long_wq, &ap->hotplug_task, 3470 queue_delayed_work(system_long_wq, &ap->hotplug_task,
@@ -3550,8 +3546,8 @@ static void ata_scsi_remove_dev(struct ata_device *dev)
3550 mutex_unlock(&ap->scsi_host->scan_mutex); 3546 mutex_unlock(&ap->scsi_host->scan_mutex);
3551 3547
3552 if (sdev) { 3548 if (sdev) {
3553 ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n", 3549 ata_dev_info(dev, "detaching (SCSI %s)\n",
3554 dev_name(&sdev->sdev_gendev)); 3550 dev_name(&sdev->sdev_gendev));
3555 3551
3556 scsi_remove_device(sdev); 3552 scsi_remove_device(sdev);
3557 scsi_device_put(sdev); 3553 scsi_device_put(sdev);
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index b1b926c55a72..c24127dd6ef2 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -227,9 +227,9 @@ int ata_sff_busy_sleep(struct ata_port *ap,
227 } 227 }
228 228
229 if (status != 0xff && (status & ATA_BUSY)) 229 if (status != 0xff && (status & ATA_BUSY))
230 ata_port_printk(ap, KERN_WARNING, 230 ata_port_warn(ap,
231 "port is slow to respond, please be patient " 231 "port is slow to respond, please be patient (Status 0x%x)\n",
232 "(Status 0x%x)\n", status); 232 status);
233 233
234 timeout = ata_deadline(timer_start, tmout); 234 timeout = ata_deadline(timer_start, tmout);
235 while (status != 0xff && (status & ATA_BUSY) && 235 while (status != 0xff && (status & ATA_BUSY) &&
@@ -242,9 +242,9 @@ int ata_sff_busy_sleep(struct ata_port *ap,
242 return -ENODEV; 242 return -ENODEV;
243 243
244 if (status & ATA_BUSY) { 244 if (status & ATA_BUSY) {
245 ata_port_printk(ap, KERN_ERR, "port failed to respond " 245 ata_port_err(ap,
246 "(%lu secs, Status 0x%x)\n", 246 "port failed to respond (%lu secs, Status 0x%x)\n",
247 DIV_ROUND_UP(tmout, 1000), status); 247 DIV_ROUND_UP(tmout, 1000), status);
248 return -EBUSY; 248 return -EBUSY;
249 } 249 }
250 250
@@ -350,8 +350,8 @@ static void ata_dev_select(struct ata_port *ap, unsigned int device,
350 unsigned int wait, unsigned int can_sleep) 350 unsigned int wait, unsigned int can_sleep)
351{ 351{
352 if (ata_msg_probe(ap)) 352 if (ata_msg_probe(ap))
353 ata_port_printk(ap, KERN_INFO, "ata_dev_select: ENTER, " 353 ata_port_info(ap, "ata_dev_select: ENTER, device %u, wait %u\n",
354 "device %u, wait %u\n", device, wait); 354 device, wait);
355 355
356 if (wait) 356 if (wait)
357 ata_wait_idle(ap); 357 ata_wait_idle(ap);
@@ -1333,9 +1333,10 @@ void ata_sff_flush_pio_task(struct ata_port *ap)
1333 1333
1334 cancel_delayed_work_sync(&ap->sff_pio_task); 1334 cancel_delayed_work_sync(&ap->sff_pio_task);
1335 ap->hsm_task_state = HSM_ST_IDLE; 1335 ap->hsm_task_state = HSM_ST_IDLE;
1336 ap->sff_pio_task_link = NULL;
1336 1337
1337 if (ata_msg_ctl(ap)) 1338 if (ata_msg_ctl(ap))
1338 ata_port_printk(ap, KERN_DEBUG, "%s: EXIT\n", __func__); 1339 ata_port_dbg(ap, "%s: EXIT\n", __func__);
1339} 1340}
1340 1341
1341static void ata_sff_pio_task(struct work_struct *work) 1342static void ata_sff_pio_task(struct work_struct *work)
@@ -1513,7 +1514,7 @@ static unsigned int ata_sff_idle_irq(struct ata_port *ap)
1513 ap->ops->sff_check_status(ap); 1514 ap->ops->sff_check_status(ap);
1514 if (ap->ops->sff_irq_clear) 1515 if (ap->ops->sff_irq_clear)
1515 ap->ops->sff_irq_clear(ap); 1516 ap->ops->sff_irq_clear(ap);
1516 ata_port_printk(ap, KERN_WARNING, "irq trap\n"); 1517 ata_port_warn(ap, "irq trap\n");
1517 return 1; 1518 return 1;
1518 } 1519 }
1519#endif 1520#endif
@@ -1711,7 +1712,7 @@ void ata_sff_lost_interrupt(struct ata_port *ap)
1711 1712
1712 /* There was a command running, we are no longer busy and we have 1713 /* There was a command running, we are no longer busy and we have
1713 no interrupt. */ 1714 no interrupt. */
1714 ata_port_printk(ap, KERN_WARNING, "lost interrupt (Status 0x%x)\n", 1715 ata_port_warn(ap, "lost interrupt (Status 0x%x)\n",
1715 status); 1716 status);
1716 /* Run the host interrupt logic as if the interrupt had not been 1717 /* Run the host interrupt logic as if the interrupt had not been
1717 lost */ 1718 lost */
@@ -1798,8 +1799,9 @@ int ata_sff_prereset(struct ata_link *link, unsigned long deadline)
1798 if (!ata_link_offline(link)) { 1799 if (!ata_link_offline(link)) {
1799 rc = ata_sff_wait_ready(link, deadline); 1800 rc = ata_sff_wait_ready(link, deadline);
1800 if (rc && rc != -ENODEV) { 1801 if (rc && rc != -ENODEV) {
1801 ata_link_printk(link, KERN_WARNING, "device not ready " 1802 ata_link_warn(link,
1802 "(errno=%d), forcing hardreset\n", rc); 1803 "device not ready (errno=%d), forcing hardreset\n",
1804 rc);
1803 ehc->i.action |= ATA_EH_HARDRESET; 1805 ehc->i.action |= ATA_EH_HARDRESET;
1804 } 1806 }
1805 } 1807 }
@@ -2056,7 +2058,7 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
2056 rc = ata_bus_softreset(ap, devmask, deadline); 2058 rc = ata_bus_softreset(ap, devmask, deadline);
2057 /* if link is occupied, -ENODEV too is an error */ 2059 /* if link is occupied, -ENODEV too is an error */
2058 if (rc && (rc != -ENODEV || sata_scr_valid(link))) { 2060 if (rc && (rc != -ENODEV || sata_scr_valid(link))) {
2059 ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc); 2061 ata_link_err(link, "SRST failed (errno=%d)\n", rc);
2060 return rc; 2062 return rc;
2061 } 2063 }
2062 2064
@@ -2170,8 +2172,7 @@ void ata_sff_drain_fifo(struct ata_queued_cmd *qc)
2170 2172
2171 /* Can become DEBUG later */ 2173 /* Can become DEBUG later */
2172 if (count) 2174 if (count)
2173 ata_port_printk(ap, KERN_DEBUG, 2175 ata_port_dbg(ap, "drained %d bytes to clear DRQ\n", count);
2174 "drained %d bytes to clear DRQ.\n", count);
2175 2176
2176} 2177}
2177EXPORT_SYMBOL_GPL(ata_sff_drain_fifo); 2178EXPORT_SYMBOL_GPL(ata_sff_drain_fifo);
@@ -2316,9 +2317,9 @@ int ata_pci_sff_init_host(struct ata_host *host)
2316 rc = pcim_iomap_regions(pdev, 0x3 << base, 2317 rc = pcim_iomap_regions(pdev, 0x3 << base,
2317 dev_driver_string(gdev)); 2318 dev_driver_string(gdev));
2318 if (rc) { 2319 if (rc) {
2319 dev_printk(KERN_WARNING, gdev, 2320 dev_warn(gdev,
2320 "failed to request/iomap BARs for port %d " 2321 "failed to request/iomap BARs for port %d (errno=%d)\n",
2321 "(errno=%d)\n", i, rc); 2322 i, rc);
2322 if (rc == -EBUSY) 2323 if (rc == -EBUSY)
2323 pcim_pin_device(pdev); 2324 pcim_pin_device(pdev);
2324 ap->ops = &ata_dummy_port_ops; 2325 ap->ops = &ata_dummy_port_ops;
@@ -2340,7 +2341,7 @@ int ata_pci_sff_init_host(struct ata_host *host)
2340 } 2341 }
2341 2342
2342 if (!mask) { 2343 if (!mask) {
2343 dev_printk(KERN_ERR, gdev, "no available native port\n"); 2344 dev_err(gdev, "no available native port\n");
2344 return -ENODEV; 2345 return -ENODEV;
2345 } 2346 }
2346 2347
@@ -2375,8 +2376,7 @@ int ata_pci_sff_prepare_host(struct pci_dev *pdev,
2375 2376
2376 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2); 2377 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
2377 if (!host) { 2378 if (!host) {
2378 dev_printk(KERN_ERR, &pdev->dev, 2379 dev_err(&pdev->dev, "failed to allocate ATA host\n");
2379 "failed to allocate ATA host\n");
2380 rc = -ENOMEM; 2380 rc = -ENOMEM;
2381 goto err_out; 2381 goto err_out;
2382 } 2382 }
@@ -2542,8 +2542,7 @@ int ata_pci_sff_init_one(struct pci_dev *pdev,
2542 2542
2543 pi = ata_sff_find_valid_pi(ppi); 2543 pi = ata_sff_find_valid_pi(ppi);
2544 if (!pi) { 2544 if (!pi) {
2545 dev_printk(KERN_ERR, &pdev->dev, 2545 dev_err(&pdev->dev, "no valid port_info specified\n");
2546 "no valid port_info specified\n");
2547 return -EINVAL; 2546 return -EINVAL;
2548 } 2547 }
2549 2548
@@ -3164,8 +3163,7 @@ static void ata_bmdma_nodma(struct ata_host *host, const char *reason)
3164{ 3163{
3165 int i; 3164 int i;
3166 3165
3167 dev_printk(KERN_ERR, host->dev, "BMDMA: %s, falling back to PIO\n", 3166 dev_err(host->dev, "BMDMA: %s, falling back to PIO\n", reason);
3168 reason);
3169 3167
3170 for (i = 0; i < 2; i++) { 3168 for (i = 0; i < 2; i++) {
3171 host->ports[i]->mwdma_mask = 0; 3169 host->ports[i]->mwdma_mask = 0;
@@ -3297,8 +3295,7 @@ int ata_pci_bmdma_init_one(struct pci_dev *pdev,
3297 3295
3298 pi = ata_sff_find_valid_pi(ppi); 3296 pi = ata_sff_find_valid_pi(ppi);
3299 if (!pi) { 3297 if (!pi) {
3300 dev_printk(KERN_ERR, &pdev->dev, 3298 dev_err(&pdev->dev, "no valid port_info specified\n");
3301 "no valid port_info specified\n");
3302 return -EINVAL; 3299 return -EINVAL;
3303 } 3300 }
3304 3301
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index 91949d997555..54145edf50e8 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -195,8 +195,6 @@ static int pacpi_port_start(struct ata_port *ap)
195 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 195 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
196 struct pata_acpi *acpi; 196 struct pata_acpi *acpi;
197 197
198 int ret;
199
200 if (ap->acpi_handle == NULL) 198 if (ap->acpi_handle == NULL)
201 return -ENODEV; 199 return -ENODEV;
202 200
@@ -205,11 +203,7 @@ static int pacpi_port_start(struct ata_port *ap)
205 return -ENOMEM; 203 return -ENOMEM;
206 acpi->mask[0] = pacpi_discover_modes(ap, &ap->link.device[0]); 204 acpi->mask[0] = pacpi_discover_modes(ap, &ap->link.device[0]);
207 acpi->mask[1] = pacpi_discover_modes(ap, &ap->link.device[1]); 205 acpi->mask[1] = pacpi_discover_modes(ap, &ap->link.device[1]);
208 ret = ata_bmdma_port_start(ap); 206 return ata_bmdma_port_start(ap);
209 if (ret < 0)
210 return ret;
211
212 return ret;
213} 207}
214 208
215static struct scsi_host_template pacpi_sht = { 209static struct scsi_host_template pacpi_sht = {
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 794ec6e3275d..cadd67998bac 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -287,10 +287,10 @@ static void ali_warn_atapi_dma(struct ata_device *adev)
287 int print_info = ehc->i.flags & ATA_EHI_PRINTINFO; 287 int print_info = ehc->i.flags & ATA_EHI_PRINTINFO;
288 288
289 if (print_info && adev->class == ATA_DEV_ATAPI && !ali_atapi_dma) { 289 if (print_info && adev->class == ATA_DEV_ATAPI && !ali_atapi_dma) {
290 ata_dev_printk(adev, KERN_WARNING, 290 ata_dev_warn(adev,
291 "WARNING: ATAPI DMA disabled for reliability issues. It can be enabled\n"); 291 "WARNING: ATAPI DMA disabled for reliability issues. It can be enabled\n");
292 ata_dev_printk(adev, KERN_WARNING, 292 ata_dev_warn(adev,
293 "WARNING: via pata_ali.atapi_dma modparam or corresponding sysfs node.\n"); 293 "WARNING: via pata_ali.atapi_dma modparam or corresponding sysfs node.\n");
294 } 294 }
295} 295}
296 296
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index b0975a5ad8c4..dc6b5dae0463 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -60,7 +60,7 @@ static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offse
60 UT = T / 2; 60 UT = T / 2;
61 61
62 if (ata_timing_compute(adev, speed, &at, T, UT) < 0) { 62 if (ata_timing_compute(adev, speed, &at, T, UT) < 0) {
63 dev_printk(KERN_ERR, &pdev->dev, "unknown mode %d.\n", speed); 63 dev_err(&pdev->dev, "unknown mode %d\n", speed);
64 return; 64 return;
65 } 65 }
66 66
@@ -311,7 +311,7 @@ static unsigned long nv_mode_filter(struct ata_device *dev,
311 cable detection result */ 311 cable detection result */
312 limit |= ata_pack_xfermask(ATA_PIO4, ATA_MWDMA2, ATA_UDMA2); 312 limit |= ata_pack_xfermask(ATA_PIO4, ATA_MWDMA2, ATA_UDMA2);
313 313
314 ata_port_printk(ap, KERN_DEBUG, "nv_mode_filter: 0x%lx&0x%lx->0x%lx, " 314 ata_port_dbg(ap, "nv_mode_filter: 0x%lx&0x%lx->0x%lx, "
315 "BIOS=0x%lx (0x%x) ACPI=0x%lx%s\n", 315 "BIOS=0x%lx (0x%x) ACPI=0x%lx%s\n",
316 xfer_mask, limit, xfer_mask & limit, bios_limit, 316 xfer_mask, limit, xfer_mask & limit, bios_limit,
317 saved_udma, acpi_limit, acpi_str); 317 saved_udma, acpi_limit, acpi_str);
@@ -530,14 +530,12 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
530 } 530 }
531 }; 531 };
532 const struct ata_port_info *ppi[] = { NULL, NULL }; 532 const struct ata_port_info *ppi[] = { NULL, NULL };
533 static int printed_version;
534 int type = id->driver_data; 533 int type = id->driver_data;
535 void *hpriv = NULL; 534 void *hpriv = NULL;
536 u8 fifo; 535 u8 fifo;
537 int rc; 536 int rc;
538 537
539 if (!printed_version++) 538 ata_print_version_once(&pdev->dev, DRV_VERSION);
540 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
541 539
542 rc = pcim_enable_device(pdev); 540 rc = pcim_enable_device(pdev);
543 if (rc) 541 if (rc)
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 2215632e4b31..78a93b690959 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -346,7 +346,6 @@ static struct ata_port_operations artop6260_ops = {
346 346
347static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) 347static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
348{ 348{
349 static int printed_version;
350 static const struct ata_port_info info_6210 = { 349 static const struct ata_port_info info_6210 = {
351 .flags = ATA_FLAG_SLAVE_POSS, 350 .flags = ATA_FLAG_SLAVE_POSS,
352 .pio_mask = ATA_PIO4, 351 .pio_mask = ATA_PIO4,
@@ -378,9 +377,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
378 const struct ata_port_info *ppi[] = { NULL, NULL }; 377 const struct ata_port_info *ppi[] = { NULL, NULL };
379 int rc; 378 int rc;
380 379
381 if (!printed_version++) 380 ata_print_version_once(&pdev->dev, DRV_VERSION);
382 dev_printk(KERN_DEBUG, &pdev->dev,
383 "version " DRV_VERSION "\n");
384 381
385 rc = pcim_enable_device(pdev); 382 rc = pcim_enable_device(pdev);
386 if (rc) 383 if (rc)
diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c
index 95295935dd95..3cfabb262af2 100644
--- a/drivers/ata/pata_atp867x.c
+++ b/drivers/ata/pata_atp867x.c
@@ -470,7 +470,7 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
470 } 470 }
471 471
472 if (!mask) { 472 if (!mask) {
473 dev_printk(KERN_ERR, gdev, "no available native port\n"); 473 dev_err(gdev, "no available native port\n");
474 return -ENODEV; 474 return -ENODEV;
475 } 475 }
476 476
@@ -487,7 +487,6 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
487static int atp867x_init_one(struct pci_dev *pdev, 487static int atp867x_init_one(struct pci_dev *pdev,
488 const struct pci_device_id *id) 488 const struct pci_device_id *id)
489{ 489{
490 static int printed_version;
491 static const struct ata_port_info info_867x = { 490 static const struct ata_port_info info_867x = {
492 .flags = ATA_FLAG_SLAVE_POSS, 491 .flags = ATA_FLAG_SLAVE_POSS,
493 .pio_mask = ATA_PIO4, 492 .pio_mask = ATA_PIO4,
@@ -499,8 +498,7 @@ static int atp867x_init_one(struct pci_dev *pdev,
499 const struct ata_port_info *ppi[] = { &info_867x, NULL }; 498 const struct ata_port_info *ppi[] = { &info_867x, NULL };
500 int rc; 499 int rc;
501 500
502 if (!printed_version++) 501 ata_print_version_once(&pdev->dev, DRV_VERSION);
503 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
504 502
505 rc = pcim_enable_device(pdev); 503 rc = pcim_enable_device(pdev);
506 if (rc) 504 if (rc)
@@ -511,15 +509,14 @@ static int atp867x_init_one(struct pci_dev *pdev,
511 509
512 host = ata_host_alloc_pinfo(&pdev->dev, ppi, ATP867X_NUM_PORTS); 510 host = ata_host_alloc_pinfo(&pdev->dev, ppi, ATP867X_NUM_PORTS);
513 if (!host) { 511 if (!host) {
514 dev_printk(KERN_ERR, &pdev->dev, 512 dev_err(&pdev->dev, "failed to allocate ATA host\n");
515 "failed to allocate ATA host\n");
516 rc = -ENOMEM; 513 rc = -ENOMEM;
517 goto err_out; 514 goto err_out;
518 } 515 }
519 516
520 rc = atp867x_ata_pci_sff_init_host(host); 517 rc = atp867x_ata_pci_sff_init_host(host);
521 if (rc) { 518 if (rc) {
522 dev_printk(KERN_ERR, &pdev->dev, "failed to init host\n"); 519 dev_err(&pdev->dev, "failed to init host\n");
523 goto err_out; 520 goto err_out;
524 } 521 }
525 522
@@ -528,7 +525,7 @@ static int atp867x_init_one(struct pci_dev *pdev,
528 rc = ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, 525 rc = ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
529 IRQF_SHARED, &atp867x_sht); 526 IRQF_SHARED, &atp867x_sht);
530 if (rc) 527 if (rc)
531 dev_printk(KERN_ERR, &pdev->dev, "failed to activate host\n"); 528 dev_err(&pdev->dev, "failed to activate host\n");
532 529
533err_out: 530err_out:
534 return rc; 531 return rc;
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index ea64967000ff..bd987bb082eb 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1129,7 +1129,7 @@ static int bfin_softreset(struct ata_link *link, unsigned int *classes,
1129 /* issue bus reset */ 1129 /* issue bus reset */
1130 err_mask = bfin_bus_softreset(ap, devmask); 1130 err_mask = bfin_bus_softreset(ap, devmask);
1131 if (err_mask) { 1131 if (err_mask) {
1132 ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n", 1132 ata_port_err(ap, "SRST failed (err_mask=0x%x)\n",
1133 err_mask); 1133 err_mask);
1134 return -EIO; 1134 return -EIO;
1135 } 1135 }
@@ -1382,7 +1382,7 @@ idle_irq:
1382#ifdef ATA_IRQ_TRAP 1382#ifdef ATA_IRQ_TRAP
1383 if ((ap->stats.idle_irq % 1000) == 0) { 1383 if ((ap->stats.idle_irq % 1000) == 0) {
1384 ap->ops->irq_ack(ap, 0); /* debug trap */ 1384 ap->ops->irq_ack(ap, 0); /* debug trap */
1385 ata_port_printk(ap, KERN_WARNING, "irq trap\n"); 1385 ata_port_warn(ap, "irq trap\n");
1386 return 1; 1386 return 1;
1387 } 1387 }
1388#endif 1388#endif
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index e3254fcff0f1..9ddcddc66a20 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -149,8 +149,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi
149 ppi[1] = &pi; 149 ppi[1] = &pi;
150 150
151 if ((pcicfg & 0x40) == 0) { 151 if ((pcicfg & 0x40) == 0) {
152 dev_printk(KERN_WARNING, &pdev->dev, 152 dev_warn(&pdev->dev, "DMA mode disabled. Enabling.\n");
153 "DMA mode disabled. Enabling.\n");
154 pci_write_config_byte(pdev, 0x60, pcicfg | 0x40); 153 pci_write_config_byte(pdev, 0x60, pcicfg | 0x40);
155 } 154 }
156 155
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c
index a08834758ea2..aca47e4e29ea 100644
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -263,7 +263,6 @@ static struct ata_port_operations efar_ops = {
263 263
264static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 264static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
265{ 265{
266 static int printed_version;
267 static const struct ata_port_info info = { 266 static const struct ata_port_info info = {
268 .flags = ATA_FLAG_SLAVE_POSS, 267 .flags = ATA_FLAG_SLAVE_POSS,
269 .pio_mask = ATA_PIO4, 268 .pio_mask = ATA_PIO4,
@@ -273,9 +272,7 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
273 }; 272 };
274 const struct ata_port_info *ppi[] = { &info, &info }; 273 const struct ata_port_info *ppi[] = { &info, &info };
275 274
276 if (!printed_version++) 275 ata_print_version_once(&pdev->dev, DRV_VERSION);
277 dev_printk(KERN_DEBUG, &pdev->dev,
278 "version " DRV_VERSION "\n");
279 276
280 return ata_pci_bmdma_init_one(pdev, ppi, &efar_sht, NULL, 277 return ata_pci_bmdma_init_one(pdev, ppi, &efar_sht, NULL,
281 ATA_HOST_PARALLEL_SCAN); 278 ATA_HOST_PARALLEL_SCAN);
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c
index 24d7df81546b..b3042dab08bb 100644
--- a/drivers/ata/pata_hpt3x3.c
+++ b/drivers/ata/pata_hpt3x3.c
@@ -185,7 +185,6 @@ static void hpt3x3_init_chipset(struct pci_dev *dev)
185 185
186static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id) 186static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
187{ 187{
188 static int printed_version;
189 static const struct ata_port_info info = { 188 static const struct ata_port_info info = {
190 .flags = ATA_FLAG_SLAVE_POSS, 189 .flags = ATA_FLAG_SLAVE_POSS,
191 .pio_mask = ATA_PIO4, 190 .pio_mask = ATA_PIO4,
@@ -206,8 +205,7 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
206 205
207 hpt3x3_init_chipset(pdev); 206 hpt3x3_init_chipset(pdev);
208 207
209 if (!printed_version++) 208 ata_print_version_once(&pdev->dev, DRV_VERSION);
210 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
211 209
212 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2); 210 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
213 if (!host) 211 if (!host)
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 9f2889fe43b2..52e7e7b8c74f 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -210,8 +210,8 @@ static void pata_icside_set_dmamode(struct ata_port *ap, struct ata_device *adev
210 else 210 else
211 iomd_type = 'A', cycle = 562; 211 iomd_type = 'A', cycle = 562;
212 212
213 ata_dev_printk(adev, KERN_INFO, "timings: act %dns rec %dns cyc %dns (%c)\n", 213 ata_dev_info(adev, "timings: act %dns rec %dns cyc %dns (%c)\n",
214 t.active, t.recover, t.cycle, iomd_type); 214 t.active, t.recover, t.cycle, iomd_type);
215 215
216 state->port[ap->port_no].speed[adev->devno] = cycle; 216 state->port[ap->port_no].speed[adev->devno] = cycle;
217} 217}
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index 4d142a2ab8fd..998af0e629b1 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -258,7 +258,6 @@ static struct ata_port_operations it8213_ops = {
258 258
259static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 259static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
260{ 260{
261 static int printed_version;
262 static const struct ata_port_info info = { 261 static const struct ata_port_info info = {
263 .flags = ATA_FLAG_SLAVE_POSS, 262 .flags = ATA_FLAG_SLAVE_POSS,
264 .pio_mask = ATA_PIO4, 263 .pio_mask = ATA_PIO4,
@@ -269,9 +268,7 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en
269 /* Current IT8213 stuff is single port */ 268 /* Current IT8213 stuff is single port */
270 const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; 269 const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
271 270
272 if (!printed_version++) 271 ata_print_version_once(&pdev->dev, DRV_VERSION);
273 dev_printk(KERN_DEBUG, &pdev->dev,
274 "version " DRV_VERSION "\n");
275 272
276 return ata_pci_bmdma_init_one(pdev, ppi, &it8213_sht, NULL, 0); 273 return ata_pci_bmdma_init_one(pdev, ppi, &it8213_sht, NULL, 0);
277} 274}
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 2d15f2548a10..62c5d00abd2e 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -473,12 +473,12 @@ static int it821x_smart_set_mode(struct ata_link *link, struct ata_device **unus
473 /* We do need the right mode information for DMA or PIO 473 /* We do need the right mode information for DMA or PIO
474 and this comes from the current configuration flags */ 474 and this comes from the current configuration flags */
475 if (ata_id_has_dma(dev->id)) { 475 if (ata_id_has_dma(dev->id)) {
476 ata_dev_printk(dev, KERN_INFO, "configured for DMA\n"); 476 ata_dev_info(dev, "configured for DMA\n");
477 dev->xfer_mode = XFER_MW_DMA_0; 477 dev->xfer_mode = XFER_MW_DMA_0;
478 dev->xfer_shift = ATA_SHIFT_MWDMA; 478 dev->xfer_shift = ATA_SHIFT_MWDMA;
479 dev->flags &= ~ATA_DFLAG_PIO; 479 dev->flags &= ~ATA_DFLAG_PIO;
480 } else { 480 } else {
481 ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); 481 ata_dev_info(dev, "configured for PIO\n");
482 dev->xfer_mode = XFER_PIO_0; 482 dev->xfer_mode = XFER_PIO_0;
483 dev->xfer_shift = ATA_SHIFT_PIO; 483 dev->xfer_shift = ATA_SHIFT_PIO;
484 dev->flags |= ATA_DFLAG_PIO; 484 dev->flags |= ATA_DFLAG_PIO;
@@ -508,12 +508,12 @@ static void it821x_dev_config(struct ata_device *adev)
508 508
509 if (strstr(model_num, "Integrated Technology Express")) { 509 if (strstr(model_num, "Integrated Technology Express")) {
510 /* RAID mode */ 510 /* RAID mode */
511 ata_dev_printk(adev, KERN_INFO, "%sRAID%d volume", 511 ata_dev_info(adev, "%sRAID%d volume",
512 adev->id[147]?"Bootable ":"", 512 adev->id[147] ? "Bootable " : "",
513 adev->id[129]); 513 adev->id[129]);
514 if (adev->id[129] != 1) 514 if (adev->id[129] != 1)
515 printk("(%dK stripe)", adev->id[146]); 515 pr_cont("(%dK stripe)", adev->id[146]);
516 printk(".\n"); 516 pr_cont("\n");
517 } 517 }
518 /* This is a controller firmware triggered funny, don't 518 /* This is a controller firmware triggered funny, don't
519 report the drive faulty! */ 519 report the drive faulty! */
@@ -610,7 +610,7 @@ static void it821x_display_disk(int n, u8 *buf)
610 char *cbl = "(40 wire cable)"; 610 char *cbl = "(40 wire cable)";
611 611
612 static const char *types[5] = { 612 static const char *types[5] = {
613 "RAID0", "RAID1" "RAID 0+1", "JBOD", "DISK" 613 "RAID0", "RAID1", "RAID 0+1", "JBOD", "DISK"
614 }; 614 };
615 615
616 if (buf[52] > 4) /* No Disk */ 616 if (buf[52] > 4) /* No Disk */
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index f6b3f995f58a..15b64311fe0a 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -31,7 +31,7 @@ static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error)
31 struct ata_device *dev; 31 struct ata_device *dev;
32 32
33 ata_for_each_dev(dev, link, ENABLED) { 33 ata_for_each_dev(dev, link, ENABLED) {
34 ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); 34 ata_dev_info(dev, "configured for PIO0\n");
35 dev->pio_mode = XFER_PIO_0; 35 dev->pio_mode = XFER_PIO_0;
36 dev->xfer_mode = XFER_PIO_0; 36 dev->xfer_mode = XFER_PIO_0;
37 dev->xfer_shift = ATA_SHIFT_PIO; 37 dev->xfer_shift = ATA_SHIFT_PIO;
@@ -181,7 +181,7 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
181 181
182 ixp4xx_setup_port(ap, data, cs0->start, cs1->start); 182 ixp4xx_setup_port(ap, data, cs0->start, cs1->start);
183 183
184 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n"); 184 ata_print_version_once(&pdev->dev, DRV_VERSION);
185 185
186 /* activate host */ 186 /* activate host */
187 return ata_host_activate(host, irq, ata_sff_interrupt, 0, &ixp4xx_sht); 187 return ata_host_activate(host, irq, ata_sff_interrupt, 0, &ixp4xx_sht);
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 6bd9425ba5ab..d960f8e9e8b1 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -213,7 +213,7 @@ static int legacy_set_mode(struct ata_link *link, struct ata_device **unused)
213 struct ata_device *dev; 213 struct ata_device *dev;
214 214
215 ata_for_each_dev(dev, link, ENABLED) { 215 ata_for_each_dev(dev, link, ENABLED) {
216 ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); 216 ata_dev_info(dev, "configured for PIO\n");
217 dev->pio_mode = XFER_PIO_0; 217 dev->pio_mode = XFER_PIO_0;
218 dev->xfer_mode = XFER_PIO_0; 218 dev->xfer_mode = XFER_PIO_0;
219 dev->xfer_shift = ATA_SHIFT_PIO; 219 dev->xfer_shift = ATA_SHIFT_PIO;
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c
index 46f589edccdb..b057e3fa44bc 100644
--- a/drivers/ata/pata_macio.c
+++ b/drivers/ata/pata_macio.c
@@ -772,8 +772,9 @@ static void pata_macio_reset_hw(struct pata_macio_priv *priv, int resume)
772 pci_restore_state(priv->pdev); 772 pci_restore_state(priv->pdev);
773 rc = pcim_enable_device(priv->pdev); 773 rc = pcim_enable_device(priv->pdev);
774 if (rc) 774 if (rc)
775 dev_printk(KERN_ERR, &priv->pdev->dev, 775 dev_err(&priv->pdev->dev,
776 "Failed to enable device after resume (%d)\n", rc); 776 "Failed to enable device after resume (%d)\n",
777 rc);
777 else 778 else
778 pci_set_master(priv->pdev); 779 pci_set_master(priv->pdev);
779 } 780 }
@@ -812,7 +813,7 @@ static int pata_macio_slave_config(struct scsi_device *sdev)
812 blk_queue_update_dma_pad(sdev->request_queue, 31); 813 blk_queue_update_dma_pad(sdev->request_queue, 31);
813 814
814 /* Tell the world about it */ 815 /* Tell the world about it */
815 ata_dev_printk(dev, KERN_INFO, "OHare alignment limits applied\n"); 816 ata_dev_info(dev, "OHare alignment limits applied\n");
816 return 0; 817 return 0;
817 } 818 }
818 819
@@ -838,8 +839,7 @@ static int pata_macio_slave_config(struct scsi_device *sdev)
838 cmd | PCI_COMMAND_INVALIDATE); 839 cmd | PCI_COMMAND_INVALIDATE);
839 840
840 /* Tell the world about it */ 841 /* Tell the world about it */
841 ata_dev_printk(dev, KERN_INFO, 842 ata_dev_info(dev, "K2/Shasta alignment limits applied\n");
842 "K2/Shasta alignment limits applied\n");
843 } 843 }
844 844
845 return 0; 845 return 0;
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index d8d9c5807740..9dc16df84191 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -152,15 +152,13 @@ static struct ata_port_operations mpiix_port_ops = {
152static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 152static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
153{ 153{
154 /* Single threaded by the PCI probe logic */ 154 /* Single threaded by the PCI probe logic */
155 static int printed_version;
156 struct ata_host *host; 155 struct ata_host *host;
157 struct ata_port *ap; 156 struct ata_port *ap;
158 void __iomem *cmd_addr, *ctl_addr; 157 void __iomem *cmd_addr, *ctl_addr;
159 u16 idetim; 158 u16 idetim;
160 int cmd, ctl, irq; 159 int cmd, ctl, irq;
161 160
162 if (!printed_version++) 161 ata_print_version_once(&dev->dev, DRV_VERSION);
163 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
164 162
165 host = ata_host_alloc(&dev->dev, 1); 163 host = ata_host_alloc(&dev->dev, 1);
166 if (!host) 164 if (!host)
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c
index 3eb921c746a1..9979a43bc596 100644
--- a/drivers/ata/pata_netcell.c
+++ b/drivers/ata/pata_netcell.c
@@ -57,7 +57,6 @@ static struct ata_port_operations netcell_ops = {
57 57
58static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 58static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
59{ 59{
60 static int printed_version;
61 static const struct ata_port_info info = { 60 static const struct ata_port_info info = {
62 .flags = ATA_FLAG_SLAVE_POSS, 61 .flags = ATA_FLAG_SLAVE_POSS,
63 /* Actually we don't really care about these as the 62 /* Actually we don't really care about these as the
@@ -70,9 +69,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e
70 const struct ata_port_info *port_info[] = { &info, NULL }; 69 const struct ata_port_info *port_info[] = { &info, NULL };
71 int rc; 70 int rc;
72 71
73 if (!printed_version++) 72 ata_print_version_once(&pdev->dev, DRV_VERSION);
74 dev_printk(KERN_DEBUG, &pdev->dev,
75 "version " DRV_VERSION "\n");
76 73
77 rc = pcim_enable_device(pdev); 74 rc = pcim_enable_device(pdev);
78 if (rc) 75 if (rc)
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index 2110863bb3db..31d5986537a3 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -86,7 +86,7 @@ static void ns87410_set_piomode(struct ata_port *ap, struct ata_device *adev)
86 idefr &= ~0x04; 86 idefr &= ~0x04;
87 87
88 if (ata_timing_compute(adev, adev->pio_mode, &at, 30303, 1) < 0) { 88 if (ata_timing_compute(adev, adev->pio_mode, &at, 30303, 1) < 0) {
89 dev_printk(KERN_ERR, &pdev->dev, "unknown mode %d.\n", adev->pio_mode); 89 dev_err(&pdev->dev, "unknown mode %d\n", adev->pio_mode);
90 return; 90 return;
91 } 91 }
92 92
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c
index 605f198f958c..f1d517bc5b49 100644
--- a/drivers/ata/pata_ns87415.c
+++ b/drivers/ata/pata_ns87415.c
@@ -350,7 +350,6 @@ static void ns87415_fixup(struct pci_dev *pdev)
350 350
351static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 351static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
352{ 352{
353 static int printed_version;
354 static const struct ata_port_info info = { 353 static const struct ata_port_info info = {
355 .flags = ATA_FLAG_SLAVE_POSS, 354 .flags = ATA_FLAG_SLAVE_POSS,
356 .pio_mask = ATA_PIO4, 355 .pio_mask = ATA_PIO4,
@@ -370,9 +369,7 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e
370 if (PCI_SLOT(pdev->devfn) == 0x0E) 369 if (PCI_SLOT(pdev->devfn) == 0x0E)
371 ppi[0] = &info87560; 370 ppi[0] = &info87560;
372#endif 371#endif
373 if (!printed_version++) 372 ata_print_version_once(&pdev->dev, DRV_VERSION);
374 dev_printk(KERN_DEBUG, &pdev->dev,
375 "version " DRV_VERSION "\n");
376 373
377 rc = pcim_enable_device(pdev); 374 rc = pcim_enable_device(pdev);
378 if (rc) 375 if (rc)
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 220ddc90608f..1d61d5d278fa 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -405,7 +405,7 @@ static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes,
405 405
406 rc = ata_sff_wait_after_reset(link, 1, deadline); 406 rc = ata_sff_wait_after_reset(link, 1, deadline);
407 if (rc) { 407 if (rc) {
408 ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc); 408 ata_link_err(link, "SRST failed (errno=%d)\n", rc);
409 return rc; 409 return rc;
410 } 410 }
411 411
@@ -807,6 +807,7 @@ static int __devinit octeon_cf_probe(struct platform_device *pdev)
807 irq_handler_t irq_handler = NULL; 807 irq_handler_t irq_handler = NULL;
808 void __iomem *base; 808 void __iomem *base;
809 struct octeon_cf_port *cf_port; 809 struct octeon_cf_port *cf_port;
810 char version[32];
810 811
811 res_cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); 812 res_cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
812 813
@@ -905,10 +906,11 @@ static int __devinit octeon_cf_probe(struct platform_device *pdev)
905 ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr); 906 ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
906 907
907 908
908 dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n", 909 snprintf(version, sizeof(version), "%s %d bit%s",
910 DRV_VERSION,
909 (ocd->is16bit) ? 16 : 8, 911 (ocd->is16bit) ? 16 : 8,
910 (cs1) ? ", True IDE" : ""); 912 (cs1) ? ", True IDE" : "");
911 913 ata_print_version_once(&pdev->dev, version);
912 914
913 return ata_host_activate(host, irq, irq_handler, 0, &octeon_cf_sht); 915 return ata_host_activate(host, irq, irq_handler, 0, &octeon_cf_sht);
914 916
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index b811c1636204..98cdf50e4065 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -235,7 +235,6 @@ static struct ata_port_operations oldpiix_pata_ops = {
235 235
236static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 236static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
237{ 237{
238 static int printed_version;
239 static const struct ata_port_info info = { 238 static const struct ata_port_info info = {
240 .flags = ATA_FLAG_SLAVE_POSS, 239 .flags = ATA_FLAG_SLAVE_POSS,
241 .pio_mask = ATA_PIO4, 240 .pio_mask = ATA_PIO4,
@@ -244,9 +243,7 @@ static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *e
244 }; 243 };
245 const struct ata_port_info *ppi[] = { &info, NULL }; 244 const struct ata_port_info *ppi[] = { &info, NULL };
246 245
247 if (!printed_version++) 246 ata_print_version_once(&pdev->dev, DRV_VERSION);
248 dev_printk(KERN_DEBUG, &pdev->dev,
249 "version " DRV_VERSION "\n");
250 247
251 return ata_pci_bmdma_init_one(pdev, ppi, &oldpiix_sht, NULL, 0); 248 return ata_pci_bmdma_init_one(pdev, ppi, &oldpiix_sht, NULL, 0);
252} 249}
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index 00c5a02a94fc..accc033faf77 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -167,10 +167,8 @@ static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id)
167 .port_ops = &opti_port_ops 167 .port_ops = &opti_port_ops
168 }; 168 };
169 const struct ata_port_info *ppi[] = { &info, NULL }; 169 const struct ata_port_info *ppi[] = { &info, NULL };
170 static int printed_version;
171 170
172 if (!printed_version++) 171 ata_print_version_once(&dev->dev, DRV_VERSION);
173 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
174 172
175 return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL, 0); 173 return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL, 0);
176} 174}
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index 0852cd07de08..77cb91408632 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -411,11 +411,9 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
411 .port_ops = &optiplus_port_ops 411 .port_ops = &optiplus_port_ops
412 }; 412 };
413 const struct ata_port_info *ppi[] = { &info_82c700, NULL }; 413 const struct ata_port_info *ppi[] = { &info_82c700, NULL };
414 static int printed_version;
415 int rc; 414 int rc;
416 415
417 if (!printed_version++) 416 ata_print_version_once(&dev->dev, DRV_VERSION);
418 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
419 417
420 rc = pcim_enable_device(dev); 418 rc = pcim_enable_device(dev);
421 if (rc) 419 if (rc)
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 021abe6d8527..a808ba03bd7f 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -68,7 +68,7 @@ static int pcmcia_set_mode(struct ata_link *link, struct ata_device **r_failed_d
68 the same vendor - check serial */ 68 the same vendor - check serial */
69 if (memcmp(master->id + ATA_ID_SERNO, slave->id + ATA_ID_SERNO, 69 if (memcmp(master->id + ATA_ID_SERNO, slave->id + ATA_ID_SERNO,
70 ATA_ID_SERNO_LEN) == 0 && master->id[ATA_ID_SERNO] >> 8) { 70 ATA_ID_SERNO_LEN) == 0 && master->id[ATA_ID_SERNO] >> 8) {
71 ata_dev_printk(slave, KERN_WARNING, "is a ghost device, ignoring.\n"); 71 ata_dev_warn(slave, "is a ghost device, ignoring\n");
72 ata_dev_disable(slave); 72 ata_dev_disable(slave);
73 } 73 }
74 } 74 }
@@ -142,8 +142,7 @@ static void pcmcia_8bit_drain_fifo(struct ata_queued_cmd *qc)
142 ioread8(ap->ioaddr.data_addr); 142 ioread8(ap->ioaddr.data_addr);
143 143
144 if (count) 144 if (count)
145 ata_port_printk(ap, KERN_WARNING, "drained %d bytes to clear DRQ.\n", 145 ata_port_warn(ap, "drained %d bytes to clear DRQ\n", count);
146 count);
147 146
148} 147}
149 148
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 9765ace16921..b1511f38b0e8 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -655,7 +655,7 @@ static int pdc_hardware_init(struct ata_host *host, unsigned int board_idx)
655 */ 655 */
656 pll_clock = pdc_detect_pll_input_clock(host); 656 pll_clock = pdc_detect_pll_input_clock(host);
657 657
658 dev_printk(KERN_INFO, host->dev, "PLL input clock %ld kHz\n", pll_clock/1000); 658 dev_info(host->dev, "PLL input clock %ld kHz\n", pll_clock/1000);
659 659
660 /* Adjust PLL control register */ 660 /* Adjust PLL control register */
661 pdc_adjust_pll(host, pll_clock, board_idx); 661 pdc_adjust_pll(host, pll_clock, board_idx);
@@ -697,7 +697,6 @@ static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base)
697 */ 697 */
698static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 698static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
699{ 699{
700 static int printed_version;
701 static const unsigned long cmd_offset[] = { 0x17c0, 0x15c0 }; 700 static const unsigned long cmd_offset[] = { 0x17c0, 0x15c0 };
702 static const unsigned long bmdma_offset[] = { 0x1000, 0x1008 }; 701 static const unsigned long bmdma_offset[] = { 0x1000, 0x1008 };
703 unsigned int board_idx = (unsigned int) ent->driver_data; 702 unsigned int board_idx = (unsigned int) ent->driver_data;
@@ -707,8 +706,7 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de
707 void __iomem *mmio_base; 706 void __iomem *mmio_base;
708 int i, rc; 707 int i, rc;
709 708
710 if (!printed_version++) 709 ata_print_version_once(&pdev->dev, DRV_VERSION);
711 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
712 710
713 /* alloc host */ 711 /* alloc host */
714 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2); 712 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 50400fa120fe..2067308f683f 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -39,7 +39,7 @@ static int pata_platform_set_mode(struct ata_link *link, struct ata_device **unu
39 dev->pio_mode = dev->xfer_mode = XFER_PIO_0; 39 dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
40 dev->xfer_shift = ATA_SHIFT_PIO; 40 dev->xfer_shift = ATA_SHIFT_PIO;
41 dev->flags |= ATA_DFLAG_PIO; 41 dev->flags |= ATA_DFLAG_PIO;
42 ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); 42 ata_dev_info(dev, "configured for PIO\n");
43 } 43 }
44 return 0; 44 return 0;
45} 45}
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index 8574b31f1773..b2d3a2bb4e60 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -213,7 +213,6 @@ static struct ata_port_operations radisys_pata_ops = {
213 213
214static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 214static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
215{ 215{
216 static int printed_version;
217 static const struct ata_port_info info = { 216 static const struct ata_port_info info = {
218 .flags = ATA_FLAG_SLAVE_POSS, 217 .flags = ATA_FLAG_SLAVE_POSS,
219 .pio_mask = ATA_PIO4, 218 .pio_mask = ATA_PIO4,
@@ -223,9 +222,7 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *e
223 }; 222 };
224 const struct ata_port_info *ppi[] = { &info, NULL }; 223 const struct ata_port_info *ppi[] = { &info, NULL };
225 224
226 if (!printed_version++) 225 ata_print_version_once(&pdev->dev, DRV_VERSION);
227 dev_printk(KERN_DEBUG, &pdev->dev,
228 "version " DRV_VERSION "\n");
229 226
230 return ata_pci_bmdma_init_one(pdev, ppi, &radisys_sht, NULL, 0); 227 return ata_pci_bmdma_init_one(pdev, ppi, &radisys_sht, NULL, 0);
231} 228}
diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c
index 5fbe9b166c69..4d318f86ae86 100644
--- a/drivers/ata/pata_rdc.c
+++ b/drivers/ata/pata_rdc.c
@@ -312,7 +312,6 @@ static struct scsi_host_template rdc_sht = {
312static int __devinit rdc_init_one(struct pci_dev *pdev, 312static int __devinit rdc_init_one(struct pci_dev *pdev,
313 const struct pci_device_id *ent) 313 const struct pci_device_id *ent)
314{ 314{
315 static int printed_version;
316 struct device *dev = &pdev->dev; 315 struct device *dev = &pdev->dev;
317 struct ata_port_info port_info[2]; 316 struct ata_port_info port_info[2];
318 const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] }; 317 const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
@@ -321,9 +320,7 @@ static int __devinit rdc_init_one(struct pci_dev *pdev,
321 struct rdc_host_priv *hpriv; 320 struct rdc_host_priv *hpriv;
322 int rc; 321 int rc;
323 322
324 if (!printed_version++) 323 ata_print_version_once(&pdev->dev, DRV_VERSION);
325 dev_printk(KERN_DEBUG, &pdev->dev,
326 "version " DRV_VERSION "\n");
327 324
328 port_info[0] = rdc_port_info; 325 port_info[0] = rdc_port_info;
329 port_info[1] = rdc_port_info; 326 port_info[1] = rdc_port_info;
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
index 4d04471794b6..aca321e1e6a2 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -44,7 +44,7 @@ static int rz1000_set_mode(struct ata_link *link, struct ata_device **unused)
44 dev->xfer_mode = XFER_PIO_0; 44 dev->xfer_mode = XFER_PIO_0;
45 dev->xfer_shift = ATA_SHIFT_PIO; 45 dev->xfer_shift = ATA_SHIFT_PIO;
46 dev->flags |= ATA_DFLAG_PIO; 46 dev->flags |= ATA_DFLAG_PIO;
47 ata_dev_printk(dev, KERN_INFO, "configured for PIO\n"); 47 ata_dev_info(dev, "configured for PIO\n");
48 } 48 }
49 return 0; 49 return 0;
50} 50}
@@ -92,7 +92,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en
92 }; 92 };
93 const struct ata_port_info *ppi[] = { &info, NULL }; 93 const struct ata_port_info *ppi[] = { &info, NULL };
94 94
95 printk_once(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n"); 95 ata_print_version_once(&pdev->dev, DRV_VERSION);
96 96
97 if (rz1000_fifo_disable(pdev) == 0) 97 if (rz1000_fifo_disable(pdev) == 0)
98 return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL, 0); 98 return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL, 0);
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c
index c446ae6055a3..1b372c297195 100644
--- a/drivers/ata/pata_samsung_cf.c
+++ b/drivers/ata/pata_samsung_cf.c
@@ -376,7 +376,7 @@ static int pata_s3c_softreset(struct ata_link *link, unsigned int *classes,
376 rc = pata_s3c_bus_softreset(ap, deadline); 376 rc = pata_s3c_bus_softreset(ap, deadline);
377 /* if link is occupied, -ENODEV too is an error */ 377 /* if link is occupied, -ENODEV too is an error */
378 if (rc && rc != -ENODEV) { 378 if (rc && rc != -ENODEV) {
379 ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc); 379 ata_link_err(link, "SRST failed (errno=%d)\n", rc);
380 return rc; 380 return rc;
381 } 381 }
382 382
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 88ea9b677b47..eb748e327143 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -637,8 +637,7 @@ static int scc_softreset(struct ata_link *link, unsigned int *classes,
637 DPRINTK("about to softreset, devmask=%x\n", devmask); 637 DPRINTK("about to softreset, devmask=%x\n", devmask);
638 err_mask = scc_bus_softreset(ap, devmask, deadline); 638 err_mask = scc_bus_softreset(ap, devmask, deadline);
639 if (err_mask) { 639 if (err_mask) {
640 ata_port_printk(ap, KERN_ERR, "SRST failed (err_mask=0x%x)\n", 640 ata_port_err(ap, "SRST failed (err_mask=0x%x)\n", err_mask);
641 err_mask);
642 return -EIO; 641 return -EIO;
643 } 642 }
644 643
@@ -1072,15 +1071,12 @@ static int scc_host_init(struct ata_host *host)
1072 1071
1073static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 1072static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1074{ 1073{
1075 static int printed_version;
1076 unsigned int board_idx = (unsigned int) ent->driver_data; 1074 unsigned int board_idx = (unsigned int) ent->driver_data;
1077 const struct ata_port_info *ppi[] = { &scc_port_info[board_idx], NULL }; 1075 const struct ata_port_info *ppi[] = { &scc_port_info[board_idx], NULL };
1078 struct ata_host *host; 1076 struct ata_host *host;
1079 int rc; 1077 int rc;
1080 1078
1081 if (!printed_version++) 1079 ata_print_version_once(&pdev->dev, DRV_VERSION);
1082 dev_printk(KERN_DEBUG, &pdev->dev,
1083 "version " DRV_VERSION "\n");
1084 1080
1085 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 1); 1081 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 1);
1086 if (!host) 1082 if (!host)
diff --git a/drivers/ata/pata_sch.c b/drivers/ata/pata_sch.c
index e97b32f03a6e..7c78b9993627 100644
--- a/drivers/ata/pata_sch.c
+++ b/drivers/ata/pata_sch.c
@@ -172,12 +172,9 @@ static void sch_set_dmamode(struct ata_port *ap, struct ata_device *adev)
172static int __devinit sch_init_one(struct pci_dev *pdev, 172static int __devinit sch_init_one(struct pci_dev *pdev,
173 const struct pci_device_id *ent) 173 const struct pci_device_id *ent)
174{ 174{
175 static int printed_version;
176 const struct ata_port_info *ppi[] = { &sch_port_info, NULL }; 175 const struct ata_port_info *ppi[] = { &sch_port_info, NULL };
177 176
178 if (!printed_version++) 177 ata_print_version_once(&pdev->dev, DRV_VERSION);
179 dev_printk(KERN_DEBUG, &pdev->dev,
180 "version " DRV_VERSION "\n");
181 178
182 return ata_pci_bmdma_init_one(pdev, ppi, &sch_sht, NULL, 0); 179 return ata_pci_bmdma_init_one(pdev, ppi, &sch_sht, NULL, 0);
183} 180}
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 118787caa93f..31f759b0ab71 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -327,13 +327,11 @@ static int __devinit sil680_init_one(struct pci_dev *pdev,
327 .port_ops = &sil680_port_ops 327 .port_ops = &sil680_port_ops
328 }; 328 };
329 const struct ata_port_info *ppi[] = { &info, NULL }; 329 const struct ata_port_info *ppi[] = { &info, NULL };
330 static int printed_version;
331 struct ata_host *host; 330 struct ata_host *host;
332 void __iomem *mmio_base; 331 void __iomem *mmio_base;
333 int rc, try_mmio; 332 int rc, try_mmio;
334 333
335 if (!printed_version++) 334 ata_print_version_once(&pdev->dev, DRV_VERSION);
336 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
337 335
338 rc = pcim_enable_device(pdev); 336 rc = pcim_enable_device(pdev);
339 if (rc) 337 if (rc)
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index be08ff92db17..533f2aefab87 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -681,7 +681,6 @@ static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
681 681
682static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) 682static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
683{ 683{
684 static int printed_version;
685 const struct ata_port_info *ppi[] = { NULL, NULL }; 684 const struct ata_port_info *ppi[] = { NULL, NULL };
686 struct pci_dev *host = NULL; 685 struct pci_dev *host = NULL;
687 struct sis_chipset *chipset = NULL; 686 struct sis_chipset *chipset = NULL;
@@ -735,9 +734,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
735 0x0, &sis_info100 734 0x0, &sis_info100
736 }; 735 };
737 736
738 if (!printed_version++) 737 ata_print_version_once(&pdev->dev, DRV_VERSION);
739 dev_printk(KERN_DEBUG, &pdev->dev,
740 "version " DRV_VERSION "\n");
741 738
742 rc = pcim_enable_device(pdev); 739 rc = pcim_enable_device(pdev);
743 if (rc) 740 if (rc)
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index 7f5d020ed56c..c06ce8ced566 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -317,9 +317,11 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id
317 rev = sl82c105_bridge_revision(dev); 317 rev = sl82c105_bridge_revision(dev);
318 318
319 if (rev == -1) 319 if (rev == -1)
320 dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Unable to find bridge, disabling DMA.\n"); 320 dev_warn(&dev->dev,
321 "pata_sl82c105: Unable to find bridge, disabling DMA\n");
321 else if (rev <= 5) 322 else if (rev <= 5)
322 dev_printk(KERN_WARNING, &dev->dev, "pata_sl82c105: Early bridge revision, no DMA available.\n"); 323 dev_warn(&dev->dev,
324 "pata_sl82c105: Early bridge revision, no DMA available\n");
323 else 325 else
324 ppi[0] = &info_dma; 326 ppi[0] = &info_dma;
325 327
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index b3e0c9432283..28da1c6becf1 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -196,10 +196,8 @@ static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id)
196 .port_ops = &triflex_port_ops 196 .port_ops = &triflex_port_ops
197 }; 197 };
198 const struct ata_port_info *ppi[] = { &info, NULL }; 198 const struct ata_port_info *ppi[] = { &info, NULL };
199 static int printed_version;
200 199
201 if (!printed_version++) 200 ata_print_version_once(&dev->dev, DRV_VERSION);
202 dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
203 201
204 return ata_pci_bmdma_init_one(dev, ppi, &triflex_sht, NULL, 0); 202 return ata_pci_bmdma_init_one(dev, ppi, &triflex_sht, NULL, 0);
205} 203}
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index ac8d7d97e408..65e4be6be220 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -350,8 +350,8 @@ static unsigned long via_mode_filter(struct ata_device *dev, unsigned long mask)
350 if (config->id == PCI_DEVICE_ID_VIA_82C586_0) { 350 if (config->id == PCI_DEVICE_ID_VIA_82C586_0) {
351 ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); 351 ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
352 if (strcmp(model_num, "TS64GSSD25-M") == 0) { 352 if (strcmp(model_num, "TS64GSSD25-M") == 0) {
353 ata_dev_printk(dev, KERN_WARNING, 353 ata_dev_warn(dev,
354 "disabling UDMA mode due to reported lockups with this device.\n"); 354 "disabling UDMA mode due to reported lockups with this device\n");
355 mask &= ~ ATA_MASK_UDMA; 355 mask &= ~ ATA_MASK_UDMA;
356 } 356 }
357 } 357 }
@@ -551,14 +551,12 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
551 const struct ata_port_info *ppi[] = { NULL, NULL }; 551 const struct ata_port_info *ppi[] = { NULL, NULL };
552 struct pci_dev *isa; 552 struct pci_dev *isa;
553 const struct via_isa_bridge *config; 553 const struct via_isa_bridge *config;
554 static int printed_version;
555 u8 enable; 554 u8 enable;
556 u32 timing; 555 u32 timing;
557 unsigned long flags = id->driver_data; 556 unsigned long flags = id->driver_data;
558 int rc; 557 int rc;
559 558
560 if (!printed_version++) 559 ata_print_version_once(&pdev->dev, DRV_VERSION);
561 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
562 560
563 rc = pcim_enable_device(pdev); 561 rc = pcim_enable_device(pdev);
564 if (rc) 562 if (rc)
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 1111712b3d7d..04911d52f59d 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -596,14 +596,12 @@ static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
596 596
597 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 597 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
598 if (rc) { 598 if (rc) {
599 dev_printk(KERN_ERR, &pdev->dev, 599 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
600 "32-bit DMA enable failed\n");
601 return rc; 600 return rc;
602 } 601 }
603 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 602 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
604 if (rc) { 603 if (rc) {
605 dev_printk(KERN_ERR, &pdev->dev, 604 dev_err(&pdev->dev, "32-bit consistent DMA enable failed\n");
606 "32-bit consistent DMA enable failed\n");
607 return rc; 605 return rc;
608 } 606 }
609 return 0; 607 return 0;
@@ -612,15 +610,13 @@ static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
612static int adma_ata_init_one(struct pci_dev *pdev, 610static int adma_ata_init_one(struct pci_dev *pdev,
613 const struct pci_device_id *ent) 611 const struct pci_device_id *ent)
614{ 612{
615 static int printed_version;
616 unsigned int board_idx = (unsigned int) ent->driver_data; 613 unsigned int board_idx = (unsigned int) ent->driver_data;
617 const struct ata_port_info *ppi[] = { &adma_port_info[board_idx], NULL }; 614 const struct ata_port_info *ppi[] = { &adma_port_info[board_idx], NULL };
618 struct ata_host *host; 615 struct ata_host *host;
619 void __iomem *mmio_base; 616 void __iomem *mmio_base;
620 int rc, port_no; 617 int rc, port_no;
621 618
622 if (!printed_version++) 619 ata_print_version_once(&pdev->dev, DRV_VERSION);
623 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
624 620
625 /* alloc host */ 621 /* alloc host */
626 host = ata_host_alloc_pinfo(&pdev->dev, ppi, ADMA_PORTS); 622 host = ata_host_alloc_pinfo(&pdev->dev, ppi, ADMA_PORTS);
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index dc88a39e7db8..b02c4ffa4db0 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -766,11 +766,15 @@ static int dma_dwc_xfer_setup(struct scatterlist *sg, int num_elems,
766static void dma_dwc_exit(struct sata_dwc_device *hsdev) 766static void dma_dwc_exit(struct sata_dwc_device *hsdev)
767{ 767{
768 dev_dbg(host_pvt.dwc_dev, "%s:\n", __func__); 768 dev_dbg(host_pvt.dwc_dev, "%s:\n", __func__);
769 if (host_pvt.sata_dma_regs) 769 if (host_pvt.sata_dma_regs) {
770 iounmap(host_pvt.sata_dma_regs); 770 iounmap(host_pvt.sata_dma_regs);
771 host_pvt.sata_dma_regs = NULL;
772 }
771 773
772 if (hsdev->irq_dma) 774 if (hsdev->irq_dma) {
773 free_irq(hsdev->irq_dma, hsdev); 775 free_irq(hsdev->irq_dma, hsdev);
776 hsdev->irq_dma = 0;
777 }
774} 778}
775 779
776/* 780/*
@@ -1642,7 +1646,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
1642 if (hsdev == NULL) { 1646 if (hsdev == NULL) {
1643 dev_err(&ofdev->dev, "kmalloc failed for hsdev\n"); 1647 dev_err(&ofdev->dev, "kmalloc failed for hsdev\n");
1644 err = -ENOMEM; 1648 err = -ENOMEM;
1645 goto error_out; 1649 goto error;
1646 } 1650 }
1647 memset(hsdev, 0, sizeof(*hsdev)); 1651 memset(hsdev, 0, sizeof(*hsdev));
1648 1652
@@ -1652,7 +1656,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
1652 dev_err(&ofdev->dev, "ioremap failed for SATA register" 1656 dev_err(&ofdev->dev, "ioremap failed for SATA register"
1653 " address\n"); 1657 " address\n");
1654 err = -ENODEV; 1658 err = -ENODEV;
1655 goto error_out; 1659 goto error_kmalloc;
1656 } 1660 }
1657 hsdev->reg_base = base; 1661 hsdev->reg_base = base;
1658 dev_dbg(&ofdev->dev, "ioremap done for SATA register address\n"); 1662 dev_dbg(&ofdev->dev, "ioremap done for SATA register address\n");
@@ -1665,7 +1669,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
1665 if (!host) { 1669 if (!host) {
1666 dev_err(&ofdev->dev, "ata_host_alloc_pinfo failed\n"); 1670 dev_err(&ofdev->dev, "ata_host_alloc_pinfo failed\n");
1667 err = -ENOMEM; 1671 err = -ENOMEM;
1668 goto error_out; 1672 goto error_iomap;
1669 } 1673 }
1670 1674
1671 host->private_data = hsdev; 1675 host->private_data = hsdev;
@@ -1733,8 +1737,11 @@ error_out:
1733 /* Free SATA DMA resources */ 1737 /* Free SATA DMA resources */
1734 dma_dwc_exit(hsdev); 1738 dma_dwc_exit(hsdev);
1735 1739
1736 if (base) 1740error_iomap:
1737 iounmap(base); 1741 iounmap(base);
1742error_kmalloc:
1743 kfree(hsdev);
1744error:
1738 return err; 1745 return err;
1739} 1746}
1740 1747
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 35a71d875d0e..78ae7b67b09e 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -346,12 +346,11 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
346 346
347 /* warn if each s/g element is not dword aligned */ 347 /* warn if each s/g element is not dword aligned */
348 if (sg_addr & 0x03) 348 if (sg_addr & 0x03)
349 ata_port_printk(qc->ap, KERN_ERR, 349 ata_port_err(qc->ap, "s/g addr unaligned : 0x%llx\n",
350 "s/g addr unaligned : 0x%llx\n", 350 (unsigned long long)sg_addr);
351 (unsigned long long)sg_addr);
352 if (sg_len & 0x03) 351 if (sg_len & 0x03)
353 ata_port_printk(qc->ap, KERN_ERR, 352 ata_port_err(qc->ap, "s/g len unaligned : 0x%x\n",
354 "s/g len unaligned : 0x%x\n", sg_len); 353 sg_len);
355 354
356 if (num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1) && 355 if (num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1) &&
357 sg_next(sg) != NULL) { 356 sg_next(sg) != NULL) {
@@ -661,8 +660,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
661 sata_fsl_scr_write(&ap->link, SCR_CONTROL, temp); 660 sata_fsl_scr_write(&ap->link, SCR_CONTROL, temp);
662 661
663 sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp); 662 sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp);
664 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", 663 dev_warn(dev, "scr_control, speed limited to %x\n", temp);
665 temp);
666#endif 664#endif
667 665
668 return 0; 666 return 0;
@@ -740,8 +738,7 @@ try_offline_again:
740 1, 500); 738 1, 500);
741 739
742 if (temp & ONLINE) { 740 if (temp & ONLINE) {
743 ata_port_printk(ap, KERN_ERR, 741 ata_port_err(ap, "Hardreset failed, not off-lined %d\n", i);
744 "Hardreset failed, not off-lined %d\n", i);
745 742
746 /* 743 /*
747 * Try to offline controller atleast twice 744 * Try to offline controller atleast twice
@@ -777,8 +774,7 @@ try_offline_again:
777 temp = ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, 0, 1, 500); 774 temp = ata_wait_register(ap, hcr_base + HSTATUS, ONLINE, 0, 1, 500);
778 775
779 if (!(temp & ONLINE)) { 776 if (!(temp & ONLINE)) {
780 ata_port_printk(ap, KERN_ERR, 777 ata_port_err(ap, "Hardreset failed, not on-lined\n");
781 "Hardreset failed, not on-lined\n");
782 goto err; 778 goto err;
783 } 779 }
784 780
@@ -794,9 +790,8 @@ try_offline_again:
794 790
795 temp = ata_wait_register(ap, hcr_base + HSTATUS, 0xFF, 0, 1, 500); 791 temp = ata_wait_register(ap, hcr_base + HSTATUS, 0xFF, 0, 1, 500);
796 if ((!(temp & 0x10)) || ata_link_offline(link)) { 792 if ((!(temp & 0x10)) || ata_link_offline(link)) {
797 ata_port_printk(ap, KERN_WARNING, 793 ata_port_warn(ap, "No Device OR PHYRDY change,Hstatus = 0x%x\n",
798 "No Device OR PHYRDY change,Hstatus = 0x%x\n", 794 ioread32(hcr_base + HSTATUS));
799 ioread32(hcr_base + HSTATUS));
800 *class = ATA_DEV_NONE; 795 *class = ATA_DEV_NONE;
801 return 0; 796 return 0;
802 } 797 }
@@ -809,13 +804,12 @@ try_offline_again:
809 500, jiffies_to_msecs(deadline - start_jiffies)); 804 500, jiffies_to_msecs(deadline - start_jiffies));
810 805
811 if ((temp & 0xFF) != 0x18) { 806 if ((temp & 0xFF) != 0x18) {
812 ata_port_printk(ap, KERN_WARNING, "No Signature Update\n"); 807 ata_port_warn(ap, "No Signature Update\n");
813 *class = ATA_DEV_NONE; 808 *class = ATA_DEV_NONE;
814 goto do_followup_srst; 809 goto do_followup_srst;
815 } else { 810 } else {
816 ata_port_printk(ap, KERN_INFO, 811 ata_port_info(ap, "Signature Update detected @ %d msecs\n",
817 "Signature Update detected @ %d msecs\n", 812 jiffies_to_msecs(jiffies - start_jiffies));
818 jiffies_to_msecs(jiffies - start_jiffies));
819 *class = sata_fsl_dev_classify(ap); 813 *class = sata_fsl_dev_classify(ap);
820 return 0; 814 return 0;
821 } 815 }
@@ -890,7 +884,7 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
890 884
891 temp = ata_wait_register(ap, CQ + hcr_base, 0x1, 0x1, 1, 5000); 885 temp = ata_wait_register(ap, CQ + hcr_base, 0x1, 0x1, 1, 5000);
892 if (temp & 0x1) { 886 if (temp & 0x1) {
893 ata_port_printk(ap, KERN_WARNING, "ATA_SRST issue failed\n"); 887 ata_port_warn(ap, "ATA_SRST issue failed\n");
894 888
895 DPRINTK("Softreset@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n", 889 DPRINTK("Softreset@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
896 ioread32(CQ + hcr_base), 890 ioread32(CQ + hcr_base),
@@ -1202,8 +1196,7 @@ static irqreturn_t sata_fsl_interrupt(int irq, void *dev_instance)
1202 if (ap) { 1196 if (ap) {
1203 sata_fsl_host_intr(ap); 1197 sata_fsl_host_intr(ap);
1204 } else { 1198 } else {
1205 dev_printk(KERN_WARNING, host->dev, 1199 dev_warn(host->dev, "interrupt on disabled port 0\n");
1206 "interrupt on disabled port 0\n");
1207 } 1200 }
1208 1201
1209 iowrite32(interrupt_enables, hcr_base + HSTATUS); 1202 iowrite32(interrupt_enables, hcr_base + HSTATUS);
@@ -1317,8 +1310,7 @@ static int sata_fsl_probe(struct platform_device *ofdev)
1317 struct ata_port_info pi = sata_fsl_port_info[0]; 1310 struct ata_port_info pi = sata_fsl_port_info[0];
1318 const struct ata_port_info *ppi[] = { &pi, NULL }; 1311 const struct ata_port_info *ppi[] = { &pi, NULL };
1319 1312
1320 dev_printk(KERN_INFO, &ofdev->dev, 1313 dev_info(&ofdev->dev, "Sata FSL Platform/CSB Driver init\n");
1321 "Sata FSL Platform/CSB Driver init\n");
1322 1314
1323 hcr_base = of_iomap(ofdev->dev.of_node, 0); 1315 hcr_base = of_iomap(ofdev->dev.of_node, 0);
1324 if (!hcr_base) 1316 if (!hcr_base)
@@ -1347,7 +1339,7 @@ static int sata_fsl_probe(struct platform_device *ofdev)
1347 1339
1348 irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); 1340 irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
1349 if (irq < 0) { 1341 if (irq < 0) {
1350 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n"); 1342 dev_err(&ofdev->dev, "invalid irq from platform\n");
1351 goto error_exit_with_cleanup; 1343 goto error_exit_with_cleanup;
1352 } 1344 }
1353 host_priv->irq = irq; 1345 host_priv->irq = irq;
@@ -1422,8 +1414,7 @@ static int sata_fsl_resume(struct platform_device *op)
1422 1414
1423 ret = sata_fsl_init_controller(host); 1415 ret = sata_fsl_init_controller(host);
1424 if (ret) { 1416 if (ret) {
1425 dev_printk(KERN_ERR, &op->dev, 1417 dev_err(&op->dev, "Error initializing hardware\n");
1426 "Error initialize hardware\n");
1427 return ret; 1418 return ret;
1428 } 1419 }
1429 1420
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 83a44471b189..5c7d70c03bf0 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -396,9 +396,8 @@ static void inic_host_intr(struct ata_port *ap)
396 } 396 }
397 397
398 spurious: 398 spurious:
399 ata_port_printk(ap, KERN_WARNING, "unhandled interrupt: " 399 ata_port_warn(ap, "unhandled interrupt: cmd=0x%x irq_stat=0x%x idma_stat=0x%x\n",
400 "cmd=0x%x irq_stat=0x%x idma_stat=0x%x\n", 400 qc ? qc->tf.command : 0xff, irq_stat, idma_stat);
401 qc ? qc->tf.command : 0xff, irq_stat, idma_stat);
402} 401}
403 402
404static irqreturn_t inic_interrupt(int irq, void *dev_instance) 403static irqreturn_t inic_interrupt(int irq, void *dev_instance)
@@ -619,8 +618,9 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class,
619 618
620 rc = sata_link_resume(link, timing, deadline); 619 rc = sata_link_resume(link, timing, deadline);
621 if (rc) { 620 if (rc) {
622 ata_link_printk(link, KERN_WARNING, "failed to resume " 621 ata_link_warn(link,
623 "link after reset (errno=%d)\n", rc); 622 "failed to resume link after reset (errno=%d)\n",
623 rc);
624 return rc; 624 return rc;
625 } 625 }
626 626
@@ -632,8 +632,9 @@ static int inic_hardreset(struct ata_link *link, unsigned int *class,
632 rc = ata_wait_after_reset(link, deadline, inic_check_ready); 632 rc = ata_wait_after_reset(link, deadline, inic_check_ready);
633 /* link occupied, -ENODEV too is an error */ 633 /* link occupied, -ENODEV too is an error */
634 if (rc) { 634 if (rc) {
635 ata_link_printk(link, KERN_WARNING, "device not ready " 635 ata_link_warn(link,
636 "after hardreset (errno=%d)\n", rc); 636 "device not ready after hardreset (errno=%d)\n",
637 rc);
637 return rc; 638 return rc;
638 } 639 }
639 640
@@ -799,7 +800,6 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
799 800
800static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 801static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
801{ 802{
802 static int printed_version;
803 const struct ata_port_info *ppi[] = { &inic_port_info, NULL }; 803 const struct ata_port_info *ppi[] = { &inic_port_info, NULL };
804 struct ata_host *host; 804 struct ata_host *host;
805 struct inic_host_priv *hpriv; 805 struct inic_host_priv *hpriv;
@@ -807,8 +807,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
807 int mmio_bar; 807 int mmio_bar;
808 int i, rc; 808 int i, rc;
809 809
810 if (!printed_version++) 810 ata_print_version_once(&pdev->dev, DRV_VERSION);
811 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
812 811
813 /* alloc host */ 812 /* alloc host */
814 host = ata_host_alloc_pinfo(&pdev->dev, ppi, NR_PORTS); 813 host = ata_host_alloc_pinfo(&pdev->dev, ppi, NR_PORTS);
@@ -847,15 +846,13 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
847 /* Set dma_mask. This devices doesn't support 64bit addressing. */ 846 /* Set dma_mask. This devices doesn't support 64bit addressing. */
848 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 847 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
849 if (rc) { 848 if (rc) {
850 dev_printk(KERN_ERR, &pdev->dev, 849 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
851 "32-bit DMA enable failed\n");
852 return rc; 850 return rc;
853 } 851 }
854 852
855 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 853 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
856 if (rc) { 854 if (rc) {
857 dev_printk(KERN_ERR, &pdev->dev, 855 dev_err(&pdev->dev, "32-bit consistent DMA enable failed\n");
858 "32-bit consistent DMA enable failed\n");
859 return rc; 856 return rc;
860 } 857 }
861 858
@@ -866,15 +863,13 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
866 */ 863 */
867 rc = pci_set_dma_max_seg_size(pdev, 65536 - 512); 864 rc = pci_set_dma_max_seg_size(pdev, 65536 - 512);
868 if (rc) { 865 if (rc) {
869 dev_printk(KERN_ERR, &pdev->dev, 866 dev_err(&pdev->dev, "failed to set the maximum segment size\n");
870 "failed to set the maximum segment size.\n");
871 return rc; 867 return rc;
872 } 868 }
873 869
874 rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl); 870 rc = init_controller(hpriv->mmio_base, hpriv->cached_hctl);
875 if (rc) { 871 if (rc) {
876 dev_printk(KERN_ERR, &pdev->dev, 872 dev_err(&pdev->dev, "failed to initialize controller\n");
877 "failed to initialize controller\n");
878 return rc; 873 return rc;
879 } 874 }
880 875
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index b52c0519ad0b..4b6b2090784b 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1190,7 +1190,7 @@ static void mv_wait_for_edma_empty_idle(struct ata_port *ap)
1190 break; 1190 break;
1191 udelay(per_loop); 1191 udelay(per_loop);
1192 } 1192 }
1193 /* ata_port_printk(ap, KERN_INFO, "%s: %u+ usecs\n", __func__, i); */ 1193 /* ata_port_info(ap, "%s: %u+ usecs\n", __func__, i); */
1194} 1194}
1195 1195
1196/** 1196/**
@@ -1228,7 +1228,7 @@ static int mv_stop_edma(struct ata_port *ap)
1228 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; 1228 pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN;
1229 mv_wait_for_edma_empty_idle(ap); 1229 mv_wait_for_edma_empty_idle(ap);
1230 if (mv_stop_edma_engine(port_mmio)) { 1230 if (mv_stop_edma_engine(port_mmio)) {
1231 ata_port_printk(ap, KERN_ERR, "Unable to stop eDMA\n"); 1231 ata_port_err(ap, "Unable to stop eDMA\n");
1232 err = -EIO; 1232 err = -EIO;
1233 } 1233 }
1234 mv_edma_cfg(ap, 0, 0); 1234 mv_edma_cfg(ap, 0, 0);
@@ -1382,7 +1382,7 @@ static void mv6_dev_config(struct ata_device *adev)
1382 if (adev->flags & ATA_DFLAG_NCQ) { 1382 if (adev->flags & ATA_DFLAG_NCQ) {
1383 if (sata_pmp_attached(adev->link->ap)) { 1383 if (sata_pmp_attached(adev->link->ap)) {
1384 adev->flags &= ~ATA_DFLAG_NCQ; 1384 adev->flags &= ~ATA_DFLAG_NCQ;
1385 ata_dev_printk(adev, KERN_INFO, 1385 ata_dev_info(adev,
1386 "NCQ disabled for command-based switching\n"); 1386 "NCQ disabled for command-based switching\n");
1387 } 1387 }
1388 } 1388 }
@@ -2225,9 +2225,8 @@ static unsigned int mv_send_fis(struct ata_port *ap, u32 *fis, int nwords)
2225 2225
2226 /* See if it worked */ 2226 /* See if it worked */
2227 if ((ifstat & 0x3000) != 0x1000) { 2227 if ((ifstat & 0x3000) != 0x1000) {
2228 ata_port_printk(ap, KERN_WARNING, 2228 ata_port_warn(ap, "%s transmission error, ifstat=%08x\n",
2229 "%s transmission error, ifstat=%08x\n", 2229 __func__, ifstat);
2230 __func__, ifstat);
2231 return AC_ERR_OTHER; 2230 return AC_ERR_OTHER;
2232 } 2231 }
2233 return 0; 2232 return 0;
@@ -2342,9 +2341,9 @@ static unsigned int mv_qc_issue(struct ata_queued_cmd *qc)
2342 */ 2341 */
2343 if (limit_warnings > 0 && (qc->nbytes / qc->sect_size) > 1) { 2342 if (limit_warnings > 0 && (qc->nbytes / qc->sect_size) > 1) {
2344 --limit_warnings; 2343 --limit_warnings;
2345 ata_link_printk(qc->dev->link, KERN_WARNING, DRV_NAME 2344 ata_link_warn(qc->dev->link, DRV_NAME
2346 ": attempting PIO w/multiple DRQ: " 2345 ": attempting PIO w/multiple DRQ: "
2347 "this may fail due to h/w errata\n"); 2346 "this may fail due to h/w errata\n");
2348 } 2347 }
2349 /* drop through */ 2348 /* drop through */
2350 case ATA_PROT_NODATA: 2349 case ATA_PROT_NODATA:
@@ -2499,20 +2498,20 @@ static int mv_handle_fbs_ncq_dev_err(struct ata_port *ap)
2499 } 2498 }
2500 failed_links = hweight16(new_map); 2499 failed_links = hweight16(new_map);
2501 2500
2502 ata_port_printk(ap, KERN_INFO, "%s: pmp_map=%04x qc_map=%04x " 2501 ata_port_info(ap,
2503 "failed_links=%d nr_active_links=%d\n", 2502 "%s: pmp_map=%04x qc_map=%04x failed_links=%d nr_active_links=%d\n",
2504 __func__, pp->delayed_eh_pmp_map, 2503 __func__, pp->delayed_eh_pmp_map,
2505 ap->qc_active, failed_links, 2504 ap->qc_active, failed_links,
2506 ap->nr_active_links); 2505 ap->nr_active_links);
2507 2506
2508 if (ap->nr_active_links <= failed_links && mv_req_q_empty(ap)) { 2507 if (ap->nr_active_links <= failed_links && mv_req_q_empty(ap)) {
2509 mv_process_crpb_entries(ap, pp); 2508 mv_process_crpb_entries(ap, pp);
2510 mv_stop_edma(ap); 2509 mv_stop_edma(ap);
2511 mv_eh_freeze(ap); 2510 mv_eh_freeze(ap);
2512 ata_port_printk(ap, KERN_INFO, "%s: done\n", __func__); 2511 ata_port_info(ap, "%s: done\n", __func__);
2513 return 1; /* handled */ 2512 return 1; /* handled */
2514 } 2513 }
2515 ata_port_printk(ap, KERN_INFO, "%s: waiting\n", __func__); 2514 ata_port_info(ap, "%s: waiting\n", __func__);
2516 return 1; /* handled */ 2515 return 1; /* handled */
2517} 2516}
2518 2517
@@ -2554,9 +2553,8 @@ static int mv_handle_dev_err(struct ata_port *ap, u32 edma_err_cause)
2554 * and we cannot handle it here. 2553 * and we cannot handle it here.
2555 */ 2554 */
2556 if (edma_err_cause & EDMA_ERR_SELF_DIS) { 2555 if (edma_err_cause & EDMA_ERR_SELF_DIS) {
2557 ata_port_printk(ap, KERN_WARNING, 2556 ata_port_warn(ap, "%s: err_cause=0x%x pp_flags=0x%x\n",
2558 "%s: err_cause=0x%x pp_flags=0x%x\n", 2557 __func__, edma_err_cause, pp->pp_flags);
2559 __func__, edma_err_cause, pp->pp_flags);
2560 return 0; /* not handled */ 2558 return 0; /* not handled */
2561 } 2559 }
2562 return mv_handle_fbs_ncq_dev_err(ap); 2560 return mv_handle_fbs_ncq_dev_err(ap);
@@ -2567,9 +2565,8 @@ static int mv_handle_dev_err(struct ata_port *ap, u32 edma_err_cause)
2567 * and we cannot handle it here. 2565 * and we cannot handle it here.
2568 */ 2566 */
2569 if (!(edma_err_cause & EDMA_ERR_SELF_DIS)) { 2567 if (!(edma_err_cause & EDMA_ERR_SELF_DIS)) {
2570 ata_port_printk(ap, KERN_WARNING, 2568 ata_port_warn(ap, "%s: err_cause=0x%x pp_flags=0x%x\n",
2571 "%s: err_cause=0x%x pp_flags=0x%x\n", 2569 __func__, edma_err_cause, pp->pp_flags);
2572 __func__, edma_err_cause, pp->pp_flags);
2573 return 0; /* not handled */ 2570 return 0; /* not handled */
2574 } 2571 }
2575 return mv_handle_fbs_non_ncq_dev_err(ap); 2572 return mv_handle_fbs_non_ncq_dev_err(ap);
@@ -2930,8 +2927,7 @@ static int mv_pci_error(struct ata_host *host, void __iomem *mmio)
2930 2927
2931 err_cause = readl(mmio + hpriv->irq_cause_offset); 2928 err_cause = readl(mmio + hpriv->irq_cause_offset);
2932 2929
2933 dev_printk(KERN_ERR, host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", 2930 dev_err(host->dev, "PCI ERROR; PCI IRQ cause=0x%08x\n", err_cause);
2934 err_cause);
2935 2931
2936 DPRINTK("All regs @ PCI error\n"); 2932 DPRINTK("All regs @ PCI error\n");
2937 mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev)); 2933 mv_dump_all_regs(mmio, -1, to_pci_dev(host->dev));
@@ -3760,8 +3756,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3760 hp_flags |= MV_HP_ERRATA_50XXB2; 3756 hp_flags |= MV_HP_ERRATA_50XXB2;
3761 break; 3757 break;
3762 default: 3758 default:
3763 dev_printk(KERN_WARNING, &pdev->dev, 3759 dev_warn(&pdev->dev,
3764 "Applying 50XXB2 workarounds to unknown rev\n"); 3760 "Applying 50XXB2 workarounds to unknown rev\n");
3765 hp_flags |= MV_HP_ERRATA_50XXB2; 3761 hp_flags |= MV_HP_ERRATA_50XXB2;
3766 break; 3762 break;
3767 } 3763 }
@@ -3780,8 +3776,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3780 hp_flags |= MV_HP_ERRATA_50XXB2; 3776 hp_flags |= MV_HP_ERRATA_50XXB2;
3781 break; 3777 break;
3782 default: 3778 default:
3783 dev_printk(KERN_WARNING, &pdev->dev, 3779 dev_warn(&pdev->dev,
3784 "Applying B2 workarounds to unknown rev\n"); 3780 "Applying B2 workarounds to unknown rev\n");
3785 hp_flags |= MV_HP_ERRATA_50XXB2; 3781 hp_flags |= MV_HP_ERRATA_50XXB2;
3786 break; 3782 break;
3787 } 3783 }
@@ -3801,8 +3797,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3801 hp_flags |= MV_HP_ERRATA_60X1C0; 3797 hp_flags |= MV_HP_ERRATA_60X1C0;
3802 break; 3798 break;
3803 default: 3799 default:
3804 dev_printk(KERN_WARNING, &pdev->dev, 3800 dev_warn(&pdev->dev,
3805 "Applying B2 workarounds to unknown rev\n"); 3801 "Applying B2 workarounds to unknown rev\n");
3806 hp_flags |= MV_HP_ERRATA_60X1B2; 3802 hp_flags |= MV_HP_ERRATA_60X1B2;
3807 break; 3803 break;
3808 } 3804 }
@@ -3851,8 +3847,8 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3851 hp_flags |= MV_HP_ERRATA_60X1C0; 3847 hp_flags |= MV_HP_ERRATA_60X1C0;
3852 break; 3848 break;
3853 default: 3849 default:
3854 dev_printk(KERN_WARNING, &pdev->dev, 3850 dev_warn(&pdev->dev,
3855 "Applying 60X1C0 workarounds to unknown rev\n"); 3851 "Applying 60X1C0 workarounds to unknown rev\n");
3856 hp_flags |= MV_HP_ERRATA_60X1C0; 3852 hp_flags |= MV_HP_ERRATA_60X1C0;
3857 break; 3853 break;
3858 } 3854 }
@@ -3867,8 +3863,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
3867 break; 3863 break;
3868 3864
3869 default: 3865 default:
3870 dev_printk(KERN_ERR, host->dev, 3866 dev_err(host->dev, "BUG: invalid board index %u\n", board_idx);
3871 "BUG: invalid board index %u\n", board_idx);
3872 return 1; 3867 return 1;
3873 } 3868 }
3874 3869
@@ -4023,7 +4018,6 @@ static void mv_conf_mbus_windows(struct mv_host_priv *hpriv,
4023 */ 4018 */
4024static int mv_platform_probe(struct platform_device *pdev) 4019static int mv_platform_probe(struct platform_device *pdev)
4025{ 4020{
4026 static int printed_version;
4027 const struct mv_sata_platform_data *mv_platform_data; 4021 const struct mv_sata_platform_data *mv_platform_data;
4028 const struct ata_port_info *ppi[] = 4022 const struct ata_port_info *ppi[] =
4029 { &mv_port_info[chip_soc], NULL }; 4023 { &mv_port_info[chip_soc], NULL };
@@ -4032,8 +4026,7 @@ static int mv_platform_probe(struct platform_device *pdev)
4032 struct resource *res; 4026 struct resource *res;
4033 int n_ports, rc; 4027 int n_ports, rc;
4034 4028
4035 if (!printed_version++) 4029 ata_print_version_once(&pdev->dev, DRV_VERSION);
4036 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
4037 4030
4038 /* 4031 /*
4039 * Simple resource validation .. 4032 * Simple resource validation ..
@@ -4091,9 +4084,8 @@ static int mv_platform_probe(struct platform_device *pdev)
4091 if (rc) 4084 if (rc)
4092 goto err; 4085 goto err;
4093 4086
4094 dev_printk(KERN_INFO, &pdev->dev, 4087 dev_info(&pdev->dev, "slots %u ports %d\n",
4095 "slots %u ports %d\n", (unsigned)MV_MAX_Q_DEPTH, 4088 (unsigned)MV_MAX_Q_DEPTH, host->n_ports);
4096 host->n_ports);
4097 4089
4098 return ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt, 4090 return ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt,
4099 IRQF_SHARED, &mv6_sht); 4091 IRQF_SHARED, &mv6_sht);
@@ -4217,22 +4209,21 @@ static int pci_go_64(struct pci_dev *pdev)
4217 if (rc) { 4209 if (rc) {
4218 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 4210 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
4219 if (rc) { 4211 if (rc) {
4220 dev_printk(KERN_ERR, &pdev->dev, 4212 dev_err(&pdev->dev,
4221 "64-bit DMA enable failed\n"); 4213 "64-bit DMA enable failed\n");
4222 return rc; 4214 return rc;
4223 } 4215 }
4224 } 4216 }
4225 } else { 4217 } else {
4226 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 4218 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
4227 if (rc) { 4219 if (rc) {
4228 dev_printk(KERN_ERR, &pdev->dev, 4220 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
4229 "32-bit DMA enable failed\n");
4230 return rc; 4221 return rc;
4231 } 4222 }
4232 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 4223 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
4233 if (rc) { 4224 if (rc) {
4234 dev_printk(KERN_ERR, &pdev->dev, 4225 dev_err(&pdev->dev,
4235 "32-bit consistent DMA enable failed\n"); 4226 "32-bit consistent DMA enable failed\n");
4236 return rc; 4227 return rc;
4237 } 4228 }
4238 } 4229 }
@@ -4276,10 +4267,9 @@ static void mv_print_info(struct ata_host *host)
4276 else 4267 else
4277 gen = "?"; 4268 gen = "?";
4278 4269
4279 dev_printk(KERN_INFO, &pdev->dev, 4270 dev_info(&pdev->dev, "Gen-%s %u slots %u ports %s mode IRQ via %s\n",
4280 "Gen-%s %u slots %u ports %s mode IRQ via %s\n", 4271 gen, (unsigned)MV_MAX_Q_DEPTH, host->n_ports,
4281 gen, (unsigned)MV_MAX_Q_DEPTH, host->n_ports, 4272 scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx");
4282 scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx");
4283} 4273}
4284 4274
4285/** 4275/**
@@ -4293,15 +4283,13 @@ static void mv_print_info(struct ata_host *host)
4293static int mv_pci_init_one(struct pci_dev *pdev, 4283static int mv_pci_init_one(struct pci_dev *pdev,
4294 const struct pci_device_id *ent) 4284 const struct pci_device_id *ent)
4295{ 4285{
4296 static int printed_version;
4297 unsigned int board_idx = (unsigned int)ent->driver_data; 4286 unsigned int board_idx = (unsigned int)ent->driver_data;
4298 const struct ata_port_info *ppi[] = { &mv_port_info[board_idx], NULL }; 4287 const struct ata_port_info *ppi[] = { &mv_port_info[board_idx], NULL };
4299 struct ata_host *host; 4288 struct ata_host *host;
4300 struct mv_host_priv *hpriv; 4289 struct mv_host_priv *hpriv;
4301 int n_ports, port, rc; 4290 int n_ports, port, rc;
4302 4291
4303 if (!printed_version++) 4292 ata_print_version_once(&pdev->dev, DRV_VERSION);
4304 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
4305 4293
4306 /* allocate host */ 4294 /* allocate host */
4307 n_ports = mv_get_hc_count(ppi[0]->flags) * MV_PORTS_PER_HC; 4295 n_ports = mv_get_hc_count(ppi[0]->flags) * MV_PORTS_PER_HC;
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index f173ef3bfc10..e0bc9646a38e 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -620,9 +620,8 @@ static void nv_adma_register_mode(struct ata_port *ap)
620 count++; 620 count++;
621 } 621 }
622 if (count == 20) 622 if (count == 20)
623 ata_port_printk(ap, KERN_WARNING, 623 ata_port_warn(ap, "timeout waiting for ADMA IDLE, stat=0x%hx\n",
624 "timeout waiting for ADMA IDLE, stat=0x%hx\n", 624 status);
625 status);
626 625
627 tmp = readw(mmio + NV_ADMA_CTL); 626 tmp = readw(mmio + NV_ADMA_CTL);
628 writew(tmp & ~NV_ADMA_CTL_GO, mmio + NV_ADMA_CTL); 627 writew(tmp & ~NV_ADMA_CTL_GO, mmio + NV_ADMA_CTL);
@@ -635,9 +634,9 @@ static void nv_adma_register_mode(struct ata_port *ap)
635 count++; 634 count++;
636 } 635 }
637 if (count == 20) 636 if (count == 20)
638 ata_port_printk(ap, KERN_WARNING, 637 ata_port_warn(ap,
639 "timeout waiting for ADMA LEGACY, stat=0x%hx\n", 638 "timeout waiting for ADMA LEGACY, stat=0x%hx\n",
640 status); 639 status);
641 640
642 pp->flags |= NV_ADMA_PORT_REGISTER_MODE; 641 pp->flags |= NV_ADMA_PORT_REGISTER_MODE;
643} 642}
@@ -665,7 +664,7 @@ static void nv_adma_mode(struct ata_port *ap)
665 count++; 664 count++;
666 } 665 }
667 if (count == 20) 666 if (count == 20)
668 ata_port_printk(ap, KERN_WARNING, 667 ata_port_warn(ap,
669 "timeout waiting for ADMA LEGACY clear and IDLE, stat=0x%hx\n", 668 "timeout waiting for ADMA LEGACY clear and IDLE, stat=0x%hx\n",
670 status); 669 status);
671 670
@@ -772,10 +771,10 @@ static int nv_adma_slave_config(struct scsi_device *sdev)
772 771
773 blk_queue_segment_boundary(sdev->request_queue, segment_boundary); 772 blk_queue_segment_boundary(sdev->request_queue, segment_boundary);
774 blk_queue_max_segments(sdev->request_queue, sg_tablesize); 773 blk_queue_max_segments(sdev->request_queue, sg_tablesize);
775 ata_port_printk(ap, KERN_INFO, 774 ata_port_info(ap,
776 "DMA mask 0x%llX, segment boundary 0x%lX, hw segs %hu\n", 775 "DMA mask 0x%llX, segment boundary 0x%lX, hw segs %hu\n",
777 (unsigned long long)*ap->host->dev->dma_mask, 776 (unsigned long long)*ap->host->dev->dma_mask,
778 segment_boundary, sg_tablesize); 777 segment_boundary, sg_tablesize);
779 778
780 spin_unlock_irqrestore(ap->lock, flags); 779 spin_unlock_irqrestore(ap->lock, flags);
781 780
@@ -1443,8 +1442,7 @@ static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)
1443 existing commands. */ 1442 existing commands. */
1444 if (unlikely(qc->tf.protocol == ATA_PROT_NCQ && 1443 if (unlikely(qc->tf.protocol == ATA_PROT_NCQ &&
1445 (qc->flags & ATA_QCFLAG_RESULT_TF))) { 1444 (qc->flags & ATA_QCFLAG_RESULT_TF))) {
1446 ata_dev_printk(qc->dev, KERN_ERR, 1445 ata_dev_err(qc->dev, "NCQ w/ RESULT_TF not allowed\n");
1447 "NCQ w/ RESULT_TF not allowed\n");
1448 return AC_ERR_SYSTEM; 1446 return AC_ERR_SYSTEM;
1449 } 1447 }
1450 1448
@@ -1581,15 +1579,15 @@ static int nv_hardreset(struct ata_link *link, unsigned int *class,
1581 int rc; 1579 int rc;
1582 1580
1583 if (!(ehc->i.flags & ATA_EHI_QUIET)) 1581 if (!(ehc->i.flags & ATA_EHI_QUIET))
1584 ata_link_printk(link, KERN_INFO, "nv: skipping " 1582 ata_link_info(link,
1585 "hardreset on occupied port\n"); 1583 "nv: skipping hardreset on occupied port\n");
1586 1584
1587 /* make sure the link is online */ 1585 /* make sure the link is online */
1588 rc = sata_link_resume(link, timing, deadline); 1586 rc = sata_link_resume(link, timing, deadline);
1589 /* whine about phy resume failure but proceed */ 1587 /* whine about phy resume failure but proceed */
1590 if (rc && rc != -EOPNOTSUPP) 1588 if (rc && rc != -EOPNOTSUPP)
1591 ata_link_printk(link, KERN_WARNING, "failed to resume " 1589 ata_link_warn(link, "failed to resume link (errno=%d)\n",
1592 "link (errno=%d)\n", rc); 1590 rc);
1593 } 1591 }
1594 1592
1595 /* device signature acquisition is unreliable */ 1593 /* device signature acquisition is unreliable */
@@ -1686,7 +1684,7 @@ static void nv_adma_error_handler(struct ata_port *ap)
1686 u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT); 1684 u8 cpb_count = readb(mmio + NV_ADMA_CPB_COUNT);
1687 u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX); 1685 u8 next_cpb_idx = readb(mmio + NV_ADMA_NEXT_CPB_IDX);
1688 1686
1689 ata_port_printk(ap, KERN_ERR, 1687 ata_port_err(ap,
1690 "EH in ADMA mode, notifier 0x%X " 1688 "EH in ADMA mode, notifier 0x%X "
1691 "notifier_error 0x%X gen_ctl 0x%X status 0x%X " 1689 "notifier_error 0x%X gen_ctl 0x%X status 0x%X "
1692 "next cpb count 0x%X next cpb idx 0x%x\n", 1690 "next cpb count 0x%X next cpb idx 0x%x\n",
@@ -1697,7 +1695,7 @@ static void nv_adma_error_handler(struct ata_port *ap)
1697 struct nv_adma_cpb *cpb = &pp->cpb[i]; 1695 struct nv_adma_cpb *cpb = &pp->cpb[i];
1698 if ((ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) || 1696 if ((ata_tag_valid(ap->link.active_tag) && i == ap->link.active_tag) ||
1699 ap->link.sactive & (1 << i)) 1697 ap->link.sactive & (1 << i))
1700 ata_port_printk(ap, KERN_ERR, 1698 ata_port_err(ap,
1701 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n", 1699 "CPB %d: ctl_flags 0x%x, resp_flags 0x%x\n",
1702 i, cpb->ctl_flags, cpb->resp_flags); 1700 i, cpb->ctl_flags, cpb->resp_flags);
1703 } 1701 }
@@ -1799,23 +1797,22 @@ static void nv_swncq_ncq_stop(struct ata_port *ap)
1799 u32 sactive; 1797 u32 sactive;
1800 u32 done_mask; 1798 u32 done_mask;
1801 1799
1802 ata_port_printk(ap, KERN_ERR, 1800 ata_port_err(ap, "EH in SWNCQ mode,QC:qc_active 0x%X sactive 0x%X\n",
1803 "EH in SWNCQ mode,QC:qc_active 0x%X sactive 0x%X\n", 1801 ap->qc_active, ap->link.sactive);
1804 ap->qc_active, ap->link.sactive); 1802 ata_port_err(ap,
1805 ata_port_printk(ap, KERN_ERR,
1806 "SWNCQ:qc_active 0x%X defer_bits 0x%X last_issue_tag 0x%x\n " 1803 "SWNCQ:qc_active 0x%X defer_bits 0x%X last_issue_tag 0x%x\n "
1807 "dhfis 0x%X dmafis 0x%X sdbfis 0x%X\n", 1804 "dhfis 0x%X dmafis 0x%X sdbfis 0x%X\n",
1808 pp->qc_active, pp->defer_queue.defer_bits, pp->last_issue_tag, 1805 pp->qc_active, pp->defer_queue.defer_bits, pp->last_issue_tag,
1809 pp->dhfis_bits, pp->dmafis_bits, pp->sdbfis_bits); 1806 pp->dhfis_bits, pp->dmafis_bits, pp->sdbfis_bits);
1810 1807
1811 ata_port_printk(ap, KERN_ERR, "ATA_REG 0x%X ERR_REG 0x%X\n", 1808 ata_port_err(ap, "ATA_REG 0x%X ERR_REG 0x%X\n",
1812 ap->ops->sff_check_status(ap), 1809 ap->ops->sff_check_status(ap),
1813 ioread8(ap->ioaddr.error_addr)); 1810 ioread8(ap->ioaddr.error_addr));
1814 1811
1815 sactive = readl(pp->sactive_block); 1812 sactive = readl(pp->sactive_block);
1816 done_mask = pp->qc_active ^ sactive; 1813 done_mask = pp->qc_active ^ sactive;
1817 1814
1818 ata_port_printk(ap, KERN_ERR, "tag : dhfis dmafis sdbfis sacitve\n"); 1815 ata_port_err(ap, "tag : dhfis dmafis sdbfis sactive\n");
1819 for (i = 0; i < ATA_MAX_QUEUE; i++) { 1816 for (i = 0; i < ATA_MAX_QUEUE; i++) {
1820 u8 err = 0; 1817 u8 err = 0;
1821 if (pp->qc_active & (1 << i)) 1818 if (pp->qc_active & (1 << i))
@@ -1825,13 +1822,13 @@ static void nv_swncq_ncq_stop(struct ata_port *ap)
1825 else 1822 else
1826 continue; 1823 continue;
1827 1824
1828 ata_port_printk(ap, KERN_ERR, 1825 ata_port_err(ap,
1829 "tag 0x%x: %01x %01x %01x %01x %s\n", i, 1826 "tag 0x%x: %01x %01x %01x %01x %s\n", i,
1830 (pp->dhfis_bits >> i) & 0x1, 1827 (pp->dhfis_bits >> i) & 0x1,
1831 (pp->dmafis_bits >> i) & 0x1, 1828 (pp->dmafis_bits >> i) & 0x1,
1832 (pp->sdbfis_bits >> i) & 0x1, 1829 (pp->sdbfis_bits >> i) & 0x1,
1833 (sactive >> i) & 0x1, 1830 (sactive >> i) & 0x1,
1834 (err ? "error! tag doesn't exit" : " ")); 1831 (err ? "error! tag doesn't exit" : " "));
1835 } 1832 }
1836 1833
1837 nv_swncq_pp_reinit(ap); 1834 nv_swncq_pp_reinit(ap);
@@ -1956,8 +1953,8 @@ static int nv_swncq_slave_config(struct scsi_device *sdev)
1956 1953
1957 if (strncmp(model_num, "Maxtor", 6) == 0) { 1954 if (strncmp(model_num, "Maxtor", 6) == 0) {
1958 ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_DEFAULT); 1955 ata_scsi_change_queue_depth(sdev, 1, SCSI_QDEPTH_DEFAULT);
1959 ata_dev_printk(dev, KERN_NOTICE, 1956 ata_dev_notice(dev, "Disabling SWNCQ mode (depth %x)\n",
1960 "Disabling SWNCQ mode (depth %x)\n", sdev->queue_depth); 1957 sdev->queue_depth);
1961 } 1958 }
1962 1959
1963 return rc; 1960 return rc;
@@ -2356,7 +2353,6 @@ static irqreturn_t nv_swncq_interrupt(int irq, void *dev_instance)
2356 2353
2357static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 2354static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2358{ 2355{
2359 static int printed_version;
2360 const struct ata_port_info *ppi[] = { NULL, NULL }; 2356 const struct ata_port_info *ppi[] = { NULL, NULL };
2361 struct nv_pi_priv *ipriv; 2357 struct nv_pi_priv *ipriv;
2362 struct ata_host *host; 2358 struct ata_host *host;
@@ -2373,8 +2369,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2373 if (pci_resource_start(pdev, bar) == 0) 2369 if (pci_resource_start(pdev, bar) == 0)
2374 return -ENODEV; 2370 return -ENODEV;
2375 2371
2376 if (!printed_version++) 2372 ata_print_version_once(&pdev->dev, DRV_VERSION);
2377 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
2378 2373
2379 rc = pcim_enable_device(pdev); 2374 rc = pcim_enable_device(pdev);
2380 if (rc) 2375 if (rc)
@@ -2382,10 +2377,10 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2382 2377
2383 /* determine type and allocate host */ 2378 /* determine type and allocate host */
2384 if (type == CK804 && adma_enabled) { 2379 if (type == CK804 && adma_enabled) {
2385 dev_printk(KERN_NOTICE, &pdev->dev, "Using ADMA mode\n"); 2380 dev_notice(&pdev->dev, "Using ADMA mode\n");
2386 type = ADMA; 2381 type = ADMA;
2387 } else if (type == MCP5x && swncq_enabled) { 2382 } else if (type == MCP5x && swncq_enabled) {
2388 dev_printk(KERN_NOTICE, &pdev->dev, "Using SWNCQ mode\n"); 2383 dev_notice(&pdev->dev, "Using SWNCQ mode\n");
2389 type = SWNCQ; 2384 type = SWNCQ;
2390 } 2385 }
2391 2386
@@ -2429,7 +2424,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2429 nv_swncq_host_init(host); 2424 nv_swncq_host_init(host);
2430 2425
2431 if (msi_enabled) { 2426 if (msi_enabled) {
2432 dev_printk(KERN_NOTICE, &pdev->dev, "Using MSI\n"); 2427 dev_notice(&pdev->dev, "Using MSI\n");
2433 pci_enable_msi(pdev); 2428 pci_enable_msi(pdev);
2434 } 2429 }
2435 2430
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index a004b1e0ea6d..000fcc99e01d 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -1179,7 +1179,6 @@ static void pdc_host_init(struct ata_host *host)
1179static int pdc_ata_init_one(struct pci_dev *pdev, 1179static int pdc_ata_init_one(struct pci_dev *pdev,
1180 const struct pci_device_id *ent) 1180 const struct pci_device_id *ent)
1181{ 1181{
1182 static int printed_version;
1183 const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; 1182 const struct ata_port_info *pi = &pdc_port_info[ent->driver_data];
1184 const struct ata_port_info *ppi[PDC_MAX_PORTS]; 1183 const struct ata_port_info *ppi[PDC_MAX_PORTS];
1185 struct ata_host *host; 1184 struct ata_host *host;
@@ -1187,8 +1186,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
1187 int n_ports, i, rc; 1186 int n_ports, i, rc;
1188 int is_sataii_tx4; 1187 int is_sataii_tx4;
1189 1188
1190 if (!printed_version++) 1189 ata_print_version_once(&pdev->dev, DRV_VERSION);
1191 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1192 1190
1193 /* enable and acquire resources */ 1191 /* enable and acquire resources */
1194 rc = pcim_enable_device(pdev); 1192 rc = pcim_enable_device(pdev);
@@ -1217,7 +1215,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
1217 1215
1218 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports); 1216 host = ata_host_alloc_pinfo(&pdev->dev, ppi, n_ports);
1219 if (!host) { 1217 if (!host) {
1220 dev_printk(KERN_ERR, &pdev->dev, "failed to allocate host\n"); 1218 dev_err(&pdev->dev, "failed to allocate host\n");
1221 return -ENOMEM; 1219 return -ENOMEM;
1222 } 1220 }
1223 host->iomap = pcim_iomap_table(pdev); 1221 host->iomap = pcim_iomap_table(pdev);
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index c5603265fa58..9d1a47bb21b3 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -563,21 +563,20 @@ static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
563 if (rc) { 563 if (rc) {
564 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 564 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
565 if (rc) { 565 if (rc) {
566 dev_printk(KERN_ERR, &pdev->dev, 566 dev_err(&pdev->dev,
567 "64-bit DMA enable failed\n"); 567 "64-bit DMA enable failed\n");
568 return rc; 568 return rc;
569 } 569 }
570 } 570 }
571 } else { 571 } else {
572 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 572 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
573 if (rc) { 573 if (rc) {
574 dev_printk(KERN_ERR, &pdev->dev, 574 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
575 "32-bit DMA enable failed\n");
576 return rc; 575 return rc;
577 } 576 }
578 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 577 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
579 if (rc) { 578 if (rc) {
580 dev_printk(KERN_ERR, &pdev->dev, 579 dev_err(&pdev->dev,
581 "32-bit consistent DMA enable failed\n"); 580 "32-bit consistent DMA enable failed\n");
582 return rc; 581 return rc;
583 } 582 }
@@ -588,14 +587,12 @@ static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
588static int qs_ata_init_one(struct pci_dev *pdev, 587static int qs_ata_init_one(struct pci_dev *pdev,
589 const struct pci_device_id *ent) 588 const struct pci_device_id *ent)
590{ 589{
591 static int printed_version;
592 unsigned int board_idx = (unsigned int) ent->driver_data; 590 unsigned int board_idx = (unsigned int) ent->driver_data;
593 const struct ata_port_info *ppi[] = { &qs_port_info[board_idx], NULL }; 591 const struct ata_port_info *ppi[] = { &qs_port_info[board_idx], NULL };
594 struct ata_host *host; 592 struct ata_host *host;
595 int rc, port_no; 593 int rc, port_no;
596 594
597 if (!printed_version++) 595 ata_print_version_once(&pdev->dev, DRV_VERSION);
598 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
599 596
600 /* alloc host */ 597 /* alloc host */
601 host = ata_host_alloc_pinfo(&pdev->dev, ppi, QS_PORTS); 598 host = ata_host_alloc_pinfo(&pdev->dev, ppi, QS_PORTS);
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index b42edaaf3a53..98c1d780f552 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -643,8 +643,8 @@ static void sil_dev_config(struct ata_device *dev)
643 ((ap->flags & SIL_FLAG_MOD15WRITE) && 643 ((ap->flags & SIL_FLAG_MOD15WRITE) &&
644 (quirks & SIL_QUIRK_MOD15WRITE))) { 644 (quirks & SIL_QUIRK_MOD15WRITE))) {
645 if (print_info) 645 if (print_info)
646 ata_dev_printk(dev, KERN_INFO, "applying Seagate " 646 ata_dev_info(dev,
647 "errata fix (mod15write workaround)\n"); 647 "applying Seagate errata fix (mod15write workaround)\n");
648 dev->max_sectors = 15; 648 dev->max_sectors = 15;
649 return; 649 return;
650 } 650 }
@@ -652,8 +652,8 @@ static void sil_dev_config(struct ata_device *dev)
652 /* limit to udma5 */ 652 /* limit to udma5 */
653 if (quirks & SIL_QUIRK_UDMA5MAX) { 653 if (quirks & SIL_QUIRK_UDMA5MAX) {
654 if (print_info) 654 if (print_info)
655 ata_dev_printk(dev, KERN_INFO, "applying Maxtor " 655 ata_dev_info(dev, "applying Maxtor errata fix %s\n",
656 "errata fix %s\n", model_num); 656 model_num);
657 dev->udma_mask &= ATA_UDMA5; 657 dev->udma_mask &= ATA_UDMA5;
658 return; 658 return;
659 } 659 }
@@ -676,8 +676,8 @@ static void sil_init_controller(struct ata_host *host)
676 writew(cls << 8 | cls, 676 writew(cls << 8 | cls,
677 mmio_base + sil_port[i].fifo_cfg); 677 mmio_base + sil_port[i].fifo_cfg);
678 } else 678 } else
679 dev_printk(KERN_WARNING, &pdev->dev, 679 dev_warn(&pdev->dev,
680 "cache line size not set. Driver may not function\n"); 680 "cache line size not set. Driver may not function\n");
681 681
682 /* Apply R_ERR on DMA activate FIS errata workaround */ 682 /* Apply R_ERR on DMA activate FIS errata workaround */
683 if (host->ports[0]->flags & SIL_FLAG_RERR_ON_DMA_ACT) { 683 if (host->ports[0]->flags & SIL_FLAG_RERR_ON_DMA_ACT) {
@@ -688,9 +688,8 @@ static void sil_init_controller(struct ata_host *host)
688 if ((tmp & 0x3) != 0x01) 688 if ((tmp & 0x3) != 0x01)
689 continue; 689 continue;
690 if (!cnt) 690 if (!cnt)
691 dev_printk(KERN_INFO, &pdev->dev, 691 dev_info(&pdev->dev,
692 "Applying R_ERR on DMA activate " 692 "Applying R_ERR on DMA activate FIS errata fix\n");
693 "FIS errata fix\n");
694 writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg); 693 writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg);
695 cnt++; 694 cnt++;
696 } 695 }
@@ -733,7 +732,6 @@ static bool sil_broken_system_poweroff(struct pci_dev *pdev)
733 732
734static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 733static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
735{ 734{
736 static int printed_version;
737 int board_id = ent->driver_data; 735 int board_id = ent->driver_data;
738 struct ata_port_info pi = sil_port_info[board_id]; 736 struct ata_port_info pi = sil_port_info[board_id];
739 const struct ata_port_info *ppi[] = { &pi, NULL }; 737 const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -742,8 +740,7 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
742 int n_ports, rc; 740 int n_ports, rc;
743 unsigned int i; 741 unsigned int i;
744 742
745 if (!printed_version++) 743 ata_print_version_once(&pdev->dev, DRV_VERSION);
746 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
747 744
748 /* allocate host */ 745 /* allocate host */
749 n_ports = 2; 746 n_ports = 2;
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 06c564e55051..55470f337e51 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -694,7 +694,7 @@ static int sil24_softreset(struct ata_link *link, unsigned int *class,
694 return 0; 694 return 0;
695 695
696 err: 696 err:
697 ata_link_printk(link, KERN_ERR, "softreset failed (%s)\n", reason); 697 ata_link_err(link, "softreset failed (%s)\n", reason);
698 return -EIO; 698 return -EIO;
699} 699}
700 700
@@ -714,8 +714,8 @@ static int sil24_hardreset(struct ata_link *link, unsigned int *class,
714 * This happens often after PM DMA CS errata. 714 * This happens often after PM DMA CS errata.
715 */ 715 */
716 if (pp->do_port_rst) { 716 if (pp->do_port_rst) {
717 ata_port_printk(ap, KERN_WARNING, "controller in dubious " 717 ata_port_warn(ap,
718 "state, performing PORT_RST\n"); 718 "controller in dubious state, performing PORT_RST\n");
719 719
720 writel(PORT_CS_PORT_RST, port + PORT_CTRL_STAT); 720 writel(PORT_CS_PORT_RST, port + PORT_CTRL_STAT);
721 ata_msleep(ap, 10); 721 ata_msleep(ap, 10);
@@ -773,7 +773,7 @@ static int sil24_hardreset(struct ata_link *link, unsigned int *class,
773 goto retry; 773 goto retry;
774 } 774 }
775 775
776 ata_link_printk(link, KERN_ERR, "hardreset failed (%s)\n", reason); 776 ata_link_err(link, "hardreset failed (%s)\n", reason);
777 return -EIO; 777 return -EIO;
778} 778}
779 779
@@ -925,7 +925,7 @@ static void sil24_pmp_attach(struct ata_port *ap)
925 925
926 if (sata_pmp_gscr_vendor(gscr) == 0x11ab && 926 if (sata_pmp_gscr_vendor(gscr) == 0x11ab &&
927 sata_pmp_gscr_devid(gscr) == 0x4140) { 927 sata_pmp_gscr_devid(gscr) == 0x4140) {
928 ata_port_printk(ap, KERN_INFO, 928 ata_port_info(ap,
929 "disabling NCQ support due to sil24-mv4140 quirk\n"); 929 "disabling NCQ support due to sil24-mv4140 quirk\n");
930 ap->flags &= ~ATA_FLAG_NCQ; 930 ap->flags &= ~ATA_FLAG_NCQ;
931 } 931 }
@@ -946,8 +946,7 @@ static int sil24_pmp_hardreset(struct ata_link *link, unsigned int *class,
946 946
947 rc = sil24_init_port(link->ap); 947 rc = sil24_init_port(link->ap);
948 if (rc) { 948 if (rc) {
949 ata_link_printk(link, KERN_ERR, 949 ata_link_err(link, "hardreset failed (port not ready)\n");
950 "hardreset failed (port not ready)\n");
951 return rc; 950 return rc;
952 } 951 }
953 952
@@ -1141,8 +1140,8 @@ static inline void sil24_host_intr(struct ata_port *ap)
1141 1140
1142 /* spurious interrupts are expected if PCIX_IRQ_WOC */ 1141 /* spurious interrupts are expected if PCIX_IRQ_WOC */
1143 if (!(ap->flags & SIL24_FLAG_PCIX_IRQ_WOC) && ata_ratelimit()) 1142 if (!(ap->flags & SIL24_FLAG_PCIX_IRQ_WOC) && ata_ratelimit())
1144 ata_port_printk(ap, KERN_INFO, "spurious interrupt " 1143 ata_port_info(ap,
1145 "(slot_stat 0x%x active_tag %d sactive 0x%x)\n", 1144 "spurious interrupt (slot_stat 0x%x active_tag %d sactive 0x%x)\n",
1146 slot_stat, ap->link.active_tag, ap->link.sactive); 1145 slot_stat, ap->link.active_tag, ap->link.sactive);
1147} 1146}
1148 1147
@@ -1256,8 +1255,8 @@ static void sil24_init_controller(struct ata_host *host)
1256 PORT_CS_PORT_RST, 1255 PORT_CS_PORT_RST,
1257 PORT_CS_PORT_RST, 10, 100); 1256 PORT_CS_PORT_RST, 10, 100);
1258 if (tmp & PORT_CS_PORT_RST) 1257 if (tmp & PORT_CS_PORT_RST)
1259 dev_printk(KERN_ERR, host->dev, 1258 dev_err(host->dev,
1260 "failed to clear port RST\n"); 1259 "failed to clear port RST\n");
1261 } 1260 }
1262 1261
1263 /* configure port */ 1262 /* configure port */
@@ -1271,7 +1270,6 @@ static void sil24_init_controller(struct ata_host *host)
1271static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1270static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1272{ 1271{
1273 extern int __MARKER__sil24_cmd_block_is_sized_wrongly; 1272 extern int __MARKER__sil24_cmd_block_is_sized_wrongly;
1274 static int printed_version;
1275 struct ata_port_info pi = sil24_port_info[ent->driver_data]; 1273 struct ata_port_info pi = sil24_port_info[ent->driver_data];
1276 const struct ata_port_info *ppi[] = { &pi, NULL }; 1274 const struct ata_port_info *ppi[] = { &pi, NULL };
1277 void __iomem * const *iomap; 1275 void __iomem * const *iomap;
@@ -1283,8 +1281,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1283 if (sizeof(union sil24_cmd_block) != PAGE_SIZE) 1281 if (sizeof(union sil24_cmd_block) != PAGE_SIZE)
1284 __MARKER__sil24_cmd_block_is_sized_wrongly = 1; 1282 __MARKER__sil24_cmd_block_is_sized_wrongly = 1;
1285 1283
1286 if (!printed_version++) 1284 ata_print_version_once(&pdev->dev, DRV_VERSION);
1287 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1288 1285
1289 /* acquire resources */ 1286 /* acquire resources */
1290 rc = pcim_enable_device(pdev); 1287 rc = pcim_enable_device(pdev);
@@ -1302,9 +1299,8 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1302 if (pi.flags & SIL24_FLAG_PCIX_IRQ_WOC) { 1299 if (pi.flags & SIL24_FLAG_PCIX_IRQ_WOC) {
1303 tmp = readl(iomap[SIL24_HOST_BAR] + HOST_CTRL); 1300 tmp = readl(iomap[SIL24_HOST_BAR] + HOST_CTRL);
1304 if (tmp & (HOST_CTRL_TRDY | HOST_CTRL_STOP | HOST_CTRL_DEVSEL)) 1301 if (tmp & (HOST_CTRL_TRDY | HOST_CTRL_STOP | HOST_CTRL_DEVSEL))
1305 dev_printk(KERN_INFO, &pdev->dev, 1302 dev_info(&pdev->dev,
1306 "Applying completion IRQ loss on PCI-X " 1303 "Applying completion IRQ loss on PCI-X errata fix\n");
1307 "errata fix\n");
1308 else 1304 else
1309 pi.flags &= ~SIL24_FLAG_PCIX_IRQ_WOC; 1305 pi.flags &= ~SIL24_FLAG_PCIX_IRQ_WOC;
1310 } 1306 }
@@ -1322,22 +1318,21 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1322 if (rc) { 1318 if (rc) {
1323 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 1319 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
1324 if (rc) { 1320 if (rc) {
1325 dev_printk(KERN_ERR, &pdev->dev, 1321 dev_err(&pdev->dev,
1326 "64-bit DMA enable failed\n"); 1322 "64-bit DMA enable failed\n");
1327 return rc; 1323 return rc;
1328 } 1324 }
1329 } 1325 }
1330 } else { 1326 } else {
1331 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 1327 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
1332 if (rc) { 1328 if (rc) {
1333 dev_printk(KERN_ERR, &pdev->dev, 1329 dev_err(&pdev->dev, "32-bit DMA enable failed\n");
1334 "32-bit DMA enable failed\n");
1335 return rc; 1330 return rc;
1336 } 1331 }
1337 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); 1332 rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
1338 if (rc) { 1333 if (rc) {
1339 dev_printk(KERN_ERR, &pdev->dev, 1334 dev_err(&pdev->dev,
1340 "32-bit consistent DMA enable failed\n"); 1335 "32-bit consistent DMA enable failed\n");
1341 return rc; 1336 return rc;
1342 } 1337 }
1343 } 1338 }
@@ -1350,7 +1345,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1350 sil24_init_controller(host); 1345 sil24_init_controller(host);
1351 1346
1352 if (sata_sil24_msi && !pci_enable_msi(pdev)) { 1347 if (sata_sil24_msi && !pci_enable_msi(pdev)) {
1353 dev_printk(KERN_INFO, &pdev->dev, "Using MSI\n"); 1348 dev_info(&pdev->dev, "Using MSI\n");
1354 pci_intx(pdev, 0); 1349 pci_intx(pdev, 0);
1355 } 1350 }
1356 1351
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index cdcc13e9cf51..447d9c05fb5a 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -193,7 +193,6 @@ static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
193 193
194static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 194static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
195{ 195{
196 static int printed_version;
197 struct ata_port_info pi = sis_port_info; 196 struct ata_port_info pi = sis_port_info;
198 const struct ata_port_info *ppi[] = { &pi, &pi }; 197 const struct ata_port_info *ppi[] = { &pi, &pi };
199 struct ata_host *host; 198 struct ata_host *host;
@@ -202,8 +201,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
202 u8 port2_start = 0x20; 201 u8 port2_start = 0x20;
203 int i, rc; 202 int i, rc;
204 203
205 if (!printed_version++) 204 ata_print_version_once(&pdev->dev, DRV_VERSION);
206 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
207 205
208 rc = pcim_enable_device(pdev); 206 rc = pcim_enable_device(pdev);
209 if (rc) 207 if (rc)
@@ -241,12 +239,12 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
241 break; 239 break;
242 } 240 }
243 if ((pmr & SIS_PMR_COMBINED) == 0) { 241 if ((pmr & SIS_PMR_COMBINED) == 0) {
244 dev_printk(KERN_INFO, &pdev->dev, 242 dev_info(&pdev->dev,
245 "Detected SiS 180/181/964 chipset in SATA mode\n"); 243 "Detected SiS 180/181/964 chipset in SATA mode\n");
246 port2_start = 64; 244 port2_start = 64;
247 } else { 245 } else {
248 dev_printk(KERN_INFO, &pdev->dev, 246 dev_info(&pdev->dev,
249 "Detected SiS 180/181 chipset in combined mode\n"); 247 "Detected SiS 180/181 chipset in combined mode\n");
250 port2_start = 0; 248 port2_start = 0;
251 pi.flags |= ATA_FLAG_SLAVE_POSS; 249 pi.flags |= ATA_FLAG_SLAVE_POSS;
252 } 250 }
@@ -256,24 +254,22 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
256 case 0x0183: 254 case 0x0183:
257 pci_read_config_dword(pdev, 0x6C, &val); 255 pci_read_config_dword(pdev, 0x6C, &val);
258 if (val & (1L << 31)) { 256 if (val & (1L << 31)) {
259 dev_printk(KERN_INFO, &pdev->dev, 257 dev_info(&pdev->dev, "Detected SiS 182/965 chipset\n");
260 "Detected SiS 182/965 chipset\n");
261 pi.flags |= ATA_FLAG_SLAVE_POSS; 258 pi.flags |= ATA_FLAG_SLAVE_POSS;
262 } else { 259 } else {
263 dev_printk(KERN_INFO, &pdev->dev, 260 dev_info(&pdev->dev, "Detected SiS 182/965L chipset\n");
264 "Detected SiS 182/965L chipset\n");
265 } 261 }
266 break; 262 break;
267 263
268 case 0x1182: 264 case 0x1182:
269 dev_printk(KERN_INFO, &pdev->dev, 265 dev_info(&pdev->dev,
270 "Detected SiS 1182/966/680 SATA controller\n"); 266 "Detected SiS 1182/966/680 SATA controller\n");
271 pi.flags |= ATA_FLAG_SLAVE_POSS; 267 pi.flags |= ATA_FLAG_SLAVE_POSS;
272 break; 268 break;
273 269
274 case 0x1183: 270 case 0x1183:
275 dev_printk(KERN_INFO, &pdev->dev, 271 dev_info(&pdev->dev,
276 "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n"); 272 "Detected SiS 1183/966/966L/968/680 controller in PATA mode\n");
277 ppi[0] = &sis_info133_for_sata; 273 ppi[0] = &sis_info133_for_sata;
278 ppi[1] = &sis_info133_for_sata; 274 ppi[1] = &sis_info133_for_sata;
279 break; 275 break;
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 35eabcf34568..c646118943ff 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -414,15 +414,13 @@ static void k2_sata_setup_port(struct ata_ioports *port, void __iomem *base)
414 414
415static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 415static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
416{ 416{
417 static int printed_version;
418 const struct ata_port_info *ppi[] = 417 const struct ata_port_info *ppi[] =
419 { &k2_port_info[ent->driver_data], NULL }; 418 { &k2_port_info[ent->driver_data], NULL };
420 struct ata_host *host; 419 struct ata_host *host;
421 void __iomem *mmio_base; 420 void __iomem *mmio_base;
422 int n_ports, i, rc, bar_pos; 421 int n_ports, i, rc, bar_pos;
423 422
424 if (!printed_version++) 423 ata_print_version_once(&pdev->dev, DRV_VERSION);
425 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
426 424
427 /* allocate host */ 425 /* allocate host */
428 n_ports = 4; 426 n_ports = 4;
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 8fd3b7252bda..cdaebbe3d184 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -1440,15 +1440,13 @@ static void pdc_20621_init(struct ata_host *host)
1440static int pdc_sata_init_one(struct pci_dev *pdev, 1440static int pdc_sata_init_one(struct pci_dev *pdev,
1441 const struct pci_device_id *ent) 1441 const struct pci_device_id *ent)
1442{ 1442{
1443 static int printed_version;
1444 const struct ata_port_info *ppi[] = 1443 const struct ata_port_info *ppi[] =
1445 { &pdc_port_info[ent->driver_data], NULL }; 1444 { &pdc_port_info[ent->driver_data], NULL };
1446 struct ata_host *host; 1445 struct ata_host *host;
1447 struct pdc_host_priv *hpriv; 1446 struct pdc_host_priv *hpriv;
1448 int i, rc; 1447 int i, rc;
1449 1448
1450 if (!printed_version++) 1449 ata_print_version_once(&pdev->dev, DRV_VERSION);
1451 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1452 1450
1453 /* allocate host */ 1451 /* allocate host */
1454 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4); 1452 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4);
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 235be717a713..b54ebfcdda32 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -145,7 +145,6 @@ static int uli_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
145 145
146static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 146static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
147{ 147{
148 static int printed_version;
149 const struct ata_port_info *ppi[] = { &uli_port_info, NULL }; 148 const struct ata_port_info *ppi[] = { &uli_port_info, NULL };
150 unsigned int board_idx = (unsigned int) ent->driver_data; 149 unsigned int board_idx = (unsigned int) ent->driver_data;
151 struct ata_host *host; 150 struct ata_host *host;
@@ -154,8 +153,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
154 struct ata_ioports *ioaddr; 153 struct ata_ioports *ioaddr;
155 int n_ports, rc; 154 int n_ports, rc;
156 155
157 if (!printed_version++) 156 ata_print_version_once(&pdev->dev, DRV_VERSION);
158 dev_printk(KERN_INFO, &pdev->dev, "version " DRV_VERSION "\n");
159 157
160 rc = pcim_enable_device(pdev); 158 rc = pcim_enable_device(pdev);
161 if (rc) 159 if (rc)
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 54434db15b12..f93e43b0ccd8 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -360,9 +360,9 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
360 360
361 online = (sstatus & 0xf) == 0x3; 361 online = (sstatus & 0xf) == 0x3;
362 362
363 ata_port_printk(ap, KERN_INFO, 363 ata_port_info(ap,
364 "SATA link %s 1.5 Gbps (SStatus %X SControl %X)\n", 364 "SATA link %s 1.5 Gbps (SStatus %X SControl %X)\n",
365 online ? "up" : "down", sstatus, scontrol); 365 online ? "up" : "down", sstatus, scontrol);
366 366
367 /* SStatus is read one more time */ 367 /* SStatus is read one more time */
368 svia_scr_read(link, SCR_STATUS, &sstatus); 368 svia_scr_read(link, SCR_STATUS, &sstatus);
@@ -469,7 +469,7 @@ static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
469 469
470 rc = pcim_iomap_regions(pdev, 1 << 5, DRV_NAME); 470 rc = pcim_iomap_regions(pdev, 1 << 5, DRV_NAME);
471 if (rc) { 471 if (rc) {
472 dev_printk(KERN_ERR, &pdev->dev, "failed to iomap PCI BAR 5\n"); 472 dev_err(&pdev->dev, "failed to iomap PCI BAR 5\n");
473 return rc; 473 return rc;
474 } 474 }
475 475
@@ -488,14 +488,14 @@ static int vt6421_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
488 488
489 *r_host = host = ata_host_alloc_pinfo(&pdev->dev, ppi, ARRAY_SIZE(ppi)); 489 *r_host = host = ata_host_alloc_pinfo(&pdev->dev, ppi, ARRAY_SIZE(ppi));
490 if (!host) { 490 if (!host) {
491 dev_printk(KERN_ERR, &pdev->dev, "failed to allocate host\n"); 491 dev_err(&pdev->dev, "failed to allocate host\n");
492 return -ENOMEM; 492 return -ENOMEM;
493 } 493 }
494 494
495 rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME); 495 rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME);
496 if (rc) { 496 if (rc) {
497 dev_printk(KERN_ERR, &pdev->dev, "failed to request/iomap " 497 dev_err(&pdev->dev, "failed to request/iomap PCI BARs (errno=%d)\n",
498 "PCI BARs (errno=%d)\n", rc); 498 rc);
499 return rc; 499 return rc;
500 } 500 }
501 host->iomap = pcim_iomap_table(pdev); 501 host->iomap = pcim_iomap_table(pdev);
@@ -526,7 +526,7 @@ static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host)
526 526
527 rc = pcim_iomap_regions(pdev, 1 << 5, DRV_NAME); 527 rc = pcim_iomap_regions(pdev, 1 << 5, DRV_NAME);
528 if (rc) { 528 if (rc) {
529 dev_printk(KERN_ERR, &pdev->dev, "failed to iomap PCI BAR 5\n"); 529 dev_err(&pdev->dev, "failed to iomap PCI BAR 5\n");
530 return rc; 530 return rc;
531 } 531 }
532 532
@@ -542,15 +542,14 @@ static void svia_configure(struct pci_dev *pdev, int board_id)
542 u8 tmp8; 542 u8 tmp8;
543 543
544 pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tmp8); 544 pci_read_config_byte(pdev, PCI_INTERRUPT_LINE, &tmp8);
545 dev_printk(KERN_INFO, &pdev->dev, "routed to hard irq line %d\n", 545 dev_info(&pdev->dev, "routed to hard irq line %d\n",
546 (int) (tmp8 & 0xf0) == 0xf0 ? 0 : tmp8 & 0x0f); 546 (int) (tmp8 & 0xf0) == 0xf0 ? 0 : tmp8 & 0x0f);
547 547
548 /* make sure SATA channels are enabled */ 548 /* make sure SATA channels are enabled */
549 pci_read_config_byte(pdev, SATA_CHAN_ENAB, &tmp8); 549 pci_read_config_byte(pdev, SATA_CHAN_ENAB, &tmp8);
550 if ((tmp8 & ALL_PORTS) != ALL_PORTS) { 550 if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
551 dev_printk(KERN_DEBUG, &pdev->dev, 551 dev_dbg(&pdev->dev, "enabling SATA channels (0x%x)\n",
552 "enabling SATA channels (0x%x)\n", 552 (int)tmp8);
553 (int) tmp8);
554 tmp8 |= ALL_PORTS; 553 tmp8 |= ALL_PORTS;
555 pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8); 554 pci_write_config_byte(pdev, SATA_CHAN_ENAB, tmp8);
556 } 555 }
@@ -558,9 +557,8 @@ static void svia_configure(struct pci_dev *pdev, int board_id)
558 /* make sure interrupts for each channel sent to us */ 557 /* make sure interrupts for each channel sent to us */
559 pci_read_config_byte(pdev, SATA_INT_GATE, &tmp8); 558 pci_read_config_byte(pdev, SATA_INT_GATE, &tmp8);
560 if ((tmp8 & ALL_PORTS) != ALL_PORTS) { 559 if ((tmp8 & ALL_PORTS) != ALL_PORTS) {
561 dev_printk(KERN_DEBUG, &pdev->dev, 560 dev_dbg(&pdev->dev, "enabling SATA channel interrupts (0x%x)\n",
562 "enabling SATA channel interrupts (0x%x)\n", 561 (int) tmp8);
563 (int) tmp8);
564 tmp8 |= ALL_PORTS; 562 tmp8 |= ALL_PORTS;
565 pci_write_config_byte(pdev, SATA_INT_GATE, tmp8); 563 pci_write_config_byte(pdev, SATA_INT_GATE, tmp8);
566 } 564 }
@@ -568,9 +566,9 @@ static void svia_configure(struct pci_dev *pdev, int board_id)
568 /* make sure native mode is enabled */ 566 /* make sure native mode is enabled */
569 pci_read_config_byte(pdev, SATA_NATIVE_MODE, &tmp8); 567 pci_read_config_byte(pdev, SATA_NATIVE_MODE, &tmp8);
570 if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) { 568 if ((tmp8 & NATIVE_MODE_ALL) != NATIVE_MODE_ALL) {
571 dev_printk(KERN_DEBUG, &pdev->dev, 569 dev_dbg(&pdev->dev,
572 "enabling SATA channel native mode (0x%x)\n", 570 "enabling SATA channel native mode (0x%x)\n",
573 (int) tmp8); 571 (int) tmp8);
574 tmp8 |= NATIVE_MODE_ALL; 572 tmp8 |= NATIVE_MODE_ALL;
575 pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8); 573 pci_write_config_byte(pdev, SATA_NATIVE_MODE, tmp8);
576 } 574 }
@@ -606,15 +604,13 @@ static void svia_configure(struct pci_dev *pdev, int board_id)
606 604
607static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 605static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
608{ 606{
609 static int printed_version;
610 unsigned int i; 607 unsigned int i;
611 int rc; 608 int rc;
612 struct ata_host *host = NULL; 609 struct ata_host *host = NULL;
613 int board_id = (int) ent->driver_data; 610 int board_id = (int) ent->driver_data;
614 const unsigned *bar_sizes; 611 const unsigned *bar_sizes;
615 612
616 if (!printed_version++) 613 ata_print_version_once(&pdev->dev, DRV_VERSION);
617 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
618 614
619 rc = pcim_enable_device(pdev); 615 rc = pcim_enable_device(pdev);
620 if (rc) 616 if (rc)
@@ -628,7 +624,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
628 for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++) 624 for (i = 0; i < ARRAY_SIZE(svia_bar_sizes); i++)
629 if ((pci_resource_start(pdev, i) == 0) || 625 if ((pci_resource_start(pdev, i) == 0) ||
630 (pci_resource_len(pdev, i) < bar_sizes[i])) { 626 (pci_resource_len(pdev, i) < bar_sizes[i])) {
631 dev_printk(KERN_ERR, &pdev->dev, 627 dev_err(&pdev->dev,
632 "invalid PCI BAR %u (sz 0x%llx, val 0x%llx)\n", 628 "invalid PCI BAR %u (sz 0x%llx, val 0x%llx)\n",
633 i, 629 i,
634 (unsigned long long)pci_resource_start(pdev, i), 630 (unsigned long long)pci_resource_start(pdev, i),
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index 7c987371136e..6135a5288695 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -273,9 +273,8 @@ static irqreturn_t vsc_sata_interrupt(int irq, void *dev_instance)
273 273
274 if (unlikely(status == 0xffffffff || status == 0)) { 274 if (unlikely(status == 0xffffffff || status == 0)) {
275 if (status) 275 if (status)
276 dev_printk(KERN_ERR, host->dev, 276 dev_err(host->dev,
277 ": IRQ status == 0xffffffff, " 277 ": IRQ status == 0xffffffff, PCI fault or device removal?\n");
278 "PCI fault or device removal?\n");
279 goto out; 278 goto out;
280 } 279 }
281 280
@@ -347,14 +346,12 @@ static int __devinit vsc_sata_init_one(struct pci_dev *pdev,
347 .port_ops = &vsc_sata_ops, 346 .port_ops = &vsc_sata_ops,
348 }; 347 };
349 const struct ata_port_info *ppi[] = { &pi, NULL }; 348 const struct ata_port_info *ppi[] = { &pi, NULL };
350 static int printed_version;
351 struct ata_host *host; 349 struct ata_host *host;
352 void __iomem *mmio_base; 350 void __iomem *mmio_base;
353 int i, rc; 351 int i, rc;
354 u8 cls; 352 u8 cls;
355 353
356 if (!printed_version++) 354 ata_print_version_once(&pdev->dev, DRV_VERSION);
357 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
358 355
359 /* allocate host */ 356 /* allocate host */
360 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4); 357 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5a9926b34072..efd6f9800762 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -74,6 +74,16 @@
74 74
75#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args) 75#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
76 76
77#define ata_print_version_once(dev, version) \
78({ \
79 static bool __print_once; \
80 \
81 if (!__print_once) { \
82 __print_once = true; \
83 ata_print_version(dev, version); \
84 } \
85})
86
77/* NEW: debug levels */ 87/* NEW: debug levels */
78#define HAVE_LIBATA_MSG 1 88#define HAVE_LIBATA_MSG 1
79 89
@@ -1244,20 +1254,50 @@ static inline int sata_srst_pmp(struct ata_link *link)
1244/* 1254/*
1245 * printk helpers 1255 * printk helpers
1246 */ 1256 */
1247#define ata_port_printk(ap, lv, fmt, args...) \ 1257__attribute__((format (printf, 3, 4)))
1248 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) 1258int ata_port_printk(const struct ata_port *ap, const char *level,
1249 1259 const char *fmt, ...);
1250#define ata_link_printk(link, lv, fmt, args...) do { \ 1260__attribute__((format (printf, 3, 4)))
1251 if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \ 1261int ata_link_printk(const struct ata_link *link, const char *level,
1252 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ 1262 const char *fmt, ...);
1253 (link)->pmp , ##args); \ 1263__attribute__((format (printf, 3, 4)))
1254 else \ 1264int ata_dev_printk(const struct ata_device *dev, const char *level,
1255 printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \ 1265 const char *fmt, ...);
1256 } while(0) 1266
1257 1267#define ata_port_err(ap, fmt, ...) \
1258#define ata_dev_printk(dev, lv, fmt, args...) \ 1268 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)
1259 printk("%sata%u.%02u: "fmt, lv, (dev)->link->ap->print_id, \ 1269#define ata_port_warn(ap, fmt, ...) \
1260 (dev)->link->pmp + (dev)->devno , ##args) 1270 ata_port_printk(ap, KERN_WARNING, fmt, ##__VA_ARGS__)
1271#define ata_port_notice(ap, fmt, ...) \
1272 ata_port_printk(ap, KERN_NOTICE, fmt, ##__VA_ARGS__)
1273#define ata_port_info(ap, fmt, ...) \
1274 ata_port_printk(ap, KERN_INFO, fmt, ##__VA_ARGS__)
1275#define ata_port_dbg(ap, fmt, ...) \
1276 ata_port_printk(ap, KERN_DEBUG, fmt, ##__VA_ARGS__)
1277
1278#define ata_link_err(link, fmt, ...) \
1279 ata_link_printk(link, KERN_ERR, fmt, ##__VA_ARGS__)
1280#define ata_link_warn(link, fmt, ...) \
1281 ata_link_printk(link, KERN_WARNING, fmt, ##__VA_ARGS__)
1282#define ata_link_notice(link, fmt, ...) \
1283 ata_link_printk(link, KERN_NOTICE, fmt, ##__VA_ARGS__)
1284#define ata_link_info(link, fmt, ...) \
1285 ata_link_printk(link, KERN_INFO, fmt, ##__VA_ARGS__)
1286#define ata_link_dbg(link, fmt, ...) \
1287 ata_link_printk(link, KERN_DEBUG, fmt, ##__VA_ARGS__)
1288
1289#define ata_dev_err(dev, fmt, ...) \
1290 ata_dev_printk(dev, KERN_ERR, fmt, ##__VA_ARGS__)
1291#define ata_dev_warn(dev, fmt, ...) \
1292 ata_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)
1293#define ata_dev_notice(dev, fmt, ...) \
1294 ata_dev_printk(dev, KERN_NOTICE, fmt, ##__VA_ARGS__)
1295#define ata_dev_info(dev, fmt, ...) \
1296 ata_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
1297#define ata_dev_dbg(dev, fmt, ...) \
1298 ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)
1299
1300void ata_print_version(const struct device *dev, const char *version);
1261 1301
1262/* 1302/*
1263 * ata_eh_info helpers 1303 * ata_eh_info helpers