pcmcia network drivers cleanup
PATCH RESEND 1/1 pcmcia network drivers cleanup
Hi,
The attached patch:
* cleans up the parameter passing (module_param() instead of MODULE_PARM()
* makes debugging work (PCMCIA_DEBUG does not exist anymore, make the Makefile test for CONFIG_PCMCIA_DEBUG and activate DEBUG in CFLAGS) and use the same debugging macros for every driver through code reuse.
I've tested this with the pcnet_cs driver, the others are not tested but compile cleanly.
Please apply.
Thanks,
Stelian.
===================================================================
===================================================================
drivers/net/pcmcia/3c574_cs.c | 91 +++++++-------- drivers/net/pcmcia/3c589_cs.c | 81 ++++++------- drivers/net/pcmcia/Makefile | 4 drivers/net/pcmcia/axnet_cs.c | 38 ++---- drivers/net/pcmcia/com20020_cs.c | 85 ++++++-------- drivers/net/pcmcia/fmvj18x_cs.c | 71 +++++------ drivers/net/pcmcia/ibmtr_cs.c | 40 +++--- drivers/net/pcmcia/nmclan_cs.c | 203 ++++++++++++++++------------------ drivers/net/pcmcia/pcnet_cs.c | 83 ++++++++----- drivers/net/pcmcia/smc91c92_cs.c | 101 ++++++++-------- drivers/net/pcmcia/xirc2ps_cs.c | 126 ++++++++++----------- linux-2.6/drivers/net/pcmcia/common.h | 16 ++ 12 files changed, 467 insertions(+), 472 deletions(-)
===================================================================
===== drivers/net/pcmcia/Makefile 1.15 vs edited =====
drivers/net/pcmcia/Makefile +4 -0
@@ -2,6 +2,10 @@ # Makefile for the Linux PCMCIA network device drivers. # +ifeq ($(CONFIG_PCMCIA_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif + # 16-bit client drivers obj-$(CONFIG_PCMCIA_3C589) += 3c589_cs.o obj-$(CONFIG_PCMCIA_3C574) += 3c574_cs.o
===== drivers/net/pcmcia/3c574_cs.c 1.34 vs edited =====
drivers/net/pcmcia/3c574_cs.c +45 -46
232 lines not on this page · raw message
===== drivers/net/pcmcia/3c589_cs.c 1.31 vs edited =====
drivers/net/pcmcia/3c589_cs.c +39 -42
215 lines not on this page · raw message
===== drivers/net/pcmcia/axnet_cs.c 1.28 vs edited =====
drivers/net/pcmcia/axnet_cs.c +17 -21
@@ -49,6 +49,7 @@#include <asm/system.h> #include <asm/byteorder.h> #include <asm/uaccess.h> +#include "common.h" #define AXNET_CMD 0x00#define AXNET_DATAPORT 0x10/* NatSemi-defined port window offset. */
@@ -73,20 +74,15 @@MODULE_DESCRIPTION ("Asix AX88190 PCMCIA ethernet driver" );MODULE_LICENSE ("GPL" ); -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") -/* Bit map of interrupts to choose from */ -INT_MODULE_PARM (irq_mask,0xdeb8 ); +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 );static int irq_list[4 ] = {-1 }; -MODULE_PARM (irq_list,"1-4i" ); +module_param_array (irq_list, int,NULL ,0444 ); -#ifdef PCMCIA_DEBUG -INT_MODULE_PARM (pc_debug,PCMCIA_DEBUG ); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = +#ifdef DEBUG +static char __attribute((unused)) *version ="axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)" ; -#else -#define DEBUG(n, args...)#endif /*====================================================================*/
@@ -161,7 +157,7 @@client_reg_t client_reg;int i, ret; -DEBUG (0 ,"axnet_attach()\n" ); +pn_dbg (0 ,"axnet_attach()\n" ); dev =alloc_netdev (sizeof (struct ei_device ) +sizeof (axnet_dev_t),"eth%d" , axdev_setup);
@@ -223,7 +219,7 @@struct net_device *dev = link->priv;dev_link_t **linkp; -DEBUG (0 ,"axnet_detach(0x%p)\n" , link); +pn_dbg (0 ,"axnet_detach(0x%p)\n" , link);/* Locate device structure */ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -342,11 +338,11 @@axnet_dev_t *info =PRIV (dev);tuple_t tuple;cisparse_t parse; -int i, j, last_ret, last_fn; +int i, j =0 , last_ret, last_fn;u_short buf[64 ];config_info_t conf; -DEBUG (0 ,"axnet_config(0x%p)\n" , link); +pn_dbg (0 ,"axnet_config(0x%p)\n" , link); tuple.Attributes =0 ; tuple.TupleData = (cisdata_t *)buf;
@@ -473,7 +469,7 @@for (i =0 ; i <6 ; i++)printk ("%02X%s" , dev->dev_addr[i], ((i<5 ) ?":" :"\n" ));if (info->phy_id !=-1 ) { -DEBUG (0 ," MII transceiver at index %d, status %x.\n" , info->phy_id, j); +pn_dbg (0 ," MII transceiver at index %d, status %x.\n" , info->phy_id, j); }else {printk (KERN_NOTICE " No MII transceivers found!\n" ); }
@@ -497,7 +493,7 @@static void axnet_release (dev_link_t *link) { -DEBUG (0 ,"axnet_release(0x%p)\n" , link); +pn_dbg (0 ,"axnet_release(0x%p)\n" , link);pcmcia_release_configuration (link->handle);pcmcia_release_io (link->handle, &link->io);
@@ -521,7 +517,7 @@dev_link_t *link = args->client_data;struct net_device *dev = link->priv; -DEBUG (2 ,"axnet_event(0x%06x)\n" , event); +pn_dbg (2 ,"axnet_event(0x%06x)\n" , event);switch (event) {case CS_EVENT_CARD_REMOVAL :
@@ -625,7 +621,7 @@axnet_dev_t *info =PRIV (dev);dev_link_t *link = &info->link; -DEBUG (2 ,"axnet_open('%s')\n" , dev->name); +pn_dbg (2 ,"axnet_open('%s')\n" , dev->name);if (!DEV_OK (link))return -ENODEV ;
@@ -651,7 +647,7 @@axnet_dev_t *info =PRIV (dev);dev_link_t *link = &info->link; -DEBUG (2 ,"axnet_close('%s')\n" , dev->name); +pn_dbg (2 ,"axnet_close('%s')\n" , dev->name);ax_close (dev);free_irq (dev->irq, dev);
@@ -822,7 +818,7 @@int xfer_count = count;char *buf = skb->data; -#ifdef PCMCIA_DEBUG +#ifdef DEBUG if ((ei_debug >4 ) && (count !=4 ))printk (KERN_DEBUG "%s: [bi=%d]\n" , dev->name, count+4 );#endif
@@ -843,7 +839,7 @@ {ioaddr_t nic_base = dev->base_addr; -#ifdef PCMCIA_DEBUG +#ifdef DEBUG if (ei_debug >4 )printk (KERN_DEBUG "%s: [bo=%d]\n" , dev->name, count);#endif
===== drivers/net/pcmcia/com20020_cs.c 1.21 vs edited =====
drivers/net/pcmcia/com20020_cs.c +38 -47
206 lines not on this page · raw message
===== drivers/net/pcmcia/fmvj18x_cs.c 1.33 vs edited =====
drivers/net/pcmcia/fmvj18x_cs.c +34 -37
194 lines not on this page · raw message
===== drivers/net/pcmcia/ibmtr_cs.c 1.27 vs edited =====
drivers/net/pcmcia/ibmtr_cs.c +18 -22
@@ -66,20 +66,16 @@#include <asm/uaccess.h> #include <asm/io.h> #include <asm/system.h> +#include "common.h" #define PCMCIA #include "../tokenring/ibmtr.c" -#ifdef PCMCIA_DEBUG -static int pc_debug =PCMCIA_DEBUG ; -MODULE_PARM (pc_debug,"i" ); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = +#ifdef DEBUG +static char __attribute((unused)) *version ="ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n" " 2.2.7 1999/05/03 12:00:00 (Mike Phillips)\n" " 2.4.2 2001/30/28 Midnight (Burt Silverman)\n" ; -#else -#define DEBUG(n, args...)#endif /*====================================================================*/
@@ -87,27 +83,27 @@/* Parameters that can be set with 'insmod' */ /* Bit map of interrupts to choose from */ -static u_int irq_mask =0xdeb8 ; +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 );static int irq_list[4 ] = {-1 }; +module_param_array (irq_list, int,NULL ,0444 );/* MMIO base address */ -static u_long mmiobase =0xce000 ; +static int mmiobase =0xce000 ; +module_param (mmiobase, int,0444 );/* SRAM base address */ -static u_long srambase =0xd0000 ; +static int srambase =0xd0000 ; +module_param (srambase, int,0444 );/* SRAM size 8,16,32,64 */ -static u_long sramsize =64 ; +static int sramsize =64 ; +module_param (sramsize, int,0444 );/* Ringspeed 4,16 */ static int ringspeed =16 ; +module_param (ringspeed, int,0444 ); -MODULE_PARM (irq_mask,"i" ); -MODULE_PARM (irq_list,"1-4i" ); -MODULE_PARM (mmiobase,"i" ); -MODULE_PARM (srambase,"i" ); -MODULE_PARM (sramsize,"i" ); -MODULE_PARM (ringspeed,"i" );MODULE_LICENSE ("GPL" );/*====================================================================*/
@@ -164,7 +160,7 @@client_reg_t client_reg;int i, ret; -DEBUG (0 ,"ibmtr_attach()\n" ); +pn_dbg (0 ,"ibmtr_attach()\n" );/* Create new token-ring device */ info =kmalloc (sizeof (*info),GFP_KERNEL );
@@ -242,7 +238,7 @@dev_link_t **linkp;struct net_device *dev; -DEBUG (0 ,"ibmtr_detach(0x%p)\n" , link); +pn_dbg (0 ,"ibmtr_detach(0x%p)\n" , link);/* Locate device structure */ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -295,7 +291,7 @@int i, last_ret, last_fn;u_char buf[64 ]; -DEBUG (0 ,"ibmtr_config(0x%p)\n" , link); +pn_dbg (0 ,"ibmtr_config(0x%p)\n" , link); tuple.Attributes =0 ; tuple.TupleData = buf;
@@ -405,7 +401,7 @@ibmtr_dev_t *info = link->priv;struct net_device *dev = info->dev; -DEBUG (0 ,"ibmtr_release(0x%p)\n" , link); +pn_dbg (0 ,"ibmtr_release(0x%p)\n" , link);pcmcia_release_configuration (link->handle);pcmcia_release_io (link->handle, &link->io);
@@ -436,7 +432,7 @@ibmtr_dev_t *info = link->priv;struct net_device *dev = info->dev; -DEBUG (1 ,"ibmtr_event(0x%06x)\n" , event); +pn_dbg (1 ,"ibmtr_event(0x%06x)\n" , event);switch (event) {case CS_EVENT_CARD_REMOVAL :
===== drivers/net/pcmcia/nmclan_cs.c 1.30 vs edited =====
drivers/net/pcmcia/nmclan_cs.c +98 -105
407 lines not on this page · raw message
===== drivers/net/pcmcia/pcnet_cs.c 1.34 vs edited =====
drivers/net/pcmcia/pcnet_cs.c +49 -34
196 lines not on this page · raw message
===== drivers/net/pcmcia/smc91c92_cs.c 1.35 vs edited =====
drivers/net/pcmcia/smc91c92_cs.c +49 -52
268 lines not on this page · raw message
===== drivers/net/pcmcia/xirc2ps_cs.c 1.37 vs edited =====
drivers/net/pcmcia/xirc2ps_cs.c +60 -66
346 lines not on this page · raw message
drivers/net/pcmcia/common.h new file +16 -0
@@ -0,0 +1,16 @@ +#include <linux/kernel.h> +#include <linux/moduleparam.h> + +#ifdef DEBUG +static int pc_debug; + +module_param (pc_debug, int,0644 ); + +#define pn_dbg(lvl, fmt, arg...) do { \ + if (pc_debug > (lvl)) \ + printk(KERN_DEBUG "pn: " fmt, ## arg); \ +} while (0) + +#else +#define pn_dbg(lvl, fmt, arg...) do { } while (0) +#endif
Signature · 1 line
Stelian Pop <[email protected]>
Quoted 8 lines · Stelian Pop
Hi,
The attached patch:
* cleans up the parameter passing (module_param()instead ofMODULE_PARM()
* makes debugging work (PCMCIA_DEBUGdoes not exist anymore, make theMakefiletest forCONFIG_PCMCIA_DEBUGand activate DEBUG in CFLAGS) and use the same debugging macros for every driver through code reuse.
Comments:
1) Can you please separate module_param() and PCMCIA_DEBUG patches?
2) why not use pr_debug()?
Jeff
Quoted 11 lines · Jeff Garzik
Quoted 9 lines · Stelian Pop
Hi,
The attached patch:
* cleans up the parameter passing (module_param()instead ofMODULE_PARM()
* makes debugging work (PCMCIA_DEBUGdoes not exist anymore, make theMakefiletest forCONFIG_PCMCIA_DEBUGand activate DEBUG in CFLAGS) and use the same debugging macros for every driver through code reuse.
Quoted 3 lines
Comments:
1) Can you please separate
module_param()andPCMCIA_DEBUGpatches?
I will and resubmit later. The two changes were a bit related (modifying the debugging made me do the module_param() cleanup because MODULE_PARM() and module_param() aren't both allowed in the same module) that's why I originaly submitted a single patch.
Quoted 1 line
2) why not use
pr_debug()?
Because pr_debug doesn't take into account the verbosity level like pn_dbg() does. A lot of drivers in drivers/pcmcia/ do use such a construction...
Stelian.
Signature · 1 line
Stelian Pop <[email protected]>
Quoted 3 lines · Jeff Garzik
Comments:
1) Can you please separate
module_param()andPCMCIA_DEBUGpatches?
I'm sorry it has taken so long but I got preempted by other things...
Anyway, here it comes again, in the next 2 followups to this mail.
Stelian.
Signature · 1 line
Stelian Pop <[email protected]>
PATCH 1/1 drivers/net/pcmcia: use module_param() instead of MODULE_PARM()
===================================================================
[email protected], 2004-11-10 16:43:13+01:00, [email protected]
drivers/net/pcmcia: use module_param() instead of MODULE_PARM()
===================================================================
3c574_cs.c | 21 +++++++++++++-------- 3c589_cs.c | 18 ++++++++++-------- axnet_cs.c | 11 ++++++----- com20020_cs.c | 34 +++++++++++++++++----------------- fmvj18x_cs.c | 15 ++++++++------- ibmtr_cs.c | 23 ++++++++++++----------- nmclan_cs.c | 14 ++++++++------ pcnet_cs.c | 46 +++++++++++++++++++++++++++++++++------------- smc91c92_cs.c | 18 ++++++++++-------- xirc2ps_cs.c | 25 +++++++++++++++++-------- 10 files changed, 134 insertions(+), 91 deletions(-)
===================================================================
drivers/net/pcmcia/3c574_cs.c +13 -8
@@ -107,24 +107,29 @@MODULE_DESCRIPTION ("3Com 3c574 series PCMCIA ethernet driver" );MODULE_LICENSE ("GPL" ); -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") +/* Bit map of interrupts to choose from */ +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 ); -/* Now-standard PC card module parameters. */ -INT_MODULE_PARM (irq_mask,0xdeb8 );static int irq_list[4 ] = {-1 }; -MODULE_PARM (irq_list,"1-4i" ); +module_param_array (irq_list, int,NULL ,0444 );/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ -INT_MODULE_PARM (max_interrupt_work,32 ); +static int max_interrupt_work =32 ; +module_param (max_interrupt_work, int,0444 );/* Force full duplex modes? */ -INT_MODULE_PARM (full_duplex,0 ); +static int full_duplex;/* = 0 */ +module_param (full_duplex, int,0444 );/* Autodetect link polarity reversal? */ -INT_MODULE_PARM (auto_polarity,1 ); +static int auto_polarity =1 ; +module_param (auto_polarity, int,0444 ); +/* Now-standard PC card module parameters. */ #ifdef PCMCIA_DEBUG -INT_MODULE_PARM (pc_debug,PCMCIA_DEBUG ); +static int pc_debug =PCMCIA_DEBUG ; +module_param (pc_debug, int,0644 ); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)static char *version ="3c574_cs.c 1.65ac1 2003/04/07 Donald Becker/David Hinds, [email protected].\n" ;
drivers/net/pcmcia/3c589_cs.c +10 -8
@@ -126,18 +126,20 @@MODULE_DESCRIPTION ("3Com 3c589 series PCMCIA ethernet driver" );MODULE_LICENSE ("GPL" ); -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") - -/* Special hook for setting if_port when module is loaded */ -INT_MODULE_PARM (if_port,0 ); -/* Bit map of interrupts to choose from */ -INT_MODULE_PARM (irq_mask,0xdeb8 ); +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 ); +static int irq_list[4 ] = {-1 }; -MODULE_PARM (irq_list,"1-4i" ); +module_param_array (irq_list, int,NULL ,0444 ); + +/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ +static int if_port;/* = 0 */ +module_param (if_port, int,0444 );#ifdef PCMCIA_DEBUG -INT_MODULE_PARM (pc_debug,PCMCIA_DEBUG ); +static int pc_debug =PCMCIA_DEBUG ; +module_param (pc_debug, int,0644 ); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)static char *version =DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)" ;
drivers/net/pcmcia/axnet_cs.c +6 -5
@@ -73,15 +73,16 @@MODULE_DESCRIPTION ("Asix AX88190 PCMCIA ethernet driver" );MODULE_LICENSE ("GPL" ); -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") -/* Bit map of interrupts to choose from */ -INT_MODULE_PARM (irq_mask,0xdeb8 ); +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 ); +static int irq_list[4 ] = {-1 }; -MODULE_PARM (irq_list,"1-4i" ); +module_param_array (irq_list, int,NULL ,0444 );#ifdef PCMCIA_DEBUG -INT_MODULE_PARM (pc_debug,PCMCIA_DEBUG ); +static int pc_debug =PCMCIA_DEBUG ; +module_param (pc_debug, int,0644 ); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)static char *version ="axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)" ;
drivers/net/pcmcia/com20020_cs.c +17 -17
@@ -57,7 +57,7 @@#ifdef PCMCIA_DEBUG static int pc_debug =PCMCIA_DEBUG ; -MODULE_PARM (pc_debug,"i" ); +module_param (pc_debug, int,0644 ); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)static void regdump (struct net_device *dev)
@@ -101,26 +101,26 @@/*====================================================================*/ -/* Parameters that can be set with 'insmod' */ - -static int node; -static int timeout =3 ; -static int backplane; -static int clockp; -static int clockm; - -MODULE_PARM (node,"i" ); -MODULE_PARM (timeout,"i" ); -MODULE_PARM (backplane,"i" ); -MODULE_PARM (clockp,"i" ); -MODULE_PARM (clockm,"i" );/* Bit map of interrupts to choose from */ -static u_int irq_mask =0xdeb8 ; +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 ); +static int irq_list[4 ] = {-1 }; +module_param_array (irq_list, int,NULL ,0444 ); + +/* Parameters that can be set with 'insmod' */ +static int node;/* = 0 */ +module_param (node, int,0444 ); +static int timeout =3 ; +module_param (timeout, int,0444 ); +static int backplane;/* = 0 */ +module_param (backplane, int,0444 ); +static int clockp;/* = 0 */ +module_param (clockp, int,0444 ); +static int clockm;/* = 0 */ +module_param (clockm, int,0444 ); -MODULE_PARM (irq_mask,"i" ); -MODULE_PARM (irq_list,"1-4i" );MODULE_LICENSE ("GPL" );/*====================================================================*/
drivers/net/pcmcia/fmvj18x_cs.c +8 -7
@@ -67,20 +67,21 @@MODULE_DESCRIPTION ("fmvj18x and compatible PCMCIA ethernet driver" );MODULE_LICENSE ("GPL" ); -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") -/* Bit map of interrupts to choose from */ -/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */ -INT_MODULE_PARM (irq_mask,0xdeb8 ); +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 ); +static int irq_list[4 ] = {-1 }; -MODULE_PARM (irq_list,"1-4i" ); +module_param_array (irq_list, int,NULL ,0444 );/* SRAM configuration */ /* 0:4KB*2 TX buffer else:8KB*2 TX buffer */ -INT_MODULE_PARM (sram_config,0 ); +static int sram_config;/* = 0 */ +module_param (sram_config, int,0444 );#ifdef PCMCIA_DEBUG -INT_MODULE_PARM (pc_debug,PCMCIA_DEBUG ); +static int pc_debug =PCMCIA_DEBUG ; +module_param (pc_debug, int,0644 ); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)static char *version =DRV_NAME ".c " DRV_VERSION " 2002/03/23" ;#else
drivers/net/pcmcia/ibmtr_cs.c +12 -11
@@ -72,7 +72,7 @@#ifdef PCMCIA_DEBUG static int pc_debug =PCMCIA_DEBUG ; -MODULE_PARM (pc_debug,"i" ); +module_param (pc_debug, int,0644 ); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)static char *version ="ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n"
@@ -87,27 +87,28 @@/* Parameters that can be set with 'insmod' */ /* Bit map of interrupts to choose from */ -static u_int irq_mask =0xdeb8 ; +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 ); +static int irq_list[4 ] = {-1 }; +module_param_array (irq_list, int,NULL ,0444 );/* MMIO base address */ -static u_long mmiobase =0xce000 ; +static int mmiobase =0xce000 ; +module_param (mmiobase, int,0444 );/* SRAM base address */ -static u_long srambase =0xd0000 ; +static int srambase =0xd0000 ; +module_param (srambase, int,0444 );/* SRAM size 8,16,32,64 */ -static u_long sramsize =64 ; +static int sramsize =64 ; +module_param (sramsize, int,0444 );/* Ringspeed 4,16 */ static int ringspeed =16 ; +module_param (ringspeed, int,0444 ); -MODULE_PARM (irq_mask,"i" ); -MODULE_PARM (irq_list,"1-4i" ); -MODULE_PARM (mmiobase,"i" ); -MODULE_PARM (srambase,"i" ); -MODULE_PARM (sramsize,"i" ); -MODULE_PARM (ringspeed,"i" );MODULE_LICENSE ("GPL" );/*====================================================================*/
drivers/net/pcmcia/nmclan_cs.c +8 -6
@@ -405,18 +405,20 @@MODULE_DESCRIPTION ("New Media PCMCIA ethernet driver" );MODULE_LICENSE ("GPL" ); -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") +/* Bit map of interrupts to choose from */ +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 );static int irq_list[4 ] = {-1 }; -MODULE_PARM (irq_list,"1-4i" ); +module_param_array (irq_list, int,NULL ,0444 );/* 0=auto, 1=10baseT, 2 = 10base2, default=auto */ -INT_MODULE_PARM (if_port,0 ); -/* Bit map of interrupts to choose from */ -INT_MODULE_PARM (irq_mask,0xdeb8 ); +static int if_port;/* = 0 */ +module_param (if_port, int,0444 );#ifdef PCMCIA_DEBUG -INT_MODULE_PARM (pc_debug,PCMCIA_DEBUG ); +static int pc_debug =PCMCIA_DEBUG ; +module_param (pc_debug, int,0644 ); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)#else #define DEBUG(n, args...)
drivers/net/pcmcia/pcnet_cs.c +33 -13
64 lines not on this page · raw message
drivers/net/pcmcia/smc91c92_cs.c +10 -8
@@ -66,7 +66,12 @@MODULE_DESCRIPTION ("SMC 91c92 series PCMCIA ethernet driver" );MODULE_LICENSE ("GPL" ); -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") +/* Bit map of interrupts to choose from */ +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 ); + +static int irq_list[4 ] = {-1 }; +module_param_array (irq_list, int,NULL ,0444 );/* Transceiver/media type.
@@ -74,15 +79,12 @@1 = 10baseT (and autoselect if #define AUTOSELECT), 2 = AUI/10base2, */ -INT_MODULE_PARM (if_port,0 ); - -/* Bit map of interrupts to choose from. */ -INT_MODULE_PARM (irq_mask,0xdeb8 ); -static int irq_list[4 ] = {-1 }; -MODULE_PARM (irq_list,"1-4i" ); +static int if_port;/* = 0 */ +module_param (if_port, int,0444 );#ifdef PCMCIA_DEBUG -INT_MODULE_PARM (pc_debug,PCMCIA_DEBUG ); +static int pc_debug =PCMCIA_DEBUG ; +module_param (pc_debug, int,0644 );static const char *version ="smc91c92_cs.c 0.09 1996/8/4 Donald Becker, [email protected].\n" ; #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
drivers/net/pcmcia/xirc2ps_cs.c +17 -8
@@ -220,7 +220,7 @@*/ #ifdef PCMCIA_DEBUG static int pc_debug =PCMCIA_DEBUG ; -MODULE_PARM (pc_debug,"i" ); +module_param (pc_debug, int,0644 ); #define DEBUG(n, args...) if (pc_debug>(n)) printk(KDBG_XIRC args)#else #define DEBUG(n, args...)
@@ -255,15 +255,24 @@MODULE_DESCRIPTION ("Xircom PCMCIA ethernet driver" );MODULE_LICENSE ("Dual MPL/GPL" ); -#define INT_MODULE_PARM (n, v) static int n = v; MODULE_PARM(n, "i") +/* Bit map of interrupts to choose from */ +static int irq_mask =0xdeb8 ; +module_param (irq_mask, int,0444 );static int irq_list[4 ] = {-1 }; -MODULE_PARM (irq_list,"1-4i" ); -INT_MODULE_PARM (irq_mask,0xdeb8 ); -INT_MODULE_PARM (if_port,0 ); -INT_MODULE_PARM (full_duplex,0 ); -INT_MODULE_PARM (do_sound,1 ); -INT_MODULE_PARM (lockup_hack,0 );/* anti lockup hack */ +module_param_array (irq_list, int,NULL ,0444 ); + +static int if_port;/* = 0 */ +module_param (if_port, int,0444 ); + +static int full_duplex;/* = 0 */ +module_param (full_duplex, int,0444 ); + +static int do_sound =1 ; +module_param (do_sound, int,0444 ); + +static int lockup_hack;/* = 0 */ +module_param (lockup_hack, int,0444 );/*====================================================================*/
Re: [PATCH] drivers/net/pcmcia: use module_param() instead of MODULE_PARM()
Hi Stelian,
Several of these changes expose module parameters to sysfs (i.e., have permissions of non-zero value) without need for that IMO.
This came up yesterday on the kernel-janitors mailing list. When asked about it, Greg KH replied:
Quoted 2 lines
Can someone please clarify the "official guidelines" for module parameter permissions in sysfs?
"When it makes sense to have it exposed to userspace"
Yeah, it's vague, sorry, but it all depends.
For things that can be changed on the fly, expose it.
For things that don't really matter, and no one will ever look them up, don't. I think the irq stuff is in the "don't" category, as almost no one messes with them anymore.
<end quote>
OTOH, debug flags are often read/write and visible, so using 0644 for them is the right thing to do.
Stelian Pop wrote:
[email protected], 2004-11-10 16:43:13+01:00, [email protected]
drivers/net/pcmcia: use module_param() instead of MODULE_PARM()
===================================================================
3c574_cs.c | 21 +++++++++++++-------- 3c589_cs.c | 18 ++++++++++-------- axnet_cs.c | 11 ++++++----- com20020_cs.c | 34 +++++++++++++++++----------------- fmvj18x_cs.c | 15 ++++++++------- ibmtr_cs.c | 23 ++++++++++++----------- nmclan_cs.c | 14 ++++++++------ pcnet_cs.c | 46 +++++++++++++++++++++++++++++++++------------- smc91c92_cs.c | 18 ++++++++++-------- xirc2ps_cs.c | 25 +++++++++++++++++-------- 10 files changed, 134 insertions(+), 91 deletions(-)
===================================================================
Signature · 1 line
~Randy
Re: [PATCH] drivers/net/pcmcia: use module_param() instead of MODULE_PARM()
Quoted 1 line · Randy.Dunlap
Hi Stelian,
Hi.
Quoted 6 lines
Several of these changes expose module parameters to sysfs (i.e., have permissions of non-zero value) without need for that IMO.
This came up yesterday on the kernel-janitors mailing list. When asked about it, Greg KH replied:
:)
I shouldn't probably discuss Greg's advice, but...
Quoted 9 lines
Quoted 3 lines
Can someone please clarify the "official guidelines" for module parameter permissions in sysfs?
"When it makes sense to have it exposed to userspace"
Yeah, it's vague, sorry, but it all depends.
For things that can be changed on the fly, expose it.
... with a write permission. Agreed.
Quoted 4 lines
For things that don't really matter, and no one will ever look them up, don't.
I think the irq stuff is in the "don't" category, as almost no one messes with them anymore.
In this case why is this a module parameter at all ? If it doesn't matter at all then it should get removed from all places.
In fact, I do think that all module parameter should be exposed in /sys, and that a '0' in module_param() should really mean 0400.
It can be useful to know what parameters have been passed to a module, and I cannot think of a single case where we want to hide this information (and no, security doesn't really apply here. If you have root rights than you can also look into the kernel memory and find out the value by yourself).
The only questions one should ask himself about a module parameter is whether:
- it is a R/O or a R/W value (and this is determined by the code who uses this value, if it is dynamic then let the parameter be R/W, if it's only used to make assumptions in the init phase then it must be R/O).
- it can be shown to everybody, or only root should be able to read the value (0400 vs 0440/0444). I'm not sure this is really useful since /etc/modprobe.conf is generaly 0644, but it could be in some cases...
Stelian.
Signature · 1 line
Stelian Pop <[email protected]>
Re: [PATCH] drivers/net/pcmcia: use module_param() instead of MODULE_PARM()
Quoted 11 lines · Stelian Pop
Quoted 1 line · Randy.Dunlap
Hi Stelian,
Hi.
Quoted 3 lines
Several of these changes expose module parameters to sysfs (i.e., have permissions of non-zero value) without need for that IMO.
Quoted 7 lines
Quoted 2 lines
This came up yesterday on the kernel-janitors mailing list. When asked about it, Greg KH replied:
:)
I shouldn't probably discuss Greg's advice, but...
AFAIK, you are free to disagree as long as I or we can also disagree. :)
Quoted 36 lines
Quoted 8 lines
Quoted 2 lines
Can someone please clarify the "official guidelines" for module parameter permissions in sysfs?
"When it makes sense to have it exposed to userspace"
Yeah, it's vague, sorry, but it all depends.
For things that can be changed on the fly, expose it.
... with a write permission. Agreed.
Quoted 3 lines
For things that don't really matter, and no one will ever look them up, don't. I think the irq stuff is in the "don't" category, as almost no one messes with them anymore.
In this case why is this a module parameter at all ? If it doesn't matter at all then it should get removed from all places.
In fact, I do think that all module parameter should be exposed in /sys, and that a '0' in
module_param()should really mean 0400.It can be useful to know what parameters have been passed to a module,
and I cannot think of a single case where we want to hide this information (and no, security doesn't really apply here. If you have root rights than you can also look into the kernel memory and find
out the value by yourself).The only questions one should ask himself about a module parameter is whether:
- it is a R/O or a R/W value (and this is determined by the code who uses this value, if it is dynamic then let the parameter be R/W, if it's only used to make assumptions in the init phase then it must be R/O).
Quoted 4 lines
- it can be shown to everybody, or only root should be able to read the value (0400 vs 0440/0444). I'm not sure this is really useful since
/etc/modprobe.confis generaly 0644, but it could be in some cases...
I don't have an argument with most of that, but I am concerned about how much memory each entry requires and how useful it really is. IOW, if I need to know the module parameters for a module, I can probably find that info somewhere else, like in /etc/modprobe.conf or a script etc., so why waste memory on it?
But then there's the question of if someone else needs to know the module parameters that were used, where do they look?
I could say: same answer as I gave above. Or you could say: exposed in /sys.
If memory usage is not an issue, I'll agree.
Signature · 1 line
~Randy
Re: [PATCH] drivers/net/pcmcia: use module_param() instead of MODULE_PARM()
Quoted 8 lines · Randy.Dunlap
Quoted 8 lines
In fact, I do think that all module parameter should be exposed in /sys, and that a '0' in
module_param()should really mean 0400.It can be useful to know what parameters have been passed to a module, and I cannot think of a single case where we want to hide this information (and no, security doesn't really apply here. If you have root rights than you can also look into the kernel memory and find out the value by yourself).
[...]
Quoted 6 lines
I don't have an argument with most of that, but I am concerned about how much memory each entry requires and how useful it really is. IOW, if I need to know the module parameters for a module, I can probably find that info somewhere else, like in
/etc/modprobe.confor a script etc., so why waste memory on it?
The problem is that the information you can get out of /etc/modprobe.conf or some script is not necessarily consistent. Maybe the module was hand-loaded using different parameters that the ones in the script.
This is the same issue as with the in-kernel .config. We have this today because this way we're sure we are looking at the right one, not an older copy which happen to be in /boot. Same thing for KKSYMOOPS.
Yes, this wastes a bit of memory (quite a lot actually for KKCONFIG or KKSYMOOPS), but less and less people cares. And those who really care (embedded people etc) can disable this with a config option.
If module parameters are a memory issue, maybe we should do the same as above: put all of them into /sys unless chosen otherwise, and in this case disable all of them, since we can go just fine without any module parameter in /sys.
Stelian.
Signature · 1 line
Stelian Pop <[email protected]>
Re: [PATCH] drivers/net/pcmcia: use module_param() instead of MODULE_PARM()
Quoted 1 line · Stelian Pop
If module parameters are a memory issue
module paramters, independent of exporting into sysfs [and they're not free'd on init!] need 56 bytes per module, and 20 + sizeof(name of parameter) bytes per module parameter.
If they're exported to sysfs, the first one per module costs 66, all other ones 10 bytes. So exporting to sysfs is cheap.
Dominik
PATCH 1/1 drivers/net/pcmcia: rework debugging
In reply to Stelian Pop===================================================================
[email protected], 2004-11-10 16:55:18+01:00, [email protected]
drivers/net/pcmcia: make debugging work and homogenize the debugging macros (use pn_dbg() instead of DEBUG())
===================================================================
3c574_cs.c | 75 ++++++++++------------ 3c589_cs.c | 68 +++++++++----------- Makefile | 4 + axnet_cs.c | 32 ++++----- com20020_cs.c | 54 ++++++---------- common.h | 17 +++++ fmvj18x_cs.c | 61 ++++++++---------- ibmtr_cs.c | 20 ++---- nmclan_cs.c | 192 +++++++++++++++++++++++++++------------------------------- pcnet_cs.c | 40 +++++------- smc91c92_cs.c | 88 ++++++++++++-------------- xirc2ps_cs.c | 102 +++++++++++++----------------- 12 files changed, 358 insertions(+), 395 deletions(-)
===================================================================
drivers/net/pcmcia/3c574_cs.c +35 -40
@@ -98,6 +98,7 @@#include <asm/uaccess.h> #include <asm/io.h> #include <asm/system.h> +#include "common.h" /*====================================================================*/
@@ -126,15 +127,9 @@static int auto_polarity =1 ;module_param (auto_polarity, int,0444 ); -/* Now-standard PC card module parameters. */ -#ifdef PCMCIA_DEBUG -static int pc_debug =PCMCIA_DEBUG ; -module_param (pc_debug, int,0644 ); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = +#ifdef DEBUG +static char __attribute((unused)) *version ="3c574_cs.c 1.65ac1 2003/04/07 Donald Becker/David Hinds, [email protected].\n" ; -#else -#define DEBUG(n, args...)#endif /*====================================================================*/
@@ -282,7 +277,7 @@struct net_device *dev;int i, ret; -DEBUG (0 ,"3c574_attach()\n" ); +pn_dbg (0 ,"3c574_attach()\n" );/* Create the PC card device object. */ dev =alloc_etherdev (sizeof (struct el3_private ));
@@ -359,7 +354,7 @@struct net_device *dev = link->priv;dev_link_t **linkp; -DEBUG (0 ,"3c574_detach(0x%p)\n" , link); +pn_dbg (0 ,"3c574_detach(0x%p)\n" , link);/* Locate device structure */ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -408,7 +403,7 @@ phys_addr = (u16 *)dev->dev_addr; -DEBUG (0 ,"3c574_config(0x%p)\n" , link); +pn_dbg (0 ,"3c574_config(0x%p)\n" , link); tuple.Attributes =0 ; tuple.DesiredTuple =CISTPL_CONFIG ;
@@ -501,8 +496,8 @@ mii_status =mdio_read (ioaddr, phy &0x1f ,1 );if (mii_status !=0xffff ) { lp->phys = phy &0x1f ; -DEBUG (0 ," MII transceiver at index %d, status %x.\n" , - phy, mii_status); +pn_dbg (0 ," MII transceiver at index %d, status %x.\n" , + phy, mii_status);if ((mii_status &0x0040 ) ==0 ) mii_preamble_required =1 ;break ;
@@ -559,7 +554,7 @@static void tc574_release (dev_link_t *link) { -DEBUG (0 ,"3c574_release(0x%p)\n" , link); +pn_dbg (0 ,"3c574_release(0x%p)\n" , link);pcmcia_release_configuration (link->handle);pcmcia_release_io (link->handle, &link->io);
@@ -581,7 +576,7 @@dev_link_t *link = args->client_data;struct net_device *dev = link->priv; -DEBUG (1 ,"3c574_event(0x%06x)\n" , event); +pn_dbg (1 ,"3c574_event(0x%06x)\n" , event);switch (event) {case CS_EVENT_CARD_REMOVAL :
@@ -837,8 +832,8 @@ lp->media.expires = jiffies +HZ ;add_timer (&lp->media); -DEBUG (2 ,"%s: opened, status %4.4x.\n" , - dev->name,inw (dev->base_addr +EL3_STATUS )); +pn_dbg (2 ,"%s: opened, status %4.4x.\n" , + dev->name,inw (dev->base_addr +EL3_STATUS ));return 0 ; }
@@ -873,8 +868,8 @@if (tx_status &0x30 )tc574_wait_for_completion (dev, TxReset);if (tx_status &0x38 ) { -DEBUG (1 ,"%s: transmit error: status 0x%02x\n" , - dev->name, tx_status); +pn_dbg (1 ,"%s: transmit error: status 0x%02x\n" , + dev->name, tx_status);outw (TxEnable, ioaddr +EL3_CMD ); lp->stats.tx_aborted_errors++; }
@@ -888,8 +883,8 @@struct el3_private *lp =netdev_priv (dev);unsigned long flags; -DEBUG (3 ,"%s: el3_start_xmit(length = %ld) called, " -"status %4.4x.\n" , dev->name, (long )skb->len, +pn_dbg (3 ,"%s: el3_start_xmit(length = %ld) called, " +"status %4.4x.\n" , dev->name, (long )skb->len,inw (ioaddr +EL3_STATUS ));spin_lock_irqsave (&lp->window_lock, flags);
@@ -926,8 +921,8 @@return IRQ_NONE ; ioaddr = dev->base_addr; -DEBUG (3 ,"%s: interrupt, status %4.4x.\n" , - dev->name,inw (ioaddr +EL3_STATUS )); +pn_dbg (3 ,"%s: interrupt, status %4.4x.\n" , + dev->name,inw (ioaddr +EL3_STATUS ));spin_lock (&lp->window_lock);
@@ -935,7 +930,7 @@ (IntLatch | RxComplete | RxEarly | StatsFull)) {if (!netif_device_present (dev) || ((status &0xe000 ) !=0x2000 )) { -DEBUG (1 ,"%s: Interrupt from dead card\n" , dev->name); +pn_dbg (1 ,"%s: Interrupt from dead card\n" , dev->name);break ; }
@@ -945,7 +940,7 @@ work_budget =el3_rx (dev, work_budget);if (status & TxAvailable) { -DEBUG (3 ," TX room bit was handled.\n" ); +pn_dbg (3 ," TX room bit was handled.\n" );/* There's room in the FIFO for a full-sized packet. */ outw (AckIntr | TxAvailable, ioaddr +EL3_CMD );netif_wake_queue (dev);
@@ -985,8 +980,8 @@ }if (--work_budget <0 ) { -DEBUG (0 ,"%s: Too much work in interrupt, " -"status %4.4x.\n" , dev->name, status); +pn_dbg (0 ,"%s: Too much work in interrupt, " +"status %4.4x.\n" , dev->name, status);/* Clear all interrupts */ outw (AckIntr |0xFF , ioaddr +EL3_CMD );break ;
@@ -995,8 +990,8 @@outw (AckIntr | IntReq | IntLatch, ioaddr +EL3_CMD ); } -DEBUG (3 ,"%s: exiting interrupt, status %4.4x.\n" , - dev->name,inw (ioaddr +EL3_STATUS )); +pn_dbg (3 ,"%s: exiting interrupt, status %4.4x.\n" , + dev->name,inw (ioaddr +EL3_STATUS ));spin_unlock (&lp->window_lock);return IRQ_RETVAL (handled);
@@ -1103,7 +1098,7 @@ioaddr_t ioaddr = dev->base_addr;u8 rx, tx, up; -DEBUG (2 ,"%s: updating the statistics.\n" , dev->name); +pn_dbg (2 ,"%s: updating the statistics.\n" , dev->name);if (inw (ioaddr+EL3_STATUS ) ==0xffff )/* No card. */ return ;
@@ -1140,8 +1135,8 @@ioaddr_t ioaddr = dev->base_addr;short rx_status; -DEBUG (3 ,"%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n" , - dev->name,inw (ioaddr+EL3_STATUS ),inw (ioaddr+RxStatus)); +pn_dbg (3 ,"%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n" , + dev->name,inw (ioaddr+EL3_STATUS ),inw (ioaddr+RxStatus));while (!((rx_status =inw (ioaddr + RxStatus)) &0x8000 ) && (--worklimit >=0 )) {if (rx_status &0x4000 ) {/* Error, update stats. */
@@ -1161,8 +1156,8 @@ skb =dev_alloc_skb (pkt_len+5 ); -DEBUG (3 ," Receiving packet size %d status %4.4x.\n" , - pkt_len, rx_status); +pn_dbg (3 ," Receiving packet size %d status %4.4x.\n" , + pkt_len, rx_status);if (skb !=NULL ) { skb->dev = dev;skb_reserve (skb,2 );
@@ -1174,8 +1169,8 @@ lp->stats.rx_packets++; lp->stats.rx_bytes += pkt_len; }else { -DEBUG (1 ,"%s: couldn't allocate a sk_buff of" -" size %d.\n" , dev->name, pkt_len); +pn_dbg (1 ,"%s: couldn't allocate a sk_buff of" +" size %d.\n" , dev->name, pkt_len); lp->stats.rx_dropped++; } }
@@ -1203,9 +1198,9 @@u16 *data = (u16 *)&rq->ifr_ifru;int phy = lp->phys &0x1f ; -DEBUG (2 ,"%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n" , - dev->name, rq->ifr_ifrn.ifrn_name, cmd, - data[0 ], data[1 ], data[2 ], data[3 ]); +pn_dbg (2 ,"%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n" , + dev->name, rq->ifr_ifrn.ifrn_name, cmd, + data[0 ], data[1 ], data[2 ], data[3 ]);switch (cmd) {case SIOCGMIIPHY :/* Get the address of the PHY in use. */
@@ -1270,7 +1265,7 @@struct el3_private *lp =netdev_priv (dev);dev_link_t *link = &lp->link; -DEBUG (2 ,"%s: shutting down ethercard.\n" , dev->name); +pn_dbg (2 ,"%s: shutting down ethercard.\n" , dev->name);if (DEV_OK (link)) {unsigned long flags;
drivers/net/pcmcia/3c589_cs.c +32 -36
199 lines not on this page · raw message
drivers/net/pcmcia/Makefile +4 -0
@@ -2,6 +2,10 @@ # Makefile for the Linux PCMCIA network device drivers. # +ifeq ($(CONFIG_PCMCIA_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif + # 16-bit client drivers obj-$(CONFIG_PCMCIA_3C589) += 3c589_cs.o obj-$(CONFIG_PCMCIA_3C574) += 3c574_cs.o
drivers/net/pcmcia/axnet_cs.c +14 -18
@@ -49,6 +49,7 @@#include <asm/system.h> #include <asm/byteorder.h> #include <asm/uaccess.h> +#include "common.h" #define AXNET_CMD 0x00#define AXNET_DATAPORT 0x10/* NatSemi-defined port window offset. */
@@ -80,14 +81,9 @@static int irq_list[4 ] = {-1 };module_param_array (irq_list, int,NULL ,0444 ); -#ifdef PCMCIA_DEBUG -static int pc_debug =PCMCIA_DEBUG ; -module_param (pc_debug, int,0644 ); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = +#ifdef DEBUG +static char __attribute((unused)) *version ="axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)" ; -#else -#define DEBUG(n, args...)#endif /*====================================================================*/
@@ -162,7 +158,7 @@client_reg_t client_reg;int i, ret; -DEBUG (0 ,"axnet_attach()\n" ); +pn_dbg (0 ,"axnet_attach()\n" ); dev =alloc_netdev (sizeof (struct ei_device ) +sizeof (axnet_dev_t),"eth%d" , axdev_setup);
@@ -224,7 +220,7 @@struct net_device *dev = link->priv;dev_link_t **linkp; -DEBUG (0 ,"axnet_detach(0x%p)\n" , link); +pn_dbg (0 ,"axnet_detach(0x%p)\n" , link);/* Locate device structure */ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -343,11 +339,11 @@axnet_dev_t *info =PRIV (dev);tuple_t tuple;cisparse_t parse; -int i, j, last_ret, last_fn; +int i, j =0 , last_ret, last_fn;u_short buf[64 ];config_info_t conf; -DEBUG (0 ,"axnet_config(0x%p)\n" , link); +pn_dbg (0 ,"axnet_config(0x%p)\n" , link); tuple.Attributes =0 ; tuple.TupleData = (cisdata_t *)buf;
@@ -474,7 +470,7 @@for (i =0 ; i <6 ; i++)printk ("%02X%s" , dev->dev_addr[i], ((i<5 ) ?":" :"\n" ));if (info->phy_id !=-1 ) { -DEBUG (0 ," MII transceiver at index %d, status %x.\n" , info->phy_id, j); +pn_dbg (0 ," MII transceiver at index %d, status %x.\n" , info->phy_id, j); }else {printk (KERN_NOTICE " No MII transceivers found!\n" ); }
@@ -498,7 +494,7 @@static void axnet_release (dev_link_t *link) { -DEBUG (0 ,"axnet_release(0x%p)\n" , link); +pn_dbg (0 ,"axnet_release(0x%p)\n" , link);pcmcia_release_configuration (link->handle);pcmcia_release_io (link->handle, &link->io);
@@ -522,7 +518,7 @@dev_link_t *link = args->client_data;struct net_device *dev = link->priv; -DEBUG (2 ,"axnet_event(0x%06x)\n" , event); +pn_dbg (2 ,"axnet_event(0x%06x)\n" , event);switch (event) {case CS_EVENT_CARD_REMOVAL :
@@ -626,7 +622,7 @@axnet_dev_t *info =PRIV (dev);dev_link_t *link = &info->link; -DEBUG (2 ,"axnet_open('%s')\n" , dev->name); +pn_dbg (2 ,"axnet_open('%s')\n" , dev->name);if (!DEV_OK (link))return -ENODEV ;
@@ -652,7 +648,7 @@axnet_dev_t *info =PRIV (dev);dev_link_t *link = &info->link; -DEBUG (2 ,"axnet_close('%s')\n" , dev->name); +pn_dbg (2 ,"axnet_close('%s')\n" , dev->name);ax_close (dev);free_irq (dev->irq, dev);
@@ -823,7 +819,7 @@int xfer_count = count;char *buf = skb->data; -#ifdef PCMCIA_DEBUG +#ifdef DEBUG if ((ei_debug >4 ) && (count !=4 ))printk (KERN_DEBUG "%s: [bi=%d]\n" , dev->name, count+4 );#endif
@@ -844,7 +840,7 @@ {ioaddr_t nic_base = dev->base_addr; -#ifdef PCMCIA_DEBUG +#ifdef DEBUG if (ei_debug >4 )printk (KERN_DEBUG "%s: [bo=%d]\n" , dev->name, count);#endif
drivers/net/pcmcia/com20020_cs.c +23 -31
166 lines not on this page · raw message
drivers/net/pcmcia/common.h new file +17 -0
@@ -0,0 +1,17 @@ +#include <linux/kernel.h> +#include <linux/moduleparam.h> + +#ifdef DEBUG +static int pc_debug; + +module_param (pc_debug, int,0644 ); +MODULE_PARM_DESC (pc_debug,"Debug verbosity level" ); + +#define pn_dbg(lvl, fmt, arg...) do { \ + if (pc_debug > (lvl)) \ + printk(KERN_DEBUG "pn: " fmt, ## arg); \ +} while (0) + +#else +#define pn_dbg(lvl, fmt, arg...) do { } while (0) +#endif
drivers/net/pcmcia/fmvj18x_cs.c +29 -32
178 lines not on this page · raw message
drivers/net/pcmcia/ibmtr_cs.c +8 -12
@@ -66,20 +66,16 @@#include <asm/uaccess.h> #include <asm/io.h> #include <asm/system.h> +#include "common.h" #define PCMCIA #include "../tokenring/ibmtr.c" -#ifdef PCMCIA_DEBUG -static int pc_debug =PCMCIA_DEBUG ; -module_param (pc_debug, int,0644 ); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = +#ifdef DEBUG +static char __attribute((unused)) *version ="ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n" " 2.2.7 1999/05/03 12:00:00 (Mike Phillips)\n" " 2.4.2 2001/30/28 Midnight (Burt Silverman)\n" ; -#else -#define DEBUG(n, args...)#endif /*====================================================================*/
@@ -165,7 +161,7 @@client_reg_t client_reg;int i, ret; -DEBUG (0 ,"ibmtr_attach()\n" ); +pn_dbg (0 ,"ibmtr_attach()\n" );/* Create new token-ring device */ info =kmalloc (sizeof (*info),GFP_KERNEL );
@@ -243,7 +239,7 @@dev_link_t **linkp;struct net_device *dev; -DEBUG (0 ,"ibmtr_detach(0x%p)\n" , link); +pn_dbg (0 ,"ibmtr_detach(0x%p)\n" , link);/* Locate device structure */ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -296,7 +292,7 @@int i, last_ret, last_fn;u_char buf[64 ]; -DEBUG (0 ,"ibmtr_config(0x%p)\n" , link); +pn_dbg (0 ,"ibmtr_config(0x%p)\n" , link); tuple.Attributes =0 ; tuple.TupleData = buf;
@@ -406,7 +402,7 @@ibmtr_dev_t *info = link->priv;struct net_device *dev = info->dev; -DEBUG (0 ,"ibmtr_release(0x%p)\n" , link); +pn_dbg (0 ,"ibmtr_release(0x%p)\n" , link);pcmcia_release_configuration (link->handle);pcmcia_release_io (link->handle, &link->io);
@@ -437,7 +433,7 @@ibmtr_dev_t *info = link->priv;struct net_device *dev = info->dev; -DEBUG (1 ,"ibmtr_event(0x%06x)\n" , event); +pn_dbg (1 ,"ibmtr_event(0x%06x)\n" , event);switch (event) {case CS_EVENT_CARD_REMOVAL :
drivers/net/pcmcia/nmclan_cs.c +92 -100
393 lines not on this page · raw message
drivers/net/pcmcia/pcnet_cs.c +18 -22
@@ -52,6 +52,7 @@#include <asm/system.h> #include <asm/byteorder.h> #include <asm/uaccess.h> +#include "common.h" #define PCNET_CMD 0x00#define PCNET_DATAPORT 0x10/* NatSemi-defined port window offset. */
@@ -69,14 +70,9 @@static char *if_names[] = {"auto" ,"10baseT" ,"10base2" }; -#ifdef PCMCIA_DEBUG -static int pc_debug =PCMCIA_DEBUG ; -module_param (pc_debug, int,0644 ); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = +#ifdef DEBUG +static char __attribute((unused)) *version ="pcnet_cs.c 1.153 2003/11/09 18:53:09 (David Hinds)" ; -#else -#define DEBUG(n, args...)#endif /*====================================================================*/
@@ -278,7 +274,7 @@client_reg_t client_reg;int i, ret; -DEBUG (0 ,"pcnet_attach()\n" ); +pn_dbg (0 ,"pcnet_attach()\n" );/* Create new ethernet device */ dev =__alloc_ei_netdev (sizeof (pcnet_dev_t));
@@ -338,7 +334,7 @@struct net_device *dev = link->priv;dev_link_t **linkp; -DEBUG (0 ,"pcnet_detach(0x%p)\n" , link); +pn_dbg (0 ,"pcnet_detach(0x%p)\n" , link);/* Locate device structure */ for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
@@ -595,7 +591,7 @@config_info_t conf;hw_info_t *hw_info; -DEBUG (0 ,"pcnet_config(0x%p)\n" , link); +pn_dbg (0 ,"pcnet_config(0x%p)\n" , link); tuple.Attributes =0 ; tuple.TupleData = (cisdata_t *)buf;
@@ -794,7 +790,7 @@ {pcnet_dev_t *info =PRIV (link->priv); -DEBUG (0 ,"pcnet_release(0x%p)\n" , link); +pn_dbg (0 ,"pcnet_release(0x%p)\n" , link);if (info->flags &USE_SHMEM ) {iounmap (info->base);
@@ -822,7 +818,7 @@dev_link_t *link = args->client_data;struct net_device *dev = link->priv; -DEBUG (2 ,"pcnet_event(0x%06x)\n" , event); +pn_dbg (2 ,"pcnet_event(0x%06x)\n" , event);switch (event) {case CS_EVENT_CARD_REMOVAL :
@@ -1076,7 +1072,7 @@ phyid = tmp <<16 ; phyid |=mdio_read (mii_addr, i,MII_PHYID_REG2 ); phyid &=MII_PHYID_REV_MASK ; -DEBUG (0 ,"%s: MII at %d is 0x%08x\n" , dev->name, i, phyid); +pn_dbg (0 ,"%s: MII at %d is 0x%08x\n" , dev->name, i, phyid);if (phyid ==AM79C9XX_HOME_PHY ) { info->pna_phy = i; }else if (phyid !=AM79C9XX_ETH_PHY ) {
@@ -1090,7 +1086,7 @@pcnet_dev_t *info =PRIV (dev);dev_link_t *link = &info->link; -DEBUG (2 ,"pcnet_open('%s')\n" , dev->name); +pn_dbg (2 ,"pcnet_open('%s')\n" , dev->name);if (!DEV_OK (link))return -ENODEV ;
@@ -1118,7 +1114,7 @@pcnet_dev_t *info =PRIV (dev);dev_link_t *link = &info->link; -DEBUG (2 ,"pcnet_close('%s')\n" , dev->name); +pn_dbg (2 ,"pcnet_close('%s')\n" , dev->name);ei_close (dev);free_irq (dev->irq, dev);
@@ -1358,7 +1354,7 @@int xfer_count = count;char *buf = skb->data; -#ifdef PCMCIA_DEBUG +#ifdef DEBUG if ((ei_debug >4 ) && (count !=4 ))printk (KERN_DEBUG "%s: [bi=%d]\n" , dev->name, count+4 );#endif
@@ -1382,7 +1378,7 @@/* This was for the ALPHA version only, but enough people have encountering problems that it is still here. */ -#ifdef PCMCIA_DEBUG +#ifdef DEBUG if (ei_debug >4 ) {/* DMA termination address check... */ int addr, tries =20 ; do {
@@ -1411,12 +1407,12 @@ {ioaddr_t nic_base = dev->base_addr;pcnet_dev_t *info =PRIV (dev); -#ifdef PCMCIA_DEBUG +#ifdef DEBUG int retries =0 ;#endif u_long dma_start; -#ifdef PCMCIA_DEBUG +#ifdef DEBUG if (ei_debug >4 )printk (KERN_DEBUG "%s: [bo=%d]\n" , dev->name, count);#endif
@@ -1436,7 +1432,7 @@/* We should already be in page 0, but to be safe... */ outb_p (E8390_PAGE0 +E8390_START +E8390_NODMA , nic_base+PCNET_CMD ); -#ifdef PCMCIA_DEBUG +#ifdef DEBUG retry:#endif
@@ -1453,7 +1449,7 @@ dma_start = jiffies; -#ifdef PCMCIA_DEBUG +#ifdef DEBUG /* This was for the ALPHA version only, but enough people have encountering problems that it is still here. */ if (ei_debug >4 ) {/* DMA termination address check... */
@@ -1677,7 +1673,7 @@ static void __exit exit_pcnet_cs(void) { -DEBUG (0 ,"pcnet_cs: unloading\n" ); +pn_dbg (0 ,"pcnet_cs: unloading\n" );pcmcia_unregister_driver (&pcnet_driver);while (dev_list !=NULL )pcnet_detach (dev_list);
drivers/net/pcmcia/smc91c92_cs.c +42 -46
248 lines not on this page · raw message
drivers/net/pcmcia/xirc2ps_cs.c +44 -58
315 lines not on this page · raw message