aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2011-04-15 18:52:00 -0400
committerJeff Garzik <jgarzik@pobox.com>2011-07-23 17:57:36 -0400
commit06296a1e684bcd40b9a28d5d8030809e4295528b (patch)
tree474fcc8507fb11107e9e5de885217396a12d99f1
parenta9a79dfec239568bdbf778242f8fcd10bcc5b9e2 (diff)
ata: Add and use ata_print_version_once
Use a single mechanism to show driver version. Reduces text a tiny bit too. Remove uses of static int printed_version Add and use ata_print_version(const struct device *, const char *ver) and ata_print_version_once. $ size drivers/ata/built-in.* text data bss dec hex filename 544969 73893 116584 735446 b38d6 drivers/ata/built-in.allyesconfig.ata.o 543870 73893 116592 734355 b34ad drivers/ata/built-in.allyesconfig.print_once.o 141328 14689 4220 160237 271ed drivers/ata/built-in.defconfig.ata.o 141212 14689 4220 160121 27179 drivers/ata/built-in.defconfig.print_once.o Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/ata/acard-ahci.c4
-rw-r--r--drivers/ata/ahci.c4
-rw-r--r--drivers/ata/ata_piix.c5
-rw-r--r--drivers/ata/libata-core.c6
-rw-r--r--drivers/ata/pata_amd.c4
-rw-r--r--drivers/ata/pata_artop.c5
-rw-r--r--drivers/ata/pata_atp867x.c4
-rw-r--r--drivers/ata/pata_efar.c5
-rw-r--r--drivers/ata/pata_hpt3x3.c4
-rw-r--r--drivers/ata/pata_it8213.c5
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c2
-rw-r--r--drivers/ata/pata_mpiix.c4
-rw-r--r--drivers/ata/pata_netcell.c5
-rw-r--r--drivers/ata/pata_ns87415.c5
-rw-r--r--drivers/ata/pata_octeon_cf.c6
-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_pdc2027x.c4
-rw-r--r--drivers/ata/pata_radisys.c5
-rw-r--r--drivers/ata/pata_rdc.c5
-rw-r--r--drivers/ata/pata_rz1000.c2
-rw-r--r--drivers/ata/pata_scc.c5
-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_triflex.c4
-rw-r--r--drivers/ata/pata_via.c4
-rw-r--r--drivers/ata/pdc_adma.c4
-rw-r--r--drivers/ata/sata_inic162x.c4
-rw-r--r--drivers/ata/sata_mv.c8
-rw-r--r--drivers/ata/sata_nv.c4
-rw-r--r--drivers/ata/sata_promise.c4
-rw-r--r--drivers/ata/sata_qstor.c4
-rw-r--r--drivers/ata/sata_sil.c4
-rw-r--r--drivers/ata/sata_sil24.c4
-rw-r--r--drivers/ata/sata_sis.c4
-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.c4
-rw-r--r--drivers/ata/sata_vsc.c4
-rw-r--r--include/linux/libata.h12
43 files changed, 63 insertions, 133 deletions
diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c
index e52d90ad1fe9..3bc8c79bf2c7 100644
--- a/drivers/ata/acard-ahci.c
+++ b/drivers/ata/acard-ahci.c
@@ -403,7 +403,6 @@ static int acard_ahci_port_start(struct ata_port *ap)
403 403
404static 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)
405{ 405{
406 static int printed_version;
407 unsigned int board_id = ent->driver_data; 406 unsigned int board_id = ent->driver_data;
408 struct ata_port_info pi = acard_ahci_port_info[board_id]; 407 struct ata_port_info pi = acard_ahci_port_info[board_id];
409 const struct ata_port_info *ppi[] = { &pi, NULL }; 408 const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -416,8 +415,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id
416 415
417 WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS); 416 WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
418 417
419 if (!printed_version++) 418 ata_print_version_once(&pdev->dev, DRV_VERSION);
420 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
421 419
422 /* acquire resources */ 420 /* acquire resources */
423 rc = pcim_enable_device(pdev); 421 rc = pcim_enable_device(pdev);
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 85f7b148f1a1..6ea99df87146 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1059,7 +1059,6 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host)
1059 1059
1060static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 1060static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1061{ 1061{
1062 static int printed_version;
1063 unsigned int board_id = ent->driver_data; 1062 unsigned int board_id = ent->driver_data;
1064 struct ata_port_info pi = ahci_port_info[board_id]; 1063 struct ata_port_info pi = ahci_port_info[board_id];
1065 const struct ata_port_info *ppi[] = { &pi, NULL }; 1064 const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -1072,8 +1071,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1072 1071
1073 WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS); 1072 WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
1074 1073
1075 if (!printed_version++) 1074 ata_print_version_once(&pdev->dev, DRV_VERSION);
1076 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1077 1075
1078 /* The AHCI driver can only drive the SATA ports, the PATA driver 1076 /* The AHCI driver can only drive the SATA ports, the PATA driver
1079 can drive them all so if both drivers are selected make sure 1077 can drive them all so if both drivers are selected make sure
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 9842faac097f..43107e9415da 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1562,7 +1562,6 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev)
1562static int __devinit piix_init_one(struct pci_dev *pdev, 1562static int __devinit piix_init_one(struct pci_dev *pdev,
1563 const struct pci_device_id *ent) 1563 const struct pci_device_id *ent)
1564{ 1564{
1565 static int printed_version;
1566 struct device *dev = &pdev->dev; 1565 struct device *dev = &pdev->dev;
1567 struct ata_port_info port_info[2]; 1566 struct ata_port_info port_info[2];
1568 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] };
@@ -1572,9 +1571,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
1572 struct piix_host_priv *hpriv; 1571 struct piix_host_priv *hpriv;
1573 int rc; 1572 int rc;
1574 1573
1575 if (!printed_version++) 1574 ata_print_version_once(&pdev->dev, DRV_VERSION);
1576 dev_printk(KERN_DEBUG, &pdev->dev,
1577 "version " DRV_VERSION "\n");
1578 1575
1579 /* no hotplugging support for later devices (FIXME) */ 1576 /* no hotplugging support for later devices (FIXME) */
1580 if (!in_module_init && ent->driver_data >= ich5_sata) 1577 if (!in_module_init && ent->driver_data >= ich5_sata)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index ef5612e42881..83a292904ca9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6647,6 +6647,12 @@ int ata_dev_printk(const struct ata_device *dev, const char *level,
6647} 6647}
6648EXPORT_SYMBOL(ata_dev_printk); 6648EXPORT_SYMBOL(ata_dev_printk);
6649 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
6650/* 6656/*
6651 * libata is essentially a library of internal helper functions for 6657 * libata is essentially a library of internal helper functions for
6652 * 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
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index 801554ddc59d..dc6b5dae0463 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -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 bcbf99856e1f..3cfabb262af2 100644
--- a/drivers/ata/pata_atp867x.c
+++ b/drivers/ata/pata_atp867x.c
@@ -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_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)
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_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_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index fc42492439bb..15b64311fe0a 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -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_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_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_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 c8707f03d886..1d61d5d278fa 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -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_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index c8cdd6d1cc6f..b1511f38b0e8 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -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_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 ed8c90559ced..aca321e1e6a2 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -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_scc.c b/drivers/ata/pata_scc.c
index a72e3663dc91..eb748e327143 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -1071,15 +1071,12 @@ static int scc_host_init(struct ata_host *host)
1071 1071
1072static 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)
1073{ 1073{
1074 static int printed_version;
1075 unsigned int board_idx = (unsigned int) ent->driver_data; 1074 unsigned int board_idx = (unsigned int) ent->driver_data;
1076 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 };
1077 struct ata_host *host; 1076 struct ata_host *host;
1078 int rc; 1077 int rc;
1079 1078
1080 if (!printed_version++) 1079 ata_print_version_once(&pdev->dev, DRV_VERSION);
1081 dev_printk(KERN_DEBUG, &pdev->dev,
1082 "version " DRV_VERSION "\n");
1083 1080
1084 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 1); 1081 host = ata_host_alloc_pinfo(&pdev->dev, ppi, 1);
1085 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_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 74763c3ee39f..65e4be6be220 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -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 fdad56c8662a..04911d52f59d 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -610,15 +610,13 @@ static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
610static int adma_ata_init_one(struct pci_dev *pdev, 610static int adma_ata_init_one(struct pci_dev *pdev,
611 const struct pci_device_id *ent) 611 const struct pci_device_id *ent)
612{ 612{
613 static int printed_version;
614 unsigned int board_idx = (unsigned int) ent->driver_data; 613 unsigned int board_idx = (unsigned int) ent->driver_data;
615 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 };
616 struct ata_host *host; 615 struct ata_host *host;
617 void __iomem *mmio_base; 616 void __iomem *mmio_base;
618 int rc, port_no; 617 int rc, port_no;
619 618
620 if (!printed_version++) 619 ata_print_version_once(&pdev->dev, DRV_VERSION);
621 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
622 620
623 /* alloc host */ 621 /* alloc host */
624 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_inic162x.c b/drivers/ata/sata_inic162x.c
index 7a5667daf0d0..5c7d70c03bf0 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -800,7 +800,6 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
800 800
801static 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)
802{ 802{
803 static int printed_version;
804 const struct ata_port_info *ppi[] = { &inic_port_info, NULL }; 803 const struct ata_port_info *ppi[] = { &inic_port_info, NULL };
805 struct ata_host *host; 804 struct ata_host *host;
806 struct inic_host_priv *hpriv; 805 struct inic_host_priv *hpriv;
@@ -808,8 +807,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
808 int mmio_bar; 807 int mmio_bar;
809 int i, rc; 808 int i, rc;
810 809
811 if (!printed_version++) 810 ata_print_version_once(&pdev->dev, DRV_VERSION);
812 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
813 811
814 /* alloc host */ 812 /* alloc host */
815 host = ata_host_alloc_pinfo(&pdev->dev, ppi, NR_PORTS); 813 host = ata_host_alloc_pinfo(&pdev->dev, ppi, NR_PORTS);
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index b0e45d29244f..4b6b2090784b 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4018,7 +4018,6 @@ static void mv_conf_mbus_windows(struct mv_host_priv *hpriv,
4018 */ 4018 */
4019static int mv_platform_probe(struct platform_device *pdev) 4019static int mv_platform_probe(struct platform_device *pdev)
4020{ 4020{
4021 static int printed_version;
4022 const struct mv_sata_platform_data *mv_platform_data; 4021 const struct mv_sata_platform_data *mv_platform_data;
4023 const struct ata_port_info *ppi[] = 4022 const struct ata_port_info *ppi[] =
4024 { &mv_port_info[chip_soc], NULL }; 4023 { &mv_port_info[chip_soc], NULL };
@@ -4027,8 +4026,7 @@ static int mv_platform_probe(struct platform_device *pdev)
4027 struct resource *res; 4026 struct resource *res;
4028 int n_ports, rc; 4027 int n_ports, rc;
4029 4028
4030 if (!printed_version++) 4029 ata_print_version_once(&pdev->dev, DRV_VERSION);
4031 dev_info(&pdev->dev, "version " DRV_VERSION "\n");
4032 4030
4033 /* 4031 /*
4034 * Simple resource validation .. 4032 * Simple resource validation ..
@@ -4285,15 +4283,13 @@ static void mv_print_info(struct ata_host *host)
4285static int mv_pci_init_one(struct pci_dev *pdev, 4283static int mv_pci_init_one(struct pci_dev *pdev,
4286 const struct pci_device_id *ent) 4284 const struct pci_device_id *ent)
4287{ 4285{
4288 static int printed_version;
4289 unsigned int board_idx = (unsigned int)ent->driver_data; 4286 unsigned int board_idx = (unsigned int)ent->driver_data;
4290 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 };
4291 struct ata_host *host; 4288 struct ata_host *host;
4292 struct mv_host_priv *hpriv; 4289 struct mv_host_priv *hpriv;
4293 int n_ports, port, rc; 4290 int n_ports, port, rc;
4294 4291
4295 if (!printed_version++) 4292 ata_print_version_once(&pdev->dev, DRV_VERSION);
4296 dev_info(&pdev->dev, "version " DRV_VERSION "\n");
4297 4293
4298 /* allocate host */ 4294 /* allocate host */
4299 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 b33f525df0f5..e0bc9646a38e 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -2353,7 +2353,6 @@ static irqreturn_t nv_swncq_interrupt(int irq, void *dev_instance)
2353 2353
2354static 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)
2355{ 2355{
2356 static int printed_version;
2357 const struct ata_port_info *ppi[] = { NULL, NULL }; 2356 const struct ata_port_info *ppi[] = { NULL, NULL };
2358 struct nv_pi_priv *ipriv; 2357 struct nv_pi_priv *ipriv;
2359 struct ata_host *host; 2358 struct ata_host *host;
@@ -2370,8 +2369,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2370 if (pci_resource_start(pdev, bar) == 0) 2369 if (pci_resource_start(pdev, bar) == 0)
2371 return -ENODEV; 2370 return -ENODEV;
2372 2371
2373 if (!printed_version++) 2372 ata_print_version_once(&pdev->dev, DRV_VERSION);
2374 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
2375 2373
2376 rc = pcim_enable_device(pdev); 2374 rc = pcim_enable_device(pdev);
2377 if (rc) 2375 if (rc)
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 2ad51f9358bd..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);
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 5702561e4e7d..9d1a47bb21b3 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -587,14 +587,12 @@ static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
587static int qs_ata_init_one(struct pci_dev *pdev, 587static int qs_ata_init_one(struct pci_dev *pdev,
588 const struct pci_device_id *ent) 588 const struct pci_device_id *ent)
589{ 589{
590 static int printed_version;
591 unsigned int board_idx = (unsigned int) ent->driver_data; 590 unsigned int board_idx = (unsigned int) ent->driver_data;
592 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 };
593 struct ata_host *host; 592 struct ata_host *host;
594 int rc, port_no; 593 int rc, port_no;
595 594
596 if (!printed_version++) 595 ata_print_version_once(&pdev->dev, DRV_VERSION);
597 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
598 596
599 /* alloc host */ 597 /* alloc host */
600 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 280ba8a62dcb..98c1d780f552 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -732,7 +732,6 @@ static bool sil_broken_system_poweroff(struct pci_dev *pdev)
732 732
733static 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)
734{ 734{
735 static int printed_version;
736 int board_id = ent->driver_data; 735 int board_id = ent->driver_data;
737 struct ata_port_info pi = sil_port_info[board_id]; 736 struct ata_port_info pi = sil_port_info[board_id];
738 const struct ata_port_info *ppi[] = { &pi, NULL }; 737 const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -741,8 +740,7 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
741 int n_ports, rc; 740 int n_ports, rc;
742 unsigned int i; 741 unsigned int i;
743 742
744 if (!printed_version++) 743 ata_print_version_once(&pdev->dev, DRV_VERSION);
745 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
746 744
747 /* allocate host */ 745 /* allocate host */
748 n_ports = 2; 746 n_ports = 2;
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 792e93688f7e..55470f337e51 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1270,7 +1270,6 @@ static void sil24_init_controller(struct ata_host *host)
1270static 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)
1271{ 1271{
1272 extern int __MARKER__sil24_cmd_block_is_sized_wrongly; 1272 extern int __MARKER__sil24_cmd_block_is_sized_wrongly;
1273 static int printed_version;
1274 struct ata_port_info pi = sil24_port_info[ent->driver_data]; 1273 struct ata_port_info pi = sil24_port_info[ent->driver_data];
1275 const struct ata_port_info *ppi[] = { &pi, NULL }; 1274 const struct ata_port_info *ppi[] = { &pi, NULL };
1276 void __iomem * const *iomap; 1275 void __iomem * const *iomap;
@@ -1282,8 +1281,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1282 if (sizeof(union sil24_cmd_block) != PAGE_SIZE) 1281 if (sizeof(union sil24_cmd_block) != PAGE_SIZE)
1283 __MARKER__sil24_cmd_block_is_sized_wrongly = 1; 1282 __MARKER__sil24_cmd_block_is_sized_wrongly = 1;
1284 1283
1285 if (!printed_version++) 1284 ata_print_version_once(&pdev->dev, DRV_VERSION);
1286 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
1287 1285
1288 /* acquire resources */ 1286 /* acquire resources */
1289 rc = pcim_enable_device(pdev); 1287 rc = pcim_enable_device(pdev);
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index ae040dee419e..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_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)
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 3072fd3f11c6..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_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 0fc1582005e8..21007b10c676 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -606,15 +606,13 @@ static void svia_configure(struct pci_dev *pdev, int board_id)
606 606
607static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 607static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
608{ 608{
609 static int printed_version;
610 unsigned int i; 609 unsigned int i;
611 int rc; 610 int rc;
612 struct ata_host *host = NULL; 611 struct ata_host *host = NULL;
613 int board_id = (int) ent->driver_data; 612 int board_id = (int) ent->driver_data;
614 const unsigned *bar_sizes; 613 const unsigned *bar_sizes;
615 614
616 if (!printed_version++) 615 ata_print_version_once(&pdev->dev, DRV_VERSION);
617 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
618 616
619 rc = pcim_enable_device(pdev); 617 rc = pcim_enable_device(pdev);
620 if (rc) 618 if (rc)
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index dcd57b04d36a..6135a5288695 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -346,14 +346,12 @@ static int __devinit vsc_sata_init_one(struct pci_dev *pdev,
346 .port_ops = &vsc_sata_ops, 346 .port_ops = &vsc_sata_ops,
347 }; 347 };
348 const struct ata_port_info *ppi[] = { &pi, NULL }; 348 const struct ata_port_info *ppi[] = { &pi, NULL };
349 static int printed_version;
350 struct ata_host *host; 349 struct ata_host *host;
351 void __iomem *mmio_base; 350 void __iomem *mmio_base;
352 int i, rc; 351 int i, rc;
353 u8 cls; 352 u8 cls;
354 353
355 if (!printed_version++) 354 ata_print_version_once(&pdev->dev, DRV_VERSION);
356 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
357 355
358 /* allocate host */ 356 /* allocate host */
359 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 4e72a6af70b5..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
@@ -1287,6 +1297,8 @@ int ata_dev_printk(const struct ata_device *dev, const char *level,
1287#define ata_dev_dbg(dev, fmt, ...) \ 1297#define ata_dev_dbg(dev, fmt, ...) \
1288 ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__) 1298 ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)
1289 1299
1300void ata_print_version(const struct device *dev, const char *version);
1301
1290/* 1302/*
1291 * ata_eh_info helpers 1303 * ata_eh_info helpers
1292 */ 1304 */