Browse Source

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>
Joe Perches 14 năm trước cách đây
mục cha
commit
06296a1e68
43 tập tin đã thay đổi với 63 bổ sung133 xóa
  1. 1 3
      drivers/ata/acard-ahci.c
  2. 1 3
      drivers/ata/ahci.c
  3. 1 4
      drivers/ata/ata_piix.c
  4. 6 0
      drivers/ata/libata-core.c
  5. 1 3
      drivers/ata/pata_amd.c
  6. 1 4
      drivers/ata/pata_artop.c
  7. 1 3
      drivers/ata/pata_atp867x.c
  8. 1 4
      drivers/ata/pata_efar.c
  9. 1 3
      drivers/ata/pata_hpt3x3.c
  10. 1 4
      drivers/ata/pata_it8213.c
  11. 1 1
      drivers/ata/pata_ixp4xx_cf.c
  12. 1 3
      drivers/ata/pata_mpiix.c
  13. 1 4
      drivers/ata/pata_netcell.c
  14. 1 4
      drivers/ata/pata_ns87415.c
  15. 4 2
      drivers/ata/pata_octeon_cf.c
  16. 1 4
      drivers/ata/pata_oldpiix.c
  17. 1 3
      drivers/ata/pata_opti.c
  18. 1 3
      drivers/ata/pata_optidma.c
  19. 1 3
      drivers/ata/pata_pdc2027x.c
  20. 1 4
      drivers/ata/pata_radisys.c
  21. 1 4
      drivers/ata/pata_rdc.c
  22. 1 1
      drivers/ata/pata_rz1000.c
  23. 1 4
      drivers/ata/pata_scc.c
  24. 1 4
      drivers/ata/pata_sch.c
  25. 1 3
      drivers/ata/pata_sil680.c
  26. 1 4
      drivers/ata/pata_sis.c
  27. 1 3
      drivers/ata/pata_triflex.c
  28. 1 3
      drivers/ata/pata_via.c
  29. 1 3
      drivers/ata/pdc_adma.c
  30. 1 3
      drivers/ata/sata_inic162x.c
  31. 2 6
      drivers/ata/sata_mv.c
  32. 1 3
      drivers/ata/sata_nv.c
  33. 1 3
      drivers/ata/sata_promise.c
  34. 1 3
      drivers/ata/sata_qstor.c
  35. 1 3
      drivers/ata/sata_sil.c
  36. 1 3
      drivers/ata/sata_sil24.c
  37. 1 3
      drivers/ata/sata_sis.c
  38. 1 3
      drivers/ata/sata_svw.c
  39. 1 3
      drivers/ata/sata_sx4.c
  40. 1 3
      drivers/ata/sata_uli.c
  41. 1 3
      drivers/ata/sata_via.c
  42. 1 3
      drivers/ata/sata_vsc.c
  43. 12 0
      include/linux/libata.h

+ 1 - 3
drivers/ata/acard-ahci.c

@@ -403,7 +403,6 @@ static int acard_ahci_port_start(struct ata_port *ap)
 
 
 static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	unsigned int board_id = ent->driver_data;
 	unsigned int board_id = ent->driver_data;
 	struct ata_port_info pi = acard_ahci_port_info[board_id];
 	struct ata_port_info pi = acard_ahci_port_info[board_id];
 	const struct ata_port_info *ppi[] = { &pi, NULL };
 	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
 
 
 	WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 	WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* acquire resources */
 	/* acquire resources */
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);

+ 1 - 3
drivers/ata/ahci.c

@@ -1059,7 +1059,6 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host)
 
 
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	unsigned int board_id = ent->driver_data;
 	unsigned int board_id = ent->driver_data;
 	struct ata_port_info pi = ahci_port_info[board_id];
 	struct ata_port_info pi = ahci_port_info[board_id];
 	const struct ata_port_info *ppi[] = { &pi, NULL };
 	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)
 
 
 	WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 	WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS);
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* The AHCI driver can only drive the SATA ports, the PATA driver
 	/* The AHCI driver can only drive the SATA ports, the PATA driver
 	   can drive them all so if both drivers are selected make sure
 	   can drive them all so if both drivers are selected make sure

+ 1 - 4
drivers/ata/ata_piix.c

@@ -1562,7 +1562,6 @@ static bool piix_broken_system_poweroff(struct pci_dev *pdev)
 static int __devinit piix_init_one(struct pci_dev *pdev,
 static int __devinit piix_init_one(struct pci_dev *pdev,
 				   const struct pci_device_id *ent)
 				   const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	struct device *dev = &pdev->dev;
 	struct device *dev = &pdev->dev;
 	struct ata_port_info port_info[2];
 	struct ata_port_info port_info[2];
 	const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
 	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,
 	struct piix_host_priv *hpriv;
 	struct piix_host_priv *hpriv;
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* no hotplugging support for later devices (FIXME) */
 	/* no hotplugging support for later devices (FIXME) */
 	if (!in_module_init && ent->driver_data >= ich5_sata)
 	if (!in_module_init && ent->driver_data >= ich5_sata)

