From: Russell King The attached patch overhauls (and fixes) PCMCIA debugging: - introduce cs_debug_level() so we don't have to export pc_debug from cs.c. - use socket->dev.class_id rather than the address of socket as an identifier. - use module_param() for pc_debug variable - this now means that socket drivers can be built in, and debugging enabled via: pcmcia_core.pc_debug=n ds.pc_debug=n sa11xx_core.pc_debug=n tcic.pc_debug=n etc - pc_debug from modules works as expected - make PCMCIA core errors reflect the same format as the debugging messages, and use cs_err() to report them. --- drivers/pcmcia/au1000_generic.c | 30 +++++++++++------ drivers/pcmcia/au1000_pb1x00.c | 6 ++- drivers/pcmcia/i82365.c | 41 +++++++++++++---------- drivers/pcmcia/sa11xx_core.c | 69 ++++++++++++++++++---------------------- drivers/pcmcia/tcic.c | 35 ++++++++++++-------- drivers/pcmcia/yenta_socket.c | 28 ++++++++-------- 6 files changed, 115 insertions(+), 94 deletions(-) diff -puN drivers/pcmcia/au1000_generic.c~pcmcia-debugging-rework-2 drivers/pcmcia/au1000_generic.c --- 25/drivers/pcmcia/au1000_generic.c~pcmcia-debugging-rework-2 2004-02-23 00:33:12.000000000 -0800 +++ 25-akpm/drivers/pcmcia/au1000_generic.c 2004-02-23 00:33:12.000000000 -0800 @@ -26,6 +26,7 @@ * */ #include +#include #include #include #include @@ -54,8 +55,17 @@ #include #include -#ifdef PCMCIA_DEBUG +#ifdef DEBUG static int pc_debug; + +module_param(pc_debug, int, 0644); + +#define debug(lvl,fmt) do { \ + if (pc_debug > (lvl)) \ + printk(KERN_DEBUG fmt); \ +} while (0) +#else +#define debug(lvl,fmt) do { } while (0) #endif MODULE_LICENSE("GPL"); @@ -209,7 +219,7 @@ static int __init au1000_pcmcia_driver_i */ au1000_pcmcia_poll_event(0); - DEBUG(1, "au1000: initialization complete\n"); + debug(1, "au1000: initialization complete\n"); return 0; } /* au1000_pcmcia_driver_init() */ @@ -228,7 +238,7 @@ static void __exit au1000_pcmcia_driver_ if (pcmcia_socket[i].virt_io) iounmap((void *)pcmcia_socket[i].virt_io); } - DEBUG(1, "au1000: shutdown complete\n"); + debug(1, "au1000: shutdown complete\n"); } module_exit(au1000_pcmcia_driver_shutdown); @@ -249,14 +259,14 @@ au1000_pcmcia_events(struct pcmcia_state unsigned int events=0; if(state->detect!=prev_state->detect){ - DEBUG(2, "%s(): card detect value %u\n", + debug(2, "%s(): card detect value %u\n", __FUNCTION__, state->detect); events |= mask&SS_DETECT; } if(state->ready!=prev_state->ready){ - DEBUG(2, "%s(): card ready value %u\n", + debug(2, "%s(): card ready value %u\n", __FUNCTION__, state->ready); events |= mask&((flags&SS_IOCARD)?0:SS_READY); } @@ -429,7 +439,7 @@ au1000_pcmcia_get_status(unsigned int so *status|=state.vs_Xv?SS_XVCARD:0; - DEBUG(2, "\tstatus: %s%s%s%s%s%s%s%s\n", + debug(2, "\tstatus: %s%s%s%s%s%s%s%s\n", (*status&SS_DETECT)?"DETECT ":"", (*status&SS_READY)?"READY ":"", (*status&SS_BATDEAD)?"BATDEAD ":"", @@ -457,7 +467,7 @@ au1000_pcmcia_set_socket(unsigned int so { struct pcmcia_configure configure; - DEBUG(2, "\tmask: %s%s%s%s%s%s\n\tflags: %s%s%s%s%s%s\n" + debug(2, "\tmask: %s%s%s%s%s%s\n\tflags: %s%s%s%s%s%s\n" "\tVcc %d Vpp %d irq %d\n", (state->csc_mask==0)?"":"", (state->csc_mask&SS_DETECT)?"DETECT ":"", @@ -494,7 +504,7 @@ au1000_pcmcia_set_socket(unsigned int so static int au1000_pcmcia_get_io_map(unsigned int sock, struct pccard_io_map *map) { - DEBUG(1, "au1000_pcmcia_get_io_map: sock %d\n", sock); + debug(1, "au1000_pcmcia_get_io_map: sock %d\n", sock); if(map->map>=MAX_IO_WIN){ printk(KERN_ERR "%s(): map (%d) out of range\n", __FUNCTION__, map->map); @@ -531,7 +541,7 @@ au1000_pcmcia_set_io_map(unsigned int so map->start=pcmcia_socket[sock].virt_io; map->stop=map->start+(map->stop-start); pcmcia_socket[sock].io_map[map->map]=*map; - DEBUG(3, "set_io_map %d start %x stop %x\n", + debug(3, "set_io_map %d start %x stop %x\n", map->map, map->start, map->stop); return 0; @@ -595,7 +605,7 @@ au1000_pcmcia_set_mem_map(unsigned int s map->sys_stop=map->sys_start+(map->sys_stop-start); pcmcia_socket[sock].mem_map[map->map]=*map; spin_unlock_irqrestore(&pcmcia_lock, flags); - DEBUG(3, "set_mem_map %d start %x stop %x card_start %x\n", + debug(3, "set_mem_map %d start %x stop %x card_start %x\n", map->map, map->sys_start, map->sys_stop, map->card_start); return 0; diff -puN drivers/pcmcia/au1000_pb1x00.c~pcmcia-debugging-rework-2 drivers/pcmcia/au1000_pb1x00.c --- 25/drivers/pcmcia/au1000_pb1x00.c~pcmcia-debugging-rework-2 2004-02-23 00:33:12.000000000 -0800 +++ 25-akpm/drivers/pcmcia/au1000_pb1x00.c 2004-02-23 00:33:12.000000000 -0800 @@ -48,6 +48,8 @@ #include #include +#define debug(fmt, arg...) do { } while (0) + #ifdef CONFIG_MIPS_PB1000 #include #define PCMCIA_IRQ AU1000_GPIO_15 @@ -213,7 +215,7 @@ pb1x00_pcmcia_configure_socket(const str } pcr &= ~PCR_SLOT_0_RST; - DEBUG(KERN_INFO "Vcc %dV Vpp %dV, pcr %x\n", + debug("Vcc %dV Vpp %dV, pcr %x\n", configure->vcc, configure->vpp, pcr); switch(configure->vcc){ case 0: /* Vcc 0 */ @@ -324,7 +326,7 @@ pb1x00_pcmcia_configure_socket(const str pcr = au_readw(PB1100_MEM_PCMCIA) & ~0xf; - DEBUG(KERN_INFO "Vcc %dV Vpp %dV, pcr %x, reset %d\n", + debug("Vcc %dV Vpp %dV, pcr %x, reset %d\n", configure->vcc, configure->vpp, pcr, configure->reset); diff -puN drivers/pcmcia/i82365.c~pcmcia-debugging-rework-2 drivers/pcmcia/i82365.c --- 25/drivers/pcmcia/i82365.c~pcmcia-debugging-rework-2 2004-02-23 00:33:12.000000000 -0800 +++ 25-akpm/drivers/pcmcia/i82365.c 2004-02-23 00:33:12.000000000 -0800 @@ -32,6 +32,7 @@ ======================================================================*/ #include +#include #include #include #include @@ -66,14 +67,20 @@ #include "ricoh.h" #include "o2micro.h" -#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) +#ifdef DEBUG static const char *version = "i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)"; + +static int pc_debug; + +module_param(pc_debug, int, 0644); + +#define debug(lvl, fmt, arg...) do { \ + if (pc_debug > (lvl)) \ + printk(KERN_DEBUG "i82365: " fmt, ## arg); \ +} while (0) #else -#define DEBUG(n, args...) do { } while (0) +#define debug(lvl, fmt, arg...) do { } while (0) #endif static irqreturn_t i365_count_irq(int, void *, struct pt_regs *); @@ -496,13 +503,13 @@ static irqreturn_t i365_count_irq(int ir { i365_get(irq_sock, I365_CSC); irq_hits++; - DEBUG(2, "-> hit on irq %d\n", irq); + debug(2, "-> hit on irq %d\n", irq); return IRQ_HANDLED; } static u_int __init test_irq(u_short sock, int irq) { - DEBUG(2, " testing ISA irq %d\n", irq); + debug(2, " testing ISA irq %d\n", irq); if (request_irq(irq, i365_count_irq, 0, "scan", i365_count_irq) != 0) return 1; irq_hits = 0; irq_sock = sock; @@ -510,7 +517,7 @@ static u_int __init test_irq(u_short soc schedule_timeout(HZ/100); if (irq_hits) { free_irq(irq, i365_count_irq); - DEBUG(2, " spurious hit!\n"); + debug(2, " spurious hit!\n"); return 1; } @@ -523,7 +530,7 @@ static u_int __init test_irq(u_short soc /* mask all interrupts */ i365_set(sock, I365_CSCINT, 0); - DEBUG(2, " hits = %d\n", irq_hits); + debug(2, " hits = %d\n", irq_hits); return (irq_hits != 1); } @@ -850,7 +857,7 @@ static irqreturn_t pcic_interrupt(int ir u_long flags = 0; int handled = 0; - DEBUG(4, "i82365: pcic_interrupt(%d)\n", irq); + debug(4, "pcic_interrupt(%d)\n", irq); for (j = 0; j < 20; j++) { active = 0; @@ -874,7 +881,7 @@ static irqreturn_t pcic_interrupt(int ir events |= (csc & I365_CSC_READY) ? SS_READY : 0; } ISA_UNLOCK(i, flags); - DEBUG(2, "i82365: socket %d event 0x%02x\n", i, events); + debug(2, "socket %d event 0x%02x\n", i, events); if (events) pcmcia_parse_events(&socket[i].socket, events); @@ -886,7 +893,7 @@ static irqreturn_t pcic_interrupt(int ir if (j == 20) printk(KERN_NOTICE "i82365: infinite loop in interrupt handler\n"); - DEBUG(4, "i82365: interrupt done\n"); + debug(4, "interrupt done\n"); return IRQ_RETVAL(handled); } /* pcic_interrupt */ @@ -928,7 +935,7 @@ static int i365_get_status(u_short sock, } } - DEBUG(1, "i82365: GetStatus(%d) = %#4.4x\n", sock, *value); + debug(1, "GetStatus(%d) = %#4.4x\n", sock, *value); return 0; } /* i365_get_status */ @@ -998,7 +1005,7 @@ static int i365_get_socket(u_short sock, state->csc_mask |= (reg & I365_CSC_READY) ? SS_READY : 0; } - DEBUG(1, "i82365: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " + debug(1, "GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " "io_irq %d, csc_mask %#2.2x\n", sock, state->flags, state->Vcc, state->Vpp, state->io_irq, state->csc_mask); return 0; @@ -1011,7 +1018,7 @@ static int i365_set_socket(u_short sock, struct i82365_socket *t = &socket[sock]; u_char reg; - DEBUG(1, "i82365: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " + debug(1, "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " "io_irq %d, csc_mask %#2.2x)\n", sock, state->flags, state->Vcc, state->Vpp, state->io_irq, state->csc_mask); @@ -1120,7 +1127,7 @@ static int i365_set_io_map(u_short sock, { u_char map, ioctl; - DEBUG(1, "i82365: SetIOMap(%d, %d, %#2.2x, %d ns, " + debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " "%#4.4x-%#4.4x)\n", sock, io->map, io->flags, io->speed, io->start, io->stop); map = io->map; @@ -1150,7 +1157,7 @@ static int i365_set_mem_map(u_short sock u_short base, i; u_char map; - DEBUG(1, "i82365: SetMemMap(%d, %d, %#2.2x, %d ns, %#5.5lx-%#5.5" + debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, %#5.5lx-%#5.5" "lx, %#5.5x)\n", sock, mem->map, mem->flags, mem->speed, mem->sys_start, mem->sys_stop, mem->card_start); diff -puN drivers/pcmcia/sa11xx_core.c~pcmcia-debugging-rework-2 drivers/pcmcia/sa11xx_core.c --- 25/drivers/pcmcia/sa11xx_core.c~pcmcia-debugging-rework-2 2004-02-23 00:33:12.000000000 -0800 +++ 25-akpm/drivers/pcmcia/sa11xx_core.c 2004-02-23 00:33:12.000000000 -0800 @@ -35,6 +35,7 @@ */ #include +#include #include #include #include @@ -54,8 +55,19 @@ #include "sa11xx_core.h" #include "sa1100.h" -#ifdef PCMCIA_DEBUG +#ifdef DEBUG static int pc_debug; + +module_param(pc_debug, int, 0644); + +#define debug(skt, lvl, fmt, arg...) do { \ + if (pc_debug > (lvl)) \ + printk(KERN_DEBUG "skt%u: %s: " fmt, \ + (skt)->nr, __func__, ## arg); \ +} while (0) + +#else +#define debug(skt, lvl, fmt, arg...) do { } while (0) #endif #define to_sa1100_socket(x) container_of(x, struct sa1100_pcmcia_socket, socket) @@ -133,8 +145,8 @@ sa1100_pcmcia_set_mecr(struct sa1100_pcm local_irq_restore(flags); - DEBUG(4, "%s(): sock %u FAST %X BSM %X BSA %X BSIO %X\n", - __FUNCTION__, skt->nr, MECR_FAST_GET(mecr, skt->nr), + debug(skt, 4, "FAST %X BSM %X BSA %X BSIO %X\n", + MECR_FAST_GET(mecr, skt->nr), MECR_BSM_GET(mecr, skt->nr), MECR_BSA_GET(mecr, skt->nr), MECR_BSIO_GET(mecr, skt->nr)); @@ -221,7 +233,7 @@ static int sa1100_pcmcia_sock_init(struc { struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock); - DEBUG(2, "%s(): initializing socket %u\n", __FUNCTION__, skt->nr); + debug(skt, 2, "initializing socket\n"); skt->ops->socket_init(skt); return 0; @@ -242,7 +254,7 @@ static int sa1100_pcmcia_suspend(struct struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock); int ret; - DEBUG(2, "%s(): suspending socket %u\n", __FUNCTION__, skt->nr); + debug(skt, 2, "suspending socket\n"); ret = sa1100_pcmcia_config_skt(skt, &dead_socket); if (ret == 0) @@ -260,7 +272,7 @@ static void sa1100_check_status(struct s { unsigned int events; - DEBUG(4, "%s(): entering PCMCIA monitoring thread\n", __FUNCTION__); + debug(skt, 4, "entering PCMCIA monitoring thread\n"); do { unsigned int status; @@ -273,7 +285,7 @@ static void sa1100_check_status(struct s skt->status = status; spin_unlock_irqrestore(&status_lock, flags); - DEBUG(2, "events: %s%s%s%s%s%s\n", + debug(skt, 4, "events: %s%s%s%s%s%s\n", events == 0 ? "" : "", events & SS_DETECT ? "DETECT " : "", events & SS_READY ? "READY " : "", @@ -293,7 +305,7 @@ static void sa1100_check_status(struct s static void sa1100_pcmcia_poll_event(unsigned long dummy) { struct sa1100_pcmcia_socket *skt = (struct sa1100_pcmcia_socket *)dummy; - DEBUG(4, "%s(): polling for events\n", __FUNCTION__); + debug(skt, 4, "polling for events\n"); mod_timer(&skt->poll_timer, jiffies + SA1100_PCMCIA_POLL_PERIOD); @@ -314,7 +326,7 @@ static irqreturn_t sa1100_pcmcia_interru { struct sa1100_pcmcia_socket *skt = dev; - DEBUG(3, "%s(): servicing IRQ %d\n", __FUNCTION__, irq); + debug(skt, 3, "servicing IRQ %d\n", irq); sa1100_check_status(skt); @@ -363,7 +375,7 @@ sa1100_pcmcia_get_socket(struct pcmcia_s { struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock); - DEBUG(2, "%s() for sock %u\n", __FUNCTION__, skt->nr); + debug(skt, 2, "\n"); *state = skt->cs_state; @@ -385,22 +397,19 @@ sa1100_pcmcia_set_socket(struct pcmcia_s { struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock); - DEBUG(2, "%s() for sock %u\n", __FUNCTION__, skt->nr); - - DEBUG(3, "\tmask: %s%s%s%s%s%s\n\tflags: %s%s%s%s%s%s\n", - (state->csc_mask==0)?"":"", + debug(skt, 2, "mask: %s%s%s%s%s%sflags: %s%s%s%s%s%sVcc %d Vpp %d irq %d\n", + (state->csc_mask==0)?" ":"", (state->csc_mask&SS_DETECT)?"DETECT ":"", (state->csc_mask&SS_READY)?"READY ":"", (state->csc_mask&SS_BATDEAD)?"BATDEAD ":"", (state->csc_mask&SS_BATWARN)?"BATWARN ":"", (state->csc_mask&SS_STSCHG)?"STSCHG ":"", - (state->flags==0)?"":"", + (state->flags==0)?" ":"", (state->flags&SS_PWR_AUTO)?"PWR_AUTO ":"", (state->flags&SS_IOCARD)?"IOCARD ":"", (state->flags&SS_RESET)?"RESET ":"", (state->flags&SS_SPKR_ENA)?"SPKR_ENA ":"", - (state->flags&SS_OUTPUT_ENA)?"OUTPUT_ENA ":""); - DEBUG(3, "\tVcc %d Vpp %d irq %d\n", + (state->flags&SS_OUTPUT_ENA)?"OUTPUT_ENA ":"", state->Vcc, state->Vpp, state->io_irq); return sa1100_pcmcia_config_skt(skt, state); @@ -422,11 +431,9 @@ sa1100_pcmcia_set_io_map(struct pcmcia_s struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock); unsigned short speed = map->speed; - DEBUG(2, "%s() for sock %u\n", __FUNCTION__, skt->nr); - - DEBUG(3, "\tmap %u speed %u\n\tstart 0x%08x stop 0x%08x\n", + debug(skt, 2, "map %u speed %u start 0x%08x stop 0x%08x\n", map->map, map->speed, map->start, map->stop); - DEBUG(3, "\tflags: %s%s%s%s%s%s%s%s\n", + debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n", (map->flags==0)?"":"", (map->flags&MAP_ACTIVE)?"ACTIVE ":"", (map->flags&MAP_16BIT)?"16BIT ":"", @@ -479,11 +486,9 @@ sa1100_pcmcia_set_mem_map(struct pcmcia_ struct resource *res; unsigned short speed = map->speed; - DEBUG(2, "%s() for sock %u\n", __FUNCTION__, skt->nr); - - DEBUG(3, "\tmap %u speed %u card_start %08x\n", + debug(skt, 2, "map %u speed %u card_start %08x\n", map->map, map->speed, map->card_start); - DEBUG(3, "\tflags: %s%s%s%s%s%s%s%s\n", + debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n", (map->flags==0)?"":"", (map->flags&MAP_ACTIVE)?"ACTIVE ":"", (map->flags&MAP_16BIT)?"16BIT ":"", @@ -920,23 +925,13 @@ sa1100_pcmcia_notifier(struct notifier_b switch (val) { case CPUFREQ_PRECHANGE: - if (freqs->new > freqs->old) { - DEBUG(2, "%s(): new frequency %u.%uMHz > %u.%uMHz, " - "pre-updating\n", __FUNCTION__, - freqs->new / 1000, (freqs->new / 100) % 10, - freqs->old / 1000, (freqs->old / 100) % 10); + if (freqs->new > freqs->old) sa1100_pcmcia_update_mecr(freqs->new); - } break; case CPUFREQ_POSTCHANGE: - if (freqs->new < freqs->old) { - DEBUG(2, "%s(): new frequency %u.%uMHz < %u.%uMHz, " - "post-updating\n", __FUNCTION__, - freqs->new / 1000, (freqs->new / 100) % 10, - freqs->old / 1000, (freqs->old / 100) % 10); + if (freqs->new < freqs->old) sa1100_pcmcia_update_mecr(freqs->new); - } break; } diff -puN drivers/pcmcia/tcic.c~pcmcia-debugging-rework-2 drivers/pcmcia/tcic.c --- 25/drivers/pcmcia/tcic.c~pcmcia-debugging-rework-2 2004-02-23 00:33:12.000000000 -0800 +++ 25-akpm/drivers/pcmcia/tcic.c 2004-02-23 00:33:12.000000000 -0800 @@ -32,6 +32,7 @@ ======================================================================*/ #include +#include #include #include #include @@ -55,14 +56,20 @@ #include #include "tcic.h" -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; +#ifdef DEBUG +static int pc_debug; + +module_param(pc_debug, int, 0644); MODULE_PARM(pc_debug, "i"); static const char *version = "tcic.c 1.111 2000/02/15 04:13:12 (David Hinds)"; -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) + +#define debug(lvl, fmt, arg...) do { \ + if (pc_debug > (lvl)) \ + printk(KERN_DEBUG "tcic: " fmt, ## arg); \ +} while (0) #else -#define DEBUG(n, args...) +#define debug(lvl, fmt, arg...) do { } while (0) #endif MODULE_AUTHOR("David Hinds "); @@ -133,7 +140,7 @@ static struct tcic_socket socket_table[2 to map to irq 11, but is coded as 0 or 1 in the irq registers. */ #define TCIC_IRQ(x) ((x) ? (((x) == 11) ? 1 : (x)) : 15) -#ifdef PCMCIA_DEBUG_X +#ifdef DEBUG_X static u_char tcic_getb(u_char reg) { u_char val = inb(tcic_base+reg); @@ -168,7 +175,7 @@ static void tcic_setw(u_char reg, u_shor static void tcic_setl(u_char reg, u_int data) { -#ifdef PCMCIA_DEBUG_X +#ifdef DEBUG_X printk(KERN_DEBUG "tcic_setl(%#x, %#lx)\n", tcic_base+reg, data); #endif outw(data & 0xffff, tcic_base+reg); @@ -573,7 +580,7 @@ static irqreturn_t tcic_interrupt(int ir } else active = 1; - DEBUG(2, "tcic: tcic_interrupt()\n"); + debug(2, "tcic_interrupt()\n"); for (i = 0; i < sockets; i++) { psock = socket_table[i].psock; @@ -610,13 +617,13 @@ static irqreturn_t tcic_interrupt(int ir } active = 0; - DEBUG(2, "tcic: interrupt done\n"); + debug(2, "interrupt done\n"); return IRQ_HANDLED; } /* tcic_interrupt */ static void tcic_timer(u_long data) { - DEBUG(2, "tcic: tcic_timer()\n"); + debug(2, "tcic_timer()\n"); tcic_timer_pending = 0; tcic_interrupt(0, NULL, NULL); } /* tcic_timer */ @@ -643,7 +650,7 @@ static int tcic_get_status(struct pcmcia reg = tcic_getb(TCIC_PWR); if (reg & (TCIC_PWR_VCC(psock)|TCIC_PWR_VPP(psock))) *value |= SS_POWERON; - DEBUG(1, "tcic: GetStatus(%d) = %#2.2x\n", psock, *value); + debug(1, "GetStatus(%d) = %#2.2x\n", psock, *value); return 0; } /* tcic_get_status */ @@ -694,7 +701,7 @@ static int tcic_get_socket(struct pcmcia state->csc_mask |= (scf2 & TCIC_SCF2_MRDY) ? 0 : SS_READY; } - DEBUG(1, "tcic: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " + debug(1, "GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, " "io_irq %d, csc_mask %#2.2x\n", psock, state->flags, state->Vcc, state->Vpp, state->io_irq, state->csc_mask); return 0; @@ -708,7 +715,7 @@ static int tcic_set_socket(struct pcmcia u_char reg; u_short scf1, scf2; - DEBUG(1, "tcic: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " + debug(1, "SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, " "io_irq %d, csc_mask %#2.2x)\n", psock, state->flags, state->Vcc, state->Vpp, state->io_irq, state->csc_mask); tcic_setw(TCIC_ADDR+2, (psock << TCIC_SS_SHFT) | TCIC_ADR2_INDREG); @@ -783,7 +790,7 @@ static int tcic_set_io_map(struct pcmcia u_int addr; u_short base, len, ioctl; - DEBUG(1, "tcic: SetIOMap(%d, %d, %#2.2x, %d ns, " + debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " "%#4.4x-%#4.4x)\n", psock, io->map, io->flags, io->speed, io->start, io->stop); if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || @@ -820,7 +827,7 @@ static int tcic_set_mem_map(struct pcmci u_short addr, ctl; u_long base, len, mmap; - DEBUG(1, "tcic: SetMemMap(%d, %d, %#2.2x, %d ns, " + debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, " "%#5.5lx-%#5.5lx, %#5.5x)\n", psock, mem->map, mem->flags, mem->speed, mem->sys_start, mem->sys_stop, mem->card_start); if ((mem->map > 3) || (mem->card_start > 0x3ffffff) || diff -puN drivers/pcmcia/yenta_socket.c~pcmcia-debugging-rework-2 drivers/pcmcia/yenta_socket.c --- 25/drivers/pcmcia/yenta_socket.c~pcmcia-debugging-rework-2 2004-02-23 00:33:12.000000000 -0800 +++ 25-akpm/drivers/pcmcia/yenta_socket.c 2004-02-23 00:33:12.000000000 -0800 @@ -30,9 +30,9 @@ #if 0 -#define DEBUG(x,args...) printk(KERN_DEBUG "%s: " x, __FUNCTION__, ##args) +#define debug(x,args...) printk(KERN_DEBUG "%s: " x, __FUNCTION__, ##args) #else -#define DEBUG(x,args...) +#define debug(x,args...) #endif /* Don't ask.. */ @@ -47,13 +47,13 @@ static inline u32 cb_readl(struct yenta_socket *socket, unsigned reg) { u32 val = readl(socket->base + reg); - DEBUG("%p %04x %08x\n", socket, reg, val); + debug("%p %04x %08x\n", socket, reg, val); return val; } static inline void cb_writel(struct yenta_socket *socket, unsigned reg, u32 val) { - DEBUG("%p %04x %08x\n", socket, reg, val); + debug("%p %04x %08x\n", socket, reg, val); writel(val, socket->base + reg); } @@ -61,7 +61,7 @@ static inline u8 config_readb(struct yen { u8 val; pci_read_config_byte(socket->dev, offset, &val); - DEBUG("%p %04x %02x\n", socket, offset, val); + debug("%p %04x %02x\n", socket, offset, val); return val; } @@ -69,7 +69,7 @@ static inline u16 config_readw(struct ye { u16 val; pci_read_config_word(socket->dev, offset, &val); - DEBUG("%p %04x %04x\n", socket, offset, val); + debug("%p %04x %04x\n", socket, offset, val); return val; } @@ -77,32 +77,32 @@ static inline u32 config_readl(struct ye { u32 val; pci_read_config_dword(socket->dev, offset, &val); - DEBUG("%p %04x %08x\n", socket, offset, val); + debug("%p %04x %08x\n", socket, offset, val); return val; } static inline void config_writeb(struct yenta_socket *socket, unsigned offset, u8 val) { - DEBUG("%p %04x %02x\n", socket, offset, val); + debug("%p %04x %02x\n", socket, offset, val); pci_write_config_byte(socket->dev, offset, val); } static inline void config_writew(struct yenta_socket *socket, unsigned offset, u16 val) { - DEBUG("%p %04x %04x\n", socket, offset, val); + debug("%p %04x %04x\n", socket, offset, val); pci_write_config_word(socket->dev, offset, val); } static inline void config_writel(struct yenta_socket *socket, unsigned offset, u32 val) { - DEBUG("%p %04x %08x\n", socket, offset, val); + debug("%p %04x %08x\n", socket, offset, val); pci_write_config_dword(socket->dev, offset, val); } static inline u8 exca_readb(struct yenta_socket *socket, unsigned reg) { u8 val = readb(socket->base + 0x800 + reg); - DEBUG("%p %04x %02x\n", socket, reg, val); + debug("%p %04x %02x\n", socket, reg, val); return val; } @@ -111,19 +111,19 @@ static inline u8 exca_readw(struct yenta u16 val; val = readb(socket->base + 0x800 + reg); val |= readb(socket->base + 0x800 + reg + 1) << 8; - DEBUG("%p %04x %04x\n", socket, reg, val); + debug("%p %04x %04x\n", socket, reg, val); return val; } static inline void exca_writeb(struct yenta_socket *socket, unsigned reg, u8 val) { - DEBUG("%p %04x %02x\n", socket, reg, val); + debug("%p %04x %02x\n", socket, reg, val); writeb(val, socket->base + 0x800 + reg); } static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val) { - DEBUG("%p %04x %04x\n", socket, reg, val); + debug("%p %04x %04x\n", socket, reg, val); writeb(val, socket->base + 0x800 + reg); writeb(val >> 8, socket->base + 0x800 + reg + 1); } _