staging: dgnc: Remove non-standard APR/RAPR printing macros
authorRoberta Dobrescu <roberta.dobrescu@gmail.com>
Tue, 7 Oct 2014 10:08:12 +0000 (13:08 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Oct 2014 02:29:18 +0000 (10:29 +0800)
This patch removes non-standard macros used by dgnc driver for printing error
or debugging messages. These are replaced by dev_err/dev_dbg (when possible)
or pr_err. There were cases where the message is completely removed since is
not adding any useful information.

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/dgnc/dgnc_cls.c
drivers/staging/dgnc/dgnc_driver.c
drivers/staging/dgnc/dgnc_driver.h
drivers/staging/dgnc/dgnc_neo.c
drivers/staging/dgnc/dgnc_tty.c

index f0b1ec7847e73836bab190817990fd47089f0999..c1c4bb9b0354fb969fd6a7c9247017a82f4fed04 100644 (file)
@@ -724,10 +724,8 @@ static void cls_tasklet(unsigned long data)
        int state = 0;
        int ports = 0;
 
-       if (!bd || bd->magic != DGNC_BOARD_MAGIC) {
-               APR(("poll_tasklet() - NULL or bad bd.\n"));
+       if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return;
-       }
 
        /* Cache a couple board values */
        spin_lock_irqsave(&bd->bd_lock, flags);
@@ -799,20 +797,12 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)
        unsigned char poll_reg;
        unsigned long flags;
 
-       if (!brd) {
-               APR(("Received interrupt (%d) with null board associated\n",
-                                                                        irq));
-               return IRQ_NONE;
-       }
-
        /*
-        * Check to make sure its for us.
+        * Check to make sure it didn't receive interrupt with a null board
+        * associated or a board pointer that wasn't ours.
         */
-       if (brd->magic != DGNC_BOARD_MAGIC) {
-               APR(("Received interrupt (%d) with a board pointer that wasn't ours!\n",
-                         irq));
+       if (!brd || brd->magic != DGNC_BOARD_MAGIC)
                return IRQ_NONE;
-       }
 
        spin_lock_irqsave(&brd->bd_intr_lock, flags);
 
index 21546659ff07549034e248597364386a33df32be..0eafd1f35a82c988b036d83eaa068b9a70cab68c 100644 (file)
@@ -207,8 +207,6 @@ static int __init dgnc_init_module(void)
 {
        int rc = 0;
 
-       APR(("%s, Digi International Part Number %s\n", DG_NAME, DG_PART));
-
        /*
         * Initialize global stuff
         */
@@ -254,8 +252,6 @@ static int dgnc_start(void)
        /* make sure that the globals are init'd before we do anything else */
        dgnc_init_globals();
 
-       APR(("For the tools package or updated drivers please visit http://www.digi.com\n"));
-
        /*
         * Register our base character device into the kernel.
         * This allows the download daemon to connect to the downld device
@@ -265,7 +261,7 @@ static int dgnc_start(void)
         */
        rc = register_chrdev(0, "dgnc", &dgnc_BoardFops);
        if (rc <= 0) {
-               APR(("Can't register dgnc driver device (%d)\n", rc));
+               pr_err(DRVSTR ": Can't register dgnc driver device (%d)\n", rc);
                return -ENXIO;
        }
        dgnc_Major = rc;
@@ -281,7 +277,7 @@ static int dgnc_start(void)
        rc = dgnc_tty_preinit();
 
        if (rc < 0) {
-               APR(("tty preinit - not enough memory (%d)\n", rc));
+               pr_err(DRVSTR ": tty preinit - not enough memory (%d)\n", rc);
                return rc;
        }
 
@@ -468,7 +464,8 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
                brd->membase = pci_resource_start(pdev, 4);
 
                if (!brd->membase) {
-                       APR(("card has no PCI IO resources, failing board.\n"));
+                       dev_err(&brd->pdev->dev,
+                               "Card has no PCI IO resources, failing.\n");
                        return -ENODEV;
                }
 
@@ -555,7 +552,8 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
                break;
 
        default:
-               APR(("Did not find any compatible Neo or Classic PCI boards in system.\n"));
+               dev_err(&brd->pdev->dev,
+                       "Didn't find any compatible Neo/Classic PCI boards.\n");
                return -ENXIO;
 
        }
