5
5
* (C) 2002 by Frank Mori Hess
6
6
***************************************************************************/
7
7
8
+ #define pr_fmt (fmt ) KBUILD_MODNAME ": " fmt
9
+ #define dev_fmt pr_fmt
10
+ #define DRV_NAME KBUILD_MODNAME
11
+
8
12
#include "ines.h"
9
13
10
14
#include <linux/pci.h>
@@ -54,7 +58,7 @@ int ines_line_status(const gpib_board_t *board)
54
58
void ines_set_xfer_counter (struct ines_priv * priv , unsigned int count )
55
59
{
56
60
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" );
58
62
return ;
59
63
}
60
64
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_
104
108
num_in_fifo_bytes (ines_priv ) ||
105
109
test_bit (RECEIVED_END_BN , & nec_priv -> state ) ||
106
110
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 )))
109
112
return - ERESTARTSYS ;
110
- }
113
+
111
114
if (test_bit (TIMO_NUM , & board -> status ))
112
115
return - ETIMEDOUT ;
113
116
if (test_bit (DEV_CLEAR_BN , & nec_priv -> state ))
114
117
return - EINTR ;
115
118
116
119
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 )
120
121
num_fifo_bytes = length - * nbytes ;
121
- }
122
+
122
123
for (i = 0 ; i < num_fifo_bytes ; i ++ )
123
124
buffer [(* nbytes )++ ] = read_byte (nec_priv , DIR );
124
125
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,
199
200
num_out_fifo_bytes (ines_priv ) < fifo_threshold ||
200
201
test_bit (BUS_ERROR_BN , & nec_priv -> state ) ||
201
202
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 )))
204
204
return - ERESTARTSYS ;
205
- }
205
+
206
206
if (test_bit (BUS_ERROR_BN , & nec_priv -> state ))
207
207
return - EIO ;
208
208
if (test_bit (DEV_CLEAR_BN , & nec_priv -> state ))
@@ -299,7 +299,7 @@ irqreturn_t ines_interrupt(gpib_board_t *board)
299
299
wake ++ ;
300
300
}
301
301
if (isr3_bits & FIFO_ERROR_BIT )
302
- pr_err ( "ines gpib: fifo error\n" );
302
+ dev_err ( board -> gpib_dev , " fifo error\n" );
303
303
if (isr3_bits & XFER_COUNT_BIT )
304
304
wake ++ ;
305
305
@@ -767,16 +767,16 @@ static int ines_common_pci_attach(gpib_board_t *board, const gpib_board_config_t
767
767
} while (1 );
768
768
}
769
769
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" );
771
771
return -1 ;
772
772
}
773
773
774
774
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" );
776
776
return -1 ;
777
777
}
778
778
779
- if (pci_request_regions (ines_priv -> pci_device , "ines-gpib" ))
779
+ if (pci_request_regions (ines_priv -> pci_device , DRV_NAME ))
780
780
return -1 ;
781
781
nec_priv -> iobase = pci_resource_start (ines_priv -> pci_device ,
782
782
found_id .gpib_region );
@@ -795,7 +795,7 @@ static int ines_common_pci_attach(gpib_board_t *board, const gpib_board_config_t
795
795
case PCI_CHIP_QUICKLOGIC5030 :
796
796
break ;
797
797
default :
798
- pr_err ( "gpib: unspecified chip type? (bug)\n" );
798
+ dev_err ( board -> gpib_dev , " unspecified chip type? (bug)\n" );
799
799
nec_priv -> iobase = 0 ;
800
800
pci_release_regions (ines_priv -> pci_device );
801
801
return -1 ;
@@ -811,8 +811,8 @@ static int ines_common_pci_attach(gpib_board_t *board, const gpib_board_config_t
811
811
#endif
812
812
isr_flags |= IRQF_SHARED ;
813
813
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 );
816
816
return -1 ;
817
817
}
818
818
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
844
844
case PCI_CHIP_QUICKLOGIC5030 :
845
845
break ;
846
846
default :
847
- pr_err ( "gpib: unspecified chip type? (bug)\n" );
847
+ dev_err ( board -> gpib_dev , " unspecified chip type? (bug)\n" );
848
848
return -1 ;
849
849
}
850
850
@@ -897,15 +897,16 @@ int ines_isa_attach(gpib_board_t *board, const gpib_board_config_t *config)
897
897
ines_priv = board -> private_data ;
898
898
nec_priv = & ines_priv -> nec7210_priv ;
899
899
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 ;
903
904
}
904
905
nec_priv -> iobase = config -> ibbase ;
905
906
nec_priv -> offset = 1 ;
906
907
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 );
909
910
return -1 ;
910
911
}
911
912
ines_priv -> irq = config -> ibirq ;
@@ -986,13 +987,6 @@ static struct pci_driver ines_pci_driver = {
986
987
#include <pcmcia/ds.h>
987
988
#include <pcmcia/cisreg.h>
988
989
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
-
996
990
static const int ines_pcmcia_iosize = 0x20 ;
997
991
998
992
/* The event() function is this driver's Card Services event handler.
@@ -1061,8 +1055,6 @@ static int ines_gpib_probe(struct pcmcia_device *link)
1061
1055
1062
1056
// int ret, i;
1063
1057
1064
- DEBUG (0 , "%s(0x%p)\n" , __func__ link );
1065
-
1066
1058
/* Allocate space for private device-specific data */
1067
1059
info = kzalloc (sizeof (* info ), GFP_KERNEL );
1068
1060
if (!info )
@@ -1096,8 +1088,6 @@ static void ines_gpib_remove(struct pcmcia_device *link)
1096
1088
struct local_info * info = link -> priv ;
1097
1089
//struct gpib_board_t *dev = info->dev;
1098
1090
1099
- DEBUG (0 , "%s(0x%p)\n" , __func__ , link );
1100
-
1101
1091
if (info -> dev )
1102
1092
ines_pcmcia_detach (info -> dev );
1103
1093
ines_gpib_release (link );
@@ -1123,7 +1113,6 @@ static int ines_gpib_config(struct pcmcia_device *link)
1123
1113
void __iomem * virt ;
1124
1114
1125
1115
dev = link -> priv ;
1126
- DEBUG (0 , "%s(0x%p)\n" , __func__ , link );
1127
1116
1128
1117
retval = pcmcia_loop_config (link , & ines_gpib_config_iteration , NULL );
1129
1118
if (retval ) {
@@ -1132,8 +1121,8 @@ static int ines_gpib_config(struct pcmcia_device *link)
1132
1121
return - ENODEV ;
1133
1122
}
1134
1123
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 );
1137
1126
1138
1127
/* for the ines card we have to setup the configuration registers in
1139
1128
* attribute memory here
@@ -1165,7 +1154,6 @@ static int ines_gpib_config(struct pcmcia_device *link)
1165
1154
ines_gpib_release (link );
1166
1155
return - ENODEV ;
1167
1156
}
1168
- pr_info ("ines gpib device loaded\n" );
1169
1157
return 0 ;
1170
1158
} /* gpib_config */
1171
1159
@@ -1177,18 +1165,16 @@ static int ines_gpib_config(struct pcmcia_device *link)
1177
1165
1178
1166
static void ines_gpib_release (struct pcmcia_device * link )
1179
1167
{
1180
- DEBUG (0 , "%s(0x%p)\n" , __func__ , link );
1181
1168
pcmcia_disable_device (link );
1182
1169
} /* gpib_release */
1183
1170
1184
1171
static int ines_gpib_suspend (struct pcmcia_device * link )
1185
1172
{
1186
1173
//struct local_info *info = link->priv;
1187
1174
//struct gpib_board_t *dev = info->dev;
1188
- DEBUG (0 , "%s(0x%p)\n" , __func__ , link );
1189
1175
1190
1176
if (link -> open )
1191
- pr_err ( "Device still open ??? \n" );
1177
+ dev_err ( & link -> dev , "Device still open\n" );
1192
1178
//netif_device_detach(dev);
1193
1179
1194
1180
return 0 ;
@@ -1198,11 +1184,9 @@ static int ines_gpib_resume(struct pcmcia_device *link)
1198
1184
{
1199
1185
//struct local_info_t *info = link->priv;
1200
1186
//struct gpib_board_t *dev = info->dev;
1201
- DEBUG (0 , "%s(0x%p)\n" , __func__ , link );
1202
1187
1203
1188
/*if (link->open) {
1204
1189
* ni_gpib_probe(dev); / really?
1205
- * printk("Gpib resumed ???\n");
1206
1190
* //netif_device_attach(dev);
1207
1191
*}
1208
1192
*/
@@ -1227,7 +1211,6 @@ static struct pcmcia_driver ines_gpib_cs_driver = {
1227
1211
1228
1212
void ines_pcmcia_cleanup_module (void )
1229
1213
{
1230
- DEBUG (0 , "ines_cs: unloading\n" );
1231
1214
pcmcia_unregister_driver (& ines_gpib_cs_driver );
1232
1215
}
1233
1216
@@ -1329,7 +1312,7 @@ int ines_common_pcmcia_attach(gpib_board_t *board)
1329
1312
int retval ;
1330
1313
1331
1314
if (!curr_dev ) {
1332
- pr_err ( "no ines pcmcia cards found\n" );
1315
+ dev_err ( board -> gpib_dev , "no ines pcmcia cards found\n" );
1333
1316
return -1 ;
1334
1317
}
1335
1318
@@ -1341,9 +1324,9 @@ int ines_common_pcmcia_attach(gpib_board_t *board)
1341
1324
nec_priv = & ines_priv -> nec7210_priv ;
1342
1325
1343
1326
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 ));
1347
1330
return -1 ;
1348
1331
}
1349
1332
@@ -1353,7 +1336,7 @@ int ines_common_pcmcia_attach(gpib_board_t *board)
1353
1336
1354
1337
if (request_irq (curr_dev -> irq , ines_pcmcia_interrupt , IRQF_SHARED ,
1355
1338
"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 );
1357
1340
return -1 ;
1358
1341
}
1359
1342
ines_priv -> irq = curr_dev -> irq ;
@@ -1416,56 +1399,56 @@ static int __init ines_init_module(void)
1416
1399
1417
1400
ret = pci_register_driver (& ines_pci_driver );
1418
1401
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 );
1420
1403
return ret ;
1421
1404
}
1422
1405
1423
1406
ret = gpib_register_driver (& ines_pci_interface , THIS_MODULE );
1424
1407
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 );
1426
1409
goto err_pci ;
1427
1410
}
1428
1411
1429
1412
ret = gpib_register_driver (& ines_pci_unaccel_interface , THIS_MODULE );
1430
1413
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 );
1432
1415
goto err_pci_unaccel ;
1433
1416
}
1434
1417
1435
1418
ret = gpib_register_driver (& ines_pci_accel_interface , THIS_MODULE );
1436
1419
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 );
1438
1421
goto err_pci_accel ;
1439
1422
}
1440
1423
1441
1424
ret = gpib_register_driver (& ines_isa_interface , THIS_MODULE );
1442
1425
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 );
1444
1427
goto err_isa ;
1445
1428
}
1446
1429
1447
1430
#ifdef CONFIG_GPIB_PCMCIA
1448
1431
ret = gpib_register_driver (& ines_pcmcia_interface , THIS_MODULE );
1449
1432
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 );
1451
1434
goto err_pcmcia ;
1452
1435
}
1453
1436
1454
1437
ret = gpib_register_driver (& ines_pcmcia_unaccel_interface , THIS_MODULE );
1455
1438
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 );
1457
1440
goto err_pcmcia_unaccel ;
1458
1441
}
1459
1442
1460
1443
ret = gpib_register_driver (& ines_pcmcia_accel_interface , THIS_MODULE );
1461
1444
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 );
1463
1446
goto err_pcmcia_accel ;
1464
1447
}
1465
1448
1466
1449
ret = pcmcia_register_driver (& ines_gpib_cs_driver );
1467
1450
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 );
1469
1452
goto err_pcmcia_driver ;
1470
1453
}
1471
1454
#endif
0 commit comments