follow-up-patches [6/10] lookup_bus by socket

Dominik Brodowski linux at brodo.de
Sat Nov 22 14:08:53 GMT 2003


The pcmcia_lookup_bus call is only issued by the userspace cardctl 
tool via ds.c. There's no need to verify the caller (ds) has a 
valid "handle", as long as it knows the proper struct pcmcia_socket.

 drivers/pcmcia/cs.c |    7 +------
 drivers/pcmcia/ds.c |    2 +-
 include/pcmcia/cs.h |    2 +-
 3 files changed, 3 insertions(+), 8 deletions(-)

diff -ruN linux-original/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c
--- linux-original/drivers/pcmcia/cs.c	2003-11-22 12:13:30.953369904 +0100
+++ linux/drivers/pcmcia/cs.c	2003-11-22 12:14:31.392181808 +0100
@@ -1125,13 +1125,8 @@
 
 #ifdef CONFIG_CARDBUS
 
-struct pci_bus *pcmcia_lookup_bus(client_handle_t handle)
+struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *s)
 {
-	struct pcmcia_socket *s;
-
-	if (CHECK_HANDLE(handle))
-		return NULL;
-	s = SOCKET(handle);
 	if (!(s->state & SOCKET_CARDBUS))
 		return NULL;
 
diff -ruN linux-original/drivers/pcmcia/ds.c linux/drivers/pcmcia/ds.c
--- linux-original/drivers/pcmcia/ds.c	2003-11-22 12:13:30.991364128 +0100
+++ linux/drivers/pcmcia/ds.c	2003-11-22 12:14:31.391181960 +0100
@@ -755,7 +755,7 @@
     {
 	struct pci_bus *bus;
 
-	bus = pcmcia_lookup_bus(s->handle);
+	bus = pcmcia_lookup_bus(s->parent);
 	if (bus) {
 	    	struct list_head *list;
 		struct pci_dev *dev = NULL;
diff -ruN linux-original/include/pcmcia/cs.h linux/include/pcmcia/cs.h
--- linux-original/include/pcmcia/cs.h	2003-11-22 12:13:30.991364128 +0100
+++ linux/include/pcmcia/cs.h	2003-11-22 12:14:31.411178920 +0100
@@ -456,7 +456,7 @@
 int pcmcia_eject_card(struct pcmcia_socket *skt);
 int pcmcia_insert_card(struct pcmcia_socket *skt);
 int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask);
-struct pci_bus *pcmcia_lookup_bus(client_handle_t handle);
+struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *skt);
 
 /* rsrc_mgr.c */
 int pcmcia_adjust_resource_info(client_handle_t handle, adjust_t *adj);



More information about the linux-pcmcia mailing list