From 1f26adc94a9f11440f4756e41b2f572afde61f5e Mon Sep 17 00:00:00 2001 From: Roberta Dobrescu Date: Tue, 7 Oct 2014 13:08:12 +0300 Subject: [PATCH] staging: dgnc: Remove non-standard APR/RAPR printing macros 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 Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dgnc/dgnc_cls.c | 18 ++++-------------- drivers/staging/dgnc/dgnc_driver.c | 20 +++++++++----------- drivers/staging/dgnc/dgnc_driver.h | 15 ++------------- drivers/staging/dgnc/dgnc_neo.c | 25 +++++++++---------------- drivers/staging/dgnc/dgnc_tty.c | 15 +++++++++++---- 5 files changed, 35 insertions(+), 58 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c index f0b1ec7847e7..c1c4bb9b0354 100644 --- a/drivers/staging/dgnc/dgnc_cls.c +++ b/drivers/staging/dgnc/dgnc_cls.c @@ -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); diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 21546659ff07..0eafd1f35a82 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -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; diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index f901957c757f..d5de3e2f2945 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -42,21 +42,10 @@ * *************************************************************************/ -/* - * 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 diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c index a5bd08fef270..27a525ead878 100644 --- a/drivers/staging/dgnc/dgnc_neo.c +++ b/drivers/staging/dgnc/dgnc_neo.c @@ -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++; diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 03c15069731f..1580bccc6a2d 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -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--; -- 2.34.1