+ 6 - 0
drivers/ata/libata-core.c

@@ -6647,6 +6647,12 @@ int ata_dev_printk(const struct ata_device *dev, const char *level,
 }
 }
 EXPORT_SYMBOL(ata_dev_printk);
 EXPORT_SYMBOL(ata_dev_printk);
 
 
+void ata_print_version(const struct device *dev, const char *version)
+{
+	dev_printk(KERN_DEBUG, dev, "version %s\n", version);
+}
+EXPORT_SYMBOL(ata_print_version);
+
 /*
 /*
  * libata is essentially a library of internal helper functions for
  * libata is essentially a library of internal helper functions for
  * low-level ATA host controller drivers.  As such, the API/ABI is
  * low-level ATA host controller drivers.  As such, the API/ABI is

+ 1 - 3
drivers/ata/pata_amd.c

@@ -530,14 +530,12 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		}
 		}
 	};
 	};
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	const struct ata_port_info *ppi[] = { NULL, NULL };
-	static int printed_version;
 	int type = id->driver_data;
 	int type = id->driver_data;
 	void *hpriv = NULL;
 	void *hpriv = NULL;
 	u8 fifo;
 	u8 fifo;
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 4
drivers/ata/pata_artop.c

@@ -346,7 +346,6 @@ static struct ata_port_operations artop6260_ops = {
 
 
 static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
 static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info_6210 = {
 	static const struct ata_port_info info_6210 = {
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.pio_mask	= ATA_PIO4,
 		.pio_mask	= ATA_PIO4,
@@ -378,9 +377,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 3
drivers/ata/pata_atp867x.c

@@ -487,7 +487,6 @@ static int atp867x_ata_pci_sff_init_host(struct ata_host *host)
 static int atp867x_init_one(struct pci_dev *pdev,
 static int atp867x_init_one(struct pci_dev *pdev,
 	const struct pci_device_id *id)
 	const struct pci_device_id *id)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info_867x = {
 	static const struct ata_port_info info_867x = {
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.pio_mask	= ATA_PIO4,
 		.pio_mask	= ATA_PIO4,
@@ -499,8 +498,7 @@ static int atp867x_init_one(struct pci_dev *pdev,
 	const struct ata_port_info *ppi[] = { &info_867x, NULL };
 	const struct ata_port_info *ppi[] = { &info_867x, NULL };
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_info(&pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 4
drivers/ata/pata_efar.c

@@ -263,7 +263,6 @@ static struct ata_port_operations efar_ops = {
 
 
 static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info = {
 	static const struct ata_port_info info = {
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.pio_mask	= ATA_PIO4,
 		.pio_mask	= ATA_PIO4,
@@ -273,9 +272,7 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 	};
 	};
 	const struct ata_port_info *ppi[] = { &info, &info };
 	const struct ata_port_info *ppi[] = { &info, &info };
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	return ata_pci_bmdma_init_one(pdev, ppi, &efar_sht, NULL,
 	return ata_pci_bmdma_init_one(pdev, ppi, &efar_sht, NULL,
 				      ATA_HOST_PARALLEL_SCAN);
 				      ATA_HOST_PARALLEL_SCAN);

+ 1 - 3
drivers/ata/pata_hpt3x3.c

@@ -185,7 +185,6 @@ static void hpt3x3_init_chipset(struct pci_dev *dev)
 
 
 static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info = {
 	static const struct ata_port_info info = {
 		.flags = ATA_FLAG_SLAVE_POSS,
 		.flags = ATA_FLAG_SLAVE_POSS,
 		.pio_mask = ATA_PIO4,
 		.pio_mask = ATA_PIO4,
@@ -206,8 +205,7 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
 
 	hpt3x3_init_chipset(pdev);
 	hpt3x3_init_chipset(pdev);
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
 	if (!host)
 	if (!host)

+ 1 - 4
drivers/ata/pata_it8213.c

@@ -258,7 +258,6 @@ static struct ata_port_operations it8213_ops = {
 
 
 static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info = {
 	static const struct ata_port_info info = {
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.pio_mask	= ATA_PIO4,
 		.pio_mask	= ATA_PIO4,
@@ -269,9 +268,7 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en
 	/* Current IT8213 stuff is single port */
 	/* Current IT8213 stuff is single port */
 	const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
 	const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info };
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	return ata_pci_bmdma_init_one(pdev, ppi, &it8213_sht, NULL, 0);
 	return ata_pci_bmdma_init_one(pdev, ppi, &it8213_sht, NULL, 0);
 }
 }

