aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-14 15:33:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-14 15:33:02 -0500
commitfb1beb29b5c531b12485d7c32174a77120590481 (patch)
treecb7d1d9733d351ae0ec7acda4851b27acd10abca /drivers
parent478e4e9d7a618379676b17e64583ff3622f2fec5 (diff)
parent9fea84f46a821aa1ff2d034ffda8ad33bff48015 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: pcmcia: CodingStyle fixes pcmcia: remove unused IRQ_FIRST_SHARED
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c3
-rw-r--r--drivers/isdn/hisax/avma1_cs.c3
-rw-r--r--drivers/isdn/hisax/elsa_cs.c2
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c2
-rw-r--r--drivers/isdn/hisax/teles_cs.c2
-rw-r--r--drivers/net/pcmcia/axnet_cs.c2
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/pcmcia/Kconfig6
-rw-r--r--drivers/pcmcia/cardbus.c23
-rw-r--r--drivers/pcmcia/cistpl.c181
-rw-r--r--drivers/pcmcia/cs.c12
-rw-r--r--drivers/pcmcia/ds.c66
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c45
-rw-r--r--drivers/pcmcia/pcmcia_resource.c37
-rw-r--r--drivers/pcmcia/rsrc_mgr.c14
-rw-r--r--drivers/pcmcia/rsrc_nonstatic.c315
-rw-r--r--drivers/pcmcia/socket_sysfs.c6
-rw-r--r--drivers/pcmcia/yenta_socket.c147
21 files changed, 485 insertions, 389 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 5a6ae646a636..94b796d84053 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -108,8 +108,7 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
108 p_dev->io.NumPorts2 = 0; 108 p_dev->io.NumPorts2 = 0;
109 109
110 /* Interrupt setup */ 110 /* Interrupt setup */
111 p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 111 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
112 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
113 112
114 /* General socket configuration */ 113 /* General socket configuration */
115 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 114 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index f9bdff39cf4a..e5deb15cf40c 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -120,8 +120,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev)
120 p_dev->io.IOAddrLines = 5; 120 p_dev->io.IOAddrLines = 5;
121 121
122 /* Interrupt setup */ 122 /* Interrupt setup */
123 p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 123 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
124 p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED;
125 124
126 /* General socket configuration */ 125 /* General socket configuration */
127 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 126 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index a2f709f53974..c9a30b1c9237 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -137,7 +137,7 @@ static int elsa_cs_probe(struct pcmcia_device *link)
137 local->cardnr = -1; 137 local->cardnr = -1;
138 138
139 /* Interrupt setup */ 139 /* Interrupt setup */
140 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 140 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
141 link->irq.Handler = NULL; 141 link->irq.Handler = NULL;
142 142
143 /* 143 /*
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index af5d393cc2d0..7836ec3c7f86 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -144,7 +144,7 @@ static int sedlbauer_probe(struct pcmcia_device *link)
144 link->priv = local; 144 link->priv = local;
145 145
146 /* Interrupt setup */ 146 /* Interrupt setup */
147 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 147 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
148 link->irq.Handler = NULL; 148 link->irq.Handler = NULL;
149 149
150 /* 150 /*
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index ea705394ce2b..b0c5976cbdb3 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -127,7 +127,7 @@ static int teles_probe(struct pcmcia_device *link)
127 link->priv = local; 127 link->priv = local;
128 128
129 /* Interrupt setup */ 129 /* Interrupt setup */
130 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 130 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
131 link->irq.Handler = NULL; 131 link->irq.Handler = NULL;
132 132
133 /* 133 /*
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 81bafd578478..d431b59e7d11 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -270,7 +270,7 @@ static int try_io_port(struct pcmcia_device *link)
270 /* for master/slave multifunction cards */ 270 /* for master/slave multifunction cards */
271 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 271 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
272 link->irq.Attributes = 272 link->irq.Attributes =
273 IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 273 IRQ_TYPE_DYNAMIC_SHARING;
274 } 274 }
275 } else { 275 } else {
276 /* This should be two 16-port windows */ 276 /* This should be two 16-port windows */
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 8ad8384fc1c0..813aca3fc433 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -426,7 +426,7 @@ static int fmvj18x_config(struct pcmcia_device *link)
426 426
427 if (link->io.NumPorts2 != 0) { 427 if (link->io.NumPorts2 != 0) {
428 link->irq.Attributes = 428 link->irq.Attributes =
429 IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 429 IRQ_TYPE_DYNAMIC_SHARING;
430 ret = mfc_try_io_port(link); 430 ret = mfc_try_io_port(link);
431 if (ret != 0) goto failed; 431 if (ret != 0) goto failed;
432 } else if (cardtype == UNGERMANN) { 432 } else if (cardtype == UNGERMANN) {
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 2d26b6ca28b9..92ed3fbf89a5 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -490,7 +490,7 @@ static int try_io_port(struct pcmcia_device *link)
490 /* for master/slave multifunction cards */ 490 /* for master/slave multifunction cards */
491 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 491 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
492 link->irq.Attributes = 492 link->irq.Attributes =
493 IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 493 IRQ_TYPE_DYNAMIC_SHARING;
494 } 494 }
495 } else { 495 } else {
496 /* This should be two 16-port windows */ 496 /* This should be two 16-port windows */
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index cc4853bc0253..6dd486d2977b 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -454,7 +454,7 @@ static int mhz_mfc_config(struct pcmcia_device *link)
454 link->conf.Attributes |= CONF_ENABLE_SPKR; 454 link->conf.Attributes |= CONF_ENABLE_SPKR;
455 link->conf.Status = CCSR_AUDIO_ENA; 455 link->conf.Status = CCSR_AUDIO_ENA;
456 link->irq.Attributes = 456 link->irq.Attributes =
457 IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; 457 IRQ_TYPE_DYNAMIC_SHARING;
458 link->io.IOAddrLines = 16; 458 link->io.IOAddrLines = 16;
459 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 459 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
460 link->io.NumPorts2 = 8; 460 link->io.NumPorts2 = 8;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index a2eda28f903e..466fc72698c0 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -841,7 +841,7 @@ xirc2ps_config(struct pcmcia_device * link)
841 link->conf.Attributes |= CONF_ENABLE_SPKR; 841 link->conf.Attributes |= CONF_ENABLE_SPKR;
842 link->conf.Status |= CCSR_AUDIO_ENA; 842 link->conf.Status |= CCSR_AUDIO_ENA;
843 } 843 }
844 link->irq.Attributes |= IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED ; 844 link->irq.Attributes |= IRQ_TYPE_DYNAMIC_SHARING;
845 link->io.NumPorts2 = 8; 845 link->io.NumPorts2 = 8;
846 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 846 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
847 if (local->dingo) { 847 if (local->dingo) {
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 58bee55a3dd3..9f3adbd9f700 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -64,7 +64,7 @@ config PCMCIA_IOCTL
64 If unsure, say Y. 64 If unsure, say Y.
65 65
66config CARDBUS 66config CARDBUS
67 bool "32-bit CardBus support" 67 bool "32-bit CardBus support"
68 depends on PCI 68 depends on PCI
69 default y 69 default y
70 ---help--- 70 ---help---
@@ -87,8 +87,8 @@ config YENTA
87 select PCCARD_NONSTATIC 87 select PCCARD_NONSTATIC
88 ---help--- 88 ---help---
89 This option enables support for CardBus host bridges. Virtually 89 This option enables support for CardBus host bridges. Virtually
90 all modern PCMCIA bridges are CardBus compatible. A "bridge" is 90 all modern PCMCIA bridges are CardBus compatible. A "bridge" is
91 the hardware inside your computer that PCMCIA cards are plugged 91 the hardware inside your computer that PCMCIA cards are plugged
92 into. 92 into.
93 93
94 To compile this driver as modules, choose M here: the 94 To compile this driver as modules, choose M here: the
diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
index a73b040ddbfb..cdf50f3bc2df 100644
--- a/drivers/pcmcia/cardbus.c
+++ b/drivers/pcmcia/cardbus.c
@@ -27,8 +27,8 @@
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/ioport.h> 29#include <linux/ioport.h>
30#include <linux/io.h>
30#include <asm/irq.h> 31#include <asm/irq.h>
31#include <asm/io.h>
32 32
33#include <pcmcia/cs_types.h> 33#include <pcmcia/cs_types.h>
34#include <pcmcia/ss.h> 34#include <pcmcia/ss.h>
@@ -58,7 +58,7 @@
58 image number and an offset within that image. xlate_rom_addr() 58 image number and an offset within that image. xlate_rom_addr()
59 converts an image/offset address to an absolute offset from the 59 converts an image/offset address to an absolute offset from the
60 ROM's base address. 60 ROM's base address.
61 61
62=====================================================================*/ 62=====================================================================*/
63 63
64static u_int xlate_rom_addr(void __iomem *b, u_int addr) 64static u_int xlate_rom_addr(void __iomem *b, u_int addr)
@@ -85,10 +85,10 @@ static u_int xlate_rom_addr(void __iomem *b, u_int addr)
85 These are similar to setup_cis_mem and release_cis_mem for 16-bit 85 These are similar to setup_cis_mem and release_cis_mem for 16-bit
86 cards. The "result" that is used externally is the cb_cis_virt 86 cards. The "result" that is used externally is the cb_cis_virt
87 pointer in the struct pcmcia_socket structure. 87 pointer in the struct pcmcia_socket structure.
88 88
89=====================================================================*/ 89=====================================================================*/
90 90
91static void cb_release_cis_mem(struct pcmcia_socket * s) 91static void cb_release_cis_mem(struct pcmcia_socket *s)
92{ 92{
93 if (s->cb_cis_virt) { 93 if (s->cb_cis_virt) {
94 dev_dbg(&s->dev, "cb_release_cis_mem()\n"); 94 dev_dbg(&s->dev, "cb_release_cis_mem()\n");
@@ -98,7 +98,7 @@ static void cb_release_cis_mem(struct pcmcia_socket * s)
98 } 98 }
99} 99}
100 100
101static int cb_setup_cis_mem(struct pcmcia_socket * s, struct resource *res) 101static int cb_setup_cis_mem(struct pcmcia_socket *s, struct resource *res)
102{ 102{
103 unsigned int start, size; 103 unsigned int start, size;
104 104
@@ -124,10 +124,11 @@ static int cb_setup_cis_mem(struct pcmcia_socket * s, struct resource *res)
124 124
125 This is used by the CIS processing code to read CIS information 125 This is used by the CIS processing code to read CIS information
126 from a CardBus device. 126 from a CardBus device.
127 127
128=====================================================================*/ 128=====================================================================*/
129 129
130int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void *ptr) 130int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len,
131 void *ptr)
131{ 132{
132 struct pci_dev *dev; 133 struct pci_dev *dev;
133 struct resource *res; 134 struct resource *res;
@@ -181,7 +182,7 @@ fail:
181 cb_alloc() and cb_free() allocate and free the kernel data 182 cb_alloc() and cb_free() allocate and free the kernel data
182 structures for a Cardbus device, and handle the lowest level PCI 183 structures for a Cardbus device, and handle the lowest level PCI
183 device setup issues. 184 device setup issues.
184 185
185=====================================================================*/ 186=====================================================================*/
186 187
187static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq) 188static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq)
@@ -214,14 +215,14 @@ static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq)
214 } 215 }
215} 216}
216 217
217int __ref cb_alloc(struct pcmcia_socket * s) 218int __ref cb_alloc(struct pcmcia_socket *s)
218{ 219{
219 struct pci_bus *bus = s->cb_dev->subordinate; 220 struct pci_bus *bus = s->cb_dev->subordinate;
220 struct pci_dev *dev; 221 struct pci_dev *dev;
221 unsigned int max, pass; 222 unsigned int max, pass;
222 223
223 s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); 224 s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0));
224// pcibios_fixup_bus(bus); 225/* pcibios_fixup_bus(bus); */
225 226
226 max = bus->secondary; 227 max = bus->secondary;
227 for (pass = 0; pass < 2; pass++) 228 for (pass = 0; pass < 2; pass++)
@@ -248,7 +249,7 @@ int __ref cb_alloc(struct pcmcia_socket * s)
248 return 0; 249 return 0;
249} 250}
250 251
251void cb_free(struct pcmcia_socket * s) 252void cb_free(struct pcmcia_socket *s)
252{ 253{
253 struct pci_dev *bridge = s->cb_dev; 254 struct pci_dev *bridge = s->cb_dev;
254 255
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 8c1b73cf021b..25b1cd219e37 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -23,7 +23,7 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <asm/io.h> 26#include <linux/io.h>
27#include <asm/byteorder.h> 27#include <asm/byteorder.h>
28#include <asm/unaligned.h> 28#include <asm/unaligned.h>
29 29
@@ -125,7 +125,7 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
125 125
126 Low-level functions to read and write CIS memory. I think the 126 Low-level functions to read and write CIS memory. I think the
127 write routine is only useful for writing one-byte registers. 127 write routine is only useful for writing one-byte registers.
128 128
129======================================================================*/ 129======================================================================*/
130 130
131/* Bits in attr field */ 131/* Bits in attr field */
@@ -137,7 +137,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
137{ 137{
138 void __iomem *sys, *end; 138 void __iomem *sys, *end;
139 unsigned char *buf = ptr; 139 unsigned char *buf = ptr;
140 140
141 dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); 141 dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len);
142 142
143 if (attr & IS_INDIRECT) { 143 if (attr & IS_INDIRECT) {
@@ -203,7 +203,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
203{ 203{
204 void __iomem *sys, *end; 204 void __iomem *sys, *end;
205 unsigned char *buf = ptr; 205 unsigned char *buf = ptr;
206 206
207 dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); 207 dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len);
208 208
209 if (attr & IS_INDIRECT) { 209 if (attr & IS_INDIRECT) {
@@ -262,7 +262,7 @@ EXPORT_SYMBOL(pcmcia_write_cis_mem);
262 This is a wrapper around read_cis_mem, with the same interface, 262 This is a wrapper around read_cis_mem, with the same interface,
263 but which caches information, for cards whose CIS may not be 263 but which caches information, for cards whose CIS may not be
264 readable all the time. 264 readable all the time.
265 265
266======================================================================*/ 266======================================================================*/
267 267
268static void read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr, 268static void read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr,
@@ -342,7 +342,7 @@ EXPORT_SYMBOL(destroy_cis_cache);
342 342
343 This verifies if the CIS of a card matches what is in the CIS 343 This verifies if the CIS of a card matches what is in the CIS
344 cache. 344 cache.
345 345
346======================================================================*/ 346======================================================================*/
347 347
348int verify_cis_cache(struct pcmcia_socket *s) 348int verify_cis_cache(struct pcmcia_socket *s)
@@ -381,7 +381,7 @@ int verify_cis_cache(struct pcmcia_socket *s)
381 381
382 For really bad cards, we provide a facility for uploading a 382 For really bad cards, we provide a facility for uploading a
383 replacement CIS. 383 replacement CIS.
384 384
385======================================================================*/ 385======================================================================*/
386 386
387int pcmcia_replace_cis(struct pcmcia_socket *s, 387int pcmcia_replace_cis(struct pcmcia_socket *s,
@@ -406,7 +406,7 @@ EXPORT_SYMBOL(pcmcia_replace_cis);
406/*====================================================================== 406/*======================================================================
407 407
408 The high-level CIS tuple services 408 The high-level CIS tuple services
409 409
410======================================================================*/ 410======================================================================*/
411 411
412typedef struct tuple_flags { 412typedef struct tuple_flags {
@@ -421,8 +421,6 @@ typedef struct tuple_flags {
421#define MFC_FN(f) (((tuple_flags *)(&(f)))->mfc_fn) 421#define MFC_FN(f) (((tuple_flags *)(&(f)))->mfc_fn)
422#define SPACE(f) (((tuple_flags *)(&(f)))->space) 422#define SPACE(f) (((tuple_flags *)(&(f)))->space)
423 423
424int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple);
425
426int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple) 424int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple)
427{ 425{
428 if (!s) 426 if (!s)
@@ -523,10 +521,11 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
523 ofs++; continue; 521 ofs++; continue;
524 } 522 }
525 } 523 }
526 524
527 /* End of chain? Follow long link if possible */ 525 /* End of chain? Follow long link if possible */
528 if (link[0] == CISTPL_END) { 526 if (link[0] == CISTPL_END) {
529 if ((ofs = follow_link(s, tuple)) < 0) 527 ofs = follow_link(s, tuple);
528 if (ofs < 0)
530 return -ENOSPC; 529 return -ENOSPC;
531 attr = SPACE(tuple->Flags); 530 attr = SPACE(tuple->Flags);
532 read_cis_cache(s, attr, ofs, 2, link); 531 read_cis_cache(s, attr, ofs, 2, link);
@@ -578,7 +577,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
578 } else 577 } else
579 if (tuple->DesiredTuple == RETURN_FIRST_TUPLE) 578 if (tuple->DesiredTuple == RETURN_FIRST_TUPLE)
580 break; 579 break;
581 580
582 if (link[0] == tuple->DesiredTuple) 581 if (link[0] == tuple->DesiredTuple)
583 break; 582 break;
584 ofs += link[1] + 2; 583 ofs += link[1] + 2;
@@ -587,7 +586,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_
587 dev_dbg(&s->dev, "cs: overrun in pcmcia_get_next_tuple\n"); 586 dev_dbg(&s->dev, "cs: overrun in pcmcia_get_next_tuple\n");
588 return -ENOSPC; 587 return -ENOSPC;
589 } 588 }
590 589
591 tuple->TupleCode = link[0]; 590 tuple->TupleCode = link[0];
592 tuple->TupleLink = link[1]; 591 tuple->TupleLink = link[1];
593 tuple->CISOffset = ofs + 2; 592 tuple->CISOffset = ofs + 2;
@@ -623,7 +622,7 @@ EXPORT_SYMBOL(pccard_get_tuple_data);
623/*====================================================================== 622/*======================================================================
624 623
625 Parsing routines for individual tuples 624 Parsing routines for individual tuples
626 625
627======================================================================*/ 626======================================================================*/
628 627
629static int parse_device(tuple_t *tuple, cistpl_device_t *device) 628static int parse_device(tuple_t *tuple, cistpl_device_t *device)
@@ -637,26 +636,37 @@ static int parse_device(tuple_t *tuple, cistpl_device_t *device)
637 636
638 device->ndev = 0; 637 device->ndev = 0;
639 for (i = 0; i < CISTPL_MAX_DEVICES; i++) { 638 for (i = 0; i < CISTPL_MAX_DEVICES; i++) {
640 639
641 if (*p == 0xff) break; 640 if (*p == 0xff)
641 break;
642 device->dev[i].type = (*p >> 4); 642 device->dev[i].type = (*p >> 4);
643 device->dev[i].wp = (*p & 0x08) ? 1 : 0; 643 device->dev[i].wp = (*p & 0x08) ? 1 : 0;
644 switch (*p & 0x07) { 644 switch (*p & 0x07) {
645 case 0: device->dev[i].speed = 0; break; 645 case 0:
646 case 1: device->dev[i].speed = 250; break; 646 device->dev[i].speed = 0;
647 case 2: device->dev[i].speed = 200; break; 647 break;
648 case 3: device->dev[i].speed = 150; break; 648 case 1:
649 case 4: device->dev[i].speed = 100; break; 649 device->dev[i].speed = 250;
650 break;
651 case 2:
652 device->dev[i].speed = 200;
653 break;
654 case 3:
655 device->dev[i].speed = 150;
656 break;
657 case 4:
658 device->dev[i].speed = 100;
659 break;
650 case 7: 660 case 7:
651 if (++p == q)
652 return -EINVAL;
653 device->dev[i].speed = SPEED_CVT(*p);
654 while (*p & 0x80)
655 if (++p == q) 661 if (++p == q)
656 return -EINVAL; 662 return -EINVAL;
657 break; 663 device->dev[i].speed = SPEED_CVT(*p);
664 while (*p & 0x80)
665 if (++p == q)
666 return -EINVAL;
667 break;
658 default: 668 default:
659 return -EINVAL; 669 return -EINVAL;
660 } 670 }
661 671
662 if (++p == q) 672 if (++p == q)
@@ -671,7 +681,7 @@ static int parse_device(tuple_t *tuple, cistpl_device_t *device)
671 if (++p == q) 681 if (++p == q)
672 break; 682 break;
673 } 683 }
674 684
675 return 0; 685 return 0;
676} 686}
677 687
@@ -706,9 +716,9 @@ static int parse_longlink_mfc(tuple_t *tuple,
706{ 716{
707 u_char *p; 717 u_char *p;
708 int i; 718 int i;
709 719
710 p = (u_char *)tuple->TupleData; 720 p = (u_char *)tuple->TupleData;
711 721
712 link->nfn = *p; p++; 722 link->nfn = *p; p++;
713 if (tuple->TupleDataLen <= link->nfn*5) 723 if (tuple->TupleDataLen <= link->nfn*5)
714 return -EINVAL; 724 return -EINVAL;
@@ -737,11 +747,13 @@ static int parse_strings(u_char *p, u_char *q, int max,
737 ns++; 747 ns++;
738 for (;;) { 748 for (;;) {
739 s[j++] = (*p == 0xff) ? '\0' : *p; 749 s[j++] = (*p == 0xff) ? '\0' : *p;
740 if ((*p == '\0') || (*p == 0xff)) break; 750 if ((*p == '\0') || (*p == 0xff))
751 break;
741 if (++p == q) 752 if (++p == q)
742 return -EINVAL; 753 return -EINVAL;
743 } 754 }
744 if ((*p == 0xff) || (++p == q)) break; 755 if ((*p == 0xff) || (++p == q))
756 break;
745 } 757 }
746 if (found) { 758 if (found) {
747 *found = ns; 759 *found = ns;
@@ -756,10 +768,10 @@ static int parse_strings(u_char *p, u_char *q, int max,
756static int parse_vers_1(tuple_t *tuple, cistpl_vers_1_t *vers_1) 768static int parse_vers_1(tuple_t *tuple, cistpl_vers_1_t *vers_1)
757{ 769{
758 u_char *p, *q; 770 u_char *p, *q;
759 771
760 p = (u_char *)tuple->TupleData; 772 p = (u_char *)tuple->TupleData;
761 q = p + tuple->TupleDataLen; 773 q = p + tuple->TupleDataLen;
762 774
763 vers_1->major = *p; p++; 775 vers_1->major = *p; p++;
764 vers_1->minor = *p; p++; 776 vers_1->minor = *p; p++;
765 if (p >= q) 777 if (p >= q)
@@ -774,10 +786,10 @@ static int parse_vers_1(tuple_t *tuple, cistpl_vers_1_t *vers_1)
774static int parse_altstr(tuple_t *tuple, cistpl_altstr_t *altstr) 786static int parse_altstr(tuple_t *tuple, cistpl_altstr_t *altstr)
775{ 787{
776 u_char *p, *q; 788 u_char *p, *q;
777 789
778 p = (u_char *)tuple->TupleData; 790 p = (u_char *)tuple->TupleData;
779 q = p + tuple->TupleDataLen; 791 q = p + tuple->TupleDataLen;
780 792
781 return parse_strings(p, q, CISTPL_MAX_ALTSTR_STRINGS, 793 return parse_strings(p, q, CISTPL_MAX_ALTSTR_STRINGS,
782 altstr->str, altstr->ofs, &altstr->ns); 794 altstr->str, altstr->ofs, &altstr->ns);
783} 795}
@@ -793,7 +805,8 @@ static int parse_jedec(tuple_t *tuple, cistpl_jedec_t *jedec)
793 q = p + tuple->TupleDataLen; 805 q = p + tuple->TupleDataLen;
794 806
795 for (nid = 0; nid < CISTPL_MAX_DEVICES; nid++) { 807 for (nid = 0; nid < CISTPL_MAX_DEVICES; nid++) {
796 if (p > q-2) break; 808 if (p > q-2)
809 break;
797 jedec->id[nid].mfr = p[0]; 810 jedec->id[nid].mfr = p[0];
798 jedec->id[nid].info = p[1]; 811 jedec->id[nid].info = p[1];
799 p += 2; 812 p += 2;
@@ -871,7 +884,7 @@ static int parse_config(tuple_t *tuple, cistpl_config_t *config)
871 884
872 The following routines are all used to parse the nightmarish 885 The following routines are all used to parse the nightmarish
873 config table entries. 886 config table entries.
874 887
875======================================================================*/ 888======================================================================*/
876 889
877static u_char *parse_power(u_char *p, u_char *q, 890static u_char *parse_power(u_char *p, u_char *q,
@@ -880,17 +893,20 @@ static u_char *parse_power(u_char *p, u_char *q,
880 int i; 893 int i;
881 u_int scale; 894 u_int scale;
882 895
883 if (p == q) return NULL; 896 if (p == q)
897 return NULL;
884 pwr->present = *p; 898 pwr->present = *p;
885 pwr->flags = 0; 899 pwr->flags = 0;
886 p++; 900 p++;
887 for (i = 0; i < 7; i++) 901 for (i = 0; i < 7; i++)
888 if (pwr->present & (1<<i)) { 902 if (pwr->present & (1<<i)) {
889 if (p == q) return NULL; 903 if (p == q)
904 return NULL;
890 pwr->param[i] = POWER_CVT(*p); 905 pwr->param[i] = POWER_CVT(*p);
891 scale = POWER_SCALE(*p); 906 scale = POWER_SCALE(*p);
892 while (*p & 0x80) { 907 while (*p & 0x80) {
893 if (++p == q) return NULL; 908 if (++p == q)
909 return NULL;
894 if ((*p & 0x7f) < 100) 910 if ((*p & 0x7f) < 100)
895 pwr->param[i] += (*p & 0x7f) * scale / 100; 911 pwr->param[i] += (*p & 0x7f) * scale / 100;
896 else if (*p == 0x7d) 912 else if (*p == 0x7d)
@@ -914,24 +930,28 @@ static u_char *parse_timing(u_char *p, u_char *q,
914{ 930{
915 u_char scale; 931 u_char scale;
916 932
917 if (p == q) return NULL; 933 if (p == q)
934 return NULL;
918 scale = *p; 935 scale = *p;
919 if ((scale & 3) != 3) { 936 if ((scale & 3) != 3) {
920 if (++p == q) return NULL; 937 if (++p == q)
938 return NULL;
921 timing->wait = SPEED_CVT(*p); 939 timing->wait = SPEED_CVT(*p);
922 timing->waitscale = exponent[scale & 3]; 940 timing->waitscale = exponent[scale & 3];
923 } else 941 } else
924 timing->wait = 0; 942 timing->wait = 0;
925 scale >>= 2; 943 scale >>= 2;
926 if ((scale & 7) != 7) { 944 if ((scale & 7) != 7) {
927 if (++p == q) return NULL; 945 if (++p == q)
946 return NULL;
928 timing->ready = SPEED_CVT(*p); 947 timing->ready = SPEED_CVT(*p);
929 timing->rdyscale = exponent[scale & 7]; 948 timing->rdyscale = exponent[scale & 7];
930 } else 949 } else
931 timing->ready = 0; 950 timing->ready = 0;
932 scale >>= 3; 951 scale >>= 3;
933 if (scale != 7) { 952 if (scale != 7) {
934 if (++p == q) return NULL; 953 if (++p == q)
954 return NULL;
935 timing->reserved = SPEED_CVT(*p); 955 timing->reserved = SPEED_CVT(*p);
936 timing->rsvscale = exponent[scale]; 956 timing->rsvscale = exponent[scale];
937 } else 957 } else
@@ -946,7 +966,8 @@ static u_char *parse_io(u_char *p, u_char *q, cistpl_io_t *io)
946{ 966{
947 int i, j, bsz, lsz; 967 int i, j, bsz, lsz;
948 968
949 if (p == q) return NULL; 969 if (p == q)
970 return NULL;
950 io->flags = *p; 971 io->flags = *p;
951 972
952 if (!(*p & 0x80)) { 973 if (!(*p & 0x80)) {
@@ -955,24 +976,29 @@ static u_char *parse_io(u_char *p, u_char *q, cistpl_io_t *io)
955 io->win[0].len = (1 << (io->flags & CISTPL_IO_LINES_MASK)); 976 io->win[0].len = (1 << (io->flags & CISTPL_IO_LINES_MASK));
956 return p+1; 977 return p+1;
957 } 978 }
958 979
959 if (++p == q) return NULL; 980 if (++p == q)
981 return NULL;
960 io->nwin = (*p & 0x0f) + 1; 982 io->nwin = (*p & 0x0f) + 1;
961 bsz = (*p & 0x30) >> 4; 983 bsz = (*p & 0x30) >> 4;
962 if (bsz == 3) bsz++; 984 if (bsz == 3)
985 bsz++;
963 lsz = (*p & 0xc0) >> 6; 986 lsz = (*p & 0xc0) >> 6;
964 if (lsz == 3) lsz++; 987 if (lsz == 3)
988 lsz++;
965 p++; 989 p++;
966 990
967 for (i = 0; i < io->nwin; i++) { 991 for (i = 0; i < io->nwin; i++) {
968 io->win[i].base = 0; 992 io->win[i].base = 0;
969 io->win[i].len = 1; 993 io->win[i].len = 1;
970 for (j = 0; j < bsz; j++, p++) { 994 for (j = 0; j < bsz; j++, p++) {
971 if (p == q) return NULL; 995 if (p == q)
996 return NULL;
972 io->win[i].base += *p << (j*8); 997 io->win[i].base += *p << (j*8);
973 } 998 }
974 for (j = 0; j < lsz; j++, p++) { 999 for (j = 0; j < lsz; j++, p++) {
975 if (p == q) return NULL; 1000 if (p == q)
1001 return NULL;
976 io->win[i].len += *p << (j*8); 1002 io->win[i].len += *p << (j*8);
977 } 1003 }
978 } 1004 }
@@ -986,27 +1012,32 @@ static u_char *parse_mem(u_char *p, u_char *q, cistpl_mem_t *mem)
986 int i, j, asz, lsz, has_ha; 1012 int i, j, asz, lsz, has_ha;
987 u_int len, ca, ha; 1013 u_int len, ca, ha;
988 1014
989 if (p == q) return NULL; 1015 if (p == q)
1016 return NULL;
990 1017
991 mem->nwin = (*p & 0x07) + 1; 1018 mem->nwin = (*p & 0x07) + 1;
992 lsz = (*p & 0x18) >> 3; 1019 lsz = (*p & 0x18) >> 3;
993 asz = (*p & 0x60) >> 5; 1020 asz = (*p & 0x60) >> 5;
994 has_ha = (*p & 0x80); 1021 has_ha = (*p & 0x80);
995 if (++p == q) return NULL; 1022 if (++p == q)
996 1023 return NULL;
1024
997 for (i = 0; i < mem->nwin; i++) { 1025 for (i = 0; i < mem->nwin; i++) {
998 len = ca = ha = 0; 1026 len = ca = ha = 0;
999 for (j = 0; j < lsz; j++, p++) { 1027 for (j = 0; j < lsz; j++, p++) {
1000 if (p == q) return NULL; 1028 if (p == q)
1029 return NULL;
1001 len += *p << (j*8); 1030 len += *p << (j*8);
1002 } 1031 }
1003 for (j = 0; j < asz; j++, p++) { 1032 for (j = 0; j < asz; j++, p++) {
1004 if (p == q) return NULL; 1033 if (p == q)
1034 return NULL;
1005 ca += *p << (j*8); 1035 ca += *p << (j*8);
1006 } 1036 }
1007 if (has_ha) 1037 if (has_ha)
1008 for (j = 0; j < asz; j++, p++) { 1038 for (j = 0; j < asz; j++, p++) {
1009 if (p == q) return NULL; 1039 if (p == q)
1040 return NULL;
1010 ha += *p << (j*8); 1041 ha += *p << (j*8);
1011 } 1042 }
1012 mem->win[i].len = len << 8; 1043 mem->win[i].len = len << 8;
@@ -1095,7 +1126,7 @@ static int parse_cftable_entry(tuple_t *tuple,
1095 entry->timing.ready = 0; 1126 entry->timing.ready = 0;
1096 entry->timing.reserved = 0; 1127 entry->timing.reserved = 0;
1097 } 1128 }
1098 1129
1099 /* I/O window options */ 1130 /* I/O window options */
1100 if (features & 0x08) { 1131 if (features & 0x08) {
1101 p = parse_io(p, q, &entry->io); 1132 p = parse_io(p, q, &entry->io);
@@ -1103,7 +1134,7 @@ static int parse_cftable_entry(tuple_t *tuple,
1103 return -EINVAL; 1134 return -EINVAL;
1104 } else 1135 } else
1105 entry->io.nwin = 0; 1136 entry->io.nwin = 0;
1106 1137
1107 /* Interrupt options */ 1138 /* Interrupt options */
1108 if (features & 0x10) { 1139 if (features & 0x10) {
1109 p = parse_irq(p, q, &entry->irq); 1140 p = parse_irq(p, q, &entry->irq);
@@ -1153,7 +1184,7 @@ static int parse_cftable_entry(tuple_t *tuple,
1153 } 1184 }
1154 1185
1155 entry->subtuples = q-p; 1186 entry->subtuples = q-p;
1156 1187
1157 return 0; 1188 return 0;
1158} 1189}
1159 1190
@@ -1176,7 +1207,7 @@ static int parse_bar(tuple_t *tuple, cistpl_bar_t *bar)
1176static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config) 1207static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config)
1177{ 1208{
1178 u_char *p; 1209 u_char *p;
1179 1210
1180 p = (u_char *)tuple->TupleData; 1211 p = (u_char *)tuple->TupleData;
1181 if ((*p != 3) || (tuple->TupleDataLen < 6)) 1212 if ((*p != 3) || (tuple->TupleDataLen < 6))
1182 return -EINVAL; 1213 return -EINVAL;
@@ -1231,7 +1262,7 @@ static int parse_cftable_entry_cb(tuple_t *tuple,
1231 entry->io = *p; p++; 1262 entry->io = *p; p++;
1232 } else 1263 } else
1233 entry->io = 0; 1264 entry->io = 0;
1234 1265
1235 /* Interrupt options */ 1266 /* Interrupt options */
1236 if (features & 0x10) { 1267 if (features & 0x10) {
1237 p = parse_irq(p, q, &entry->irq); 1268 p = parse_irq(p, q, &entry->irq);
@@ -1264,7 +1295,7 @@ static int parse_cftable_entry_cb(tuple_t *tuple,
1264 } 1295 }
1265 1296
1266 entry->subtuples = q-p; 1297 entry->subtuples = q-p;
1267 1298
1268 return 0; 1299 return 0;
1269} 1300}
1270 1301
@@ -1281,7 +1312,8 @@ static int parse_device_geo(tuple_t *tuple, cistpl_device_geo_t *geo)
1281 q = p + tuple->TupleDataLen; 1312 q = p + tuple->TupleDataLen;
1282 1313
1283 for (n = 0; n < CISTPL_MAX_DEVICES; n++) { 1314 for (n = 0; n < CISTPL_MAX_DEVICES; n++) {
1284 if (p > q-6) break; 1315 if (p > q-6)
1316 break;
1285 geo->geo[n].buswidth = p[0]; 1317 geo->geo[n].buswidth = p[0];
1286 geo->geo[n].erase_block = 1 << (p[1]-1); 1318 geo->geo[n].erase_block = 1 << (p[1]-1);
1287 geo->geo[n].read_block = 1 << (p[2]-1); 1319 geo->geo[n].read_block = 1 << (p[2]-1);
@@ -1302,13 +1334,13 @@ static int parse_vers_2(tuple_t *tuple, cistpl_vers_2_t *v2)
1302 1334
1303 if (tuple->TupleDataLen < 10) 1335 if (tuple->TupleDataLen < 10)
1304 return -EINVAL; 1336 return -EINVAL;
1305 1337
1306 p = tuple->TupleData; 1338 p = tuple->TupleData;
1307 q = p + tuple->TupleDataLen; 1339 q = p + tuple->TupleDataLen;
1308 1340
1309 v2->vers = p[0]; 1341 v2->vers = p[0];
1310 v2->comply = p[1]; 1342 v2->comply = p[1];
1311 v2->dindex = get_unaligned_le16(p +2 ); 1343 v2->dindex = get_unaligned_le16(p + 2);
1312 v2->vspec8 = p[6]; 1344 v2->vspec8 = p[6];
1313 v2->vspec9 = p[7]; 1345 v2->vspec9 = p[7];
1314 v2->nhdr = p[8]; 1346 v2->nhdr = p[8];
@@ -1322,7 +1354,7 @@ static int parse_org(tuple_t *tuple, cistpl_org_t *org)
1322{ 1354{
1323 u_char *p, *q; 1355 u_char *p, *q;
1324 int i; 1356 int i;
1325 1357
1326 p = tuple->TupleData; 1358 p = tuple->TupleData;
1327 q = p + tuple->TupleDataLen; 1359 q = p + tuple->TupleDataLen;
1328 if (p == q) 1360 if (p == q)
@@ -1332,7 +1364,8 @@ static int parse_org(tuple_t *tuple, cistpl_org_t *org)
1332 return -EINVAL; 1364 return -EINVAL;
1333 for (i = 0; i < 30; i++) { 1365 for (i = 0; i < 30; i++) {
1334 org->desc[i] = *p; 1366 org->desc[i] = *p;
1335 if (*p == '\0') break; 1367 if (*p == '\0')
1368 break;
1336 if (++p == q) 1369 if (++p == q)
1337 return -EINVAL; 1370 return -EINVAL;
1338 } 1371 }
@@ -1363,7 +1396,7 @@ static int parse_format(tuple_t *tuple, cistpl_format_t *fmt)
1363int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse) 1396int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse)
1364{ 1397{
1365 int ret = 0; 1398 int ret = 0;
1366 1399
1367 if (tuple->TupleDataLen > tuple->TupleDataMax) 1400 if (tuple->TupleDataLen > tuple->TupleDataMax)
1368 return -EINVAL; 1401 return -EINVAL;
1369 switch (tuple->TupleCode) { 1402 switch (tuple->TupleCode) {
@@ -1448,7 +1481,7 @@ EXPORT_SYMBOL(pcmcia_parse_tuple);
1448/*====================================================================== 1481/*======================================================================
1449 1482
1450 This is used internally by Card Services to look up CIS stuff. 1483 This is used internally by Card Services to look up CIS stuff.
1451 1484
1452======================================================================*/ 1485======================================================================*/
1453 1486
1454int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse) 1487int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse)
@@ -1550,7 +1583,7 @@ EXPORT_SYMBOL(pccard_loop_tuple);
1550 checks include making sure several critical tuples are present and 1583 checks include making sure several critical tuples are present and
1551 valid; seeing if the total number of tuples is reasonable; and 1584 valid; seeing if the total number of tuples is reasonable; and
1552 looking for tuples that use reserved codes. 1585 looking for tuples that use reserved codes.
1553 1586
1554======================================================================*/ 1587======================================================================*/
1555 1588
1556int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info) 1589int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 790af87a922f..6d6f82b38a68 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -135,7 +135,7 @@ int pcmcia_socket_dev_resume(struct device *dev)
135EXPORT_SYMBOL(pcmcia_socket_dev_resume); 135EXPORT_SYMBOL(pcmcia_socket_dev_resume);
136 136
137 137
138struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt) 138struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt)
139{ 139{
140 struct device *dev = get_device(&skt->dev); 140 struct device *dev = get_device(&skt->dev);
141 if (!dev) 141 if (!dev)
@@ -145,7 +145,7 @@ struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt)
145 put_device(&skt->dev); 145 put_device(&skt->dev);
146 return NULL; 146 return NULL;
147 } 147 }
148 return (skt); 148 return skt;
149} 149}
150EXPORT_SYMBOL(pcmcia_get_socket); 150EXPORT_SYMBOL(pcmcia_get_socket);
151 151
@@ -297,7 +297,7 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
297EXPORT_SYMBOL(pcmcia_unregister_socket); 297EXPORT_SYMBOL(pcmcia_unregister_socket);
298 298
299 299
300struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr) 300struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr)
301{ 301{
302 struct pcmcia_socket *s; 302 struct pcmcia_socket *s;
303 303
@@ -736,7 +736,7 @@ EXPORT_SYMBOL(pcmcia_parse_events);
736/* register pcmcia_callback */ 736/* register pcmcia_callback */
737int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c) 737int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
738{ 738{
739 int ret = 0; 739 int ret = 0;
740 740
741 /* s->skt_mutex also protects s->callback */ 741 /* s->skt_mutex also protects s->callback */
742 mutex_lock(&s->skt_mutex); 742 mutex_lock(&s->skt_mutex);
@@ -848,7 +848,7 @@ EXPORT_SYMBOL(pcmcia_suspend_card);
848int pcmcia_resume_card(struct pcmcia_socket *skt) 848int pcmcia_resume_card(struct pcmcia_socket *skt)
849{ 849{
850 int ret; 850 int ret;
851 851
852 dev_dbg(&skt->dev, "waking up socket\n"); 852 dev_dbg(&skt->dev, "waking up socket\n");
853 853
854 mutex_lock(&skt->skt_mutex); 854 mutex_lock(&skt->skt_mutex);
@@ -876,7 +876,7 @@ EXPORT_SYMBOL(pcmcia_resume_card);
876int pcmcia_eject_card(struct pcmcia_socket *skt) 876int pcmcia_eject_card(struct pcmcia_socket *skt)
877{ 877{
878 int ret; 878 int ret;
879 879
880 dev_dbg(&skt->dev, "user eject request\n"); 880 dev_dbg(&skt->dev, "user eject request\n");
881 881
882 mutex_lock(&skt->skt_mutex); 882 mutex_lock(&skt->skt_mutex);
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 05893d41dd41..1a4a3c49cc15 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -57,7 +57,7 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv)
57 "function\n", p_drv->drv.name); 57 "function\n", p_drv->drv.name);
58 58
59 while (did && did->match_flags) { 59 while (did && did->match_flags) {
60 for (i=0; i<4; i++) { 60 for (i = 0; i < 4; i++) {
61 if (!did->prod_id[i]) 61 if (!did->prod_id[i])
62 continue; 62 continue;
63 63
@@ -105,7 +105,7 @@ pcmcia_store_new_id(struct device_driver *driver, const char *buf, size_t count)
105 __u16 match_flags, manf_id, card_id; 105 __u16 match_flags, manf_id, card_id;
106 __u8 func_id, function, device_no; 106 __u8 func_id, function, device_no;
107 __u32 prod_id_hash[4] = {0, 0, 0, 0}; 107 __u32 prod_id_hash[4] = {0, 0, 0, 0};
108 int fields=0; 108 int fields = 0;
109 int retval = 0; 109 int retval = 0;
110 110
111 fields = sscanf(buf, "%hx %hx %hx %hhx %hhx %hhx %x %x %x %x", 111 fields = sscanf(buf, "%hx %hx %hx %hhx %hhx %hhx %x %x %x %x",
@@ -214,7 +214,7 @@ EXPORT_SYMBOL(pcmcia_unregister_driver);
214 214
215/* pcmcia_device handling */ 215/* pcmcia_device handling */
216 216
217struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev) 217struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev)
218{ 218{
219 struct device *tmp_dev; 219 struct device *tmp_dev;
220 tmp_dev = get_device(&p_dev->dev); 220 tmp_dev = get_device(&p_dev->dev);
@@ -258,7 +258,7 @@ static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc)
258 return; 258 return;
259} 259}
260 260
261static int pcmcia_device_probe(struct device * dev) 261static int pcmcia_device_probe(struct device *dev)
262{ 262{
263 struct pcmcia_device *p_dev; 263 struct pcmcia_device *p_dev;
264 struct pcmcia_driver *p_drv; 264 struct pcmcia_driver *p_drv;
@@ -325,7 +325,7 @@ put_module:
325put_dev: 325put_dev:
326 if (ret) 326 if (ret)
327 put_device(dev); 327 put_device(dev);
328 return (ret); 328 return ret;
329} 329}
330 330
331 331
@@ -354,7 +354,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
354 354
355 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 355 spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
356 list_del(&p_dev->socket_device_list); 356 list_del(&p_dev->socket_device_list);
357 p_dev->_removed=1; 357 p_dev->_removed = 1;
358 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 358 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
359 359
360 dev_dbg(&p_dev->dev, "unregistering device\n"); 360 dev_dbg(&p_dev->dev, "unregistering device\n");
@@ -364,7 +364,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le
364 return; 364 return;
365} 365}
366 366
367static int pcmcia_device_remove(struct device * dev) 367static int pcmcia_device_remove(struct device *dev)
368{ 368{
369 struct pcmcia_device *p_dev; 369 struct pcmcia_device *p_dev;
370 struct pcmcia_driver *p_drv; 370 struct pcmcia_driver *p_drv;
@@ -391,7 +391,7 @@ static int pcmcia_device_remove(struct device * dev)
391 return 0; 391 return 0;
392 392
393 if (p_drv->remove) 393 if (p_drv->remove)
394 p_drv->remove(p_dev); 394 p_drv->remove(p_dev);
395 395
396 p_dev->dev_node = NULL; 396 p_dev->dev_node = NULL;
397 397
@@ -499,7 +499,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
499 */ 499 */
500static DEFINE_MUTEX(device_add_lock); 500static DEFINE_MUTEX(device_add_lock);
501 501
502struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) 502struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function)
503{ 503{
504 struct pcmcia_device *p_dev, *tmp_dev; 504 struct pcmcia_device *p_dev, *tmp_dev;
505 unsigned long flags; 505 unsigned long flags;
@@ -545,8 +545,8 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f
545 * Note that this is serialized by the device_add_lock, so that 545 * Note that this is serialized by the device_add_lock, so that
546 * only one such struct will be created. 546 * only one such struct will be created.
547 */ 547 */
548 list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list) 548 list_for_each_entry(tmp_dev, &s->devices_list, socket_device_list)
549 if (p_dev->func == tmp_dev->func) { 549 if (p_dev->func == tmp_dev->func) {
550 p_dev->function_config = tmp_dev->function_config; 550 p_dev->function_config = tmp_dev->function_config;
551 p_dev->io = tmp_dev->io; 551 p_dev->io = tmp_dev->io;
552 p_dev->irq = tmp_dev->irq; 552 p_dev->irq = tmp_dev->irq;
@@ -627,10 +627,10 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
627 no_funcs = 1; 627 no_funcs = 1;
628 s->functions = no_funcs; 628 s->functions = no_funcs;
629 629
630 for (i=0; i < no_funcs; i++) 630 for (i = 0; i < no_funcs; i++)
631 pcmcia_device_add(s, i); 631 pcmcia_device_add(s, i);
632 632
633 return (ret); 633 return ret;
634} 634}
635 635
636 636
@@ -756,7 +756,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename)
756 release: 756 release:
757 release_firmware(fw); 757 release_firmware(fw);
758 758
759 return (ret); 759 return ret;
760} 760}
761 761
762#else /* !CONFIG_PCMCIA_LOAD_CIS */ 762#else /* !CONFIG_PCMCIA_LOAD_CIS */
@@ -852,7 +852,7 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
852 852
853 if (did->match_flags & PCMCIA_DEV_ID_MATCH_ANONYMOUS) { 853 if (did->match_flags & PCMCIA_DEV_ID_MATCH_ANONYMOUS) {
854 int i; 854 int i;
855 for (i=0; i<4; i++) 855 for (i = 0; i < 4; i++)
856 if (dev->prod_id[i]) 856 if (dev->prod_id[i])
857 return 0; 857 return 0;
858 if (dev->has_manf_id || dev->has_card_id || dev->has_func_id) 858 if (dev->has_manf_id || dev->has_card_id || dev->has_func_id)
@@ -865,9 +865,10 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
865} 865}
866 866
867 867
868static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { 868static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)
869 struct pcmcia_device * p_dev = to_pcmcia_dev(dev); 869{
870 struct pcmcia_driver * p_drv = to_pcmcia_drv(drv); 870 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
871 struct pcmcia_driver *p_drv = to_pcmcia_drv(drv);
871 struct pcmcia_device_id *did = p_drv->id_table; 872 struct pcmcia_device_id *did = p_drv->id_table;
872 struct pcmcia_dynid *dynid; 873 struct pcmcia_dynid *dynid;
873 874
@@ -917,7 +918,7 @@ static int pcmcia_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
917 p_dev = to_pcmcia_dev(dev); 918 p_dev = to_pcmcia_dev(dev);
918 919
919 /* calculate hashes */ 920 /* calculate hashes */
920 for (i=0; i<4; i++) { 921 for (i = 0; i < 4; i++) {
921 if (!p_dev->prod_id[i]) 922 if (!p_dev->prod_id[i])
922 continue; 923 continue;
923 hash[i] = crc32(0, p_dev->prod_id[i], strlen(p_dev->prod_id[i])); 924 hash[i] = crc32(0, p_dev->prod_id[i], strlen(p_dev->prod_id[i]));
@@ -984,14 +985,14 @@ static void runtime_resume(struct device *dev)
984static ssize_t field##_show (struct device *dev, struct device_attribute *attr, char *buf) \ 985static ssize_t field##_show (struct device *dev, struct device_attribute *attr, char *buf) \
985{ \ 986{ \
986 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ 987 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \
987 return p_dev->test ? sprintf (buf, format, p_dev->field) : -ENODEV; \ 988 return p_dev->test ? sprintf(buf, format, p_dev->field) : -ENODEV; \
988} 989}
989 990
990#define pcmcia_device_stringattr(name, field) \ 991#define pcmcia_device_stringattr(name, field) \
991static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ 992static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf) \
992{ \ 993{ \
993 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \ 994 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); \
994 return p_dev->field ? sprintf (buf, "%s\n", p_dev->field) : -ENODEV; \ 995 return p_dev->field ? sprintf(buf, "%s\n", p_dev->field) : -ENODEV; \
995} 996}
996 997
997pcmcia_device_attr(func, socket, "0x%02x\n"); 998pcmcia_device_attr(func, socket, "0x%02x\n");
@@ -1020,8 +1021,8 @@ static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute
1020 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1021 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1021 int ret = 0; 1022 int ret = 0;
1022 1023
1023 if (!count) 1024 if (!count)
1024 return -EINVAL; 1025 return -EINVAL;
1025 1026
1026 if ((!p_dev->suspended) && !strncmp(buf, "off", 3)) 1027 if ((!p_dev->suspended) && !strncmp(buf, "off", 3))
1027 ret = runtime_suspend(dev); 1028 ret = runtime_suspend(dev);
@@ -1039,10 +1040,11 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
1039 u32 hash[4] = { 0, 0, 0, 0}; 1040 u32 hash[4] = { 0, 0, 0, 0};
1040 1041
1041 /* calculate hashes */ 1042 /* calculate hashes */
1042 for (i=0; i<4; i++) { 1043 for (i = 0; i < 4; i++) {
1043 if (!p_dev->prod_id[i]) 1044 if (!p_dev->prod_id[i])
1044 continue; 1045 continue;
1045 hash[i] = crc32(0,p_dev->prod_id[i],strlen(p_dev->prod_id[i])); 1046 hash[i] = crc32(0, p_dev->prod_id[i],
1047 strlen(p_dev->prod_id[i]));
1046 } 1048 }
1047 return sprintf(buf, "pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" 1049 return sprintf(buf, "pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X"
1048 "pa%08Xpb%08Xpc%08Xpd%08X\n", 1050 "pa%08Xpb%08Xpc%08Xpd%08X\n",
@@ -1091,7 +1093,7 @@ static struct device_attribute pcmcia_dev_attrs[] = {
1091 1093
1092/* PM support, also needed for reset */ 1094/* PM support, also needed for reset */
1093 1095
1094static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) 1096static int pcmcia_dev_suspend(struct device *dev, pm_message_t state)
1095{ 1097{
1096 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1098 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1097 struct pcmcia_driver *p_drv = NULL; 1099 struct pcmcia_driver *p_drv = NULL;
@@ -1131,10 +1133,10 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state)
1131} 1133}
1132 1134
1133 1135
1134static int pcmcia_dev_resume(struct device * dev) 1136static int pcmcia_dev_resume(struct device *dev)
1135{ 1137{
1136 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1138 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
1137 struct pcmcia_driver *p_drv = NULL; 1139 struct pcmcia_driver *p_drv = NULL;
1138 int ret = 0; 1140 int ret = 0;
1139 1141
1140 if (!p_dev->suspended) 1142 if (!p_dev->suspended)
@@ -1211,7 +1213,7 @@ static int pcmcia_bus_suspend(struct pcmcia_socket *skt)
1211/*====================================================================== 1213/*======================================================================
1212 1214
1213 The card status event handler. 1215 The card status event handler.
1214 1216
1215======================================================================*/ 1217======================================================================*/
1216 1218
1217/* Normally, the event is passed to individual drivers after 1219/* Normally, the event is passed to individual drivers after
@@ -1264,7 +1266,7 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
1264} /* ds_event */ 1266} /* ds_event */
1265 1267
1266 1268
1267struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *_p_dev) 1269struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev)
1268{ 1270{
1269 struct pcmcia_device *p_dev; 1271 struct pcmcia_device *p_dev;
1270 struct pcmcia_device *ret = NULL; 1272 struct pcmcia_device *ret = NULL;
@@ -1329,7 +1331,7 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
1329 if (ret) { 1331 if (ret) {
1330 dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n"); 1332 dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n");
1331 pcmcia_put_socket(socket); 1333 pcmcia_put_socket(socket);
1332 return (ret); 1334 return ret;
1333 } 1335 }
1334 1336
1335 return 0; 1337 return 0;
@@ -1400,7 +1402,7 @@ static int __init init_pcmcia_bus(void)
1400 1402
1401 return 0; 1403 return 0;
1402} 1404}
1403fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that 1405fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that
1404 * pcmcia_socket_class is already registered */ 1406 * pcmcia_socket_class is already registered */
1405 1407
1406 1408
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index c4d7908fa37f..f73fd5beaa37 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -88,12 +88,12 @@ static struct pcmcia_driver *get_pcmcia_driver(dev_info_t *dev_info)
88 88
89 p_drv = container_of(drv, struct pcmcia_driver, drv); 89 p_drv = container_of(drv, struct pcmcia_driver, drv);
90 90
91 return (p_drv); 91 return p_drv;
92} 92}
93 93
94 94
95#ifdef CONFIG_PROC_FS 95#ifdef CONFIG_PROC_FS
96static struct proc_dir_entry *proc_pccard = NULL; 96static struct proc_dir_entry *proc_pccard;
97 97
98static int proc_read_drivers_callback(struct device_driver *driver, void *_m) 98static int proc_read_drivers_callback(struct device_driver *driver, void *_m)
99{ 99{
@@ -158,7 +158,8 @@ static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj)
158 158
159#else 159#else
160 160
161static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) { 161static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj)
162{
162 return 0; 163 return 0;
163} 164}
164 165
@@ -195,7 +196,7 @@ static int pcmcia_adjust_resource_info(adjust_t *adj)
195 begin = adj->resource.memory.Base; 196 begin = adj->resource.memory.Base;
196 end = adj->resource.memory.Base + adj->resource.memory.Size - 1; 197 end = adj->resource.memory.Base + adj->resource.memory.Size - 1;
197 if (s->resource_ops->add_mem) 198 if (s->resource_ops->add_mem)
198 ret =s->resource_ops->add_mem(s, adj->Action, begin, end); 199 ret = s->resource_ops->add_mem(s, adj->Action, begin, end);
199 case RES_IO_RANGE: 200 case RES_IO_RANGE:
200 begin = adj->resource.io.BasePort; 201 begin = adj->resource.io.BasePort;
201 end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; 202 end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1;
@@ -215,7 +216,7 @@ static int pcmcia_adjust_resource_info(adjust_t *adj)
215 } 216 }
216 up_read(&pcmcia_socket_list_rwsem); 217 up_read(&pcmcia_socket_list_rwsem);
217 218
218 return (ret); 219 return ret;
219} 220}
220 221
221 222
@@ -490,7 +491,7 @@ static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info)
490 } 491 }
491 492
492 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 493 spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
493 list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 494 list_for_each_entry(p_dev, &s->devices_list, socket_device_list) {
494 if (p_dev->func == bind_info->function) { 495 if (p_dev->func == bind_info->function) {
495 if ((p_dev->dev.driver == &p_drv->drv)) { 496 if ((p_dev->dev.driver == &p_drv->drv)) {
496 if (p_dev->cardmgr) { 497 if (p_dev->cardmgr) {
@@ -558,7 +559,7 @@ rescan:
558 err_put: 559 err_put:
559 pcmcia_put_socket(s); 560 pcmcia_put_socket(s);
560 561
561 return (ret); 562 return ret;
562} /* bind_request */ 563} /* bind_request */
563 564
564#ifdef CONFIG_CARDBUS 565#ifdef CONFIG_CARDBUS
@@ -655,7 +656,7 @@ static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int
655 656
656 err_put: 657 err_put:
657 pcmcia_put_dev(p_dev); 658 pcmcia_put_dev(p_dev);
658 return (ret); 659 return ret;
659} /* get_device_info */ 660} /* get_device_info */
660 661
661 662
@@ -664,7 +665,7 @@ static int ds_open(struct inode *inode, struct file *file)
664 socket_t i = iminor(inode); 665 socket_t i = iminor(inode);
665 struct pcmcia_socket *s; 666 struct pcmcia_socket *s;
666 user_info_t *user; 667 user_info_t *user;
667 static int warning_printed = 0; 668 static int warning_printed;
668 int ret = 0; 669 int ret = 0;
669 670
670 pr_debug("ds_open(socket %d)\n", i); 671 pr_debug("ds_open(socket %d)\n", i);
@@ -738,12 +739,13 @@ static int ds_release(struct inode *inode, struct file *file)
738 s = user->socket; 739 s = user->socket;
739 740
740 /* Unlink user data structure */ 741 /* Unlink user data structure */
741 if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 742 if ((file->f_flags & O_ACCMODE) != O_RDONLY)
742 s->pcmcia_state.busy = 0; 743 s->pcmcia_state.busy = 0;
743 } 744
744 file->private_data = NULL; 745 file->private_data = NULL;
745 for (link = &s->user; *link; link = &(*link)->next) 746 for (link = &s->user; *link; link = &(*link)->next)
746 if (*link == user) break; 747 if (*link == user)
748 break;
747 if (link == NULL) 749 if (link == NULL)
748 goto out; 750 goto out;
749 *link = user->next; 751 *link = user->next;
@@ -774,7 +776,7 @@ static ssize_t ds_read(struct file *file, char __user *buf,
774 776
775 s = user->socket; 777 s = user->socket;
776 if (s->pcmcia_state.dead) 778 if (s->pcmcia_state.dead)
777 return -EIO; 779 return -EIO;
778 780
779 ret = wait_event_interruptible(s->queue, !queue_empty(user)); 781 ret = wait_event_interruptible(s->queue, !queue_empty(user));
780 if (ret == 0) 782 if (ret == 0)
@@ -824,7 +826,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)
824 826
825/*====================================================================*/ 827/*====================================================================*/
826 828
827static int ds_ioctl(struct inode * inode, struct file * file, 829static int ds_ioctl(struct inode *inode, struct file *file,
828 u_int cmd, u_long arg) 830 u_int cmd, u_long arg)
829{ 831{
830 struct pcmcia_socket *s; 832 struct pcmcia_socket *s;
@@ -842,10 +844,11 @@ static int ds_ioctl(struct inode * inode, struct file * file,
842 844
843 s = user->socket; 845 s = user->socket;
844 if (s->pcmcia_state.dead) 846 if (s->pcmcia_state.dead)
845 return -EIO; 847 return -EIO;
846 848
847 size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; 849 size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
848 if (size > sizeof(ds_ioctl_arg_t)) return -EINVAL; 850 if (size > sizeof(ds_ioctl_arg_t))
851 return -EINVAL;
849 852
850 /* Permission check */ 853 /* Permission check */
851 if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN)) 854 if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN))
@@ -1024,8 +1027,8 @@ static int ds_ioctl(struct inode * inode, struct file * file,
1024 } 1027 }
1025 1028
1026 if (cmd & IOC_OUT) { 1029 if (cmd & IOC_OUT) {
1027 if (__copy_to_user(uarg, (char *)buf, size)) 1030 if (__copy_to_user(uarg, (char *)buf, size))
1028 err = -EFAULT; 1031 err = -EFAULT;
1029 } 1032 }
1030 1033
1031free_out: 1034free_out:
@@ -1045,7 +1048,8 @@ static const struct file_operations ds_fops = {
1045 .poll = ds_poll, 1048 .poll = ds_poll,
1046}; 1049};
1047 1050
1048void __init pcmcia_setup_ioctl(void) { 1051void __init pcmcia_setup_ioctl(void)
1052{
1049 int i; 1053 int i;
1050 1054
1051 /* Set up character device for user mode clients */ 1055 /* Set up character device for user mode clients */
@@ -1064,7 +1068,8 @@ void __init pcmcia_setup_ioctl(void) {
1064} 1068}
1065 1069
1066 1070
1067void __exit pcmcia_cleanup_ioctl(void) { 1071void __exit pcmcia_cleanup_ioctl(void)
1072{
1068#ifdef CONFIG_PROC_FS 1073#ifdef CONFIG_PROC_FS
1069 if (proc_pccard) { 1074 if (proc_pccard) {
1070 remove_proc_entry("drivers", proc_pccard); 1075 remove_proc_entry("drivers", proc_pccard);
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index a8bf8c1b45ed..d5db95644b64 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -33,7 +33,7 @@
33 33
34 34
35/* Access speed for IO windows */ 35/* Access speed for IO windows */
36static int io_speed = 0; 36static int io_speed;
37module_param(io_speed, int, 0444); 37module_param(io_speed, int, 0444);
38 38
39 39
@@ -62,7 +62,8 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr,
62 num, align); 62 num, align);
63 align = 0; 63 align = 0;
64 } else 64 } else
65 while (align && (align < num)) align <<= 1; 65 while (align && (align < num))
66 align <<= 1;
66 } 67 }
67 if (*base & ~(align-1)) { 68 if (*base & ~(align-1)) {
68 dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n", 69 dev_dbg(&s->dev, "odd IO request: base %#x align %#x\n",
@@ -338,7 +339,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
338 struct pcmcia_socket *s = p_dev->socket; 339 struct pcmcia_socket *s = p_dev->socket;
339 config_t *c = p_dev->function_config; 340 config_t *c = p_dev->function_config;
340 341
341 if (!p_dev->_io ) 342 if (!p_dev->_io)
342 return -EINVAL; 343 return -EINVAL;
343 344
344 p_dev->_io = 0; 345 p_dev->_io = 0;
@@ -362,7 +363,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
362static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) 363static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
363{ 364{
364 struct pcmcia_socket *s = p_dev->socket; 365 struct pcmcia_socket *s = p_dev->socket;
365 config_t *c= p_dev->function_config; 366 config_t *c = p_dev->function_config;
366 367
367 if (!p_dev->_irq) 368 if (!p_dev->_irq)
368 return -EINVAL; 369 return -EINVAL;
@@ -383,9 +384,8 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
383 s->irq.AssignedIRQ = 0; 384 s->irq.AssignedIRQ = 0;
384 } 385 }
385 386
386 if (req->Handler) { 387 if (req->Handler)
387 free_irq(req->AssignedIRQ, p_dev->priv); 388 free_irq(req->AssignedIRQ, p_dev->priv);
388 }
389 389
390#ifdef CONFIG_PCMCIA_PROBE 390#ifdef CONFIG_PCMCIA_PROBE
391 pcmcia_used_irq[req->AssignedIRQ]--; 391 pcmcia_used_irq[req->AssignedIRQ]--;
@@ -656,7 +656,8 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
656 type = IRQF_SHARED; 656 type = IRQF_SHARED;
657 else if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) 657 else if (req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)
658 type = IRQF_SHARED; 658 type = IRQF_SHARED;
659 else printk(KERN_WARNING "pcmcia: Driver needs updating to support IRQ sharing.\n"); 659 else
660 printk(KERN_WARNING "pcmcia: Driver needs updating to support IRQ sharing.\n");
660 661
661#ifdef CONFIG_PCMCIA_PROBE 662#ifdef CONFIG_PCMCIA_PROBE
662 663
@@ -788,7 +789,8 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
788 789
789 /* Allocate system memory window */ 790 /* Allocate system memory window */
790 for (w = 0; w < MAX_WIN; w++) 791 for (w = 0; w < MAX_WIN; w++)
791 if (!(s->state & SOCKET_WIN_REQ(w))) break; 792 if (!(s->state & SOCKET_WIN_REQ(w)))
793 break;
792 if (w == MAX_WIN) { 794 if (w == MAX_WIN) {
793 dev_dbg(&s->dev, "all windows are used already\n"); 795 dev_dbg(&s->dev, "all windows are used already\n");
794 return -EINVAL; 796 return -EINVAL;
@@ -826,18 +828,19 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha
826 s->state |= SOCKET_WIN_REQ(w); 828 s->state |= SOCKET_WIN_REQ(w);
827 829
828 /* Return window handle */ 830 /* Return window handle */
829 if (s->features & SS_CAP_STATIC_MAP) { 831 if (s->features & SS_CAP_STATIC_MAP)
830 req->Base = win->static_start; 832 req->Base = win->static_start;
831 } else { 833 else
832 req->Base = win->res->start; 834 req->Base = win->res->start;
833 } 835
834 *wh = w + 1; 836 *wh = w + 1;
835 837
836 return 0; 838 return 0;
837} /* pcmcia_request_window */ 839} /* pcmcia_request_window */
838EXPORT_SYMBOL(pcmcia_request_window); 840EXPORT_SYMBOL(pcmcia_request_window);
839 841
840void pcmcia_disable_device(struct pcmcia_device *p_dev) { 842void pcmcia_disable_device(struct pcmcia_device *p_dev)
843{
841 pcmcia_release_configuration(p_dev); 844 pcmcia_release_configuration(p_dev);
842 pcmcia_release_io(p_dev, &p_dev->io); 845 pcmcia_release_io(p_dev, &p_dev->io);
843 pcmcia_release_irq(p_dev, &p_dev->irq); 846 pcmcia_release_irq(p_dev, &p_dev->irq);
@@ -970,7 +973,7 @@ int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code,
970 973
971 return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL, 974 return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL,
972 &loop, pcmcia_do_loop_tuple); 975 &loop, pcmcia_do_loop_tuple);
973}; 976}
974EXPORT_SYMBOL(pcmcia_loop_tuple); 977EXPORT_SYMBOL(pcmcia_loop_tuple);
975 978
976 979
@@ -1000,7 +1003,7 @@ static int pcmcia_do_get_tuple(struct pcmcia_device *p_dev, tuple_t *tuple,
1000 } else 1003 } else
1001 dev_dbg(&p_dev->dev, "do_get_tuple: out of memory\n"); 1004 dev_dbg(&p_dev->dev, "do_get_tuple: out of memory\n");
1002 return 0; 1005 return 0;
1003}; 1006}
1004 1007
1005/** 1008/**
1006 * pcmcia_get_tuple() - get first tuple from CIS 1009 * pcmcia_get_tuple() - get first tuple from CIS
@@ -1024,7 +1027,7 @@ size_t pcmcia_get_tuple(struct pcmcia_device *p_dev, cisdata_t code,
1024 pcmcia_loop_tuple(p_dev, code, pcmcia_do_get_tuple, &get); 1027 pcmcia_loop_tuple(p_dev, code, pcmcia_do_get_tuple, &get);
1025 1028
1026 return get.len; 1029 return get.len;
1027}; 1030}
1028EXPORT_SYMBOL(pcmcia_get_tuple); 1031EXPORT_SYMBOL(pcmcia_get_tuple);
1029 1032
1030 1033
@@ -1057,7 +1060,7 @@ static int pcmcia_do_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple,
1057 for (i = 0; i < 6; i++) 1060 for (i = 0; i < 6; i++)
1058 dev->dev_addr[i] = tuple->TupleData[i+2]; 1061 dev->dev_addr[i] = tuple->TupleData[i+2];
1059 return 0; 1062 return 0;
1060}; 1063}
1061 1064
1062/** 1065/**
1063 * pcmcia_get_mac_from_cis() - read out MAC address from CISTPL_FUNCE 1066 * pcmcia_get_mac_from_cis() - read out MAC address from CISTPL_FUNCE
@@ -1071,6 +1074,6 @@ static int pcmcia_do_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple,
1071int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, struct net_device *dev) 1074int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, struct net_device *dev)
1072{ 1075{
1073 return pcmcia_loop_tuple(p_dev, CISTPL_FUNCE, pcmcia_do_get_mac, dev); 1076 return pcmcia_loop_tuple(p_dev, CISTPL_FUNCE, pcmcia_do_get_mac, dev);
1074}; 1077}
1075EXPORT_SYMBOL(pcmcia_get_mac_from_cis); 1078EXPORT_SYMBOL(pcmcia_get_mac_from_cis);
1076 1079
diff --git a/drivers/pcmcia/rsrc_mgr.c b/drivers/pcmcia/rsrc_mgr.c
index de0e770ce6a3..52db17263d8b 100644
--- a/drivers/pcmcia/rsrc_mgr.c
+++ b/drivers/pcmcia/rsrc_mgr.c
@@ -126,16 +126,16 @@ static void pcmcia_align(void *align_data, struct resource *res,
126 res->start = start; 126 res->start = start;
127 127
128#ifdef CONFIG_X86 128#ifdef CONFIG_X86
129 if (res->flags & IORESOURCE_IO) { 129 if (res->flags & IORESOURCE_IO) {
130 if (start & 0x300) { 130 if (start & 0x300) {
131 start = (start + 0x3ff) & ~0x3ff; 131 start = (start + 0x3ff) & ~0x3ff;
132 res->start = start; 132 res->start = start;
133 } 133 }
134 } 134 }
135#endif 135#endif
136 136
137#ifdef CONFIG_M68K 137#ifdef CONFIG_M68K
138 if (res->flags & IORESOURCE_IO) { 138 if (res->flags & IORESOURCE_IO) {
139 if ((res->start + size - 1) >= 1024) 139 if ((res->start + size - 1) >= 1024)
140 res->start = res->end; 140 res->start = res->end;
141 } 141 }
diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 7039f3cf5b77..9b0dc433a8c3 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -24,9 +24,9 @@
24#include <linux/timer.h> 24#include <linux/timer.h>
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/device.h> 26#include <linux/device.h>
27#include <linux/io.h>
27 28
28#include <asm/irq.h> 29#include <asm/irq.h>
29#include <asm/io.h>
30 30
31#include <pcmcia/cs_types.h> 31#include <pcmcia/cs_types.h>
32#include <pcmcia/ss.h> 32#include <pcmcia/ss.h>
@@ -144,43 +144,44 @@ static int add_interval(struct resource_map *map, u_long base, u_long num)
144 144
145static int sub_interval(struct resource_map *map, u_long base, u_long num) 145static int sub_interval(struct resource_map *map, u_long base, u_long num)
146{ 146{
147 struct resource_map *p, *q; 147 struct resource_map *p, *q;
148 148
149 for (p = map; ; p = q) { 149 for (p = map; ; p = q) {
150 q = p->next; 150 q = p->next;
151 if (q == map) 151 if (q == map)
152 break; 152 break;
153 if ((q->base+q->num > base) && (base+num > q->base)) { 153 if ((q->base+q->num > base) && (base+num > q->base)) {
154 if (q->base >= base) { 154 if (q->base >= base) {
155 if (q->base+q->num <= base+num) { 155 if (q->base+q->num <= base+num) {
156 /* Delete whole block */ 156 /* Delete whole block */
157 p->next = q->next; 157 p->next = q->next;
158 kfree(q); 158 kfree(q);
159 /* don't advance the pointer yet */ 159 /* don't advance the pointer yet */
160 q = p; 160 q = p;
161 } else { 161 } else {
162 /* Cut off bit from the front */ 162 /* Cut off bit from the front */
163 q->num = q->base + q->num - base - num; 163 q->num = q->base + q->num - base - num;
164 q->base = base + num; 164 q->base = base + num;
165 } 165 }
166 } else if (q->base+q->num <= base+num) { 166 } else if (q->base+q->num <= base+num) {
167 /* Cut off bit from the end */ 167 /* Cut off bit from the end */
168 q->num = base - q->base; 168 q->num = base - q->base;
169 } else { 169 } else {
170 /* Split the block into two pieces */ 170 /* Split the block into two pieces */
171 p = kmalloc(sizeof(struct resource_map), GFP_KERNEL); 171 p = kmalloc(sizeof(struct resource_map),
172 if (!p) { 172 GFP_KERNEL);
173 printk(KERN_WARNING "out of memory to update resources\n"); 173 if (!p) {
174 return -ENOMEM; 174 printk(KERN_WARNING "out of memory to update resources\n");
175 return -ENOMEM;
176 }
177 p->base = base+num;
178 p->num = q->base+q->num - p->base;
179 q->num = base - q->base;
180 p->next = q->next ; q->next = p;
181 }
175 } 182 }
176 p->base = base+num;
177 p->num = q->base+q->num - p->base;
178 q->num = base - q->base;
179 p->next = q->next ; q->next = p;
180 }
181 } 183 }
182 } 184 return 0;
183 return 0;
184} 185}
185 186
186/*====================================================================== 187/*======================================================================
@@ -194,69 +195,72 @@ static int sub_interval(struct resource_map *map, u_long base, u_long num)
194static void do_io_probe(struct pcmcia_socket *s, unsigned int base, 195static void do_io_probe(struct pcmcia_socket *s, unsigned int base,
195 unsigned int num) 196 unsigned int num)
196{ 197{
197 struct resource *res; 198 struct resource *res;
198 struct socket_data *s_data = s->resource_data; 199 struct socket_data *s_data = s->resource_data;
199 unsigned int i, j, bad; 200 unsigned int i, j, bad;
200 int any; 201 int any;
201 u_char *b, hole, most; 202 u_char *b, hole, most;
202 203
203 dev_printk(KERN_INFO, &s->dev, "cs: IO port probe %#x-%#x:", 204 dev_printk(KERN_INFO, &s->dev, "cs: IO port probe %#x-%#x:",
204 base, base+num-1); 205 base, base+num-1);
205 206
206 /* First, what does a floating port look like? */ 207 /* First, what does a floating port look like? */
207 b = kzalloc(256, GFP_KERNEL); 208 b = kzalloc(256, GFP_KERNEL);
208 if (!b) { 209 if (!b) {
209 printk("\n"); 210 printk("\n");
210 dev_printk(KERN_ERR, &s->dev, 211 dev_printk(KERN_ERR, &s->dev,
211 "do_io_probe: unable to kmalloc 256 bytes"); 212 "do_io_probe: unable to kmalloc 256 bytes");
212 return; 213 return;
213 }
214 for (i = base, most = 0; i < base+num; i += 8) {
215 res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA IO probe");
216 if (!res)
217 continue;
218 hole = inb(i);
219 for (j = 1; j < 8; j++)
220 if (inb(i+j) != hole) break;
221 free_region(res);
222 if ((j == 8) && (++b[hole] > b[most]))
223 most = hole;
224 if (b[most] == 127) break;
225 }
226 kfree(b);
227
228 bad = any = 0;
229 for (i = base; i < base+num; i += 8) {
230 res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA IO probe");
231 if (!res)
232 continue;
233 for (j = 0; j < 8; j++)
234 if (inb(i+j) != most) break;
235 free_region(res);
236 if (j < 8) {
237 if (!any)
238 printk(" excluding");
239 if (!bad)
240 bad = any = i;
241 } else {
242 if (bad) {
243 sub_interval(&s_data->io_db, bad, i-bad);
244 printk(" %#x-%#x", bad, i-1);
245 bad = 0;
246 }
247 } 214 }
248 } 215 for (i = base, most = 0; i < base+num; i += 8) {
249 if (bad) { 216 res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA ioprobe");
250 if ((num > 16) && (bad == base) && (i == base+num)) { 217 if (!res)
251 printk(" nothing: probe failed.\n"); 218 continue;
252 return; 219 hole = inb(i);
253 } else { 220 for (j = 1; j < 8; j++)
254 sub_interval(&s_data->io_db, bad, i-bad); 221 if (inb(i+j) != hole)
255 printk(" %#x-%#x", bad, i-1); 222 break;
223 free_region(res);
224 if ((j == 8) && (++b[hole] > b[most]))
225 most = hole;
226 if (b[most] == 127)
227 break;
256 } 228 }
257 } 229 kfree(b);
258 230
259 printk(any ? "\n" : " clean.\n"); 231 bad = any = 0;
232 for (i = base; i < base+num; i += 8) {
233 res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA ioprobe");
234 if (!res)
235 continue;
236 for (j = 0; j < 8; j++)
237 if (inb(i+j) != most)
238 break;
239 free_region(res);
240 if (j < 8) {
241 if (!any)
242 printk(" excluding");
243 if (!bad)
244 bad = any = i;
245 } else {
246 if (bad) {
247 sub_interval(&s_data->io_db, bad, i-bad);
248 printk(" %#x-%#x", bad, i-1);
249 bad = 0;
250 }
251 }
252 }
253 if (bad) {
254 if ((num > 16) && (bad == base) && (i == base+num)) {
255 printk(" nothing: probe failed.\n");
256 return;
257 } else {
258 sub_interval(&s_data->io_db, bad, i-bad);
259 printk(" %#x-%#x", bad, i-1);
260 }
261 }
262
263 printk(any ? "\n" : " clean.\n");
260} 264}
261#endif 265#endif
262 266
@@ -327,8 +331,9 @@ cis_readable(struct pcmcia_socket *s, unsigned long base, unsigned long size)
327 unsigned int info1, info2; 331 unsigned int info1, info2;
328 int ret = 0; 332 int ret = 0;
329 333
330 res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "cs memory probe"); 334 res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "PCMCIA memprobe");
331 res2 = claim_region(s, base + size/2, size/2, IORESOURCE_MEM, "cs memory probe"); 335 res2 = claim_region(s, base + size/2, size/2, IORESOURCE_MEM,
336 "PCMCIA memprobe");
332 337
333 if (res1 && res2) { 338 if (res1 && res2) {
334 ret = readable(s, res1, &info1); 339 ret = readable(s, res1, &info1);
@@ -347,8 +352,9 @@ checksum_match(struct pcmcia_socket *s, unsigned long base, unsigned long size)
347 struct resource *res1, *res2; 352 struct resource *res1, *res2;
348 int a = -1, b = -1; 353 int a = -1, b = -1;
349 354
350 res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "cs memory probe"); 355 res1 = claim_region(s, base, size/2, IORESOURCE_MEM, "PCMCIA memprobe");
351 res2 = claim_region(s, base + size/2, size/2, IORESOURCE_MEM, "cs memory probe"); 356 res2 = claim_region(s, base + size/2, size/2, IORESOURCE_MEM,
357 "PCMCIA memprobe");
352 358
353 if (res1 && res2) { 359 if (res1 && res2) {
354 a = checksum(s, res1); 360 a = checksum(s, res1);
@@ -371,42 +377,43 @@ checksum_match(struct pcmcia_socket *s, unsigned long base, unsigned long size)
371 377
372static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s) 378static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s)
373{ 379{
374 struct socket_data *s_data = s->resource_data; 380 struct socket_data *s_data = s->resource_data;
375 u_long i, j, bad, fail, step; 381 u_long i, j, bad, fail, step;
376 382
377 dev_printk(KERN_INFO, &s->dev, "cs: memory probe 0x%06lx-0x%06lx:", 383 dev_printk(KERN_INFO, &s->dev, "cs: memory probe 0x%06lx-0x%06lx:",
378 base, base+num-1); 384 base, base+num-1);
379 bad = fail = 0; 385 bad = fail = 0;
380 step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff); 386 step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff);
381 /* don't allow too large steps */ 387 /* don't allow too large steps */
382 if (step > 0x800000) 388 if (step > 0x800000)
383 step = 0x800000; 389 step = 0x800000;
384 /* cis_readable wants to map 2x map_size */ 390 /* cis_readable wants to map 2x map_size */
385 if (step < 2 * s->map_size) 391 if (step < 2 * s->map_size)
386 step = 2 * s->map_size; 392 step = 2 * s->map_size;
387 for (i = j = base; i < base+num; i = j + step) { 393 for (i = j = base; i < base+num; i = j + step) {
388 if (!fail) { 394 if (!fail) {
389 for (j = i; j < base+num; j += step) { 395 for (j = i; j < base+num; j += step) {
390 if (cis_readable(s, j, step)) 396 if (cis_readable(s, j, step))
391 break; 397 break;
392 } 398 }
393 fail = ((i == base) && (j == base+num)); 399 fail = ((i == base) && (j == base+num));
394 } 400 }
395 if (fail) { 401 if (fail) {
396 for (j = i; j < base+num; j += 2*step) 402 for (j = i; j < base+num; j += 2*step)
397 if (checksum_match(s, j, step) && 403 if (checksum_match(s, j, step) &&
398 checksum_match(s, j + step, step)) 404 checksum_match(s, j + step, step))
399 break; 405 break;
400 } 406 }
401 if (i != j) { 407 if (i != j) {
402 if (!bad) printk(" excluding"); 408 if (!bad)
403 printk(" %#05lx-%#05lx", i, j-1); 409 printk(" excluding");
404 sub_interval(&s_data->mem_db, i, j-i); 410 printk(" %#05lx-%#05lx", i, j-1);
405 bad += j-i; 411 sub_interval(&s_data->mem_db, i, j-i);
412 bad += j-i;
413 }
406 } 414 }
407 } 415 printk(bad ? "\n" : " clean.\n");
408 printk(bad ? "\n" : " clean.\n"); 416 return num - bad;
409 return (num - bad);
410} 417}
411 418
412#ifdef CONFIG_PCMCIA_PROBE 419#ifdef CONFIG_PCMCIA_PROBE
@@ -656,7 +663,7 @@ static struct resource *nonstatic_find_io_region(unsigned long base, int num,
656 return res; 663 return res;
657} 664}
658 665
659static struct resource * nonstatic_find_mem_region(u_long base, u_long num, 666static struct resource *nonstatic_find_mem_region(u_long base, u_long num,
660 u_long align, int low, struct pcmcia_socket *s) 667 u_long align, int low, struct pcmcia_socket *s)
661{ 668{
662 struct resource *res = make_resource(0, num, IORESOURCE_MEM, dev_name(&s->dev)); 669 struct resource *res = make_resource(0, num, IORESOURCE_MEM, dev_name(&s->dev));
@@ -794,7 +801,7 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
794 return -EINVAL; 801 return -EINVAL;
795#endif 802#endif
796 803
797 for (i=0; i < PCI_BUS_NUM_RESOURCES; i++) { 804 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
798 res = s->cb_dev->bus->resource[i]; 805 res = s->cb_dev->bus->resource[i];
799 if (!res) 806 if (!res)
800 continue; 807 continue;
@@ -908,14 +915,14 @@ static ssize_t show_io_db(struct device *dev,
908 for (p = data->io_db.next; p != &data->io_db; p = p->next) { 915 for (p = data->io_db.next; p != &data->io_db; p = p->next) {
909 if (ret > (PAGE_SIZE - 10)) 916 if (ret > (PAGE_SIZE - 10))
910 continue; 917 continue;
911 ret += snprintf (&buf[ret], (PAGE_SIZE - ret - 1), 918 ret += snprintf(&buf[ret], (PAGE_SIZE - ret - 1),
912 "0x%08lx - 0x%08lx\n", 919 "0x%08lx - 0x%08lx\n",
913 ((unsigned long) p->base), 920 ((unsigned long) p->base),
914 ((unsigned long) p->base + p->num - 1)); 921 ((unsigned long) p->base + p->num - 1));
915 } 922 }
916 923
917 mutex_unlock(&rsrc_mutex); 924 mutex_unlock(&rsrc_mutex);
918 return (ret); 925 return ret;
919} 926}
920 927
921static ssize_t store_io_db(struct device *dev, 928static ssize_t store_io_db(struct device *dev,
@@ -927,12 +934,13 @@ static ssize_t store_io_db(struct device *dev,
927 unsigned int add = ADD_MANAGED_RESOURCE; 934 unsigned int add = ADD_MANAGED_RESOURCE;
928 ssize_t ret = 0; 935 ssize_t ret = 0;
929 936
930 ret = sscanf (buf, "+ 0x%lx - 0x%lx", &start_addr, &end_addr); 937 ret = sscanf(buf, "+ 0x%lx - 0x%lx", &start_addr, &end_addr);
931 if (ret != 2) { 938 if (ret != 2) {
932 ret = sscanf (buf, "- 0x%lx - 0x%lx", &start_addr, &end_addr); 939 ret = sscanf(buf, "- 0x%lx - 0x%lx", &start_addr, &end_addr);
933 add = REMOVE_MANAGED_RESOURCE; 940 add = REMOVE_MANAGED_RESOURCE;
934 if (ret != 2) { 941 if (ret != 2) {
935 ret = sscanf (buf, "0x%lx - 0x%lx", &start_addr, &end_addr); 942 ret = sscanf(buf, "0x%lx - 0x%lx", &start_addr,
943 &end_addr);
936 add = ADD_MANAGED_RESOURCE; 944 add = ADD_MANAGED_RESOURCE;
937 if (ret != 2) 945 if (ret != 2)
938 return -EINVAL; 946 return -EINVAL;
@@ -963,14 +971,14 @@ static ssize_t show_mem_db(struct device *dev,
963 for (p = data->mem_db.next; p != &data->mem_db; p = p->next) { 971 for (p = data->mem_db.next; p != &data->mem_db; p = p->next) {
964 if (ret > (PAGE_SIZE - 10)) 972 if (ret > (PAGE_SIZE - 10))
965 continue; 973 continue;
966 ret += snprintf (&buf[ret], (PAGE_SIZE - ret - 1), 974 ret += snprintf(&buf[ret], (PAGE_SIZE - ret - 1),
967 "0x%08lx - 0x%08lx\n", 975 "0x%08lx - 0x%08lx\n",
968 ((unsigned long) p->base), 976 ((unsigned long) p->base),
969 ((unsigned long) p->base + p->num - 1)); 977 ((unsigned long) p->base + p->num - 1));
970 } 978 }
971 979
972 mutex_unlock(&rsrc_mutex); 980 mutex_unlock(&rsrc_mutex);
973 return (ret); 981 return ret;
974} 982}
975 983
976static ssize_t store_mem_db(struct device *dev, 984static ssize_t store_mem_db(struct device *dev,
@@ -982,12 +990,13 @@ static ssize_t store_mem_db(struct device *dev,
982 unsigned int add = ADD_MANAGED_RESOURCE; 990 unsigned int add = ADD_MANAGED_RESOURCE;
983 ssize_t ret = 0; 991 ssize_t ret = 0;
984 992
985 ret = sscanf (buf, "+ 0x%lx - 0x%lx", &start_addr, &end_addr); 993 ret = sscanf(buf, "+ 0x%lx - 0x%lx", &start_addr, &end_addr);
986 if (ret != 2) { 994 if (ret != 2) {
987 ret = sscanf (buf, "- 0x%lx - 0x%lx", &start_addr, &end_addr); 995 ret = sscanf(buf, "- 0x%lx - 0x%lx", &start_addr, &end_addr);
988 add = REMOVE_MANAGED_RESOURCE; 996 add = REMOVE_MANAGED_RESOURCE;
989 if (ret != 2) { 997 if (ret != 2) {
990 ret = sscanf (buf, "0x%lx - 0x%lx", &start_addr, &end_addr); 998 ret = sscanf(buf, "0x%lx - 0x%lx", &start_addr,
999 &end_addr);
991 add = ADD_MANAGED_RESOURCE; 1000 add = ADD_MANAGED_RESOURCE;
992 if (ret != 2) 1001 if (ret != 2)
993 return -EINVAL; 1002 return -EINVAL;
diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c
index 78d5aab542f7..7a456000332a 100644
--- a/drivers/pcmcia/socket_sysfs.c
+++ b/drivers/pcmcia/socket_sysfs.c
@@ -164,7 +164,7 @@ static ssize_t pccard_store_irq_mask(struct device *dev,
164 if (!count) 164 if (!count)
165 return -EINVAL; 165 return -EINVAL;
166 166
167 ret = sscanf (buf, "0x%x\n", &mask); 167 ret = sscanf(buf, "0x%x\n", &mask);
168 168
169 if (ret == 1) { 169 if (ret == 1) {
170 s->irq_mask &= mask; 170 s->irq_mask &= mask;
@@ -278,7 +278,7 @@ static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off
278 free_tuple: 278 free_tuple:
279 kfree(tuplebuffer); 279 kfree(tuplebuffer);
280 280
281 return (ret); 281 return ret;
282} 282}
283 283
284static ssize_t pccard_show_cis(struct kobject *kobj, 284static ssize_t pccard_show_cis(struct kobject *kobj,
@@ -308,7 +308,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
308 count = pccard_extract_cis(s, buf, off, count); 308 count = pccard_extract_cis(s, buf, off, count);
309 } 309 }
310 310
311 return (count); 311 return count;
312} 312}
313 313
314static ssize_t pccard_store_cis(struct kobject *kobj, 314static ssize_t pccard_store_cis(struct kobject *kobj,
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 8be4cc447a17..fe02cfd4b5e9 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -6,7 +6,7 @@
6 * Changelog: 6 * Changelog:
7 * Aug 2002: Manfred Spraul <manfred@colorfullife.com> 7 * Aug 2002: Manfred Spraul <manfred@colorfullife.com>
8 * Dynamically adjust the size of the bridge resource 8 * Dynamically adjust the size of the bridge resource
9 * 9 *
10 * May 2003: Dominik Brodowski <linux@brodo.de> 10 * May 2003: Dominik Brodowski <linux@brodo.de>
11 * Merge pci_socket.c and yenta.c into one file 11 * Merge pci_socket.c and yenta.c into one file
12 */ 12 */
@@ -16,13 +16,12 @@
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/io.h>
19 20
20#include <pcmcia/cs_types.h> 21#include <pcmcia/cs_types.h>
21#include <pcmcia/ss.h> 22#include <pcmcia/ss.h>
22#include <pcmcia/cs.h> 23#include <pcmcia/cs.h>
23 24
24#include <asm/io.h>
25
26#include "yenta_socket.h" 25#include "yenta_socket.h"
27#include "i82365.h" 26#include "i82365.h"
28 27
@@ -55,7 +54,7 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket);
55 54
56static unsigned int override_bios; 55static unsigned int override_bios;
57module_param(override_bios, uint, 0000); 56module_param(override_bios, uint, 0000);
58MODULE_PARM_DESC (override_bios, "yenta ignore bios resource allocation"); 57MODULE_PARM_DESC(override_bios, "yenta ignore bios resource allocation");
59 58
60/* 59/*
61 * Generate easy-to-use ways of reading a cardbus sockets 60 * Generate easy-to-use ways of reading a cardbus sockets
@@ -237,24 +236,42 @@ static void yenta_set_power(struct yenta_socket *socket, socket_state_t *state)
237 /* i82365SL-DF style */ 236 /* i82365SL-DF style */
238 if (socket->flags & YENTA_16BIT_POWER_DF) { 237 if (socket->flags & YENTA_16BIT_POWER_DF) {
239 switch (state->Vcc) { 238 switch (state->Vcc) {
240 case 33: reg |= I365_VCC_3V; break; 239 case 33:
241 case 50: reg |= I365_VCC_5V; break; 240 reg |= I365_VCC_3V;
242 default: reg = 0; break; 241 break;
242 case 50:
243 reg |= I365_VCC_5V;
244 break;
245 default:
246 reg = 0;
247 break;
243 } 248 }
244 switch (state->Vpp) { 249 switch (state->Vpp) {
245 case 33: 250 case 33:
246 case 50: reg |= I365_VPP1_5V; break; 251 case 50:
247 case 120: reg |= I365_VPP1_12V; break; 252 reg |= I365_VPP1_5V;
253 break;
254 case 120:
255 reg |= I365_VPP1_12V;
256 break;
248 } 257 }
249 } else { 258 } else {
250 /* i82365SL-B style */ 259 /* i82365SL-B style */
251 switch (state->Vcc) { 260 switch (state->Vcc) {
252 case 50: reg |= I365_VCC_5V; break; 261 case 50:
253 default: reg = 0; break; 262 reg |= I365_VCC_5V;
263 break;
264 default:
265 reg = 0;
266 break;
254 } 267 }
255 switch (state->Vpp) { 268 switch (state->Vpp) {
256 case 50: reg |= I365_VPP1_5V | I365_VPP2_5V; break; 269 case 50:
257 case 120: reg |= I365_VPP1_12V | I365_VPP2_12V; break; 270 reg |= I365_VPP1_5V | I365_VPP2_5V;
271 break;
272 case 120:
273 reg |= I365_VPP1_12V | I365_VPP2_12V;
274 break;
258 } 275 }
259 } 276 }
260 277
@@ -263,14 +280,26 @@ static void yenta_set_power(struct yenta_socket *socket, socket_state_t *state)
263 } else { 280 } else {
264 u32 reg = 0; /* CB_SC_STPCLK? */ 281 u32 reg = 0; /* CB_SC_STPCLK? */
265 switch (state->Vcc) { 282 switch (state->Vcc) {
266 case 33: reg = CB_SC_VCC_3V; break; 283 case 33:
267 case 50: reg = CB_SC_VCC_5V; break; 284 reg = CB_SC_VCC_3V;
268 default: reg = 0; break; 285 break;
286 case 50:
287 reg = CB_SC_VCC_5V;
288 break;
289 default:
290 reg = 0;
291 break;
269 } 292 }
270 switch (state->Vpp) { 293 switch (state->Vpp) {
271 case 33: reg |= CB_SC_VPP_3V; break; 294 case 33:
272 case 50: reg |= CB_SC_VPP_5V; break; 295 reg |= CB_SC_VPP_3V;
273 case 120: reg |= CB_SC_VPP_12V; break; 296 break;
297 case 50:
298 reg |= CB_SC_VPP_5V;
299 break;
300 case 120:
301 reg |= CB_SC_VPP_12V;
302 break;
274 } 303 }
275 if (reg != cb_readl(socket, CB_SOCKET_CONTROL)) 304 if (reg != cb_readl(socket, CB_SOCKET_CONTROL))
276 cb_writel(socket, CB_SOCKET_CONTROL, reg); 305 cb_writel(socket, CB_SOCKET_CONTROL, reg);
@@ -314,23 +343,29 @@ static int yenta_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
314 343
315 reg = exca_readb(socket, I365_POWER) & (I365_VCC_MASK|I365_VPP1_MASK); 344 reg = exca_readb(socket, I365_POWER) & (I365_VCC_MASK|I365_VPP1_MASK);
316 reg |= I365_PWR_NORESET; 345 reg |= I365_PWR_NORESET;
317 if (state->flags & SS_PWR_AUTO) reg |= I365_PWR_AUTO; 346 if (state->flags & SS_PWR_AUTO)
318 if (state->flags & SS_OUTPUT_ENA) reg |= I365_PWR_OUT; 347 reg |= I365_PWR_AUTO;
348 if (state->flags & SS_OUTPUT_ENA)
349 reg |= I365_PWR_OUT;
319 if (exca_readb(socket, I365_POWER) != reg) 350 if (exca_readb(socket, I365_POWER) != reg)
320 exca_writeb(socket, I365_POWER, reg); 351 exca_writeb(socket, I365_POWER, reg);
321 352
322 /* CSC interrupt: no ISA irq for CSC */ 353 /* CSC interrupt: no ISA irq for CSC */
323 reg = I365_CSC_DETECT; 354 reg = I365_CSC_DETECT;
324 if (state->flags & SS_IOCARD) { 355 if (state->flags & SS_IOCARD) {
325 if (state->csc_mask & SS_STSCHG) reg |= I365_CSC_STSCHG; 356 if (state->csc_mask & SS_STSCHG)
357 reg |= I365_CSC_STSCHG;
326 } else { 358 } else {
327 if (state->csc_mask & SS_BATDEAD) reg |= I365_CSC_BVD1; 359 if (state->csc_mask & SS_BATDEAD)
328 if (state->csc_mask & SS_BATWARN) reg |= I365_CSC_BVD2; 360 reg |= I365_CSC_BVD1;
329 if (state->csc_mask & SS_READY) reg |= I365_CSC_READY; 361 if (state->csc_mask & SS_BATWARN)
362 reg |= I365_CSC_BVD2;
363 if (state->csc_mask & SS_READY)
364 reg |= I365_CSC_READY;
330 } 365 }
331 exca_writeb(socket, I365_CSCINT, reg); 366 exca_writeb(socket, I365_CSCINT, reg);
332 exca_readb(socket, I365_CSC); 367 exca_readb(socket, I365_CSC);
333 if(sock->zoom_video) 368 if (sock->zoom_video)
334 sock->zoom_video(sock, state->flags & SS_ZVCARD); 369 sock->zoom_video(sock, state->flags & SS_ZVCARD);
335 } 370 }
336 config_writew(socket, CB_BRIDGE_CONTROL, bridge); 371 config_writew(socket, CB_BRIDGE_CONTROL, bridge);
@@ -368,9 +403,12 @@ static int yenta_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io
368 exca_writew(socket, I365_IO(map)+I365_W_STOP, io->stop); 403 exca_writew(socket, I365_IO(map)+I365_W_STOP, io->stop);
369 404
370 ioctl = exca_readb(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map); 405 ioctl = exca_readb(socket, I365_IOCTL) & ~I365_IOCTL_MASK(map);
371 if (io->flags & MAP_0WS) ioctl |= I365_IOCTL_0WS(map); 406 if (io->flags & MAP_0WS)
372 if (io->flags & MAP_16BIT) ioctl |= I365_IOCTL_16BIT(map); 407 ioctl |= I365_IOCTL_0WS(map);
373 if (io->flags & MAP_AUTOSZ) ioctl |= I365_IOCTL_IOCS16(map); 408 if (io->flags & MAP_16BIT)
409 ioctl |= I365_IOCTL_16BIT(map);
410 if (io->flags & MAP_AUTOSZ)
411 ioctl |= I365_IOCTL_IOCS16(map);
374 exca_writeb(socket, I365_IOCTL, ioctl); 412 exca_writeb(socket, I365_IOCTL, ioctl);
375 413
376 if (io->flags & MAP_ACTIVE) 414 if (io->flags & MAP_ACTIVE)
@@ -416,10 +454,17 @@ static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *
416 454
417 word = (stop >> 12) & 0x0fff; 455 word = (stop >> 12) & 0x0fff;
418 switch (to_cycles(mem->speed)) { 456 switch (to_cycles(mem->speed)) {
419 case 0: break; 457 case 0:
420 case 1: word |= I365_MEM_WS0; break; 458 break;
421 case 2: word |= I365_MEM_WS1; break; 459 case 1:
422 default: word |= I365_MEM_WS1 | I365_MEM_WS0; break; 460 word |= I365_MEM_WS0;
461 break;
462 case 2:
463 word |= I365_MEM_WS1;
464 break;
465 default:
466 word |= I365_MEM_WS1 | I365_MEM_WS0;
467 break;
423 } 468 }
424 exca_writew(socket, I365_MEM(map) + I365_W_STOP, word); 469 exca_writew(socket, I365_MEM(map) + I365_W_STOP, word);
425 470
@@ -547,9 +592,9 @@ static int yenta_sock_suspend(struct pcmcia_socket *sock)
547 * max 4 MB, min 16 kB. We try very hard to not get below 592 * max 4 MB, min 16 kB. We try very hard to not get below
548 * the "ACC" values, though. 593 * the "ACC" values, though.
549 */ 594 */
550#define BRIDGE_MEM_MAX 4*1024*1024 595#define BRIDGE_MEM_MAX (4*1024*1024)
551#define BRIDGE_MEM_ACC 128*1024 596#define BRIDGE_MEM_ACC (128*1024)
552#define BRIDGE_MEM_MIN 16*1024 597#define BRIDGE_MEM_MIN (16*1024)
553 598
554#define BRIDGE_IO_MAX 512 599#define BRIDGE_IO_MAX 512
555#define BRIDGE_IO_ACC 256 600#define BRIDGE_IO_ACC 256
@@ -574,7 +619,7 @@ static int yenta_search_one_res(struct resource *root, struct resource *res,
574 int i; 619 int i;
575 size = BRIDGE_MEM_MAX; 620 size = BRIDGE_MEM_MAX;
576 if (size > avail/8) { 621 if (size > avail/8) {
577 size=(avail+1)/8; 622 size = (avail+1)/8;
578 /* round size down to next power of 2 */ 623 /* round size down to next power of 2 */
579 i = 0; 624 i = 0;
580 while ((size /= 2) != 0) 625 while ((size /= 2) != 0)
@@ -590,7 +635,7 @@ static int yenta_search_one_res(struct resource *root, struct resource *res,
590 635
591 do { 636 do {
592 if (allocate_resource(root, res, size, start, end, align, 637 if (allocate_resource(root, res, size, start, end, align,
593 NULL, NULL)==0) { 638 NULL, NULL) == 0) {
594 return 1; 639 return 1;
595 } 640 }
596 size = size/2; 641 size = size/2;
@@ -605,8 +650,8 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
605 u32 min) 650 u32 min)
606{ 651{
607 int i; 652 int i;
608 for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) { 653 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
609 struct resource * root = socket->dev->bus->resource[i]; 654 struct resource *root = socket->dev->bus->resource[i];
610 if (!root) 655 if (!root)
611 continue; 656 continue;
612 657
@@ -704,7 +749,7 @@ static void yenta_allocate_resources(struct yenta_socket *socket)
704static void yenta_free_resources(struct yenta_socket *socket) 749static void yenta_free_resources(struct yenta_socket *socket)
705{ 750{
706 int i; 751 int i;
707 for (i=0;i<4;i++) { 752 for (i = 0; i < 4; i++) {
708 struct resource *res; 753 struct resource *res;
709 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i; 754 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i;
710 if (res->start != 0 && res->end != 0) 755 if (res->start != 0 && res->end != 0)
@@ -726,7 +771,7 @@ static void __devexit yenta_close(struct pci_dev *dev)
726 771
727 /* we don't want a dying socket registered */ 772 /* we don't want a dying socket registered */
728 pcmcia_unregister_socket(&sock->socket); 773 pcmcia_unregister_socket(&sock->socket);
729 774
730 /* Disable all events so we don't die in an IRQ storm */ 775 /* Disable all events so we don't die in an IRQ storm */
731 cb_writel(sock, CB_SOCKET_MASK, 0x0); 776 cb_writel(sock, CB_SOCKET_MASK, 0x0);
732 exca_writeb(sock, I365_CSCINT, 0); 777 exca_writeb(sock, I365_CSCINT, 0);
@@ -898,7 +943,7 @@ static irqreturn_t yenta_probe_handler(int irq, void *dev_id)
898{ 943{
899 struct yenta_socket *socket = (struct yenta_socket *) dev_id; 944 struct yenta_socket *socket = (struct yenta_socket *) dev_id;
900 u8 csc; 945 u8 csc;
901 u32 cb_event; 946 u32 cb_event;
902 947
903 /* Clear interrupt status for the event */ 948 /* Clear interrupt status for the event */
904 cb_event = cb_readl(socket, CB_SOCKET_EVENT); 949 cb_event = cb_readl(socket, CB_SOCKET_EVENT);
@@ -1019,7 +1064,7 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1019{ 1064{
1020 struct list_head *tmp; 1065 struct list_head *tmp;
1021 unsigned char upper_limit; 1066 unsigned char upper_limit;
1022 /* 1067 /*
1023 * We only check and fix the parent bridge: All systems which need 1068 * We only check and fix the parent bridge: All systems which need
1024 * this fixup that have been reviewed are laptops and the only bridge 1069 * this fixup that have been reviewed are laptops and the only bridge
1025 * which needed fixing was the parent bridge of the CardBus bridge: 1070 * which needed fixing was the parent bridge of the CardBus bridge:
@@ -1038,7 +1083,7 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1038 1083
1039 /* check the bus ranges of all silbling bridges to prevent overlap */ 1084 /* check the bus ranges of all silbling bridges to prevent overlap */
1040 list_for_each(tmp, &bridge_to_fix->parent->children) { 1085 list_for_each(tmp, &bridge_to_fix->parent->children) {
1041 struct pci_bus * silbling = pci_bus_b(tmp); 1086 struct pci_bus *silbling = pci_bus_b(tmp);
1042 /* 1087 /*
1043 * If the silbling has a higher secondary bus number 1088 * If the silbling has a higher secondary bus number
1044 * and it's secondary is equal or smaller than our 1089 * and it's secondary is equal or smaller than our
@@ -1083,7 +1128,7 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge)
1083 * interrupt, and that we can map the cardbus area. Fill in the 1128 * interrupt, and that we can map the cardbus area. Fill in the
1084 * socket information structure.. 1129 * socket information structure..
1085 */ 1130 */
1086static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_id *id) 1131static int __devinit yenta_probe(struct pci_dev *dev, const struct pci_device_id *id)
1087{ 1132{
1088 struct yenta_socket *socket; 1133 struct yenta_socket *socket;
1089 int ret; 1134 int ret;
@@ -1302,7 +1347,7 @@ static struct dev_pm_ops yenta_pm_ops = {
1302#define YENTA_PM_OPS NULL 1347#define YENTA_PM_OPS NULL
1303#endif 1348#endif
1304 1349
1305#define CB_ID(vend,dev,type) \ 1350#define CB_ID(vend, dev, type) \
1306 { \ 1351 { \
1307 .vendor = vend, \ 1352 .vendor = vend, \
1308 .device = dev, \ 1353 .device = dev, \
@@ -1313,7 +1358,7 @@ static struct dev_pm_ops yenta_pm_ops = {
1313 .driver_data = CARDBUS_TYPE_##type, \ 1358 .driver_data = CARDBUS_TYPE_##type, \
1314 } 1359 }
1315 1360
1316static struct pci_device_id yenta_table [] = { 1361static struct pci_device_id yenta_table[] = {
1317 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1031, TI), 1362 CB_ID(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1031, TI),
1318 1363
1319 /* 1364 /*
@@ -1403,13 +1448,13 @@ static struct pci_driver yenta_cardbus_driver = {
1403 1448
1404static int __init yenta_socket_init(void) 1449static int __init yenta_socket_init(void)
1405{ 1450{
1406 return pci_register_driver (&yenta_cardbus_driver); 1451 return pci_register_driver(&yenta_cardbus_driver);
1407} 1452}
1408 1453
1409 1454
1410static void __exit yenta_socket_exit (void) 1455static void __exit yenta_socket_exit(void)
1411{ 1456{
1412 pci_unregister_driver (&yenta_cardbus_driver); 1457 pci_unregister_driver(&yenta_cardbus_driver);
1413} 1458}
1414 1459
1415 1460