Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6

* 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6:
pcmcia: fix error handling in cm4000_cs.c
drivers/pcmcia: Add missing local_irq_restore
serial_cs: MD55x support (PCMCIA GPRS/EDGE modem) (kernel 2.6.33)
pcmcia: avoid late calls to pccard_validate_cis
pcmcia: fix ioport size calculation in rsrc_nonstatic
pcmcia: re-start on MFC override
pcmcia: fix io_probe due to parent (PCI) resources
pcmcia: use previously assigned IRQ for all card functions

+55 -23
+5 -3
drivers/char/pcmcia/cm4000_cs.c
··· 1026 1027 xoutb(0, REG_FLAGS1(iobase)); /* clear detectCMM */ 1028 /* last check before exit */ 1029 - if (!io_detect_cm4000(iobase, dev)) 1030 - count = -ENODEV; 1031 1032 if (test_bit(IS_INVREV, &dev->flags) && count > 0) 1033 str_invert_revert(dev->rbuf, count); 1034 1035 if (copy_to_user(buf, dev->rbuf, count)) 1036 - return -EFAULT; 1037 1038 release_io: 1039 clear_bit(LOCK_IO, &dev->flags);
··· 1026 1027 xoutb(0, REG_FLAGS1(iobase)); /* clear detectCMM */ 1028 /* last check before exit */ 1029 + if (!io_detect_cm4000(iobase, dev)) { 1030 + rc = -ENODEV; 1031 + goto release_io; 1032 + } 1033 1034 if (test_bit(IS_INVREV, &dev->flags) && count > 0) 1035 str_invert_revert(dev->rbuf, count); 1036 1037 if (copy_to_user(buf, dev->rbuf, count)) 1038 + rc = -EFAULT; 1039 1040 release_io: 1041 clear_bit(LOCK_IO, &dev->flags);
+7 -2
drivers/pcmcia/cistpl.c
··· 1484 if (!s) 1485 return -EINVAL; 1486 1487 /* We do not want to validate the CIS cache... */ 1488 mutex_lock(&s->ops_mutex); 1489 destroy_cis_cache(s); ··· 1644 count = 0; 1645 else { 1646 struct pcmcia_socket *s; 1647 - unsigned int chains; 1648 1649 if (off + count > size) 1650 count = size - off; ··· 1653 1654 if (!(s->state & SOCKET_PRESENT)) 1655 return -ENODEV; 1656 - if (pccard_validate_cis(s, &chains)) 1657 return -EIO; 1658 if (!chains) 1659 return -ENODATA;
··· 1484 if (!s) 1485 return -EINVAL; 1486 1487 + if (s->functions) { 1488 + WARN_ON(1); 1489 + return -EINVAL; 1490 + } 1491 + 1492 /* We do not want to validate the CIS cache... */ 1493 mutex_lock(&s->ops_mutex); 1494 destroy_cis_cache(s); ··· 1639 count = 0; 1640 else { 1641 struct pcmcia_socket *s; 1642 + unsigned int chains = 1; 1643 1644 if (off + count > size) 1645 count = size - off; ··· 1648 1649 if (!(s->state & SOCKET_PRESENT)) 1650 return -ENODEV; 1651 + if (!s->functions && pccard_validate_cis(s, &chains)) 1652 return -EIO; 1653 if (!chains) 1654 return -ENODATA;
+3 -1
drivers/pcmcia/db1xxx_ss.c
··· 166 167 ret = request_irq(sock->insert_irq, db1200_pcmcia_cdirq, 168 IRQF_DISABLED, "pcmcia_insert", sock); 169 - if (ret) 170 goto out1; 171 172 ret = request_irq(sock->eject_irq, db1200_pcmcia_cdirq, 173 IRQF_DISABLED, "pcmcia_eject", sock);
··· 166 167 ret = request_irq(sock->insert_irq, db1200_pcmcia_cdirq, 168 IRQF_DISABLED, "pcmcia_insert", sock); 169 + if (ret) { 170 + local_irq_restore(flags); 171 goto out1; 172 + } 173 174 ret = request_irq(sock->eject_irq, db1200_pcmcia_cdirq, 175 IRQF_DISABLED, "pcmcia_eject", sock);
+14 -8
drivers/pcmcia/ds.c
··· 687 new_funcs = mfc.nfn; 688 else 689 new_funcs = 1; 690 - if (old_funcs > new_funcs) { 691 pcmcia_card_remove(s, NULL); 692 pcmcia_card_add(s); 693 - } else if (new_funcs > old_funcs) { 694 - s->functions = new_funcs; 695 - pcmcia_device_add(s, 1); 696 } 697 } 698 ··· 726 struct pcmcia_socket *s = dev->socket; 727 const struct firmware *fw; 728 int ret = -ENOMEM; 729 730 if (!filename) 731 return -EINVAL; ··· 750 goto release; 751 } 752 753 754 /* update information */ 755 pcmcia_device_query(dev); ··· 866 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { 867 dev_dbg(&dev->dev, "device needs a fake CIS\n"); 868 if (!dev->socket->fake_cis) 869 - pcmcia_load_firmware(dev, did->cisfile); 870 - 871 - if (!dev->socket->fake_cis) 872 - return 0; 873 } 874 875 if (did->match_flags & PCMCIA_DEV_ID_MATCH_ANONYMOUS) {
··· 687 new_funcs = mfc.nfn; 688 else 689 new_funcs = 1; 690 + if (old_funcs != new_funcs) { 691 + /* we need to re-start */ 692 pcmcia_card_remove(s, NULL); 693 pcmcia_card_add(s); 694 } 695 } 696 ··· 728 struct pcmcia_socket *s = dev->socket; 729 const struct firmware *fw; 730 int ret = -ENOMEM; 731 + cistpl_longlink_mfc_t mfc; 732 + int old_funcs, new_funcs = 1; 733 734 if (!filename) 735 return -EINVAL; ··· 750 goto release; 751 } 752 753 + /* we need to re-start if the number of functions changed */ 754 + old_funcs = s->functions; 755 + if (!pccard_read_tuple(s, BIND_FN_ALL, CISTPL_LONGLINK_MFC, 756 + &mfc)) 757 + new_funcs = mfc.nfn; 758 + 759 + if (old_funcs != new_funcs) 760 + ret = -EBUSY; 761 762 /* update information */ 763 pcmcia_device_query(dev); ··· 858 if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { 859 dev_dbg(&dev->dev, "device needs a fake CIS\n"); 860 if (!dev->socket->fake_cis) 861 + if (pcmcia_load_firmware(dev, did->cisfile)) 862 + return 0; 863 } 864 865 if (did->match_flags & PCMCIA_DEV_ID_MATCH_ANONYMOUS) {
+5 -5
drivers/pcmcia/pcmcia_resource.c
··· 755 else 756 printk(KERN_WARNING "pcmcia: Driver needs updating to support IRQ sharing.\n"); 757 758 - #ifdef CONFIG_PCMCIA_PROBE 759 - 760 - if (s->irq.AssignedIRQ != 0) { 761 - /* If the interrupt is already assigned, it must be the same */ 762 irq = s->irq.AssignedIRQ; 763 - } else { 764 int try; 765 u32 mask = s->irq_mask; 766 void *data = p_dev; /* something unique to this device */
··· 755 else 756 printk(KERN_WARNING "pcmcia: Driver needs updating to support IRQ sharing.\n"); 757 758 + /* If the interrupt is already assigned, it must be the same */ 759 + if (s->irq.AssignedIRQ != 0) 760 irq = s->irq.AssignedIRQ; 761 + 762 + #ifdef CONFIG_PCMCIA_PROBE 763 + if (!irq) { 764 int try; 765 u32 mask = s->irq_mask; 766 void *data = p_dev; /* something unique to this device */
+12 -4
drivers/pcmcia/rsrc_nonstatic.c
··· 214 return; 215 } 216 for (i = base, most = 0; i < base+num; i += 8) { 217 - res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA ioprobe"); 218 if (!res) 219 continue; 220 hole = inb(i); ··· 231 232 bad = any = 0; 233 for (i = base; i < base+num; i += 8) { 234 - res = claim_region(NULL, i, 8, IORESOURCE_IO, "PCMCIA ioprobe"); 235 - if (!res) 236 continue; 237 for (j = 0; j < 8; j++) 238 if (inb(i+j) != most) 239 break; ··· 258 } 259 if (bad) { 260 if ((num > 16) && (bad == base) && (i == base+num)) { 261 printk(" nothing: probe failed.\n"); 262 return; 263 } else { ··· 810 static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long start, unsigned long end) 811 { 812 struct socket_data *data = s->resource_data; 813 - unsigned long size = end - start + 1; 814 int ret = 0; 815 816 #if defined(CONFIG_X86) ··· 819 if (start < 0x100) 820 start = 0x100; 821 #endif 822 823 if (end < start) 824 return -EINVAL;
··· 214 return; 215 } 216 for (i = base, most = 0; i < base+num; i += 8) { 217 + res = claim_region(s, i, 8, IORESOURCE_IO, "PCMCIA ioprobe"); 218 if (!res) 219 continue; 220 hole = inb(i); ··· 231 232 bad = any = 0; 233 for (i = base; i < base+num; i += 8) { 234 + res = claim_region(s, i, 8, IORESOURCE_IO, "PCMCIA ioprobe"); 235 + if (!res) { 236 + if (!any) 237 + printk(" excluding"); 238 + if (!bad) 239 + bad = any = i; 240 continue; 241 + } 242 for (j = 0; j < 8; j++) 243 if (inb(i+j) != most) 244 break; ··· 253 } 254 if (bad) { 255 if ((num > 16) && (bad == base) && (i == base+num)) { 256 + sub_interval(&s_data->io_db, bad, i-bad); 257 printk(" nothing: probe failed.\n"); 258 return; 259 } else { ··· 804 static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long start, unsigned long end) 805 { 806 struct socket_data *data = s->resource_data; 807 + unsigned long size; 808 int ret = 0; 809 810 #if defined(CONFIG_X86) ··· 813 if (start < 0x100) 814 start = 0x100; 815 #endif 816 + 817 + size = end - start + 1; 818 819 if (end < start) 820 return -EINVAL;
+9
drivers/serial/serial_cs.c
··· 105 * manfid 0x0160, 0x0104 106 * This card appears to have a 14.7456MHz clock. 107 */ 108 static void quirk_setup_brainboxes_0104(struct pcmcia_device *link, struct uart_port *port) 109 { 110 port->uartclk = 14745600; ··· 197 { 198 .manfid = 0x0160, 199 .prodid = 0x0104, 200 .multi = -1, 201 .setup = quirk_setup_brainboxes_0104, 202 }, {
··· 105 * manfid 0x0160, 0x0104 106 * This card appears to have a 14.7456MHz clock. 107 */ 108 + /* Generic Modem: MD55x (GPRS/EDGE) have 109 + * Elan VPU16551 UART with 14.7456MHz oscillator 110 + * manfid 0x015D, 0x4C45 111 + */ 112 static void quirk_setup_brainboxes_0104(struct pcmcia_device *link, struct uart_port *port) 113 { 114 port->uartclk = 14745600; ··· 193 { 194 .manfid = 0x0160, 195 .prodid = 0x0104, 196 + .multi = -1, 197 + .setup = quirk_setup_brainboxes_0104, 198 + }, { 199 + .manfid = 0x015D, 200 + .prodid = 0x4C45, 201 .multi = -1, 202 .setup = quirk_setup_brainboxes_0104, 203 }, {