+ 1 - 1
drivers/ata/pata_ixp4xx_cf.c

@@ -181,7 +181,7 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev)
 
 
 	ixp4xx_setup_port(ap, data, cs0->start, cs1->start);
 	ixp4xx_setup_port(ap, data, cs0->start, cs1->start);
 
 
-	dev_info(&pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* activate host */
 	/* activate host */
 	return ata_host_activate(host, irq, ata_sff_interrupt, 0, &ixp4xx_sht);
 	return ata_host_activate(host, irq, ata_sff_interrupt, 0, &ixp4xx_sht);

+ 1 - 3
drivers/ata/pata_mpiix.c

@@ -152,15 +152,13 @@ static struct ata_port_operations mpiix_port_ops = {
 static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 static int mpiix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
 {
 	/* Single threaded by the PCI probe logic */
 	/* Single threaded by the PCI probe logic */
-	static int printed_version;
 	struct ata_host *host;
 	struct ata_host *host;
 	struct ata_port *ap;
 	struct ata_port *ap;
 	void __iomem *cmd_addr, *ctl_addr;
 	void __iomem *cmd_addr, *ctl_addr;
 	u16 idetim;
 	u16 idetim;
 	int cmd, ctl, irq;
 	int cmd, ctl, irq;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&dev->dev, DRV_VERSION);
 
 
 	host = ata_host_alloc(&dev->dev, 1);
 	host = ata_host_alloc(&dev->dev, 1);
 	if (!host)
 	if (!host)

+ 1 - 4
drivers/ata/pata_netcell.c

@@ -57,7 +57,6 @@ static struct ata_port_operations netcell_ops = {
 
 
 static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info = {
 	static const struct ata_port_info info = {
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		/* Actually we don't really care about these as the
 		/* 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
 	const struct ata_port_info *port_info[] = { &info, NULL };
 	const struct ata_port_info *port_info[] = { &info, NULL };
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 4
drivers/ata/pata_ns87415.c

@@ -350,7 +350,6 @@ static void ns87415_fixup(struct pci_dev *pdev)
 
 
 static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info = {
 	static const struct ata_port_info info = {
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.pio_mask	= ATA_PIO4,
 		.pio_mask	= ATA_PIO4,
@@ -370,9 +369,7 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e
 	if (PCI_SLOT(pdev->devfn) == 0x0E)
 	if (PCI_SLOT(pdev->devfn) == 0x0E)
 		ppi[0] = &info87560;
 		ppi[0] = &info87560;
 #endif
 #endif
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 4 - 2
drivers/ata/pata_octeon_cf.c

@@ -807,6 +807,7 @@ static int __devinit octeon_cf_probe(struct platform_device *pdev)
 	irq_handler_t irq_handler = NULL;
 	irq_handler_t irq_handler = NULL;
 	void __iomem *base;
 	void __iomem *base;
 	struct octeon_cf_port *cf_port;
 	struct octeon_cf_port *cf_port;
+	char version[32];
 
 
 	res_cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	res_cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
 
@@ -905,10 +906,11 @@ static int __devinit octeon_cf_probe(struct platform_device *pdev)
 	ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
 	ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
 
 
 
 
-	dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n",
+	snprintf(version, sizeof(version), "%s %d bit%s",
+		 DRV_VERSION,
 		 (ocd->is16bit) ? 16 : 8,
 		 (ocd->is16bit) ? 16 : 8,
 		 (cs1) ? ", True IDE" : "");
 		 (cs1) ? ", True IDE" : "");
-
+	ata_print_version_once(&pdev->dev, version);
 
 
 	return ata_host_activate(host, irq, irq_handler, 0, &octeon_cf_sht);
 	return ata_host_activate(host, irq, irq_handler, 0, &octeon_cf_sht);
 
 

+ 1 - 4
drivers/ata/pata_oldpiix.c

@@ -235,7 +235,6 @@ static struct ata_port_operations oldpiix_pata_ops = {
 
 
 static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info = {
 	static const struct ata_port_info info = {
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.pio_mask	= ATA_PIO4,
 		.pio_mask	= ATA_PIO4,
@@ -244,9 +243,7 @@ static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *e
 	};
 	};
 	const struct ata_port_info *ppi[] = { &info, NULL };
 	const struct ata_port_info *ppi[] = { &info, NULL };
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	return ata_pci_bmdma_init_one(pdev, ppi, &oldpiix_sht, NULL, 0);
 	return ata_pci_bmdma_init_one(pdev, ppi, &oldpiix_sht, NULL, 0);
 }
 }

+ 1 - 3
drivers/ata/pata_opti.c

@@ -167,10 +167,8 @@ static int opti_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 		.port_ops = &opti_port_ops
 		.port_ops = &opti_port_ops
 	};
 	};
 	const struct ata_port_info *ppi[] = { &info, NULL };
 	const struct ata_port_info *ppi[] = { &info, NULL };
-	static int printed_version;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&dev->dev, DRV_VERSION);
 
 
 	return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL, 0);
 	return ata_pci_sff_init_one(dev, ppi, &opti_sht, NULL, 0);
 }
 }

+ 1 - 3
drivers/ata/pata_optidma.c

@@ -411,11 +411,9 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 		.port_ops = &optiplus_port_ops
 		.port_ops = &optiplus_port_ops
 	};
 	};
 	const struct ata_port_info *ppi[] = { &info_82c700, NULL };
 	const struct ata_port_info *ppi[] = { &info_82c700, NULL };
-	static int printed_version;
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&dev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(dev);
 	rc = pcim_enable_device(dev);
 	if (rc)
 	if (rc)

+ 1 - 3
drivers/ata/pata_pdc2027x.c

@@ -697,7 +697,6 @@ static void pdc_ata_setup_port(struct ata_ioports *port, void __iomem *base)
  */
  */
 static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	static const unsigned long cmd_offset[] = { 0x17c0, 0x15c0 };
 	static const unsigned long cmd_offset[] = { 0x17c0, 0x15c0 };
 	static const unsigned long bmdma_offset[] = { 0x1000, 0x1008 };
 	static const unsigned long bmdma_offset[] = { 0x1000, 0x1008 };
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	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
 	void __iomem *mmio_base;
 	void __iomem *mmio_base;
 	int i, rc;
 	int i, rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* alloc host */
 	/* alloc host */
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 2);

+ 1 - 4
drivers/ata/pata_radisys.c

@@ -213,7 +213,6 @@ static struct ata_port_operations radisys_pata_ops = {
 
 
 static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	static const struct ata_port_info info = {
 	static const struct ata_port_info info = {
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.flags		= ATA_FLAG_SLAVE_POSS,
 		.pio_mask	= ATA_PIO4,
 		.pio_mask	= ATA_PIO4,
@@ -223,9 +222,7 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *e
 	};
 	};
 	const struct ata_port_info *ppi[] = { &info, NULL };
 	const struct ata_port_info *ppi[] = { &info, NULL };
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	return ata_pci_bmdma_init_one(pdev, ppi, &radisys_sht, NULL, 0);
 	return ata_pci_bmdma_init_one(pdev, ppi, &radisys_sht, NULL, 0);
 }
 }

+ 1 - 4
drivers/ata/pata_rdc.c

@@ -312,7 +312,6 @@ static struct scsi_host_template rdc_sht = {
 static int __devinit rdc_init_one(struct pci_dev *pdev,
 static int __devinit rdc_init_one(struct pci_dev *pdev,
 				   const struct pci_device_id *ent)
 				   const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	struct device *dev = &pdev->dev;
 	struct device *dev = &pdev->dev;
 	struct ata_port_info port_info[2];
 	struct ata_port_info port_info[2];
 	const struct ata_port_info *ppi[] = { &port_info[0], &port_info[1] };
 	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,
 	struct rdc_host_priv *hpriv;
 	struct rdc_host_priv *hpriv;
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	port_info[0] = rdc_port_info;
 	port_info[0] = rdc_port_info;
 	port_info[1] = rdc_port_info;
 	port_info[1] = rdc_port_info;

+ 1 - 1
drivers/ata/pata_rz1000.c

@@ -92,7 +92,7 @@ static int rz1000_init_one (struct pci_dev *pdev, const struct pci_device_id *en
 	};
 	};
 	const struct ata_port_info *ppi[] = { &info, NULL };
 	const struct ata_port_info *ppi[] = { &info, NULL };
 
 
-	printk_once(KERN_DEBUG DRV_NAME " version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	if (rz1000_fifo_disable(pdev) == 0)
 	if (rz1000_fifo_disable(pdev) == 0)
 		return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL, 0);
 		return ata_pci_sff_init_one(pdev, ppi, &rz1000_sht, NULL, 0);

+ 1 - 4
drivers/ata/pata_scc.c

@@ -1071,15 +1071,12 @@ static int scc_host_init(struct ata_host *host)
 
 
 static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	const struct ata_port_info *ppi[] = { &scc_port_info[board_idx], NULL };
 	const struct ata_port_info *ppi[] = { &scc_port_info[board_idx], NULL };
 	struct ata_host *host;
 	struct ata_host *host;
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 1);
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 1);
 	if (!host)
 	if (!host)

+ 1 - 4
drivers/ata/pata_sch.c

@@ -172,12 +172,9 @@ static void sch_set_dmamode(struct ata_port *ap, struct ata_device *adev)
 static int __devinit sch_init_one(struct pci_dev *pdev,
 static int __devinit sch_init_one(struct pci_dev *pdev,
 				   const struct pci_device_id *ent)
 				   const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	const struct ata_port_info *ppi[] = { &sch_port_info, NULL };
 	const struct ata_port_info *ppi[] = { &sch_port_info, NULL };
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	return ata_pci_bmdma_init_one(pdev, ppi, &sch_sht, NULL, 0);
 	return ata_pci_bmdma_init_one(pdev, ppi, &sch_sht, NULL, 0);
 }
 }

+ 1 - 3
drivers/ata/pata_sil680.c

@@ -327,13 +327,11 @@ static int __devinit sil680_init_one(struct pci_dev *pdev,
 		.port_ops = &sil680_port_ops
 		.port_ops = &sil680_port_ops
 	};
 	};
 	const struct ata_port_info *ppi[] = { &info, NULL };
 	const struct ata_port_info *ppi[] = { &info, NULL };