@@ -567,7 +565,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
        rc = dgnc_tty_register(brd);
        if (rc < 0) {
                dgnc_tty_uninit(brd);
-               APR(("Can't register tty devices (%d)\n", rc));
+               pr_err(DRVSTR ": Can't register tty devices (%d)\n", rc);
                brd->state = BOARD_FAILED;
                brd->dpastatus = BD_NOFEP;
                goto failed;
@@ -575,7 +573,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 
        rc = dgnc_finalize_board_init(brd);
        if (rc < 0) {
-               APR(("Can't finalize board init (%d)\n", rc));
+               pr_err(DRVSTR ": Can't finalize board init (%d)\n", rc);
                brd->state = BOARD_FAILED;
                brd->dpastatus = BD_NOFEP;
 
@@ -585,7 +583,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
        rc = dgnc_tty_init(brd);
        if (rc < 0) {
                dgnc_tty_uninit(brd);
-               APR(("Can't init tty devices (%d)\n", rc));
+               pr_err(DRVSTR ": Can't init tty devices (%d)\n", rc);
                brd->state = BOARD_FAILED;
                brd->dpastatus = BD_NOFEP;
 
index f901957c757fe6b49a751875686d81975050dfc3..d5de3e2f29451d0f3f62e5553418eebddcba5ac1 100644 (file)
  *
  *************************************************************************/
 
-/*
- * Driver identification, error and debugging statments
- *
- * In theory, you can change all occurrences of "digi" in the next
- * three lines, and the driver printk's will all automagically change.
- *
- * APR((fmt, args, ...));      Always prints message
- */
+/* Driver identification, error and debugging statments */
 #define        PROCSTR         "dgnc"                  /* /proc entries         */
 #define        DEVSTR          "/dev/dg/dgnc"          /* /dev entries          */
-#define        DRVSTR          "dgnc"                  /* Driver name string
-                                                * displayed by APR      */
-#define        APR(args)       do { printk(DRVSTR": "); printk args; \
-                          } while (0)
-#define        RAPR(args)      do { printk args; } while (0)
+#define        DRVSTR          "dgnc"                  /* Driver name string    */
 
 #define TRC_TO_CONSOLE 1
 
index a5bd08fef270303e2b1800a82745e6a79f500eaf..27a525ead87839f97548fab9e71006061c29e7f6 100644 (file)
@@ -530,10 +530,11 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)
        int linestatus;
        unsigned long flags;
 
-       if (!brd)
-               return;
-
-       if (brd->magic != DGNC_BOARD_MAGIC)
+       /*
+        * Check to make sure it didn't receive interrupt with a null board
+        * associated or a board pointer that wasn't ours.
+        */
+       if (!brd || brd->magic != DGNC_BOARD_MAGIC)
                return;
 
        if (port > brd->maxports)
@@ -869,10 +870,8 @@ static void neo_tasklet(unsigned long data)
        int state = 0;
        int ports = 0;
 
-       if (!bd || bd->magic != DGNC_BOARD_MAGIC) {
-               APR(("poll_tasklet() - NULL or bad bd.\n"));
+       if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return;
-       }
 
        /* Cache a couple board values */
        spin_lock_irqsave(&bd->bd_lock, flags);
@@ -955,18 +954,12 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
        unsigned long flags;
        unsigned long flags2;
 
-       if (!brd) {
-               APR(("Received interrupt (%d) with null board associated\n", irq));
-               return IRQ_NONE;
-       }
-
        /*
-        * Check to make sure its for us.
+        * Check to make sure it didn't receive interrupt with a null board
+        * associated or a board pointer that wasn't ours.
         */
-       if (brd->magic != DGNC_BOARD_MAGIC) {
-               APR(("Received interrupt (%d) with a board pointer that wasn't ours!\n", irq));
+       if (!brd || brd->magic != DGNC_BOARD_MAGIC)
                return IRQ_NONE;
-       }
 
        brd->intr_count++;
 
index 03c15069731f758e3e71312d32bcbef86060c3a8..1580bccc6a2d4d9938bab88de1978c1a4917cf4a 100644 (file)
@@ -233,7 +233,8 @@ int dgnc_tty_register(struct dgnc_board *brd)
                /* Register tty devices */
                rc = tty_register_driver(&brd->SerialDriver);
                if (rc < 0) {
-                       APR(("Can't register tty device (%d)\n", rc));
+                       dev_dbg(&brd->pdev->dev,
+                               "Can't register tty device (%d)\n", rc);
                        return rc;
                }
                brd->dgnc_Major_Serial_Registered = TRUE;
@@ -281,7 +282,9 @@ int dgnc_tty_register(struct dgnc_board *brd)
                /* Register Transparent Print devices */
                rc = tty_register_driver(&brd->PrintDriver);
                if (rc < 0) {
-                       APR(("Can't register Transparent Print device (%d)\n", rc));
+                       dev_dbg(&brd->pdev->dev,
+                               "Can't register Transparent Print device(%d)\n",
+                               rc);
                        return rc;
                }
                brd->dgnc_Major_TransparentPrint_Registered = TRUE;
@@ -1546,14 +1549,18 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)
                 * one, we've got real problems, since it means the
                 * serial port won't be shutdown.
                 */
-               APR(("tty->count is 1, un open count is %d\n", un->un_open_count));
+               dev_dbg(tty->dev,
+                       "tty->count is 1, un open count is %d\n",
+                       un->un_open_count);
                un->un_open_count = 1;
        }
 
        if (un->un_open_count)
                un->un_open_count--;
        else
-               APR(("bad serial port open count of %d\n", un->un_open_count));
+               dev_dbg(tty->dev,
+                       "bad serial port open count of %d\n",
+                       un->un_open_count);
 
        ch->ch_open_count--;