Skip to contentSkip to conversation

drivers/spi: Convert printks to pr_<level>

PATCH Superseded Joe Perches 2 participants 2 messages Jul 21, 2010 – Aug 1, 2010 SPI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/spi: Convert printks to pr_<level>

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert printks to pr_<level>
Convert a test w/ errmsg to a more normal form

Uncompiled, untested

---
 drivers/spi/amba-pl022.c    |    6 ++++--
 drivers/spi/au1550_spi.c    |    5 +++--
 drivers/spi/dw_spi.c        |    6 +++---
 drivers/spi/dw_spi_pci.c    |    2 +-
 drivers/spi/omap_spi_100k.c |    2 +-
 drivers/spi/omap_uwire.c    |    3 +--
 drivers/spi/spi_lm70llp.c   |   23 +++++++++++------------
 7 files changed, 24 insertions(+), 23 deletions(-)
drivers/spi/amba-pl022.c +4 -2
index f0a1418..427fa44 100644
@@ -30,6 +30,8 @@
  * - add generic DMA framework support
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/device.h>
@@ -1775,8 +1777,8 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
 		status = -ENOMEM;
 		goto err_no_ioremap;
 	}
-	printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n",
-	       adev->res.start, pl022->virtbase);
+	pr_info("mapped registers from 0x%08llx to %p\n",
+		(unsigned long long)adev->res.start, pl022->virtbase);
 
 	pl022->clk = clk_get(&adev->dev, NULL);
 	if (IS_ERR(pl022->clk)) {
drivers/spi/au1550_spi.c +3 -2
index 3c9ade6..d95a54e 100644
@@ -21,6 +21,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
@@ -1012,8 +1014,7 @@ static int __init au1550_spi_init(void)
 	if (usedma) {
 		ddma_memid = au1xxx_ddma_add_device(&au1550_spi_mem_dbdev);
 		if (!ddma_memid)
-			printk(KERN_ERR "au1550-spi: cannot add memory"
-					"dbdma device\n");
+			pr_err("cannot add memory dbdma device\n");
 	}
 	return platform_driver_probe(&au1550_spi_drv, au1550_spi_probe);
 }
