diff options
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/Kconfig | 2 | ||||
-rw-r--r-- | drivers/pcmcia/at91_cf.c | 51 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 22 | ||||
-rw-r--r-- | drivers/pcmcia/i82365.c | 7 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 23 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 18 | ||||
-rw-r--r-- | drivers/pcmcia/pd6729.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_sharpsl.c | 8 |
8 files changed, 77 insertions, 56 deletions
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index cba6c9eef28e..61cb4b29f55c 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -250,7 +250,7 @@ config M32R_CFC_NUM | |||
250 | 250 | ||
251 | config PCMCIA_VRC4171 | 251 | config PCMCIA_VRC4171 |
252 | tristate "NEC VRC4171 Card Controllers support" | 252 | tristate "NEC VRC4171 Card Controllers support" |
253 | depends on VRC4171 && PCMCIA | 253 | depends on CPU_VR41XX && ISA && PCMCIA |
254 | 254 | ||
255 | config PCMCIA_VRC4173 | 255 | config PCMCIA_VRC4173 |
256 | tristate "NEC VRC4173 CARDU support" | 256 | tristate "NEC VRC4173 CARDU support" |
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c index 67cc5f7d0c90..a4d50940ebeb 100644 --- a/drivers/pcmcia/at91_cf.c +++ b/drivers/pcmcia/at91_cf.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #include <asm/arch/gpio.h> | 28 | #include <asm/arch/gpio.h> |
29 | 29 | ||
30 | 30 | ||
31 | #define CF_SIZE 0x30000000 /* CS5+CS6: unavailable */ | ||
32 | |||
33 | /* | 31 | /* |
34 | * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; | 32 | * A0..A10 work in each range; A23 indicates I/O space; A25 is CFRNW; |
35 | * some other bit in {A24,A22..A11} is nREG to flag memory access | 33 | * some other bit in {A24,A22..A11} is nREG to flag memory access |
@@ -76,7 +74,8 @@ static irqreturn_t at91_cf_irq(int irq, void *_cf, struct pt_regs *r) | |||
76 | /* kick pccard as needed */ | 74 | /* kick pccard as needed */ |
77 | if (present != cf->present) { | 75 | if (present != cf->present) { |
78 | cf->present = present; | 76 | cf->present = present; |
79 | pr_debug("%s: card %s\n", driver_name, present ? "present" : "gone"); | 77 | pr_debug("%s: card %s\n", driver_name, |
78 | present ? "present" : "gone"); | ||
80 | pcmcia_parse_events(&cf->socket, SS_DETECT); | 79 | pcmcia_parse_events(&cf->socket, SS_DETECT); |
81 | } | 80 | } |
82 | } | 81 | } |
@@ -93,7 +92,7 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp) | |||
93 | 92 | ||
94 | cf = container_of(s, struct at91_cf_socket, socket); | 93 | cf = container_of(s, struct at91_cf_socket, socket); |
95 | 94 | ||
96 | /* NOTE: we assume 3VCARD, not XVCARD... */ | 95 | /* NOTE: CF is always 3VCARD */ |
97 | if (at91_cf_present(cf)) { | 96 | if (at91_cf_present(cf)) { |
98 | int rdy = cf->board->irq_pin; /* RDY/nIRQ */ | 97 | int rdy = cf->board->irq_pin; /* RDY/nIRQ */ |
99 | int vcc = cf->board->vcc_pin; | 98 | int vcc = cf->board->vcc_pin; |
@@ -109,7 +108,8 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp) | |||
109 | return 0; | 108 | return 0; |
110 | } | 109 | } |
111 | 110 | ||
112 | static int at91_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) | 111 | static int |
112 | at91_cf_set_socket(struct pcmcia_socket *sock, struct socket_state_t *s) | ||
113 | { | 113 | { |
114 | struct at91_cf_socket *cf; | 114 | struct at91_cf_socket *cf; |
115 | 115 | ||
@@ -184,7 +184,8 @@ static int at91_cf_set_io_map(struct pcmcia_socket *s, struct pccard_io_map *io) | |||
184 | } | 184 | } |
185 | 185 | ||
186 | /* pcmcia layer maps/unmaps mem regions */ | 186 | /* pcmcia layer maps/unmaps mem regions */ |
187 | static int at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map) | 187 | static int |
188 | at91_cf_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *map) | ||
188 | { | 189 | { |
189 | struct at91_cf_socket *cf; | 190 | struct at91_cf_socket *cf; |
190 | 191 | ||
@@ -218,12 +219,17 @@ static int __init at91_cf_probe(struct device *dev) | |||
218 | struct at91_cf_socket *cf; | 219 | struct at91_cf_socket *cf; |
219 | struct at91_cf_data *board = dev->platform_data; | 220 | struct at91_cf_data *board = dev->platform_data; |
220 | struct platform_device *pdev = to_platform_device(dev); | 221 | struct platform_device *pdev = to_platform_device(dev); |
222 | struct resource *io; | ||
221 | unsigned int csa; | 223 | unsigned int csa; |
222 | int status; | 224 | int status; |
223 | 225 | ||
224 | if (!board || !board->det_pin || !board->rst_pin) | 226 | if (!board || !board->det_pin || !board->rst_pin) |
225 | return -ENODEV; | 227 | return -ENODEV; |
226 | 228 | ||
229 | io = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
230 | if (!io) | ||
231 | return -ENODEV; | ||
232 | |||
227 | cf = kcalloc(1, sizeof *cf, GFP_KERNEL); | 233 | cf = kcalloc(1, sizeof *cf, GFP_KERNEL); |
228 | if (!cf) | 234 | if (!cf) |
229 | return -ENOMEM; | 235 | return -ENOMEM; |
@@ -250,10 +256,14 @@ static int __init at91_cf_probe(struct device *dev) | |||
250 | * REVISIT: these timings are in terms of MCK cycles, so | 256 | * REVISIT: these timings are in terms of MCK cycles, so |
251 | * when MCK changes (cpufreq etc) so must these values... | 257 | * when MCK changes (cpufreq etc) so must these values... |
252 | */ | 258 | */ |
253 | at91_sys_write(AT91_SMC_CSR(4), AT91_SMC_ACSS_STD | AT91_SMC_DBW_16 | AT91_SMC_BAT | AT91_SMC_WSEN | 259 | at91_sys_write(AT91_SMC_CSR(4), |
254 | | AT91_SMC_NWS_(32) /* wait states */ | 260 | AT91_SMC_ACSS_STD |
255 | | AT91_SMC_RWSETUP_(6) /* setup time */ | 261 | | AT91_SMC_DBW_16 |
256 | | AT91_SMC_RWHOLD_(4) /* hold time */ | 262 | | AT91_SMC_BAT |
263 | | AT91_SMC_WSEN | ||
264 | | AT91_SMC_NWS_(32) /* wait states */ | ||
265 | | AT91_SMC_RWSETUP_(6) /* setup time */ | ||
266 | | AT91_SMC_RWHOLD_(4) /* hold time */ | ||
257 | ); | 267 | ); |
258 | 268 | ||
259 | /* must be a GPIO; ergo must trigger on both edges */ | 269 | /* must be a GPIO; ergo must trigger on both edges */ |
@@ -274,8 +284,7 @@ static int __init at91_cf_probe(struct device *dev) | |||
274 | if (status < 0) | 284 | if (status < 0) |
275 | goto fail0a; | 285 | goto fail0a; |
276 | cf->socket.pci_irq = board->irq_pin; | 286 | cf->socket.pci_irq = board->irq_pin; |
277 | } | 287 | } else |
278 | else | ||
279 | cf->socket.pci_irq = NR_IRQS + 1; | 288 | cf->socket.pci_irq = NR_IRQS + 1; |
280 | 289 | ||
281 | /* pcmcia layer only remaps "real" memory not iospace */ | 290 | /* pcmcia layer only remaps "real" memory not iospace */ |
@@ -284,7 +293,8 @@ static int __init at91_cf_probe(struct device *dev) | |||
284 | goto fail1; | 293 | goto fail1; |
285 | 294 | ||
286 | /* reserve CS4, CS5, and CS6 regions; but use just CS4 */ | 295 | /* reserve CS4, CS5, and CS6 regions; but use just CS4 */ |
287 | if (!request_mem_region(AT91_CF_BASE, CF_SIZE, driver_name)) | 296 | if (!request_mem_region(io->start, io->end + 1 - io->start, |
297 | driver_name)) | ||
288 | goto fail1; | 298 | goto fail1; |
289 | 299 | ||
290 | pr_info("%s: irqs det #%d, io #%d\n", driver_name, | 300 | pr_info("%s: irqs det #%d, io #%d\n", driver_name, |
@@ -297,7 +307,7 @@ static int __init at91_cf_probe(struct device *dev) | |||
297 | cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP | 307 | cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP |
298 | | SS_CAP_MEM_ALIGN; | 308 | | SS_CAP_MEM_ALIGN; |
299 | cf->socket.map_size = SZ_2K; | 309 | cf->socket.map_size = SZ_2K; |
300 | cf->socket.io[0].NumPorts = SZ_2K; | 310 | cf->socket.io[0].res = io; |
301 | 311 | ||
302 | status = pcmcia_register_socket(&cf->socket); | 312 | status = pcmcia_register_socket(&cf->socket); |
303 | if (status < 0) | 313 | if (status < 0) |
@@ -307,7 +317,7 @@ static int __init at91_cf_probe(struct device *dev) | |||
307 | 317 | ||
308 | fail2: | 318 | fail2: |
309 | iounmap((void __iomem *) cf->socket.io_offset); | 319 | iounmap((void __iomem *) cf->socket.io_offset); |
310 | release_mem_region(AT91_CF_BASE, CF_SIZE); | 320 | release_mem_region(io->start, io->end + 1 - io->start); |
311 | fail1: | 321 | fail1: |
312 | if (board->irq_pin) | 322 | if (board->irq_pin) |
313 | free_irq(board->irq_pin, cf); | 323 | free_irq(board->irq_pin, cf); |
@@ -321,14 +331,15 @@ fail0: | |||
321 | 331 | ||
322 | static int __exit at91_cf_remove(struct device *dev) | 332 | static int __exit at91_cf_remove(struct device *dev) |
323 | { | 333 | { |
324 | struct at91_cf_socket *cf = dev_get_drvdata(dev); | 334 | struct at91_cf_socket *cf = dev_get_drvdata(dev); |
325 | unsigned int csa; | 335 | struct resource *io = cf->socket.io[0].res; |
336 | unsigned int csa; | ||
326 | 337 | ||
327 | pcmcia_unregister_socket(&cf->socket); | 338 | pcmcia_unregister_socket(&cf->socket); |
328 | free_irq(cf->board->irq_pin, cf); | 339 | free_irq(cf->board->irq_pin, cf); |
329 | free_irq(cf->board->det_pin, cf); | 340 | free_irq(cf->board->det_pin, cf); |
330 | iounmap((void __iomem *) cf->socket.io_offset); | 341 | iounmap((void __iomem *) cf->socket.io_offset); |
331 | release_mem_region(AT91_CF_BASE, CF_SIZE); | 342 | release_mem_region(io->start, io->end + 1 - io->start); |
332 | 343 | ||
333 | csa = at91_sys_read(AT91_EBI_CSA); | 344 | csa = at91_sys_read(AT91_EBI_CSA); |
334 | at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A); | 345 | at91_sys_write(AT91_EBI_CSA, csa & ~AT91_EBI_CS4A); |
@@ -342,8 +353,8 @@ static struct device_driver at91_cf_driver = { | |||
342 | .bus = &platform_bus_type, | 353 | .bus = &platform_bus_type, |
343 | .probe = at91_cf_probe, | 354 | .probe = at91_cf_probe, |
344 | .remove = __exit_p(at91_cf_remove), | 355 | .remove = __exit_p(at91_cf_remove), |
345 | .suspend = pcmcia_socket_dev_suspend, | 356 | .suspend = pcmcia_socket_dev_suspend, |
346 | .resume = pcmcia_socket_dev_resume, | 357 | .resume = pcmcia_socket_dev_resume, |
347 | }; | 358 | }; |
348 | 359 | ||
349 | /*--------------------------------------------------------------------------*/ | 360 | /*--------------------------------------------------------------------------*/ |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index ae10d1eed65e..74b3124e8247 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -236,11 +236,11 @@ static void pcmcia_check_driver(struct pcmcia_driver *p_drv) | |||
236 | /** | 236 | /** |
237 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken | 237 | * pcmcia_load_firmware - load CIS from userspace if device-provided is broken |
238 | * @dev - the pcmcia device which needs a CIS override | 238 | * @dev - the pcmcia device which needs a CIS override |
239 | * @filename - requested filename in /lib/firmware/cis/ | 239 | * @filename - requested filename in /lib/firmware/ |
240 | * | 240 | * |
241 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if | 241 | * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if |
242 | * the one provided by the card is broken. The firmware files reside in | 242 | * the one provided by the card is broken. The firmware files reside in |
243 | * /lib/firmware/cis/ in userspace. | 243 | * /lib/firmware/ in userspace. |
244 | */ | 244 | */ |
245 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) | 245 | static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) |
246 | { | 246 | { |
@@ -298,9 +298,6 @@ static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filenam | |||
298 | * | 298 | * |
299 | * Registers a PCMCIA driver with the PCMCIA bus core. | 299 | * Registers a PCMCIA driver with the PCMCIA bus core. |
300 | */ | 300 | */ |
301 | static int pcmcia_device_probe(struct device *dev); | ||
302 | static int pcmcia_device_remove(struct device * dev); | ||
303 | |||
304 | int pcmcia_register_driver(struct pcmcia_driver *driver) | 301 | int pcmcia_register_driver(struct pcmcia_driver *driver) |
305 | { | 302 | { |
306 | if (!driver) | 303 | if (!driver) |
@@ -400,7 +397,7 @@ static int pcmcia_device_probe(struct device * dev) | |||
400 | * call which will then check whether there are two | 397 | * call which will then check whether there are two |
401 | * pseudo devices, and if not, add the second one. | 398 | * pseudo devices, and if not, add the second one. |
402 | */ | 399 | */ |
403 | did = (struct pcmcia_device_id *) p_dev->dev.driver_data; | 400 | did = p_dev->dev.driver_data; |
404 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 401 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
405 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) | 402 | (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) |
406 | pcmcia_add_pseudo_device(p_dev->socket); | 403 | pcmcia_add_pseudo_device(p_dev->socket); |
@@ -448,7 +445,6 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le | |||
448 | return; | 445 | return; |
449 | } | 446 | } |
450 | 447 | ||
451 | |||
452 | static int pcmcia_device_remove(struct device * dev) | 448 | static int pcmcia_device_remove(struct device * dev) |
453 | { | 449 | { |
454 | struct pcmcia_device *p_dev; | 450 | struct pcmcia_device *p_dev; |
@@ -463,7 +459,7 @@ static int pcmcia_device_remove(struct device * dev) | |||
463 | * pseudo multi-function card, we need to unbind | 459 | * pseudo multi-function card, we need to unbind |
464 | * all devices | 460 | * all devices |
465 | */ | 461 | */ |
466 | did = (struct pcmcia_device_id *) p_dev->dev.driver_data; | 462 | did = p_dev->dev.driver_data; |
467 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && | 463 | if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && |
468 | (p_dev->socket->device_count != 0) && | 464 | (p_dev->socket->device_count != 0) && |
469 | (p_dev->device_no == 0)) | 465 | (p_dev->device_no == 0)) |
@@ -476,6 +472,8 @@ static int pcmcia_device_remove(struct device * dev) | |||
476 | if (p_drv->remove) | 472 | if (p_drv->remove) |
477 | p_drv->remove(p_dev); | 473 | p_drv->remove(p_dev); |
478 | 474 | ||
475 | p_dev->dev_node = NULL; | ||
476 | |||
479 | /* check for proper unloading */ | 477 | /* check for proper unloading */ |
480 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) | 478 | if (p_dev->_irq || p_dev->_io || p_dev->_locked) |
481 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", | 479 | printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", |
@@ -628,7 +626,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f | |||
628 | } | 626 | } |
629 | 627 | ||
630 | /* Add to the list in pcmcia_bus_socket */ | 628 | /* Add to the list in pcmcia_bus_socket */ |
631 | list_add_tail(&p_dev->socket_device_list, &s->devices_list); | 629 | list_add(&p_dev->socket_device_list, &s->devices_list); |
632 | 630 | ||
633 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); | 631 | spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); |
634 | 632 | ||
@@ -1145,6 +1143,12 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) | |||
1145 | { | 1143 | { |
1146 | struct pcmcia_socket *s = pcmcia_get_socket(skt); | 1144 | struct pcmcia_socket *s = pcmcia_get_socket(skt); |
1147 | 1145 | ||
1146 | if (!s) { | ||
1147 | printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ | ||
1148 | "failed, event 0x%x lost!\n", skt, event); | ||
1149 | return -ENODEV; | ||
1150 | } | ||
1151 | |||
1148 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", | 1152 | ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", |
1149 | event, priority, skt); | 1153 | event, priority, skt); |
1150 | 1154 | ||
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index bd0308e89815..a2f05f485156 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
@@ -509,7 +509,8 @@ static irqreturn_t i365_count_irq(int irq, void *dev, struct pt_regs *regs) | |||
509 | static u_int __init test_irq(u_short sock, int irq) | 509 | static u_int __init test_irq(u_short sock, int irq) |
510 | { | 510 | { |
511 | debug(2, " testing ISA irq %d\n", irq); | 511 | debug(2, " testing ISA irq %d\n", irq); |
512 | if (request_irq(irq, i365_count_irq, 0, "scan", i365_count_irq) != 0) | 512 | if (request_irq(irq, i365_count_irq, SA_PROBEIRQ, "scan", |
513 | i365_count_irq) != 0) | ||
513 | return 1; | 514 | return 1; |
514 | irq_hits = 0; irq_sock = sock; | 515 | irq_hits = 0; irq_sock = sock; |
515 | msleep(10); | 516 | msleep(10); |
@@ -561,7 +562,7 @@ static u_int __init isa_scan(u_short sock, u_int mask0) | |||
561 | } else { | 562 | } else { |
562 | /* Fallback: just find interrupts that aren't in use */ | 563 | /* Fallback: just find interrupts that aren't in use */ |
563 | for (i = 0; i < 16; i++) | 564 | for (i = 0; i < 16; i++) |
564 | if ((mask0 & (1 << i)) && (_check_irq(i, 0) == 0)) | 565 | if ((mask0 & (1 << i)) && (_check_irq(i, SA_PROBEIRQ) == 0)) |
565 | mask1 |= (1 << i); | 566 | mask1 |= (1 << i); |
566 | printk("default"); | 567 | printk("default"); |
567 | /* If scan failed, default to polled status */ | 568 | /* If scan failed, default to polled status */ |
@@ -725,7 +726,7 @@ static void __init add_pcic(int ns, int type) | |||
725 | u_int cs_mask = mask & ((cs_irq) ? (1<<cs_irq) : ~(1<<12)); | 726 | u_int cs_mask = mask & ((cs_irq) ? (1<<cs_irq) : ~(1<<12)); |
726 | for (cs_irq = 15; cs_irq > 0; cs_irq--) | 727 | for (cs_irq = 15; cs_irq > 0; cs_irq--) |
727 | if ((cs_mask & (1 << cs_irq)) && | 728 | if ((cs_mask & (1 << cs_irq)) && |
728 | (_check_irq(cs_irq, 0) == 0)) | 729 | (_check_irq(cs_irq, SA_PROBEIRQ) == 0)) |
729 | break; | 730 | break; |
730 | if (cs_irq) { | 731 | if (cs_irq) { |
731 | grab_irq = 1; | 732 | grab_irq = 1; |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index c53db7ceda5e..738b1ef595a3 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -426,7 +426,7 @@ static int ds_open(struct inode *inode, struct file *file) | |||
426 | 426 | ||
427 | if (!warning_printed) { | 427 | if (!warning_printed) { |
428 | printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " | 428 | printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " |
429 | "usage.\n"); | 429 | "usage from process: %s.\n", current->comm); |
430 | printk(KERN_INFO "pcmcia: This interface will soon be removed from " | 430 | printk(KERN_INFO "pcmcia: This interface will soon be removed from " |
431 | "the kernel; please expect breakage unless you upgrade " | 431 | "the kernel; please expect breakage unless you upgrade " |
432 | "to new tools.\n"); | 432 | "to new tools.\n"); |
@@ -601,8 +601,12 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
601 | ret = CS_BAD_ARGS; | 601 | ret = CS_BAD_ARGS; |
602 | else { | 602 | else { |
603 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); | 603 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); |
604 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); | 604 | if (p_dev == NULL) |
605 | pcmcia_put_dev(p_dev); | 605 | ret = CS_BAD_ARGS; |
606 | else { | ||
607 | ret = pccard_get_configuration_info(s, p_dev, &buf->config); | ||
608 | pcmcia_put_dev(p_dev); | ||
609 | } | ||
606 | } | 610 | } |
607 | break; | 611 | break; |
608 | case DS_GET_FIRST_TUPLE: | 612 | case DS_GET_FIRST_TUPLE: |
@@ -632,8 +636,12 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
632 | ret = CS_BAD_ARGS; | 636 | ret = CS_BAD_ARGS; |
633 | else { | 637 | else { |
634 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); | 638 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); |
635 | ret = pccard_get_status(s, p_dev, &buf->status); | 639 | if (p_dev == NULL) |
636 | pcmcia_put_dev(p_dev); | 640 | ret = CS_BAD_ARGS; |
641 | else { | ||
642 | ret = pccard_get_status(s, p_dev, &buf->status); | ||
643 | pcmcia_put_dev(p_dev); | ||
644 | } | ||
637 | } | 645 | } |
638 | break; | 646 | break; |
639 | case DS_VALIDATE_CIS: | 647 | case DS_VALIDATE_CIS: |
@@ -665,9 +673,10 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
665 | if (!(buf->conf_reg.Function && | 673 | if (!(buf->conf_reg.Function && |
666 | (buf->conf_reg.Function >= s->functions))) { | 674 | (buf->conf_reg.Function >= s->functions))) { |
667 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); | 675 | struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); |
668 | if (p_dev) | 676 | if (p_dev) { |
669 | ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); | 677 | ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); |
670 | pcmcia_put_dev(p_dev); | 678 | pcmcia_put_dev(p_dev); |
679 | } | ||
671 | } | 680 | } |
672 | break; | 681 | break; |
673 | case DS_GET_FIRST_REGION: | 682 | case DS_GET_FIRST_REGION: |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 45063b4e5b78..3131bb0a0095 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -88,7 +88,6 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base, | |||
88 | } | 88 | } |
89 | if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) { | 89 | if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) { |
90 | *base = s->io_offset | (*base & 0x0fff); | 90 | *base = s->io_offset | (*base & 0x0fff); |
91 | s->io[0].res->flags = (s->io[0].res->flags & ~IORESOURCE_BITS) | (attr & IORESOURCE_BITS); | ||
92 | return 0; | 91 | return 0; |
93 | } | 92 | } |
94 | /* Check for an already-allocated window that must conflict with | 93 | /* Check for an already-allocated window that must conflict with |
@@ -209,7 +208,6 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, | |||
209 | if (!(s->state & SOCKET_PRESENT)) | 208 | if (!(s->state & SOCKET_PRESENT)) |
210 | return CS_NO_CARD; | 209 | return CS_NO_CARD; |
211 | 210 | ||
212 | config->Function = p_dev->func; | ||
213 | 211 | ||
214 | #ifdef CONFIG_CARDBUS | 212 | #ifdef CONFIG_CARDBUS |
215 | if (s->state & SOCKET_CARDBUS) { | 213 | if (s->state & SOCKET_CARDBUS) { |
@@ -223,14 +221,22 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, | |||
223 | config->AssignedIRQ = s->irq.AssignedIRQ; | 221 | config->AssignedIRQ = s->irq.AssignedIRQ; |
224 | if (config->AssignedIRQ) | 222 | if (config->AssignedIRQ) |
225 | config->Attributes |= CONF_ENABLE_IRQ; | 223 | config->Attributes |= CONF_ENABLE_IRQ; |
226 | config->BasePort1 = s->io[0].res->start; | 224 | if (s->io[0].res) { |
227 | config->NumPorts1 = s->io[0].res->end - config->BasePort1 + 1; | 225 | config->BasePort1 = s->io[0].res->start; |
226 | config->NumPorts1 = s->io[0].res->end - config->BasePort1 + 1; | ||
227 | } | ||
228 | } | 228 | } |
229 | return CS_SUCCESS; | 229 | return CS_SUCCESS; |
230 | } | 230 | } |
231 | #endif | 231 | #endif |
232 | 232 | ||
233 | c = (p_dev) ? p_dev->function_config : NULL; | 233 | if (p_dev) { |
234 | c = p_dev->function_config; | ||
235 | config->Function = p_dev->func; | ||
236 | } else { | ||
237 | c = NULL; | ||
238 | config->Function = 0; | ||
239 | } | ||
234 | 240 | ||
235 | if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { | 241 | if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { |
236 | config->Attributes = 0; | 242 | config->Attributes = 0; |
@@ -947,7 +953,5 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) { | |||
947 | pcmcia_release_irq(p_dev, &p_dev->irq); | 953 | pcmcia_release_irq(p_dev, &p_dev->irq); |
948 | if (&p_dev->win) | 954 | if (&p_dev->win) |
949 | pcmcia_release_window(p_dev->win); | 955 | pcmcia_release_window(p_dev->win); |
950 | |||
951 | p_dev->dev_node = NULL; | ||
952 | } | 956 | } |
953 | EXPORT_SYMBOL(pcmcia_disable_device); | 957 | EXPORT_SYMBOL(pcmcia_disable_device); |
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 16d1ea7b0a18..247ab837f841 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c | |||
@@ -589,7 +589,7 @@ static int pd6729_check_irq(int irq, int flags) | |||
589 | return 0; | 589 | return 0; |
590 | } | 590 | } |
591 | 591 | ||
592 | static u_int __init pd6729_isa_scan(void) | 592 | static u_int __devinit pd6729_isa_scan(void) |
593 | { | 593 | { |
594 | u_int mask0, mask = 0; | 594 | u_int mask0, mask = 0; |
595 | int i; | 595 | int i; |
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c index fd3647368955..b7b9e149c5b9 100644 --- a/drivers/pcmcia/pxa2xx_sharpsl.c +++ b/drivers/pcmcia/pxa2xx_sharpsl.c | |||
@@ -26,14 +26,6 @@ | |||
26 | #include "soc_common.h" | 26 | #include "soc_common.h" |
27 | 27 | ||
28 | #define NO_KEEP_VS 0x0001 | 28 | #define NO_KEEP_VS 0x0001 |
29 | |||
30 | /* PCMCIA to Scoop linkage | ||
31 | |||
32 | There is no easy way to link multiple scoop devices into one | ||
33 | single entity for the pxa2xx_pcmcia device so this structure | ||
34 | is used which is setup by the platform code | ||
35 | */ | ||
36 | struct scoop_pcmcia_config *platform_scoop_config; | ||
37 | #define SCOOP_DEV platform_scoop_config->devs | 29 | #define SCOOP_DEV platform_scoop_config->devs |
38 | 30 | ||
39 | static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt) | 31 | static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt) |