[PATCH] pcmcia: remove inquire_socket

Dominik Brodowski linux at brodo.de
Thu Jun 12 19:40:11 BST 2003


Remove the inquire_socket callback by moving the (static) capability
information to the top-level of struct pcmcia_socket.

 drivers/pcmcia/cardbus.c  |   10 +++++-----
 drivers/pcmcia/cistpl.c   |   38 +++++++++++++++++++-------------------
 drivers/pcmcia/cs.c       |   39 +++++++++++++++++++--------------------
 drivers/pcmcia/i82092.c   |   20 ++++----------------
 drivers/pcmcia/i82092aa.h |    1 -
 drivers/pcmcia/i82365.c   |   21 +++++----------------
 drivers/pcmcia/rsrc_mgr.c |   32 ++++++++++++++++----------------
 drivers/pcmcia/tcic.c     |   33 +++++++++++++--------------------
 drivers/pcmcia/yenta.c    |   22 ++++++----------------
 drivers/pcmcia/yenta.h    |    1 -
 include/pcmcia/ss.h       |   21 +++++++++------------
 11 files changed, 96 insertions(+), 142 deletions(-)


diff -ruN linux-original/drivers/pcmcia/cardbus.c linux/drivers/pcmcia/cardbus.c
--- linux-original/drivers/pcmcia/cardbus.c	2003-06-12 16:01:34.000000000 +0200
+++ linux/drivers/pcmcia/cardbus.c	2003-06-12 18:19:37.000000000 +0200
@@ -169,7 +169,7 @@
 
 	DEBUG(3, "cs: read_cb_mem(%d, %#x, %u)\n", space, addr, len);
 
-	dev = pci_find_slot(s->cap.cb_dev->subordinate->number, 0);
+	dev = pci_find_slot(s->cb_dev->subordinate->number, 0);
 	if (!dev)
 		goto fail;
 