-	static int printed_version;
 	struct ata_host *host;
 	struct ata_host *host;
 	void __iomem *mmio_base;
 	void __iomem *mmio_base;
 	int rc, try_mmio;
 	int rc, try_mmio;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 4
drivers/ata/pata_sis.c

@@ -681,7 +681,6 @@ static void sis_fixup(struct pci_dev *pdev, struct sis_chipset *sis)
 
 
 static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	struct pci_dev *host = NULL;
 	struct pci_dev *host = NULL;
 	struct sis_chipset *chipset = NULL;
 	struct sis_chipset *chipset = NULL;
@@ -735,9 +734,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 		0x0, &sis_info100
 		0x0, &sis_info100
 	};
 	};
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev,
-			   "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 3
drivers/ata/pata_triflex.c

@@ -196,10 +196,8 @@ static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 		.port_ops = &triflex_port_ops
 		.port_ops = &triflex_port_ops
 	};
 	};
 	const struct ata_port_info *ppi[] = { &info, NULL };
 	const struct ata_port_info *ppi[] = { &info, NULL };
-	static int printed_version;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&dev->dev, DRV_VERSION);
 
 
 	return ata_pci_bmdma_init_one(dev, ppi, &triflex_sht, NULL, 0);
 	return ata_pci_bmdma_init_one(dev, ppi, &triflex_sht, NULL, 0);
 }
 }

