[PATCH 2.6] Enable Pcmcia debug

Jean Tourrilhes jt at bougret.hpl.hp.com
Fri Sep 5 18:44:56 BST 2003


	Hi guys,

	The patch below add some options to enable the PCMCIA debug
code and fix it so that it compiles and execute properly. If this code
is in the kernel, we might as well make it usable. The reason for this
patch will be obvious in 2sec.
	Tested on 2.6.0-test4.

	Have fun...

	Jean

-----------------------------------------------------------

diff -u -p linux/include/pcmcia/cs.j1.h linux/include/pcmcia/cs.h
--- linux/include/pcmcia/cs.j1.h	Fri Sep  5 16:27:10 2003
+++ linux/include/pcmcia/cs.h	Fri Sep  5 16:28:47 2003
@@ -463,6 +463,11 @@ struct pci_bus *pcmcia_lookup_bus(client
 /* rsrc_mgr.c */
 int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj);
 
+/* Debugging stuff */
+#ifdef CONFIG_PCMCIA_DEBUG_ENABLE
+#define PCMCIA_DEBUG CONFIG_PCMCIA_DEBUG_LEVEL
+#endif
+
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_CS_H */
diff -u -p linux/drivers/pcmcia.j1/Kconfig linux/drivers/pcmcia/Kconfig
--- linux/drivers/pcmcia.j1/Kconfig	Fri Sep  5 16:13:50 2003
+++ linux/drivers/pcmcia/Kconfig	Fri Sep  5 16:32:23 2003
@@ -104,6 +104,22 @@ config PCMCIA_SA1111
 
 	  This driver is also available as a module called sa1111_cs.
 
+config PCMCIA_DEBUG_ENABLE
+	bool "Enable PCMCIA debug code"
+	depends on PCMCIA
+	help
+	  Enable PCMCIA debugging code.
+	  You can select the level at run time for each pcmcia module
+	  via the module parameter "pc_debug".
+
+config PCMCIA_DEBUG_LEVEL
+	int "PCMCIA debug level"
+	depends on PCMCIA_DEBUG_ENABLE
+	default "0"
+	help
+	  Default PCMCIA debugging level when not specified via module
+	  parameter.
+
 config PCMCIA_PROBE
 	bool
 	default y if ISA && !ARCH_SA1100 && !ARCH_CLPS711X
diff -u -p linux/drivers/pcmcia.j1/cistpl.c linux/drivers/pcmcia/cistpl.c
--- linux/drivers/pcmcia.j1/cistpl.c	Tue Sep  2 19:00:32 2003
+++ linux/drivers/pcmcia/cistpl.c	Fri Sep  5 16:44:58 2003
@@ -570,7 +570,7 @@ int pcmcia_get_next_tuple(client_handle_
 	ofs += link[1] + 2;
     }
     if (i == MAX_TUPLES) {
-	DEBUG(1, "cs: overrun in pcmcia_get_next_tuple for socket %d\n",
+	DEBUG(1, "cs: overrun in pcmcia_get_next_tuple for socket 0x%p\n",
 	      handle->Socket);
 	return CS_NO_MORE_ITEMS;
     }
diff -u -p linux/drivers/pcmcia.j1/cs.c linux/drivers/pcmcia/cs.c
--- linux/drivers/pcmcia.j1/cs.c	Tue Sep  2 19:00:59 2003
+++ linux/drivers/pcmcia/cs.c	Fri Sep  5 17:09:37 2003
@@ -112,7 +112,8 @@ INT_MODULE_PARM(cis_speed,	300);		/* ns 
 INT_MODULE_PARM(io_speed,	0);		/* ns */
 
 #ifdef PCMCIA_DEBUG
-INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG);
+int pc_debug = PCMCIA_DEBUG;	/* Can't be static !!! */
+MODULE_PARM(pc_debug, "i");
 static const char *version =
 "cs.c 1.279 2001/10/13 00:08:28 (David Hinds)";
 #endif
@@ -1020,7 +1021,7 @@ int pcmcia_bind_device(bind_req_t *req)
     init_waitqueue_head(&client->mtd_req);
     client->next = s->clients;
     s->clients = client;