@@ -239,7 +239,7 @@
 
 int cb_alloc(struct pcmcia_socket * s)
 {
-	struct pci_bus *bus = s->cap.cb_dev->subordinate;
+	struct pci_bus *bus = s->cb_dev->subordinate;
 	struct pci_dev *dev;
 	unsigned int max, pass;
 
@@ -258,17 +258,17 @@
 	 */
 	pci_bus_size_bridges(bus);
 	pci_bus_assign_resources(bus);
-	cardbus_assign_irqs(bus, s->cap.pci_irq);
+	cardbus_assign_irqs(bus, s->pci_irq);
 	pci_enable_bridges(bus);
 	pci_bus_add_devices(bus);
 
-	s->irq.AssignedIRQ = s->cap.pci_irq;
+	s->irq.AssignedIRQ = s->pci_irq;
 	return CS_SUCCESS;
 }
 
 void cb_free(struct pcmcia_socket * s)
 {
-	struct pci_dev *bridge = s->cap.cb_dev;
+	struct pci_dev *bridge = s->cb_dev;
 
 	cb_release_cis_mem(s);
 
diff -ruN linux-original/drivers/pcmcia/cistpl.c linux/drivers/pcmcia/cistpl.c
--- linux-original/drivers/pcmcia/cistpl.c	2003-06-12 16:01:34.000000000 +0200
+++ linux/drivers/pcmcia/cistpl.c	2003-06-12 18:19:37.000000000 +0200
@@ -87,8 +87,8 @@
     if (s->cis_mem.sys_start != 0) {
 	s->cis_mem.flags &= ~MAP_ACTIVE;
 	s->ss_entry->set_mem_map(s, &s->cis_mem);
-	if (!(s->cap.features & SS_CAP_STATIC_MAP))
-	    release_mem_region(s->cis_mem.sys_start, s->cap.map_size);
+	if (!(s->features & SS_CAP_STATIC_MAP))
+	    release_mem_region(s->cis_mem.sys_start, s->map_size);
 	iounmap(s->cis_virt);
 	s->cis_mem.sys_start = 0;
 	s->cis_virt = NULL;
@@ -104,26 +104,26 @@
 set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
 {
     pccard_mem_map *mem = &s->cis_mem;
-    if (!(s->cap.features & SS_CAP_STATIC_MAP) &&
+    if (!(s->features & SS_CAP_STATIC_MAP) &&
 	mem->sys_start == 0) {
-	int low = !(s->cap.features & SS_CAP_PAGE_REGS);
+	int low = !(s->features & SS_CAP_PAGE_REGS);
 	validate_mem(s);
 	mem->sys_start = 0;
-	if (find_mem_region(&mem->sys_start, s->cap.map_size,
-			    s->cap.map_size, low, "card services", s)) {
+	if (find_mem_region(&mem->sys_start, s->map_size,
+			    s->map_size, low, "card services", s)) {
 	    printk(KERN_NOTICE "cs: unable to map card memory!\n");
 	    return NULL;
 	}
-	mem->sys_stop = mem->sys_start+s->cap.map_size-1;
-	s->cis_virt = ioremap(mem->sys_start, s->cap.map_size);
+	mem->sys_stop = mem->sys_start+s->map_size-1;
+	s->cis_virt = ioremap(mem->sys_start, s->map_size);
     }
     mem->card_start = card_offset;
     mem->flags = flags;
     s->ss_entry->set_mem_map(s, mem);
-    if (s->cap.features & SS_CAP_STATIC_MAP) {
+    if (s->features & SS_CAP_STATIC_MAP) {
 	if (s->cis_virt)
 	    iounmap(s->cis_virt);
-	s->cis_virt = ioremap(mem->sys_start, s->cap.map_size);
+	s->cis_virt = ioremap(mem->sys_start, s->map_size);
     }
     return s->cis_virt;
 }
@@ -178,21 +178,21 @@
 	    addr *= 2;
 	}
 
-	card_offset = addr & ~(s->cap.map_size-1);
+	card_offset = addr & ~(s->map_size-1);
 	while (len) {
 	    sys = set_cis_map(s, card_offset, flags);
 	    if (!sys) {
 		memset(ptr, 0xff, len);
 		return -1;
 	    }
-	    end = sys + s->cap.map_size;
-	    sys = sys + (addr & (s->cap.map_size-1));
+	    end = sys + s->map_size;
+	    sys = sys + (addr & (s->map_size-1));
 	    for ( ; len > 0; len--, buf++, sys += inc) {
 		if (sys == end)
 		    break;
 		*buf = readb(sys);
 	    }
-	    card_offset += s->cap.map_size;
+	    card_offset += s->map_size;
 	    addr = 0;
 	}
     }
@@ -239,20 +239,20 @@
 	    addr *= 2;
 	}
 
-	card_offset = addr & ~(s->cap.map_size-1);
+	card_offset = addr & ~(s->map_size-1);
 	while (len) {
 	    sys = set_cis_map(s, card_offset, flags);
 	    if (!sys)
 		return; /* FIXME: error */
 
-	    end = sys + s->cap.map_size;
-	    sys = sys + (addr & (s->cap.map_size-1));
+	    end = sys + s->map_size;
+	    sys = sys + (addr & (s->map_size-1));
 	    for ( ; len > 0; len--, buf++, sys += inc) {
 		if (sys == end)
 		    break;
 		writeb(*buf, sys);
 	    }
-	    card_offset += s->cap.map_size;
+	    card_offset += s->map_size;
 	    addr = 0;
 	}
     }
@@ -418,7 +418,7 @@
     tuple->TupleLink = tuple->Flags = 0;
 #ifdef CONFIG_CARDBUS
     if (s->state & SOCKET_CARDBUS) {
-	struct pci_dev *dev = s->cap.cb_dev;
+	struct pci_dev *dev = s->cb_dev;
 	u_int ptr;
 	pci_bus_read_config_dword(dev->subordinate, 0, PCI_CARDBUS_CIS, &ptr);
 	tuple->CISOffset = ptr & ~7;
diff -ruN linux-original/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c
--- linux-original/drivers/pcmcia/cs.c	2003-06-12 18:19:44.000000000 +0200
+++ linux/drivers/pcmcia/cs.c	2003-06-12 18:19:37.000000000 +0200
@@ -352,7 +352,6 @@
 	spin_lock_init(&socket->lock);
 
 	init_socket(socket);
-	socket->ss_entry->inquire_socket(socket, &socket->cap);
 
 	init_completion(&socket->thread_done);
 	init_waitqueue_head(&socket->thread_wait);
@@ -871,8 +870,8 @@
 	      *base, align);
 	align = 0;
     }