drivers/spi/dw_spi.c +3 -3
index d256cb0..c5d15d4 100644
@@ -490,8 +490,8 @@ static void pump_transfers(unsigned long data)
 		if (transfer->speed_hz != speed) {
 			speed = transfer->speed_hz;
 			if (speed > dws->max_freq) {
-				printk(KERN_ERR "MRST SPI0: unsupported"
-					"freq: %dHz\n", speed);
+				pr_err("MRST SPI0: unsupported freq: %dHz\n",
+				       speed);
 				message->status = -EIO;
 				goto early_exit;
 			}
@@ -525,7 +525,7 @@ static void pump_transfers(unsigned long data)
 					u16_writer : null_writer;
 			break;
 		default:
-			printk(KERN_ERR "MRST SPI0: unsupported bits:"
+			pr_err("MRST SPI0: unsupported bits:"
 				"%db\n", bits);
 			message->status = -EIO;
 			goto early_exit;
drivers/spi/dw_spi_pci.c +1 -1
index 1f52755..35f1811 100644
@@ -38,7 +38,7 @@ static int __devinit spi_pci_probe(struct pci_dev *pdev,
 	int pci_bar = 0;
 	int ret;
 
-	printk(KERN_INFO "DW: found PCI SPI controller(ID: %04x:%04x)\n",
+	pr_info("DW: found PCI SPI controller(ID: %04x:%04x)\n",
 		pdev->vendor, pdev->device);
 
 	ret = pci_enable_device(pdev);
drivers/spi/omap_spi_100k.c +1 -1
index 9bd1c92..b8b23f2 100644
@@ -425,7 +425,7 @@ static void omap1_spi100k_work(struct work_struct *work)
 	spin_unlock_irq(&spi100k->lock);
 
 	if (status < 0)
-		printk(KERN_WARNING "spi transfer failed with %d\n", status);
+		pr_warning("spi transfer failed with %d\n", status);
 }
 
 static int omap1_spi100k_transfer(struct spi_device *spi, struct spi_message *m)
drivers/spi/omap_uwire.c +1 -2
index 160d326..445a454 100644
@@ -154,8 +154,7 @@ static int wait_uwire_csr_flag(u16 mask, u16 val, int might_not_catch)
 		if ((w & mask) == val)
 			break;
 		if (time_after(jiffies, max_jiffies)) {
-			printk(KERN_ERR "%s: timeout. reg=%#06x "
-					"mask=%#06x val=%#06x\n",
+			pr_err("%s: timeout. reg=%#06x mask=%#06x val=%#06x\n",
 			       __func__, w, mask, val);
 			return -1;
 		}
drivers/spi/spi_lm70llp.c +11 -12
index 7746a41..ac3a13d 100644
@@ -18,6 +18,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -202,9 +204,7 @@ static void spi_lm70llp_attach(struct parport *p)
 	int			status;
 
 	if (lm70llp) {
-		printk(KERN_WARNING
-			"%s: spi_lm70llp instance already loaded. Aborting.\n",
-			DRVNAME);
+		pr_warning("instance already loaded. Aborting\n");
 		return;
 	}
 
@@ -252,9 +252,8 @@ static void spi_lm70llp_attach(struct parport *p)
 	 */
 	status = spi_bitbang_start(&pp->bitbang);
 	if (status < 0) {
-		printk(KERN_WARNING
-			"%s: spi_bitbang_start failed with status %d\n",
-			DRVNAME, status);
+		pr_warning("spi_bitbang_start failed with status %d\n",
+			   status);
 		goto out_off_and_release;
 	}
 
@@ -277,14 +276,14 @@ static void spi_lm70llp_attach(struct parport *p)
 	 */
 	pp->info.controller_data = pp;
 	pp->spidev_lm70 = spi_new_device(pp->bitbang.master, &pp->info);
-	if (pp->spidev_lm70)
-		dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n",
-				dev_name(&pp->spidev_lm70->dev));
-	else {
-		printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME);
+	if (!pp->spidev_lm70) {
+		pr_warning("spi_new_device failed\n");
 		status = -ENODEV;
 		goto out_bitbang_stop;
 	}
+	dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n",
+		dev_name(&pp->spidev_lm70->dev));
+
 	pp->spidev_lm70->bits_per_word = 8;
 
 	lm70llp = pp;
@@ -302,7 +301,7 @@ out_parport_unreg:
 out_free_master:
 	(void) spi_master_put(master);
 out_fail:
-	pr_info("%s: spi_lm70llp probe fail, status %d\n", DRVNAME, status);
+	pr_info("probe fail, status %d\n", status);
 }
 
 static void spi_lm70llp_detach(struct parport *p)
#1 lore raw
Quoted 5 lines · Joe Perches

Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
Convert printks to pr_<level>
Convert a test w/ errmsg to a more normal form

Uncompiled, untested

Hi Joe,

If going through the bother of changing printk statements, then most of these should be converted to dev_err/info/dbg() instead of pr_*(). Nack.

Cheers,
g.

Quoted 196 lines

---
 drivers/spi/amba-pl022.c    |    6 ++++-- drivers/spi/au1550_spi.c    |    5 +++-- drivers/spi/dw_spi.c        |    6 +++--- drivers/spi/dw_spi_pci.c    |    2 +- drivers/spi/omap_spi_100k.c |    2 +- drivers/spi/omap_uwire.c    |    3 +-- drivers/spi/spi_lm70llp.c   |   23 +++++++++++------------

 7 files changed, 24 insertions(+), 23 deletions(-)
drivers/spi/amba-pl022.c +4 -2
index f0a1418..427fa44 100644
@@ -30,6 +30,8 @@
  * - add generic DMA framework support
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
  #include <linux/init.h>
  #include <linux/module.h>
  #include <linux/device.h>
@@ -1775,8 +1777,8 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
                status = -ENOMEM;
                goto err_no_ioremap;
        }
-       printk(KERN_INFO "pl022: mapped registers from 0x%08x to %p\n",
-              adev->res.start, pl022->virtbase);
+       pr_info("mapped registers from 0x%08llx to %p\n",
+               (unsigned long long)adev->res.start, pl022->virtbase);
 
        pl022->clk = clk_get(&adev->dev, NULL);
        if (IS_ERR(pl022->clk)) {
drivers/spi/au1550_spi.c +3 -2
index 3c9ade6..d95a54e 100644
@@ -21,6 +21,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
  #include <linux/init.h>
  #include <linux/interrupt.h>
  #include <linux/slab.h>
@@ -1012,8 +1014,7 @@ static int __init au1550_spi_init(void)
        if (usedma) {
                ddma_memid = au1xxx_ddma_add_device(&au1550_spi_mem_dbdev);
                if (!ddma_memid)
-                       printk(KERN_ERR "au1550-spi: cannot add memory"
-                                       "dbdma device\n");
+                       pr_err("cannot add memory dbdma device\n");
        }
        return platform_driver_probe(&au1550_spi_drv, au1550_spi_probe);
  }
