Skip to content

Commit 0de5124

Browse files
dpenklergregkh
authored andcommitted
staging: gpib: ines console messaging cleanup
Enable module name to be printed in pr_xxx and dev_xxx Use DRV_NAME defined as KBUILD_MODNAME instead of hard coded string "ines_gpib" in pci_request_regions, request_irq and request_region. Remove "ines:" and "ines_gpib:" string prefixes in messages since module name printing is enabled. Change pr_err to dev_err where possible. Remove interrupt warnings. Remove PCMCIA debug comments, PCMCIA_DEBUG conditional compilation symbol, the DEBUG macro definition and its uses. Change pr_debug to dev_dbg. Remove pr_info Remove commented printk. Signed-off-by: Dave Penkler <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 82e3508 commit 0de5124

File tree

1 file changed

+42
-59
lines changed

1 file changed

+42
-59
lines changed

drivers/staging/gpib/ines/ines_gpib.c

Lines changed: 42 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* (C) 2002 by Frank Mori Hess
66
***************************************************************************/
77

8+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9+
#define dev_fmt pr_fmt
10+
#define DRV_NAME KBUILD_MODNAME
11+
812
#include "ines.h"
913

1014
#include <linux/pci.h>
@@ -54,7 +58,7 @@ int ines_line_status(const gpib_board_t *board)
5458
void ines_set_xfer_counter(struct ines_priv *priv, unsigned int count)
5559
{
5660
if (count > 0xffff) {
57-
pr_err("ines: bug! tried to set xfer counter > 0xffff\n");
61+
pr_err("bug! tried to set xfer counter > 0xffff\n");
5862
return;
5963
}
6064
ines_outb(priv, (count >> 8) & 0xff, XFER_COUNT_UPPER);
@@ -104,21 +108,18 @@ static ssize_t pio_read(gpib_board_t *board, struct ines_priv *ines_priv, uint8_
104108
num_in_fifo_bytes(ines_priv) ||
105109
test_bit(RECEIVED_END_BN, &nec_priv->state) ||
106110
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
107-
test_bit(TIMO_NUM, &board->status))) {
108-
pr_warn("gpib: pio read wait interrupted\n");
111+
test_bit(TIMO_NUM, &board->status)))
109112
return -ERESTARTSYS;
110-
}
113+
111114
if (test_bit(TIMO_NUM, &board->status))
112115
return -ETIMEDOUT;
113116
if (test_bit(DEV_CLEAR_BN, &nec_priv->state))
114117
return -EINTR;
115118

116119
num_fifo_bytes = num_in_fifo_bytes(ines_priv);
117-
if (num_fifo_bytes + *nbytes > length) {
118-
pr_warn("ines: counter allowed %li extra byte(s)\n",
119-
(long)(num_fifo_bytes - (length - *nbytes)));
120+
if (num_fifo_bytes + *nbytes > length)
120121
num_fifo_bytes = length - *nbytes;
121-
}
122+
122123
for (i = 0; i < num_fifo_bytes; i++)
123124
buffer[(*nbytes)++] = read_byte(nec_priv, DIR);
124125
if (test_bit(RECEIVED_END_BN, &nec_priv->state) &&
@@ -199,10 +200,9 @@ static int ines_write_wait(gpib_board_t *board, struct ines_priv *ines_priv,
199200
num_out_fifo_bytes(ines_priv) < fifo_threshold ||
200201
test_bit(BUS_ERROR_BN, &nec_priv->state) ||
201202
test_bit(DEV_CLEAR_BN, &nec_priv->state) ||
202-
test_bit(TIMO_NUM, &board->status))) {
203-
dev_dbg(board->gpib_dev, "gpib write interrupted\n");
203+
test_bit(TIMO_NUM, &board->status)))
204204
return -ERESTARTSYS;
205-
}
205+
206206
if (test_bit(BUS_ERROR_BN, &nec_priv->state))
207207
return -EIO;
208208
if (test_bit(DEV_CLEAR_BN, &nec_priv->state))
@@ -299,7 +299,7 @@ irqreturn_t ines_interrupt(gpib_board_t *board)
299299
wake++;
300300
}
301301
if (isr3_bits & FIFO_ERROR_BIT)
302-
pr_err("ines gpib: fifo error\n");
302+
dev_err(board->gpib_dev, "fifo error\n");
303303
if (isr3_bits & XFER_COUNT_BIT)
304304
wake++;
305305