-    if ((s->cap.features & SS_CAP_STATIC_MAP) && s->cap.io_offset) {
-	*base = s->cap.io_offset | (*base & 0x0fff);
+    if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) {
+	*base = s->io_offset | (*base & 0x0fff);
 	return 0;
     }
     /* Check for an already-allocated window that must conflict with
@@ -919,7 +918,7 @@
 			     ioaddr_t num)
 {
     int i;
-    if(!(s->cap.features & SS_CAP_STATIC_MAP))
+    if(!(s->features & SS_CAP_STATIC_MAP))
 	release_region(base, num);
     for (i = 0; i < MAX_IO_WIN; i++) {
 	if ((s->io[i].BasePort <= base) &&
@@ -1136,7 +1135,7 @@
 	config->Function = fn;
 	config->Vcc = s->socket.Vcc;
 	config->Vpp1 = config->Vpp2 = s->socket.Vpp;
-	config->Option = s->cap.cb_dev->subordinate->number;
+	config->Option = s->cb_dev->subordinate->number;
 	if (s->state & SOCKET_CARDBUS_CONFIG) {
 	    config->Attributes = CONF_VALID_CLIENT;
 	    config->IntType = INT_CARDBUS;
@@ -1309,7 +1308,7 @@
 	if (!(s->state & SOCKET_CARDBUS))
 		return NULL;
 
-	return s->cap.cb_dev->subordinate;
+	return s->cb_dev->subordinate;
 }
 
 EXPORT_SYMBOL(pcmcia_lookup_bus);
@@ -1681,7 +1680,7 @@
     }
 
 #ifdef CONFIG_PCMCIA_PROBE
-    if (req->AssignedIRQ != s->cap.pci_irq)
+    if (req->AssignedIRQ != s->pci_irq)
 	undo_irq(req->Attributes, req->AssignedIRQ);
 #endif
     
@@ -1706,7 +1705,7 @@
     s->state &= ~SOCKET_WIN_REQ(win->index);
 
     /* Release system memory */
-    if(!(s->cap.features & SS_CAP_STATIC_MAP))
+    if(!(s->features & SS_CAP_STATIC_MAP))
 	release_mem_region(win->base, win->size);
     win->handle->state &= ~CLIENT_WIN_REQ(win->index);
 
@@ -1931,22 +1930,22 @@
 	return CS_IN_USE;
     
     /* Short cut: if there are no ISA interrupts, then it is PCI */