drivers/spi/dw_spi.c +2 -2
index d256cb0..c5d15d4 100644
@@ -490,8 +490,8 @@ static void pump_transfers(unsigned long data)
                if (transfer->speed_hz != speed) {
                        speed = transfer->speed_hz;
                        if (speed > dws->max_freq) {
-                               printk(KERN_ERR "MRST SPI0: unsupported"
-                                       "freq: %dHz\n", speed);
+                               pr_err("MRST SPI0: unsupported freq: %dHz\n",
+                                      speed);
                                message->status = -EIO;
                                goto early_exit;
                        }
@@ -525,7 +525,7 @@ static void pump_transfers(unsigned long data)
                                        u16_writer : null_writer;
                        break;

               default:
-                       printk(KERN_ERR "MRST SPI0: unsupported bits:"
+                       pr_err("MRST SPI0: unsupported bits:" "%db\n", bits); message->status = -EIO;
                       goto early_exit;

drivers/spi/dw_spi_pci.c +1 -1
index 1f52755..35f1811 100644
@@ -38,7 +38,7 @@ static int __devinit spi_pci_probe(struct pci_dev *pdev,
        int pci_bar = 0;
        int ret;
 
-       printk(KERN_INFO "DW: found PCI SPI controller(ID: %04x:%04x)\n",
+       pr_info("DW: found PCI SPI controller(ID: %04x:%04x)\n",
                pdev->vendor, pdev->device);
 
        ret = pci_enable_device(pdev);
drivers/spi/omap_spi_100k.c +1 -1
index 9bd1c92..b8b23f2 100644
@@ -425,7 +425,7 @@ static void omap1_spi100k_work(struct work_struct *work)
        spin_unlock_irq(&spi100k->lock);
 
        if (status < 0)
-               printk(KERN_WARNING "spi transfer failed with %d\n", status);
+               pr_warning("spi transfer failed with %d\n", status);
  }
 
  static int omap1_spi100k_transfer(struct spi_device *spi, struct spi_message *m)
drivers/spi/omap_uwire.c +1 -2
index 160d326..445a454 100644
@@ -154,8 +154,7 @@ static int wait_uwire_csr_flag(u16 mask, u16 val, int might_not_catch)
                if ((w & mask) == val)
                        break;
                if (time_after(jiffies, max_jiffies)) {
-                       printk(KERN_ERR "%s: timeout. reg=%#06x "
-                                       "mask=%#06x val=%#06x\n",
+                       pr_err("%s: timeout. reg=%#06x mask=%#06x val=%#06x\n",
                               __func__, w, mask, val);
                        return -1;
                }
drivers/spi/spi_lm70llp.c +10 -11
index 7746a41..ac3a13d 100644
@@ -18,6 +18,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
  #include <linux/init.h>
  #include <linux/module.h>
  #include <linux/kernel.h>
@@ -202,9 +204,7 @@ static void spi_lm70llp_attach(struct parport *p)
        int                     status;
 
        if (lm70llp) {
-               printk(KERN_WARNING
-                       "%s: spi_lm70llp instance already loaded. Aborting.\n",
-                       DRVNAME);
+               pr_warning("instance already loaded. Aborting\n");
                return;
        }
 
@@ -252,9 +252,8 @@ static void spi_lm70llp_attach(struct parport *p)
         */
        status = spi_bitbang_start(&pp->bitbang);
        if (status < 0) {
-               printk(KERN_WARNING
-                       "%s: spi_bitbang_start failed with status %d\n",
-                       DRVNAME, status);
+               pr_warning("spi_bitbang_start failed with status %d\n",
+                          status);
                goto out_off_and_release;
        }
 
@@ -277,14 +276,14 @@ static void spi_lm70llp_attach(struct parport *p)
         */
        pp->info.controller_data = pp;
        pp->spidev_lm70 = spi_new_device(pp->bitbang.master, &pp->info);
-       if (pp->spidev_lm70)
-               dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n",
-                               dev_name(&pp->spidev_lm70->dev));
-       else {
-               printk(KERN_WARNING "%s: spi_new_device failed\n", DRVNAME);
+       if (!pp->spidev_lm70) {
+               pr_warning("spi_new_device failed\n");
                status = -ENODEV;
                goto out_bitbang_stop;
        }
+       dev_dbg(&pp->spidev_lm70->dev, "spidev_lm70 at %s\n",
+               dev_name(&pp->spidev_lm70->dev));
+
        pp->spidev_lm70->bits_per_word = 8;
 
        lm70llp = pp;
@@ -302,7 +301,7 @@ out_parport_unreg:

 out_free_master:
       (void) spi_master_put(master);
 out_fail:
-       pr_info("%s: spi_lm70llp probe fail, status %d\n", DRVNAME, status);
+       pr_info("probe fail, status %d\n", status);
 }

 static void spi_lm70llp_detach(struct parport *p)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.