+ 1 - 3
drivers/ata/pata_via.c

@@ -551,14 +551,12 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	struct pci_dev *isa;
 	struct pci_dev *isa;
 	const struct via_isa_bridge *config;
 	const struct via_isa_bridge *config;
-	static int printed_version;
 	u8 enable;
 	u8 enable;
 	u32 timing;
 	u32 timing;
 	unsigned long flags = id->driver_data;
 	unsigned long flags = id->driver_data;
 	int rc;
 	int rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 3
drivers/ata/pdc_adma.c

@@ -610,15 +610,13 @@ static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
 static int adma_ata_init_one(struct pci_dev *pdev,
 static int adma_ata_init_one(struct pci_dev *pdev,
 			     const struct pci_device_id *ent)
 			     const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	const struct ata_port_info *ppi[] = { &adma_port_info[board_idx], NULL };
 	const struct ata_port_info *ppi[] = { &adma_port_info[board_idx], NULL };
 	struct ata_host *host;
 	struct ata_host *host;
 	void __iomem *mmio_base;
 	void __iomem *mmio_base;
 	int rc, port_no;
 	int rc, port_no;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* alloc host */
 	/* alloc host */
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, ADMA_PORTS);
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, ADMA_PORTS);

+ 1 - 3
drivers/ata/sata_inic162x.c

