Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-fixes-2.6:
[PATCH] PCMCIA: fix __must_check warnings
[PATCH] PCMCIA: handle sysfs, PCI errors
[PATCH] Export soc_common_drv_pcmcia_remove to allow modular PCMCIA.
[PATCH] ioremap balanced with iounmap for drivers/pcmcia
[PATCH] pcmcia: au1000_generic fix
[PATCH] i82092: wire up errors from pci_register_driver()
[PATCH] CONFIG_PM=n slim: drivers/pcmcia/*
[PATCH] pcmcia/ds: driver layer error checking
[PATCH] pcmcia: update alloc_io_space for conflict checking for multifunction PC card
[PATCH] pcmcia: add more IDs to hostap_cs.c
[PATCH] pcmcia: at91_cf update

+105 -48
+7
drivers/net/wireless/hostap/hostap_cs.c
··· 887 PCMCIA_DEVICE_PROD_ID123( 888 "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02", 889 0xc7b8df9d, 0x1700d087, 0x4b74baa0), 890 PCMCIA_DEVICE_NULL 891 }; 892 MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
··· 887 PCMCIA_DEVICE_PROD_ID123( 888 "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02", 889 0xc7b8df9d, 0x1700d087, 0x4b74baa0), 890 + PCMCIA_DEVICE_PROD_ID123( 891 + "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio", 892 + "Ver. 1.00", 893 + 0x5cd01705, 0x4271660f, 0x9d08ee12), 894 + PCMCIA_DEVICE_PROD_ID123( 895 + "corega", "WL PCCL-11", "ISL37300P", 896 + 0xa21501a, 0x59868926, 0xc9049a39), 897 PCMCIA_DEVICE_NULL 898 }; 899 MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
+9 -19
drivers/pcmcia/at91_cf.c
··· 241 csa = at91_sys_read(AT91_EBI_CSA); 242 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH); 243 244 - /* force poweron defaults for these pins ... */ 245 - (void) at91_set_A_periph(AT91_PIN_PC9, 0); /* A25/CFRNW */ 246 - (void) at91_set_A_periph(AT91_PIN_PC10, 0); /* NCS4/CFCS */ 247 - (void) at91_set_A_periph(AT91_PIN_PC11, 0); /* NCS5/CFCE1 */ 248 - (void) at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */ 249 - 250 /* nWAIT is _not_ a default setting */ 251 (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */ 252 ··· 310 return 0; 311 312 fail2: 313 - iounmap((void __iomem *) cf->socket.io_offset); 314 release_mem_region(io->start, io->end + 1 - io->start); 315 fail1: 316 if (board->irq_pin) 317 free_irq(board->irq_pin, cf); 318 fail0a: 319 free_irq(board->det_pin, cf); 320 device_init_wakeup(&pdev->dev, 0); 321 fail0: ··· 356 struct at91_cf_data *board = cf->board; 357 358 pcmcia_socket_dev_suspend(&pdev->dev, mesg); 359 - if (device_may_wakeup(&pdev->dev)) 360 enable_irq_wake(board->det_pin); 361 - else { 362 disable_irq_wake(board->det_pin); 363 - disable_irq(board->det_pin); 364 } 365 - if (board->irq_pin) 366 - disable_irq(board->irq_pin); 367 return 0; 368 } 369 370 static int at91_cf_resume(struct platform_device *pdev) 371 { 372 - struct at91_cf_socket *cf = platform_get_drvdata(pdev); 373 - struct at91_cf_data *board = cf->board; 374 - 375 - if (board->irq_pin) 376 - enable_irq(board->irq_pin); 377 - if (!device_may_wakeup(&pdev->dev)) 378 - enable_irq(board->det_pin); 379 pcmcia_socket_dev_resume(&pdev->dev); 380 return 0; 381 }
··· 241 csa = at91_sys_read(AT91_EBI_CSA); 242 at91_sys_write(AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH); 243 244 /* nWAIT is _not_ a default setting */ 245 (void) at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */ 246 ··· 316 return 0; 317 318 fail2: 319 release_mem_region(io->start, io->end + 1 - io->start); 320 fail1: 321 + if (cf->socket.io_offset) 322 + iounmap((void __iomem *) cf->socket.io_offset); 323 if (board->irq_pin) 324 free_irq(board->irq_pin, cf); 325 fail0a: 326 + device_init_wakeup(&pdev->dev, 0); 327 free_irq(board->det_pin, cf); 328 device_init_wakeup(&pdev->dev, 0); 329 fail0: ··· 360 struct at91_cf_data *board = cf->board; 361 362 pcmcia_socket_dev_suspend(&pdev->dev, mesg); 363 + if (device_may_wakeup(&pdev->dev)) { 364 enable_irq_wake(board->det_pin); 365 + if (board->irq_pin) 366 + enable_irq_wake(board->irq_pin); 367 + } else { 368 disable_irq_wake(board->det_pin); 369 + if (board->irq_pin) 370 + disable_irq_wake(board->irq_pin); 371 } 372 return 0; 373 } 374 375 static int at91_cf_resume(struct platform_device *pdev) 376 { 377 pcmcia_socket_dev_resume(&pdev->dev); 378 return 0; 379 }
+19 -6
drivers/pcmcia/au1000_generic.c
··· 351 int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) 352 { 353 struct skt_dev_info *sinfo; 354 int ret, i; 355 356 sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL); ··· 366 * Initialise the per-socket structure. 367 */ 368 for (i = 0; i < nr; i++) { 369 - struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 370 memset(skt, 0, sizeof(*skt)); 371 372 skt->socket.resource_ops = &pccard_static_ops; ··· 439 dev_set_drvdata(dev, sinfo); 440 return 0; 441 442 - do { 443 - struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); 444 445 del_timer_sync(&skt->poll_timer); 446 pcmcia_unregister_socket(&skt->socket); 447 - out_err: 448 flush_scheduled_work(); 449 ops->hw_shutdown(skt); 450 451 - i--; 452 - } while (i > 0); 453 kfree(sinfo); 454 out: 455 return ret;
··· 351 int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) 352 { 353 struct skt_dev_info *sinfo; 354 + struct au1000_pcmcia_socket *skt; 355 int ret, i; 356 357 sinfo = kzalloc(sizeof(struct skt_dev_info), GFP_KERNEL); ··· 365 * Initialise the per-socket structure. 366 */ 367 for (i = 0; i < nr; i++) { 368 + skt = PCMCIA_SOCKET(i); 369 memset(skt, 0, sizeof(*skt)); 370 371 skt->socket.resource_ops = &pccard_static_ops; ··· 438 dev_set_drvdata(dev, sinfo); 439 return 0; 440 441 + 442 + out_err: 443 + flush_scheduled_work(); 444 + ops->hw_shutdown(skt); 445 + while (i-- > 0) { 446 + skt = PCMCIA_SOCKET(i); 447 448 del_timer_sync(&skt->poll_timer); 449 pcmcia_unregister_socket(&skt->socket); 450 flush_scheduled_work(); 451 + if (i == 0) { 452 + iounmap(skt->virt_io + (u32)mips_io_port_base); 453 + skt->virt_io = NULL; 454 + } 455 + #ifndef CONFIG_MIPS_XXS1500 456 + else { 457 + iounmap(skt->virt_io + (u32)mips_io_port_base); 458 + skt->virt_io = NULL; 459 + } 460 + #endif 461 ops->hw_shutdown(skt); 462 463 + } 464 kfree(sinfo); 465 out: 466 return ret;
+24 -5
drivers/pcmcia/ds.c
··· 717 static void pcmcia_bus_rescan(struct pcmcia_socket *skt) 718 { 719 int no_devices=0; 720 unsigned long flags; 721 722 /* must be called with skt_mutex held */ ··· 730 * missing resource information or other trouble, we need to 731 * do this now. */ 732 if (no_devices) { 733 - int ret = pcmcia_card_add(skt); 734 if (ret) 735 return; 736 } ··· 742 743 /* we re-scan all devices, not just the ones connected to this 744 * socket. This does not matter, though. */ 745 - bus_rescan_devices(&pcmcia_bus_type); 746 } 747 748 static inline int pcmcia_devmatch(struct pcmcia_device *dev, ··· 1004 struct device_attribute *attr, const char *buf, size_t count) 1005 { 1006 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1007 1008 if (!count) 1009 return -EINVAL; ··· 1013 p_dev->allow_func_id_match = 1; 1014 mutex_unlock(&p_dev->socket->skt_mutex); 1015 1016 - bus_rescan_devices(&pcmcia_bus_type); 1017 1018 return count; 1019 } ··· 1299 1300 static int __init init_pcmcia_bus(void) 1301 { 1302 spin_lock_init(&pcmcia_dev_list_lock); 1303 1304 - bus_register(&pcmcia_bus_type); 1305 - class_interface_register(&pcmcia_bus_interface); 1306 1307 pcmcia_setup_ioctl(); 1308
··· 717 static void pcmcia_bus_rescan(struct pcmcia_socket *skt) 718 { 719 int no_devices=0; 720 + int ret = 0; 721 unsigned long flags; 722 723 /* must be called with skt_mutex held */ ··· 729 * missing resource information or other trouble, we need to 730 * do this now. */ 731 if (no_devices) { 732 + ret = pcmcia_card_add(skt); 733 if (ret) 734 return; 735 } ··· 741 742 /* we re-scan all devices, not just the ones connected to this 743 * socket. This does not matter, though. */ 744 + ret = bus_rescan_devices(&pcmcia_bus_type); 745 + if (ret) 746 + printk(KERN_INFO "pcmcia: bus_rescan_devices failed\n"); 747 } 748 749 static inline int pcmcia_devmatch(struct pcmcia_device *dev, ··· 1001 struct device_attribute *attr, const char *buf, size_t count) 1002 { 1003 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 1004 + int ret; 1005 1006 if (!count) 1007 return -EINVAL; ··· 1009 p_dev->allow_func_id_match = 1; 1010 mutex_unlock(&p_dev->socket->skt_mutex); 1011 1012 + ret = bus_rescan_devices(&pcmcia_bus_type); 1013 + if (ret) 1014 + printk(KERN_INFO "pcmcia: bus_rescan_devices failed after " 1015 + "allowing func_id matches\n"); 1016 1017 return count; 1018 } ··· 1292 1293 static int __init init_pcmcia_bus(void) 1294 { 1295 + int ret; 1296 + 1297 spin_lock_init(&pcmcia_dev_list_lock); 1298 1299 + ret = bus_register(&pcmcia_bus_type); 1300 + if (ret < 0) { 1301 + printk(KERN_WARNING "pcmcia: bus_register error: %d\n", ret); 1302 + return ret; 1303 + } 1304 + ret = class_interface_register(&pcmcia_bus_interface); 1305 + if (ret < 0) { 1306 + printk(KERN_WARNING 1307 + "pcmcia: class_interface_register error: %d\n", ret); 1308 + bus_unregister(&pcmcia_bus_type); 1309 + return ret; 1310 + } 1311 1312 pcmcia_setup_ioctl(); 1313
+5 -4
drivers/pcmcia/i82092.c
··· 41 }; 42 MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids); 43 44 static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state) 45 { 46 return pcmcia_socket_dev_suspend(&dev->dev, state); ··· 51 { 52 return pcmcia_socket_dev_resume(&dev->dev); 53 } 54 55 static struct pci_driver i82092aa_pci_drv = { 56 .name = "i82092aa", 57 .id_table = i82092aa_pci_ids, 58 .probe = i82092aa_pci_probe, 59 .remove = __devexit_p(i82092aa_pci_remove), 60 .suspend = i82092aa_socket_suspend, 61 .resume = i82092aa_socket_resume, 62 }; 63 64 ··· 709 710 static int i82092aa_module_init(void) 711 { 712 - enter("i82092aa_module_init"); 713 - pci_register_driver(&i82092aa_pci_drv); 714 - leave("i82092aa_module_init"); 715 - return 0; 716 } 717 718 static void i82092aa_module_exit(void)
··· 41 }; 42 MODULE_DEVICE_TABLE(pci, i82092aa_pci_ids); 43 44 + #ifdef CONFIG_PM 45 static int i82092aa_socket_suspend (struct pci_dev *dev, pm_message_t state) 46 { 47 return pcmcia_socket_dev_suspend(&dev->dev, state); ··· 50 { 51 return pcmcia_socket_dev_resume(&dev->dev); 52 } 53 + #endif 54 55 static struct pci_driver i82092aa_pci_drv = { 56 .name = "i82092aa", 57 .id_table = i82092aa_pci_ids, 58 .probe = i82092aa_pci_probe, 59 .remove = __devexit_p(i82092aa_pci_remove), 60 + #ifdef CONFIG_PM 61 .suspend = i82092aa_socket_suspend, 62 .resume = i82092aa_socket_resume, 63 + #endif 64 }; 65 66 ··· 705 706 static int i82092aa_module_init(void) 707 { 708 + return pci_register_driver(&i82092aa_pci_drv); 709 } 710 711 static void i82092aa_module_exit(void)
+8 -4
drivers/pcmcia/m8xx_pcmcia.c
··· 427 reg |= BCSR1_PCCVCC1; 428 break; 429 default: 430 - return 1; 431 } 432 433 switch(vpp) { ··· 438 if(vcc == vpp) 439 reg |= BCSR1_PCCVPP1; 440 else 441 - return 1; 442 break; 443 case 120: 444 if ((vcc == 33) || (vcc == 50)) 445 reg |= BCSR1_PCCVPP0; 446 else 447 - return 1; 448 default: 449 - return 1; 450 } 451 452 /* first, turn off all power */ ··· 457 458 iounmap(bcsr_io); 459 return 0; 460 } 461 462 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
··· 427 reg |= BCSR1_PCCVCC1; 428 break; 429 default: 430 + goto out_unmap; 431 } 432 433 switch(vpp) { ··· 438 if(vcc == vpp) 439 reg |= BCSR1_PCCVPP1; 440 else 441 + goto out_unmap; 442 break; 443 case 120: 444 if ((vcc == 33) || (vcc == 50)) 445 reg |= BCSR1_PCCVPP0; 446 else 447 + goto out_unmap; 448 default: 449 + goto out_unmap; 450 } 451 452 /* first, turn off all power */ ··· 457 458 iounmap(bcsr_io); 459 return 0; 460 + 461 + out_unmap: 462 + iounmap(bcsr_io); 463 + return 1; 464 } 465 466 #define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
+2 -1
drivers/pcmcia/omap_cf.c
··· 309 return 0; 310 311 fail2: 312 - iounmap((void __iomem *) cf->socket.io_offset); 313 release_mem_region(cf->phys_cf, SZ_8K); 314 fail1: 315 free_irq(irq, cf); 316 fail0: 317 kfree(cf);
··· 309 return 0; 310 311 fail2: 312 release_mem_region(cf->phys_cf, SZ_8K); 313 fail1: 314 + if (cf->socket.io_offset) 315 + iounmap((void __iomem *) cf->socket.io_offset); 316 free_irq(irq, cf); 317 fail0: 318 kfree(cf);
+8 -3
drivers/pcmcia/pcmcia_ioctl.c
··· 128 int count, int *eof, void *data) 129 { 130 char *p = buf; 131 132 - bus_for_each_drv(&pcmcia_bus_type, NULL, 133 - (void *) &p, proc_read_drivers_callback); 134 135 return (p - buf); 136 } ··· 272 * Prevent this racing with a card insertion. 273 */ 274 mutex_lock(&s->skt_mutex); 275 - bus_rescan_devices(&pcmcia_bus_type); 276 mutex_unlock(&s->skt_mutex); 277 278 /* check whether the driver indeed matched. I don't care if this 279 * is racy or not, because it can only happen on cardmgr access
··· 128 int count, int *eof, void *data) 129 { 130 char *p = buf; 131 + int rc; 132 133 + rc = bus_for_each_drv(&pcmcia_bus_type, NULL, 134 + (void *) &p, proc_read_drivers_callback); 135 + if (rc < 0) 136 + return rc; 137 138 return (p - buf); 139 } ··· 269 * Prevent this racing with a card insertion. 270 */ 271 mutex_lock(&s->skt_mutex); 272 + ret = bus_rescan_devices(&pcmcia_bus_type); 273 mutex_unlock(&s->skt_mutex); 274 + if (ret) 275 + goto err_put_module; 276 277 /* check whether the driver indeed matched. I don't care if this 278 * is racy or not, because it can only happen on cardmgr access
+1 -1
drivers/pcmcia/pcmcia_resource.c
··· 95 * potential conflicts, just the most obvious ones. 96 */ 97 for (i = 0; i < MAX_IO_WIN; i++) 98 - if ((s->io[i].res) && 99 ((s->io[i].res->start & (align-1)) == *base)) 100 return 1; 101 for (i = 0; i < MAX_IO_WIN; i++) {
··· 95 * potential conflicts, just the most obvious ones. 96 */ 97 for (i = 0; i < MAX_IO_WIN; i++) 98 + if ((s->io[i].res) && *base && 99 ((s->io[i].res->start & (align-1)) == *base)) 100 return 1; 101 for (i = 0; i < MAX_IO_WIN; i++) {
+4
drivers/pcmcia/pd6729.c
··· 755 kfree(socket); 756 } 757 758 static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state) 759 { 760 return pcmcia_socket_dev_suspend(&dev->dev, state); ··· 765 { 766 return pcmcia_socket_dev_resume(&dev->dev); 767 } 768 769 static struct pci_device_id pd6729_pci_ids[] = { 770 { ··· 783 .id_table = pd6729_pci_ids, 784 .probe = pd6729_pci_probe, 785 .remove = __devexit_p(pd6729_pci_remove), 786 .suspend = pd6729_socket_suspend, 787 .resume = pd6729_socket_resume, 788 }; 789 790 static int pd6729_module_init(void)
··· 755 kfree(socket); 756 } 757 758 + #ifdef CONFIG_PM 759 static int pd6729_socket_suspend(struct pci_dev *dev, pm_message_t state) 760 { 761 return pcmcia_socket_dev_suspend(&dev->dev, state); ··· 764 { 765 return pcmcia_socket_dev_resume(&dev->dev); 766 } 767 + #endif 768 769 static struct pci_device_id pd6729_pci_ids[] = { 770 { ··· 781 .id_table = pd6729_pci_ids, 782 .probe = pd6729_pci_probe, 783 .remove = __devexit_p(pd6729_pci_remove), 784 + #ifdef CONFIG_PM 785 .suspend = pd6729_socket_suspend, 786 .resume = pd6729_socket_resume, 787 + #endif 788 }; 789 790 static int pd6729_module_init(void)
+1
drivers/pcmcia/soc_common.c
··· 824 825 return 0; 826 }
··· 824 825 return 0; 826 } 827 + EXPORT_SYMBOL(soc_common_drv_pcmcia_remove);
+17 -5
drivers/pcmcia/yenta_socket.c
··· 1197 ret = pcmcia_register_socket(&socket->socket); 1198 if (ret == 0) { 1199 /* Add the yenta register attributes */ 1200 - device_create_file(&dev->dev, &dev_attr_yenta_registers); 1201 - goto out; 1202 } 1203 1204 unmap: ··· 1217 return ret; 1218 } 1219 1220 - 1221 static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state) 1222 { 1223 struct yenta_socket *socket = pci_get_drvdata(dev); ··· 1252 struct yenta_socket *socket = pci_get_drvdata(dev); 1253 1254 if (socket) { 1255 pci_set_power_state(dev, 0); 1256 /* FIXME: pci_restore_state needs to have a better interface */ 1257 pci_restore_state(dev); 1258 pci_write_config_dword(dev, 16*4, socket->saved_state[0]); 1259 pci_write_config_dword(dev, 17*4, socket->saved_state[1]); 1260 - pci_enable_device(dev); 1261 pci_set_master(dev); 1262 1263 if (socket->type && socket->type->restore_state) ··· 1272 1273 return pcmcia_socket_dev_resume(&dev->dev); 1274 } 1275 - 1276 1277 #define CB_ID(vend,dev,type) \ 1278 { \ ··· 1369 .id_table = yenta_table, 1370 .probe = yenta_probe, 1371 .remove = __devexit_p(yenta_close), 1372 .suspend = yenta_dev_suspend, 1373 .resume = yenta_dev_resume, 1374 }; 1375 1376
··· 1197 ret = pcmcia_register_socket(&socket->socket); 1198 if (ret == 0) { 1199 /* Add the yenta register attributes */ 1200 + ret = device_create_file(&dev->dev, &dev_attr_yenta_registers); 1201 + if (ret == 0) 1202 + goto out; 1203 + 1204 + /* error path... */ 1205 + pcmcia_unregister_socket(&socket->socket); 1206 } 1207 1208 unmap: ··· 1213 return ret; 1214 } 1215 1216 + #ifdef CONFIG_PM 1217 static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state) 1218 { 1219 struct yenta_socket *socket = pci_get_drvdata(dev); ··· 1248 struct yenta_socket *socket = pci_get_drvdata(dev); 1249 1250 if (socket) { 1251 + int rc; 1252 + 1253 pci_set_power_state(dev, 0); 1254 /* FIXME: pci_restore_state needs to have a better interface */ 1255 pci_restore_state(dev); 1256 pci_write_config_dword(dev, 16*4, socket->saved_state[0]); 1257 pci_write_config_dword(dev, 17*4, socket->saved_state[1]); 1258 + 1259 + rc = pci_enable_device(dev); 1260 + if (rc) 1261 + return rc; 1262 + 1263 pci_set_master(dev); 1264 1265 if (socket->type && socket->type->restore_state) ··· 1262 1263 return pcmcia_socket_dev_resume(&dev->dev); 1264 } 1265 + #endif 1266 1267 #define CB_ID(vend,dev,type) \ 1268 { \ ··· 1359 .id_table = yenta_table, 1360 .probe = yenta_probe, 1361 .remove = __devexit_p(yenta_close), 1362 + #ifdef CONFIG_PM 1363 .suspend = yenta_dev_suspend, 1364 .resume = yenta_dev_resume, 1365 + #endif 1366 }; 1367 1368