@@ -767,16 +767,16 @@ static int ines_common_pci_attach(gpib_board_t *board, const gpib_board_config_t
767767
} while (1);
768768
}
769769
if (!ines_priv->pci_device) {
770-
pr_err("gpib: could not find ines PCI board\n");
770+
dev_err(board->gpib_dev, "could not find ines PCI board\n");
771771
return -1;
772772
}
773773

774774
if (pci_enable_device(ines_priv->pci_device)) {
775-
pr_err("error enabling pci device\n");
775+
dev_err(board->gpib_dev, "error enabling pci device\n");
776776
return -1;
777777
}
778778

779-
if (pci_request_regions(ines_priv->pci_device, "ines-gpib"))
779+
if (pci_request_regions(ines_priv->pci_device, DRV_NAME))
780780
return -1;
781781
nec_priv->iobase = pci_resource_start(ines_priv->pci_device,
782782
found_id.gpib_region);
@@ -795,7 +795,7 @@ static int ines_common_pci_attach(gpib_board_t *board, const gpib_board_config_t
795795
case PCI_CHIP_QUICKLOGIC5030:
796796
break;
797797
default:
798-
pr_err("gpib: unspecified chip type? (bug)\n");
798+
dev_err(board->gpib_dev, "unspecified chip type? (bug)\n");
799799
nec_priv->iobase = 0;
800800
pci_release_regions(ines_priv->pci_device);
801801
return -1;
@@ -811,8 +811,8 @@ static int ines_common_pci_attach(gpib_board_t *board, const gpib_board_config_t
811811
#endif
812812
isr_flags |= IRQF_SHARED;
813813
if (request_irq(ines_priv->pci_device->irq, ines_pci_interrupt, isr_flags,
814-
"pci-gpib", board)) {
815-
pr_err("gpib: can't request IRQ %d\n", ines_priv->pci_device->irq);
814+
DRV_NAME, board)) {
815+
dev_err(board->gpib_dev, "can't request IRQ %d\n", ines_priv->pci_device->irq);
816816
return -1;
817817
}
818818
ines_priv->irq = ines_priv->pci_device->irq;
@@ -844,7 +844,7 @@ static int ines_common_pci_attach(gpib_board_t *board, const gpib_board_config_t
844844
case PCI_CHIP_QUICKLOGIC5030:
845845
break;
846846
default:
847-
pr_err("gpib: unspecified chip type? (bug)\n");
847+
dev_err(board->gpib_dev, "unspecified chip type? (bug)\n");
848848
return -1;
849849
}
850850

@@ -897,15 +897,16 @@ int ines_isa_attach(gpib_board_t *board, const gpib_board_config_t *config)
897897
ines_priv = board->private_data;
898898
nec_priv = &ines_priv->nec7210_priv;
899899

900-
if (!request_region(config->ibbase, ines_isa_iosize, "ines_gpib")) {
901-
pr_err("ines_gpib: ioports at 0x%x already in use\n", config->ibbase);
902-
return -1;
900+
if (!request_region(config->ibbase, ines_isa_iosize, DRV_NAME)) {
901+
dev_err(board->gpib_dev, "ioports at 0x%x already in use\n",
902+
config->ibbase);
903+
return -EBUSY;
903904
}
904905
nec_priv->iobase = config->ibbase;
905906
nec_priv->offset = 1;
906907
nec7210_board_reset(nec_priv, board);
907-
if (request_irq(config->ibirq, ines_pci_interrupt, isr_flags, "ines_gpib", board)) {
908-
pr_err("ines_gpib: failed to allocate IRQ %d\n", config->ibirq);
908+
if (request_irq(config->ibirq, ines_pci_interrupt, isr_flags, DRV_NAME, board)) {
909+
dev_err(board->gpib_dev, "failed to allocate IRQ %d\n", config->ibirq);
909910
return -1;
910911
}
911912
ines_priv->irq = config->ibirq;
@@ -986,13 +987,6 @@ static struct pci_driver ines_pci_driver = {
986987
#include <pcmcia/ds.h>
987988
#include <pcmcia/cisreg.h>
988989

989-
#ifdef PCMCIA_DEBUG
990-
static int pc_debug = PCMCIA_DEBUG;
991-
#define DEBUG(n, args...) do {if (pc_debug > (n)) pr_debug(args)} while (0)
992-
#else
993-
#define DEBUG(args...)
994-
#endif
995-
996990
static const int ines_pcmcia_iosize = 0x20;
997991

998992
/* The event() function is this driver's Card Services event handler.
@@ -1061,8 +1055,6 @@ static int ines_gpib_probe(struct pcmcia_device *link)
10611055

10621056
// int ret, i;
10631057

1064-
DEBUG(0, "%s(0x%p)\n", __func__ link);
1065-
10661058
/* Allocate space for private device-specific data */
10671059
info = kzalloc(sizeof(*info), GFP_KERNEL);
10681060
if (!info)
@@ -1096,8 +1088,6 @@ static void ines_gpib_remove(struct pcmcia_device *link)
10961088
struct local_info *info = link->priv;
10971089
//struct gpib_board_t *dev = info->dev;
10981090

1099-
DEBUG(0, "%s(0x%p)\n", __func__, link);
1100-
11011091
if (info->dev)
11021092
ines_pcmcia_detach(info->dev);
11031093
ines_gpib_release(link);
@@ -1123,7 +1113,6 @@ static int ines_gpib_config(struct pcmcia_device *link)
11231113
void __iomem *virt;
11241114

11251115
dev = link->priv;
1126-
DEBUG(0, "%s(0x%p)\n", __func__, link);
11271116

11281117
retval = pcmcia_loop_config(link, &ines_gpib_config_iteration, NULL);
11291118
if (retval) {
@@ -1132,8 +1121,8 @@ static int ines_gpib_config(struct pcmcia_device *link)
11321121
return -ENODEV;
11331122
}
11341123

1135-
pr_debug("ines_cs: manufacturer: 0x%x card: 0x%x\n",
1136-
link->manf_id, link->card_id);
1124+
dev_dbg(&link->dev, "ines_cs: manufacturer: 0x%x card: 0x%x\n",
1125+
link->manf_id, link->card_id);
11371126

11381127
/* for the ines card we have to setup the configuration registers in
11391128
* attribute memory here
@@ -1165,7 +1154,6 @@ static int ines_gpib_config(struct pcmcia_device *link)
11651154
ines_gpib_release(link);
11661155
return -ENODEV;
11671156
}
1168-
pr_info("ines gpib device loaded\n");
11691157
return 0;
11701158
} /* gpib_config */
11711159

@@ -1177,18 +1165,16 @@ static int ines_gpib_config(struct pcmcia_device *link)
11771165

11781166
static void ines_gpib_release(struct pcmcia_device *link)
11791167
{
1180-
DEBUG(0, "%s(0x%p)\n", __func__, link);
11811168
pcmcia_disable_device(link);
11821169
} /* gpib_release */
11831170

11841171
static int ines_gpib_suspend(struct pcmcia_device *link)
11851172
{
11861173
//struct local_info *info = link->priv;
11871174
//struct gpib_board_t *dev = info->dev;
1188-
DEBUG(0, "%s(0x%p)\n", __func__, link);
11891175

11901176
if (link->open)
1191-
pr_err("Device still open ???\n");
1177+
dev_err(&link->dev, "Device still open\n");
11921178
//netif_device_detach(dev);
11931179

11941180
return 0;
@@ -1198,11 +1184,9 @@ static int ines_gpib_resume(struct pcmcia_device *link)
11981184
{
11991185
//struct local_info_t *info = link->priv;
12001186
//struct gpib_board_t *dev = info->dev;
1201-
DEBUG(0, "%s(0x%p)\n", __func__, link);
12021187

12031188
/*if (link->open) {
12041189
* ni_gpib_probe(dev); / really?
1205-
* printk("Gpib resumed ???\n");
12061190
* //netif_device_attach(dev);
12071191
*}
12081192
*/
@@ -1227,7 +1211,6 @@ static struct pcmcia_driver ines_gpib_cs_driver = {
12271211

12281212
void ines_pcmcia_cleanup_module(void)
12291213
{
1230-
DEBUG(0, "ines_cs: unloading\n");
12311214
pcmcia_unregister_driver(&ines_gpib_cs_driver);
12321215
}
12331216

@@ -1329,7 +1312,7 @@ int ines_common_pcmcia_attach(gpib_board_t *board)
13291312
int retval;
13301313

13311314
if (!curr_dev) {
1332-
pr_err("no ines pcmcia cards found\n");
1315+
dev_err(board->gpib_dev, "no ines pcmcia cards found\n");
13331316
return -1;
13341317
}
13351318

@@ -1341,9 +1324,9 @@ int ines_common_pcmcia_attach(gpib_board_t *board)
13411324
nec_priv = &ines_priv->nec7210_priv;
13421325

13431326
if (!request_region(curr_dev->resource[0]->start,
1344-
resource_size(curr_dev->resource[0]), "ines_gpib")) {
1345-
pr_err("ines_gpib: ioports at 0x%lx already in use\n",
1346-
(unsigned long)(curr_dev->resource[0]->start));
1327+
resource_size(curr_dev->resource[0]), DRV_NAME)) {
1328+
dev_err(board->gpib_dev, "ioports at 0x%lx already in use\n",
1329+
(unsigned long)(curr_dev->resource[0]->start));
13471330
return -1;
13481331
}
13491332

@@ -1353,7 +1336,7 @@ int ines_common_pcmcia_attach(gpib_board_t *board)
13531336

13541337
if (request_irq(curr_dev->irq, ines_pcmcia_interrupt, IRQF_SHARED,
13551338
"pcmcia-gpib", board)) {
1356-
pr_err("gpib: can't request IRQ %d\n", curr_dev->irq);
1339+
dev_err(board->gpib_dev, "can't request IRQ %d\n", curr_dev->irq);
13571340
return -1;
13581341
}
13591342
ines_priv->irq = curr_dev->irq;
@@ -1416,56 +1399,56 @@ static int __init ines_init_module(void)
14161399

14171400
ret = pci_register_driver(&ines_pci_driver);
14181401
if (ret) {
1419-
pr_err("ines_gpib: pci_register_driver failed: error = %d\n", ret);
1402+
pr_err("pci_register_driver failed: error = %d\n", ret);
14201403
return ret;
14211404
}
14221405

14231406
ret = gpib_register_driver(&ines_pci_interface, THIS_MODULE);
14241407
if (ret) {
1425-
pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret);
1408+
pr_err("gpib_register_driver failed: error = %d\n", ret);
14261409
goto err_pci;
14271410
}
14281411

14291412
ret = gpib_register_driver(&ines_pci_unaccel_interface, THIS_MODULE);
14301413
if (ret) {
1431-
pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret);
1414+
pr_err("gpib_register_driver failed: error = %d\n", ret);
14321415
goto err_pci_unaccel;
14331416
}
14341417

14351418
ret = gpib_register_driver(&ines_pci_accel_interface, THIS_MODULE);
14361419
if (ret) {
1437-
pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret);
1420+
pr_err("gpib_register_driver failed: error = %d\n", ret);
14381421
goto err_pci_accel;
14391422
}
14401423

14411424
ret = gpib_register_driver(&ines_isa_interface, THIS_MODULE);
14421425
if (ret) {
1443-
pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret);
1426+
pr_err("gpib_register_driver failed: error = %d\n", ret);
14441427
goto err_isa;
14451428
}
14461429

14471430
#ifdef CONFIG_GPIB_PCMCIA
14481431
ret = gpib_register_driver(&ines_pcmcia_interface, THIS_MODULE);
14491432
if (ret) {
1450-
pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret);
1433+
pr_err("gpib_register_driver failed: error = %d\n", ret);
14511434
goto err_pcmcia;
14521435
}
14531436

14541437
ret = gpib_register_driver(&ines_pcmcia_unaccel_interface, THIS_MODULE);
14551438
if (ret) {
1456-
pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret);
1439+
pr_err("gpib_register_driver failed: error = %d\n", ret);
14571440
goto err_pcmcia_unaccel;
14581441
}
14591442

14601443
ret = gpib_register_driver(&ines_pcmcia_accel_interface, THIS_MODULE);
14611444
if (ret) {
1462-
pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret);
1445+
pr_err("gpib_register_driver failed: error = %d\n", ret);
14631446
goto err_pcmcia_accel;
14641447
}
14651448

14661449
ret = pcmcia_register_driver(&ines_gpib_cs_driver);
14671450
if (ret) {
1468-
pr_err("ines_gpib: pcmcia_register_driver failed: error = %d\n", ret);
1451+
pr_err("pcmcia_register_driver failed: error = %d\n", ret);
14691452
goto err_pcmcia_driver;
14701453
}
14711454
#endif

0 commit comments

Comments
 (0)