@@ -800,7 +800,6 @@ static int inic_pci_device_resume(struct pci_dev *pdev)
 
 
 static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	const struct ata_port_info *ppi[] = { &inic_port_info, NULL };
 	const struct ata_port_info *ppi[] = { &inic_port_info, NULL };
 	struct ata_host *host;
 	struct ata_host *host;
 	struct inic_host_priv *hpriv;
 	struct inic_host_priv *hpriv;
@@ -808,8 +807,7 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	int mmio_bar;
 	int mmio_bar;
 	int i, rc;
 	int i, rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* alloc host */
 	/* alloc host */
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, NR_PORTS);
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, NR_PORTS);

+ 2 - 6
drivers/ata/sata_mv.c

@@ -4018,7 +4018,6 @@ static void mv_conf_mbus_windows(struct mv_host_priv *hpriv,
  */
  */
 static int mv_platform_probe(struct platform_device *pdev)
 static int mv_platform_probe(struct platform_device *pdev)
 {
 {
-	static int printed_version;
 	const struct mv_sata_platform_data *mv_platform_data;
 	const struct mv_sata_platform_data *mv_platform_data;
 	const struct ata_port_info *ppi[] =
 	const struct ata_port_info *ppi[] =
 	    { &mv_port_info[chip_soc], NULL };
 	    { &mv_port_info[chip_soc], NULL };
@@ -4027,8 +4026,7 @@ static int mv_platform_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct resource *res;
 	int n_ports, rc;
 	int n_ports, rc;
 
 
-	if (!printed_version++)
-		dev_info(&pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/*
 	/*
 	 * Simple resource validation ..
 	 * Simple resource validation ..
@@ -4285,15 +4283,13 @@ static void mv_print_info(struct ata_host *host)
 static int mv_pci_init_one(struct pci_dev *pdev,
 static int mv_pci_init_one(struct pci_dev *pdev,
 			   const struct pci_device_id *ent)
 			   const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	unsigned int board_idx = (unsigned int)ent->driver_data;
 	unsigned int board_idx = (unsigned int)ent->driver_data;
 	const struct ata_port_info *ppi[] = { &mv_port_info[board_idx], NULL };
 	const struct ata_port_info *ppi[] = { &mv_port_info[board_idx], NULL };
 	struct ata_host *host;
 	struct ata_host *host;
 	struct mv_host_priv *hpriv;
 	struct mv_host_priv *hpriv;
 	int n_ports, port, rc;
 	int n_ports, port, rc;
 
 
-	if (!printed_version++)
-		dev_info(&pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* allocate host */
 	/* allocate host */
 	n_ports = mv_get_hc_count(ppi[0]->flags) * MV_PORTS_PER_HC;
 	n_ports = mv_get_hc_count(ppi[0]->flags) * MV_PORTS_PER_HC;

+ 1 - 3
drivers/ata/sata_nv.c

@@ -2353,7 +2353,6 @@ static irqreturn_t nv_swncq_interrupt(int irq, void *dev_instance)
 
 
 static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	const struct ata_port_info *ppi[] = { NULL, NULL };
 	struct nv_pi_priv *ipriv;
 	struct nv_pi_priv *ipriv;
 	struct ata_host *host;
 	struct ata_host *host;
@@ -2370,8 +2369,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		if (pci_resource_start(pdev, bar) == 0)
 		if (pci_resource_start(pdev, bar) == 0)
 			return -ENODEV;
 			return -ENODEV;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 3
drivers/ata/sata_promise.c

@@ -1179,7 +1179,6 @@ static void pdc_host_init(struct ata_host *host)
 static int pdc_ata_init_one(struct pci_dev *pdev,
 static int pdc_ata_init_one(struct pci_dev *pdev,
 			    const struct pci_device_id *ent)
 			    const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	const struct ata_port_info *pi = &pdc_port_info[ent->driver_data];
 	const struct ata_port_info *pi = &pdc_port_info[ent->driver_data];
 	const struct ata_port_info *ppi[PDC_MAX_PORTS];
 	const struct ata_port_info *ppi[PDC_MAX_PORTS];
 	struct ata_host *host;
 	struct ata_host *host;
@@ -1187,8 +1186,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev,
 	int n_ports, i, rc;
 	int n_ports, i, rc;
 	int is_sataii_tx4;
 	int is_sataii_tx4;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* enable and acquire resources */
 	/* enable and acquire resources */
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);

+ 1 - 3
drivers/ata/sata_qstor.c

@@ -587,14 +587,12 @@ static int qs_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
 static int qs_ata_init_one(struct pci_dev *pdev,
 static int qs_ata_init_one(struct pci_dev *pdev,
 				const struct pci_device_id *ent)
 				const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	const struct ata_port_info *ppi[] = { &qs_port_info[board_idx], NULL };
 	const struct ata_port_info *ppi[] = { &qs_port_info[board_idx], NULL };
 	struct ata_host *host;
 	struct ata_host *host;
 	int rc, port_no;
 	int rc, port_no;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* alloc host */
 	/* alloc host */
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, QS_PORTS);
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, QS_PORTS);

+ 1 - 3
drivers/ata/sata_sil.c

@@ -732,7 +732,6 @@ static bool sil_broken_system_poweroff(struct pci_dev *pdev)
 
 
 static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	int board_id = ent->driver_data;
 	int board_id = ent->driver_data;
 	struct ata_port_info pi = sil_port_info[board_id];
 	struct ata_port_info pi = sil_port_info[board_id];
 	const struct ata_port_info *ppi[] = { &pi, NULL };
 	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)
 	int n_ports, rc;
 	int n_ports, rc;
 	unsigned int i;
 	unsigned int i;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* allocate host */
 	/* allocate host */
 	n_ports = 2;
 	n_ports = 2;

+ 1 - 3
drivers/ata/sata_sil24.c

@@ -1270,7 +1270,6 @@ static void sil24_init_controller(struct ata_host *host)
 static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
 	extern int __MARKER__sil24_cmd_block_is_sized_wrongly;
 	extern int __MARKER__sil24_cmd_block_is_sized_wrongly;
-	static int printed_version;
 	struct ata_port_info pi = sil24_port_info[ent->driver_data];
 	struct ata_port_info pi = sil24_port_info[ent->driver_data];
 	const struct ata_port_info *ppi[] = { &pi, NULL };
 	const struct ata_port_info *ppi[] = { &pi, NULL };
 	void __iomem * const *iomap;
 	void __iomem * const *iomap;
@@ -1282,8 +1281,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (sizeof(union sil24_cmd_block) != PAGE_SIZE)
 	if (sizeof(union sil24_cmd_block) != PAGE_SIZE)
 		__MARKER__sil24_cmd_block_is_sized_wrongly = 1;
 		__MARKER__sil24_cmd_block_is_sized_wrongly = 1;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* acquire resources */
 	/* acquire resources */
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);

+ 1 - 3
drivers/ata/sata_sis.c

@@ -193,7 +193,6 @@ static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 
 
 static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	struct ata_port_info pi = sis_port_info;
 	struct ata_port_info pi = sis_port_info;
 	const struct ata_port_info *ppi[] = { &pi, &pi };
 	const struct ata_port_info *ppi[] = { &pi, &pi };
 	struct ata_host *host;
 	struct ata_host *host;
@@ -202,8 +201,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	u8 port2_start = 0x20;
 	u8 port2_start = 0x20;
 	int i, rc;
 	int i, rc;
 
 
-	if (!printed_version++)
-		dev_info(&pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 3
drivers/ata/sata_svw.c

@@ -414,15 +414,13 @@ static void k2_sata_setup_port(struct ata_ioports *port, void __iomem *base)
 
 
 static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	const struct ata_port_info *ppi[] =
 	const struct ata_port_info *ppi[] =
 		{ &k2_port_info[ent->driver_data], NULL };
 		{ &k2_port_info[ent->driver_data], NULL };
 	struct ata_host *host;
 	struct ata_host *host;
 	void __iomem *mmio_base;
 	void __iomem *mmio_base;
 	int n_ports, i, rc, bar_pos;
 	int n_ports, i, rc, bar_pos;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* allocate host */
 	/* allocate host */
 	n_ports = 4;
 	n_ports = 4;

+ 1 - 3
drivers/ata/sata_sx4.c

@@ -1440,15 +1440,13 @@ static void pdc_20621_init(struct ata_host *host)
 static int pdc_sata_init_one(struct pci_dev *pdev,
 static int pdc_sata_init_one(struct pci_dev *pdev,
 			     const struct pci_device_id *ent)
 			     const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	const struct ata_port_info *ppi[] =
 	const struct ata_port_info *ppi[] =
 		{ &pdc_port_info[ent->driver_data], NULL };
 		{ &pdc_port_info[ent->driver_data], NULL };
 	struct ata_host *host;
 	struct ata_host *host;
 	struct pdc_host_priv *hpriv;
 	struct pdc_host_priv *hpriv;
 	int i, rc;
 	int i, rc;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* allocate host */
 	/* allocate host */
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4);
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4);

+ 1 - 3
drivers/ata/sata_uli.c

@@ -145,7 +145,6 @@ static int uli_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
 
 
 static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	const struct ata_port_info *ppi[] = { &uli_port_info, NULL };
 	const struct ata_port_info *ppi[] = { &uli_port_info, NULL };
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	unsigned int board_idx = (unsigned int) ent->driver_data;
 	struct ata_host *host;
 	struct ata_host *host;
@@ -154,8 +153,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	struct ata_ioports *ioaddr;
 	struct ata_ioports *ioaddr;
 	int n_ports, rc;
 	int n_ports, rc;
 
 
-	if (!printed_version++)
-		dev_info(&pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 3
drivers/ata/sata_via.c

@@ -606,15 +606,13 @@ static void svia_configure(struct pci_dev *pdev, int board_id)
 
 
 static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 {
-	static int printed_version;
 	unsigned int i;
 	unsigned int i;
 	int rc;
 	int rc;
 	struct ata_host *host = NULL;
 	struct ata_host *host = NULL;
 	int board_id = (int) ent->driver_data;
 	int board_id = (int) ent->driver_data;
 	const unsigned *bar_sizes;
 	const unsigned *bar_sizes;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	rc = pcim_enable_device(pdev);
 	rc = pcim_enable_device(pdev);
 	if (rc)
 	if (rc)

+ 1 - 3
drivers/ata/sata_vsc.c

@@ -346,14 +346,12 @@ static int __devinit vsc_sata_init_one(struct pci_dev *pdev,
 		.port_ops	= &vsc_sata_ops,
 		.port_ops	= &vsc_sata_ops,
 	};
 	};
 	const struct ata_port_info *ppi[] = { &pi, NULL };
 	const struct ata_port_info *ppi[] = { &pi, NULL };
-	static int printed_version;
 	struct ata_host *host;
 	struct ata_host *host;
 	void __iomem *mmio_base;
 	void __iomem *mmio_base;
 	int i, rc;
 	int i, rc;
 	u8 cls;
 	u8 cls;
 
 
-	if (!printed_version++)
-		dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
+	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
 
 	/* allocate host */
 	/* allocate host */
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4);
 	host = ata_host_alloc_pinfo(&pdev->dev, ppi, 4);

+ 12 - 0
include/linux/libata.h

@@ -74,6 +74,16 @@
 
 
 #define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
 #define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
 
 
+#define ata_print_version_once(dev, version)			\
+({								\
+	static bool __print_once;				\
+								\
+	if (!__print_once) {					\
+		__print_once = true;				\
+		ata_print_version(dev, version);		\
+	}							\
+})
+
 /* NEW: debug levels */
 /* NEW: debug levels */
 #define HAVE_LIBATA_MSG 1
 #define HAVE_LIBATA_MSG 1
 
 
@@ -1287,6 +1297,8 @@ int ata_dev_printk(const struct ata_device *dev, const char *level,
 #define ata_dev_dbg(dev, fmt, ...)				\
 #define ata_dev_dbg(dev, fmt, ...)				\
 	ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)
 	ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)
 
 
+void ata_print_version(const struct device *dev, const char *version);
+
 /*
 /*
  * ata_eh_info helpers
  * ata_eh_info helpers
  */
  */