-    if (!s->cap.irq_mask) {
-	irq = s->cap.pci_irq;
+    if (!s->irq_mask) {
+	irq = s->pci_irq;
 	ret = (irq) ? 0 : CS_IN_USE;
 #ifdef CONFIG_PCMCIA_PROBE
     } else if (s->irq.AssignedIRQ != 0) {
 	/* If the interrupt is already assigned, it must match */
 	irq = s->irq.AssignedIRQ;
 	if (req->IRQInfo1 & IRQ_INFO2_VALID) {
-	    u_int mask = req->IRQInfo2 & s->cap.irq_mask;
+	    u_int mask = req->IRQInfo2 & s->irq_mask;
 	    ret = ((mask >> irq) & 1) ? 0 : CS_BAD_ARGS;
 	} else
 	    ret = ((req->IRQInfo1&IRQ_MASK) == irq) ? 0 : CS_BAD_ARGS;
     } else {
 	ret = CS_IN_USE;
 	if (req->IRQInfo1 & IRQ_INFO2_VALID) {
-	    u_int try, mask = req->IRQInfo2 & s->cap.irq_mask;
+	    u_int try, mask = req->IRQInfo2 & s->irq_mask;
 	    for (try = 0; try < 2; try++) {
 		for (irq = 0; irq < 32; irq++)
 		    if ((mask >> irq) & 1) {
@@ -1967,7 +1966,7 @@
 	if (request_irq(irq, req->Handler,
 			    ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || 
 			     (s->functions > 1) ||
-			     (irq == s->cap.pci_irq)) ? SA_SHIRQ : 0,
+			     (irq == s->pci_irq)) ? SA_SHIRQ : 0,
 			    handle->dev_info, req->Instance))
 	    return CS_IN_USE;
     }
@@ -2005,13 +2004,13 @@
 
     /* Window size defaults to smallest available */
     if (req->Size == 0)
-	req->Size = s->cap.map_size;
-    align = (((s->cap.features & SS_CAP_MEM_ALIGN) ||
+	req->Size = s->map_size;
+    align = (((s->features & SS_CAP_MEM_ALIGN) ||
 	      (req->Attributes & WIN_STRICT_ALIGN)) ?
-	     req->Size : s->cap.map_size);
-    if (req->Size & (s->cap.map_size-1))
+	     req->Size : s->map_size);
+    if (req->Size & (s->map_size-1))
 	return CS_BAD_SIZE;
-    if ((req->Base && (s->cap.features & SS_CAP_STATIC_MAP)) ||
+    if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
 	(req->Base & (align-1)))
 	return CS_BAD_BASE;
     if (req->Base)
@@ -2031,10 +2030,10 @@
     win->base = req->Base;
     win->size = req->Size;
 
-    if (!(s->cap.features & SS_CAP_STATIC_MAP) &&
+    if (!(s->features & SS_CAP_STATIC_MAP) &&
 	find_mem_region(&win->base, win->size, align,
 			(req->Attributes & WIN_MAP_BELOW_1MB) ||
-			!(s->cap.features & SS_CAP_PAGE_REGS),
+			!(s->features & SS_CAP_PAGE_REGS),
 			(*handle)->dev_info, s))
 	return CS_IN_USE;
     (*handle)->state |= CLIENT_WIN_REQ(w);
diff -ruN linux-original/drivers/pcmcia/i82092.c linux/drivers/pcmcia/i82092.c
--- linux-original/drivers/pcmcia/i82092.c	2003-06-12 18:09:48.000000000 +0200
+++ linux/drivers/pcmcia/i82092.c	2003-06-12 18:19:37.000000000 +0200
@@ -68,7 +68,6 @@
 	.init 		 	= i82092aa_init,
 	.suspend	   	= i82092aa_suspend,
 	.register_callback 	= i82092aa_register_callback,
-	.inquire_socket		= i82092aa_inquire_socket,   
 	.get_status		= i82092aa_get_status,
 	.get_socket		= i82092aa_get_socket,
 	.set_socket		= i82092aa_set_socket,
@@ -85,7 +84,6 @@
 				    2 = card but not initialized,
 				    3 = operational card */
 	int 	io_base; 	/* base io address of the socket */
-	socket_cap_t cap;
 	
 	unsigned int pending_events; /* Pending events on this interface */
 	
@@ -140,10 +138,10 @@
 	for (i = 0;i<socket_count;i++) {
 		sockets[i].card_state = 1; /* 1 = present but empty */
 		sockets[i].io_base = pci_resource_start(dev, 0);
-		sockets[i].cap.features |= SS_CAP_PCCARD;
-		sockets[i].cap.map_size = 0x1000;
-		sockets[i].cap.irq_mask = 0;
-		sockets[i].cap.pci_irq  = dev->irq;
+		sockets[i].socket.features |= SS_CAP_PCCARD;
+		sockets[i].socket.map_size = 0x1000;
+		sockets[i].socket.irq_mask = 0;
+		sockets[i].socket.pci_irq  = dev->irq;
 
 		sockets[i].number = i;
 		
@@ -487,16 +485,6 @@
 	return 0;
 } /* i82092aa_register_callback */
                                         
-static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap)
-{
-	unsigned int sock = container_of(socket, struct socket_info, socket)->number;
-	enter("i82092aa_inquire_socket");
-	*cap = sockets[sock].cap;
-	leave("i82092aa_inquire_socket");
-	return 0;
-} /* i82092aa_inquire_socket */
-
-
 static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
 {
 	unsigned int sock = container_of(socket, struct socket_info, socket)->number;
diff -ruN linux-original/drivers/pcmcia/i82092aa.h linux/drivers/pcmcia/i82092aa.h
--- linux-original/drivers/pcmcia/i82092aa.h	2003-06-12 18:09:48.000000000 +0200
+++ linux/drivers/pcmcia/i82092aa.h	2003-06-12 18:19:49.000000000 +0200
@@ -36,7 +36,6 @@
 static int i82092aa_init(struct pcmcia_socket *socket);
 static int i82092aa_suspend(struct pcmcia_socket *socket);
 static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info);
-static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap);
 
 #endif
 
diff -ruN linux-original/drivers/pcmcia/i82365.c linux/drivers/pcmcia/i82365.c
--- linux-original/drivers/pcmcia/i82365.c	2003-06-12 18:09:48.000000000 +0200
+++ linux/drivers/pcmcia/i82365.c	2003-06-12 18:19:37.000000000 +0200
@@ -161,7 +161,6 @@
     u_short		type, flags;
     struct pcmcia_socket	socket;
     unsigned int	number;
-    socket_cap_t	cap;
     ioaddr_t		ioaddr;
     u_short		psock;
     u_char		cs_irq, intr;
@@ -758,9 +757,9 @@
     
     /* Update socket interrupt information, capabilities */
     for (i = 0; i < ns; i++) {
-	t[i].cap.features |= SS_CAP_PCCARD;
-	t[i].cap.map_size = 0x1000;
-	t[i].cap.irq_mask = mask;
+	t[i].socket.features |= SS_CAP_PCCARD;
+	t[i].socket.map_size = 0x1000;
+	t[i].socket.irq_mask = mask;
 	t[i].cs_irq = isa_irq;
     }
 
@@ -907,7 +906,7 @@
 	active = 0;
 	for (i = 0; i < sockets; i++) {
 	    if ((socket[i].cs_irq != irq) &&
-		(socket[i].cap.pci_irq != irq))
+		(socket[i].socket.pci_irq != irq))
 		continue;
 	    handled = 1;
 	    ISA_LOCK(i, flags);
@@ -979,15 +978,6 @@
 
 /*====================================================================*/
 
-static int pcic_inquire_socket(struct pcmcia_socket *s, socket_cap_t *cap)
-{
-    unsigned int sock = container_of(s, struct i82365_socket, socket)->number;
-    *cap = socket[sock].cap;
-    return 0;
-} /* pcic_inquire_socket */
-
-/*====================================================================*/
-
 static int i365_get_status(u_short sock, u_int *value)
 {
     u_int status;
@@ -1109,7 +1099,7 @@
     
     /* IO card, RESET flag, IO interrupt */
     reg = t->intr;
-    if (state->io_irq != t->cap.pci_irq) reg |= state->io_irq;
+    if (state->io_irq != t->socket.pci_irq) reg |= state->io_irq;
     reg |= (state->flags & SS_RESET) ? 0 : I365_PC_RESET;
     reg |= (state->flags & SS_IOCARD) ? I365_PC_IOCARD : 0;
     i365_set(sock, I365_INTCTL, reg);
@@ -1414,7 +1404,6 @@
 	.init			= pcic_init,
 	.suspend		= pcic_suspend,
 	.register_callback	= pcic_register_callback,
-	.inquire_socket		= pcic_inquire_socket,
 	.get_status		= pcic_get_status,
 	.get_socket		= pcic_get_socket,
 	.set_socket		= pcic_set_socket,
diff -ruN linux-original/drivers/pcmcia/rsrc_mgr.c linux/drivers/pcmcia/rsrc_mgr.c
--- linux-original/drivers/pcmcia/rsrc_mgr.c	2003-06-12 18:09:48.000000000 +0200
+++ linux/drivers/pcmcia/rsrc_mgr.c	2003-06-12 18:19:37.000000000 +0200
@@ -345,17 +345,17 @@
     cisinfo_t info1, info2;
     int ret;
     s->cis_mem.sys_start = base;
-    s->cis_mem.sys_stop = base+s->cap.map_size-1;
-    s->cis_virt = ioremap(base, s->cap.map_size);
+    s->cis_mem.sys_stop = base+s->map_size-1;
+    s->cis_virt = ioremap(base, s->map_size);
     ret = pcmcia_validate_cis(s->clients, &info1);
     /* invalidate mapping and CIS cache */
     iounmap(s->cis_virt);
     destroy_cis_cache(s);
     if ((ret != 0) || (info1.Chains == 0))
 	return 0;
-    s->cis_mem.sys_start = base+s->cap.map_size;
-    s->cis_mem.sys_stop = base+2*s->cap.map_size-1;
-    s->cis_virt = ioremap(base+s->cap.map_size, s->cap.map_size);
+    s->cis_mem.sys_start = base+s->map_size;
+    s->cis_mem.sys_stop = base+2*s->map_size-1;
+    s->cis_virt = ioremap(base+s->map_size, s->map_size);
     ret = pcmcia_validate_cis(s->clients, &info2);
     iounmap(s->cis_virt);
     destroy_cis_cache(s);
@@ -367,14 +367,14 @@
 {
     int i, a, b, d;
     s->cis_mem.sys_start = base;
-    s->cis_mem.sys_stop = base+s->cap.map_size-1;
-    s->cis_virt = ioremap(base, s->cap.map_size);
+    s->cis_mem.sys_stop = base+s->map_size-1;
+    s->cis_virt = ioremap(base, s->map_size);
     s->cis_mem.card_start = 0;
     s->cis_mem.flags = MAP_ACTIVE;
     s->ss_entry->set_mem_map(s, &s->cis_mem);
     /* Don't bother checking every word... */
     a = 0; b = -1;
-    for (i = 0; i < s->cap.map_size; i += 44) {
+    for (i = 0; i < s->map_size; i += 44) {
 	d = readl(s->cis_virt+i);
 	a += d; b &= d;
     }
@@ -384,7 +384,7 @@
 
 static int checksum_match(struct pcmcia_socket *s, u_long base)
 {
-    int a = checksum(s, base), b = checksum(s, base+s->cap.map_size);
+    int a = checksum(s, base), b = checksum(s, base+s->map_size);
     return ((a == b) && (a >= 0));
 }
 
@@ -405,19 +405,19 @@
     bad = fail = 0;
     step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff);
     /* cis_readable wants to map 2x map_size */
-    if (step < 2 * s->cap.map_size)
-	step = 2 * s->cap.map_size;
+    if (step < 2 * s->map_size)
+	step = 2 * s->map_size;
     for (i = j = base; i < base+num; i = j + step) {
 	if (!fail) {	
 	    for (j = i; j < base+num; j += step)
-		if ((check_mem_resource(j, step, s->cap.cb_dev) == 0) &&
+		if ((check_mem_resource(j, step, s->cb_dev) == 0) &&
 		    cis_readable(s, j))
 		    break;
 	    fail = ((i == base) && (j == base+num));
 	}
 	if (fail) {
 	    for (j = i; j < base+num; j += 2*step)
-		if ((check_mem_resource(j, 2*step, s->cap.cb_dev) == 0) &&
+		if ((check_mem_resource(j, 2*step, s->cb_dev) == 0) &&
 		    checksum_match(s, j) && checksum_match(s, j + step))
 		    break;
 	}
@@ -456,7 +456,7 @@
     static u_char order[] = { 0xd0, 0xe0, 0xc0, 0xf0 };
     static int hi = 0, lo = 0;
     u_long b, i, ok = 0;
-    int force_low = !(s->cap.features & SS_CAP_PAGE_REGS);
+    int force_low = !(s->features & SS_CAP_PAGE_REGS);
 
     if (!probe_mem)
 	return;
@@ -540,7 +540,7 @@
 	for (try = (try >= m->base) ? try : try+align;
 	     (try >= m->base) && (try+num <= m->base+m->num);
 	     try += align) {
-	    if (request_io_resource(try, num, name, s->cap.cb_dev) == 0) {
+	    if (request_io_resource(try, num, name, s->cb_dev) == 0) {
 		*base = try;
 		ret = 0;
 		goto out;
@@ -572,7 +572,7 @@
 	    for (try = (try >= m->base) ? try : try+align;
 		 (try >= m->base) && (try+num <= m->base+m->num);
 		 try += align) {
-		if (request_mem_resource(try, num, name, s->cap.cb_dev) == 0) {
+		if (request_mem_resource(try, num, name, s->cb_dev) == 0) {
 		    *base = try;
 		    ret = 0;
 		    goto out;
diff -ruN linux-original/drivers/pcmcia/tcic.c linux/drivers/pcmcia/tcic.c
--- linux-original/drivers/pcmcia/tcic.c	2003-06-12 18:09:48.000000000 +0200
+++ linux/drivers/pcmcia/tcic.c	2003-06-12 18:19:37.000000000 +0200
@@ -129,14 +129,6 @@
 static int sockets;
 static struct tcic_socket socket_table[2];
 
-static socket_cap_t tcic_cap = {
-	/* only 16-bit cards, memory windows must be size-aligned */
-	.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN,
-	.irq_mask = 0x4cf8,		/* irq 14, 11, 10, 7, 6, 5, 4, 3 */
-	.map_size = 0x1000,		/* 4K minimum window size */
-	/* No PCI or CardBus support */
-};
-
 /*====================================================================*/
 
 /* Trick when selecting interrupts: the TCIC sktirq pin is supposed
@@ -444,6 +436,14 @@
 	socket_table[sockets].handler = NULL;
 	socket_table[sockets].info = NULL;
 	socket_table[sockets].id = get_tcic_id();
+
+	/* only 16-bit cards, memory windows must be size-aligned */
+	/* No PCI or CardBus support */
+	socket_table[sockets].socket.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN;
+	/* irq 14, 11, 10, 7, 6, 5, 4, 3 */
+	socket_table[sockets].socket.irq_mask = 0x4cf8;
+	/* 4K minimum window size */
+	socket_table[sockets].socket.map_size = 0x1000;		
 	sockets++;
     }
 
@@ -478,11 +478,13 @@
     else
 	for (i = mask = 0; i < 16; i++)
 	    mask |= (1<<irq_list[i]);
-    mask &= tcic_cap.irq_mask;
 
+    /* irq 14, 11, 10, 7, 6, 5, 4, 3 */
+    mask &= 0x4cf8;
     /* Scan interrupts */
     mask = irq_scan(mask);
-    tcic_cap.irq_mask = mask;
+    for (i=0;i<sockets;i++)
+	    socket_table[i].socket.irq_mask = mask;
     
     /* Check for only two interrupts available */
     scan = (mask & (mask-1));
@@ -501,7 +503,7 @@
 	if (cs_irq == 0) poll_interval = HZ;
     }
     
-    if (tcic_cap.irq_mask & (1 << 11))
+    if (socket_table[0].socket.irq_mask & (1 << 11))
 	printk("sktirq is irq 11, ");
     if (cs_irq != 0)
 	printk("status change on irq %d\n", cs_irq);
@@ -679,14 +681,6 @@
   
 /*====================================================================*/
 
-static int tcic_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
-{
-    *cap = tcic_cap;
-    return 0;
-} /* tcic_inquire_socket */
-
-/*====================================================================*/
-
 static int tcic_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
 {
     u_short psock = container_of(sock, struct tcic_socket, socket)->psock;
@@ -925,7 +919,6 @@
 	.init		   = tcic_init,
 	.suspend	   = tcic_suspend,
 	.register_callback = tcic_register_callback,
-	.inquire_socket	   = tcic_inquire_socket,
 	.get_status	   = tcic_get_status,
 	.get_socket	   = tcic_get_socket,
 	.set_socket	   = tcic_set_socket,
diff -ruN linux-original/drivers/pcmcia/yenta.c linux/drivers/pcmcia/yenta.c
--- linux-original/drivers/pcmcia/yenta.c	2003-06-12 18:09:48.000000000 +0200
+++ linux/drivers/pcmcia/yenta.c	2003-06-12 18:19:37.000000000 +0200
@@ -515,22 +515,13 @@
  */
 static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
 {
-	socket->cap.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD | SS_CAP_CARDBUS;
-	socket->cap.map_size = 0x1000;
-	socket->cap.pci_irq = socket->cb_irq;
-	socket->cap.irq_mask = yenta_probe_irq(socket, isa_irq_mask);
-	socket->cap.cb_dev = socket->dev;
+	socket->socket.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD | SS_CAP_CARDBUS;
+	socket->socket.map_size = 0x1000;
+	socket->socket.pci_irq = socket->cb_irq;
+	socket->socket.irq_mask = yenta_probe_irq(socket, isa_irq_mask);
+	socket->socket.cb_dev = socket->dev;
 
-	printk("Yenta IRQ list %04x, PCI irq%d\n", socket->cap.irq_mask, socket->cb_irq);
-}
-
-static int yenta_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
-{
-	struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
-
-	*cap = socket->cap;
-
-	return 0;
+	printk("Yenta IRQ list %04x, PCI irq%d\n", socket->socket.irq_mask, socket->cb_irq);
 }
 
 
@@ -793,7 +784,6 @@
 	.init			= yenta_init,
 	.suspend		= yenta_suspend,
 	.register_callback	= yenta_register_callback,
-	.inquire_socket		= yenta_inquire_socket,
 	.get_status		= yenta_get_status,
 	.get_socket		= yenta_get_socket,
 	.set_socket		= yenta_set_socket,
diff -ruN linux-original/drivers/pcmcia/yenta.h linux/drivers/pcmcia/yenta.h
--- linux-original/drivers/pcmcia/yenta.h	2003-06-12 16:01:34.000000000 +0200
+++ linux/drivers/pcmcia/yenta.h	2003-06-12 18:19:37.000000000 +0200
@@ -101,7 +101,6 @@
 	void *base;
 	void (*handler)(void *, unsigned int);
 	void *info;
-	socket_cap_t cap;
 	spinlock_t event_lock;
 	unsigned int events;
 	struct work_struct tq_task;
diff -ruN linux-original/include/pcmcia/ss.h linux/include/pcmcia/ss.h
--- linux-original/include/pcmcia/ss.h	2003-06-12 18:09:48.000000000 +0200
+++ linux/include/pcmcia/ss.h	2003-06-12 18:19:37.000000000 +0200
@@ -52,16 +52,6 @@
 #define SS_XVCARD	0x2000
 #define SS_PENDING	0x4000
 
-/* for InquireSocket */
-typedef struct socket_cap_t {
-    u_int	features;
-    u_int	irq_mask;
-    u_int	map_size;
-    ioaddr_t	io_offset;
-    u_char	pci_irq;
-    struct pci_dev *cb_dev;
-} socket_cap_t;
-
 /* InquireSocket capabilities */
 #define SS_CAP_PAGE_REGS	0x0001
 #define SS_CAP_VIRTUAL_BUS	0x0002
@@ -133,7 +123,6 @@
 	int (*init)(struct pcmcia_socket *sock);
 	int (*suspend)(struct pcmcia_socket *sock);
 	int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
-	int (*inquire_socket)(struct pcmcia_socket *sock, socket_cap_t *cap);
 	int (*get_status)(struct pcmcia_socket *sock, u_int *value);
 	int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
 	int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
@@ -183,7 +172,6 @@
 	spinlock_t			lock;
 	struct pccard_operations *	ss_entry;
 	socket_state_t			socket;
-	socket_cap_t			cap;
 	u_int				state;
 	u_short				functions;
 	u_short				lock_count;
@@ -209,6 +197,15 @@
  	/* deprecated */
 	unsigned int			sock;		/* socket number */
 
+
+	/* socket capabilities */
+	u_int				features;
+	u_int				irq_mask;
+	u_int				map_size;
+	ioaddr_t			io_offset;
+	u_char				pci_irq;
+	struct pci_dev *		cb_dev;
+
 	/* state thread */
 	struct semaphore		skt_sem;	/* protects socket h/w state */
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-pcmcia/attachments/20030612/58de94db/attachment.bin


More information about the linux-pcmcia mailing list