-    DEBUG(1, "cs: bind_device(): client 0x%p, sock %d, dev %s\n",
+    DEBUG(1, "cs: bind_device(): client 0x%p, sock 0x%p, dev %s\n",
 	  client, client->Socket, client->dev_info);
     return CS_SUCCESS;
 } /* bind_device */
@@ -1551,7 +1552,7 @@ int pcmcia_register_client(client_handle
 	memset(s->config, 0, sizeof(config_t) * s->functions);
     }
     
-    DEBUG(1, "cs: register_client(): client 0x%p, sock %d, dev %s\n",
+    DEBUG(1, "cs: register_client(): client 0x%p, sock 0x%p, dev %s\n",
 	  client, client->Socket, client->dev_info);
     if (client->EventMask & CS_EVENT_REGISTRATION_COMPLETE)
 	EVENT(client, CS_EVENT_REGISTRATION_COMPLETE, CS_EVENT_PRI_LOW);
@@ -2081,7 +2082,7 @@ int pcmcia_reset_card(client_handle_t ha
     
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: resetting socket %d\n", handle->Socket);
+	DEBUG(1, "cs: resetting socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
@@ -2130,7 +2131,7 @@ int pcmcia_suspend_card(client_handle_t 
     
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: suspending socket %d\n", handle->Socket);
+	DEBUG(1, "cs: suspending socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
@@ -2157,7 +2158,7 @@ int pcmcia_resume_card(client_handle_t h
     
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: waking up socket %d\n", handle->Socket);
+	DEBUG(1, "cs: waking up socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
@@ -2190,7 +2191,7 @@ int pcmcia_eject_card(client_handle_t ha
     
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: user eject request on socket %d\n", handle->Socket);
+	DEBUG(1, "cs: user eject request on socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
@@ -2219,7 +2220,7 @@ int pcmcia_insert_card(client_handle_t h
 
 	if (CHECK_HANDLE(handle))
 		return CS_BAD_HANDLE;
-	DEBUG(1, "cs: user insert request on socket %d\n", handle->Socket);
+	DEBUG(1, "cs: user insert request on socket 0x%p\n", handle->Socket);
 	skt = SOCKET(handle);
 
 	down(&skt->skt_sem);
diff -u -p linux/drivers/pcmcia.j1/tcic.c linux/drivers/pcmcia/tcic.c
--- linux/drivers/pcmcia.j1/tcic.c	Tue Sep  2 19:01:19 2003
+++ linux/drivers/pcmcia/tcic.c	Fri Sep  5 16:49:38 2003
@@ -627,7 +627,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", lsock, *value);
+    DEBUG(1, "tcic: GetStatus(0x%p) = %#2.2x\n", sock, *value);
     return 0;
 } /* tcic_get_status */
   
@@ -678,8 +678,8 @@ 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, "
-	  "io_irq %d, csc_mask %#2.2x\n", lsock, state->flags,
+    DEBUG(1, "tcic: GetSocket(0x%p) = 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;
 } /* tcic_get_socket */
@@ -692,8 +692,8 @@ 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, "
-	  "io_irq %d, csc_mask %#2.2x)\n", lsock, state->flags,
+    DEBUG(1, "tcic: SetSocket(0x%p, 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);
     tcic_setw(TCIC_ADDR+2, (psock << TCIC_SS_SHFT) | TCIC_ADR2_INDREG);
 
@@ -767,8 +767,8 @@ 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, "
-	  "%#4.4x-%#4.4x)\n", lsock, io->map, io->flags,
+    DEBUG(1, "tcic: SetIOMap(0x%p, %d, %#2.2x, %d ns, "
+	  "%#4.4x-%#4.4x)\n", sock, io->map, io->flags,
 	  io->speed, io->start, io->stop);
     if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
 	(io->stop < io->start)) return -EINVAL;
@@ -804,8 +804,8 @@ 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, "
-	  "%#5.5lx-%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags,
+    DEBUG(1, "tcic: SetMemMap(0x%p, %d, %#2.2x, %d ns, "
+	  "%#5.5lx-%#5.5lx, %#5.5x)\n", sock, mem->map, mem->flags,
 	  mem->speed, mem->sys_start, mem->sys_stop, mem->card_start);
     if ((mem->map > 3) || (mem->card_start > 0x3ffffff) ||
 	(mem->sys_start > 0xffffff) || (mem->sys_stop > 0xffffff) ||



More information about the linux-pcmcia mailing list