Commit 49b766ec authored by Linus Torvalds's avatar Linus Torvalds

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

* 'urgent-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6:
  pcmcia: do not load the pd6729 driver if io_base is NULL
  pcmcia: Fix possible printk format warnings
  pcmcia: do not try to store more than 4 version strings
  pcmcia: pccard_read_tuple and TUPLE_RETURN_COMMON cleanup
  pcmcia: properly close previous dev_printk if kzalloc fails in do_io_probe
  pcmcia: fix controller printk format warnings
parents 464d155c 94efb723
...@@ -1463,6 +1463,8 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t ...@@ -1463,6 +1463,8 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t
return -ENOMEM; return -ENOMEM;
} }
tuple.DesiredTuple = code; tuple.DesiredTuple = code;
tuple.Attributes = 0;
if (function == BIND_FN_ALL)
tuple.Attributes = TUPLE_RETURN_COMMON; tuple.Attributes = TUPLE_RETURN_COMMON;
ret = pccard_get_first_tuple(s, function, &tuple); ret = pccard_get_first_tuple(s, function, &tuple);
if (ret != 0) if (ret != 0)
...@@ -1490,7 +1492,7 @@ EXPORT_SYMBOL(pccard_read_tuple); ...@@ -1490,7 +1492,7 @@ EXPORT_SYMBOL(pccard_read_tuple);
======================================================================*/ ======================================================================*/
int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *info) int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
{ {
tuple_t *tuple; tuple_t *tuple;
cisparse_t *p; cisparse_t *p;
...@@ -1515,30 +1517,30 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned ...@@ -1515,30 +1517,30 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned
count = reserved = 0; count = reserved = 0;
tuple->DesiredTuple = RETURN_FIRST_TUPLE; tuple->DesiredTuple = RETURN_FIRST_TUPLE;
tuple->Attributes = TUPLE_RETURN_COMMON; tuple->Attributes = TUPLE_RETURN_COMMON;
ret = pccard_get_first_tuple(s, function, tuple); ret = pccard_get_first_tuple(s, BIND_FN_ALL, tuple);
if (ret != 0) if (ret != 0)
goto done; goto done;
/* First tuple should be DEVICE; we should really have either that /* First tuple should be DEVICE; we should really have either that
or a CFTABLE_ENTRY of some sort */ or a CFTABLE_ENTRY of some sort */
if ((tuple->TupleCode == CISTPL_DEVICE) || if ((tuple->TupleCode == CISTPL_DEVICE) ||
(pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == 0) || (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY, p) == 0) ||
(pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY_CB, p) == 0))
dev_ok++; dev_ok++;
/* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2
tuple, for card identification. Certain old D-Link and Linksys tuple, for card identification. Certain old D-Link and Linksys
cards have only a broken VERS_2 tuple; hence the bogus test. */ cards have only a broken VERS_2 tuple; hence the bogus test. */
if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == 0) || if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) ||
(pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) || (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) ||
(pccard_read_tuple(s, function, CISTPL_VERS_2, p) != -ENOSPC)) (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC))
ident_ok++; ident_ok++;
if (!dev_ok && !ident_ok) if (!dev_ok && !ident_ok)
goto done; goto done;
for (count = 1; count < MAX_TUPLES; count++) { for (count = 1; count < MAX_TUPLES; count++) {
ret = pccard_get_next_tuple(s, function, tuple); ret = pccard_get_next_tuple(s, BIND_FN_ALL, tuple);
if (ret != 0) if (ret != 0)
break; break;
if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) ||
......
...@@ -197,8 +197,7 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, ...@@ -197,8 +197,7 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
cisdata_t code, void *parse); cisdata_t code, void *parse);
int pcmcia_replace_cis(struct pcmcia_socket *s, int pcmcia_replace_cis(struct pcmcia_socket *s,
const u8 *data, const size_t len); const u8 *data, const size_t len);
int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count);
unsigned int *count);
/* rsrc_mgr.c */ /* rsrc_mgr.c */
int pcmcia_validate_mem(struct pcmcia_socket *s); int pcmcia_validate_mem(struct pcmcia_socket *s);
......
...@@ -547,7 +547,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) ...@@ -547,7 +547,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
if (!vers1) if (!vers1)
return -ENOMEM; return -ENOMEM;
if (!pccard_read_tuple(p_dev->socket, p_dev->func, if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL,
CISTPL_MANFID, &manf_id)) { CISTPL_MANFID, &manf_id)) {
p_dev->manf_id = manf_id.manf; p_dev->manf_id = manf_id.manf;
p_dev->card_id = manf_id.card; p_dev->card_id = manf_id.card;
...@@ -581,9 +581,9 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) ...@@ -581,9 +581,9 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
kfree(devgeo); kfree(devgeo);
} }
if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_VERS_1, if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL, CISTPL_VERS_1,
vers1)) { vers1)) {
for (i=0; i < vers1->ns; i++) { for (i = 0; i < min_t(unsigned int, 4, vers1->ns); i++) {
char *tmp; char *tmp;
unsigned int length; unsigned int length;
...@@ -733,7 +733,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s) ...@@ -733,7 +733,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
return -EAGAIN; /* try again, but later... */ return -EAGAIN; /* try again, but later... */
} }
ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains); ret = pccard_validate_cis(s, &no_chains);
if (ret || !no_chains) { if (ret || !no_chains) {
ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n"); ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n");
return -ENODEV; return -ENODEV;
......
...@@ -1053,8 +1053,8 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io) ...@@ -1053,8 +1053,8 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io)
u_char map, ioctl; u_char map, ioctl;
debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, "
"%#x-%#x)\n", sock, io->map, io->flags, "%#llx-%#llx)\n", sock, io->map, io->flags, io->speed,
io->speed, io->start, io->stop); (unsigned long long)io->start, (unsigned long long)io->stop);
map = io->map; map = io->map;
if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
(io->stop < io->start)) return -EINVAL; (io->stop < io->start)) return -EINVAL;
......
...@@ -537,8 +537,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) ...@@ -537,8 +537,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io)
u_char map; u_char map;
debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, "
"%#lx-%#lx)\n", sock, io->map, io->flags, "%#llx-%#llx)\n", sock, io->map, io->flags,
io->speed, io->start, io->stop); io->speed, (unsigned long long)io->start,
(unsigned long long)io->stop);
map = io->map; map = io->map;
return 0; return 0;
...@@ -554,8 +555,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) ...@@ -554,8 +555,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem)
pcc_socket_t *t = &socket[sock]; pcc_socket_t *t = &socket[sock];
debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, "
"%#lx, %#x)\n", sock, map, mem->flags, "%#llx, %#x)\n", sock, map, mem->flags,
mem->speed, mem->static_start, mem->card_start); mem->speed, (unsigned long long)mem->static_start,
mem->card_start);
/* /*
* sanity check * sanity check
......
...@@ -492,8 +492,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) ...@@ -492,8 +492,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io)
u_char map; u_char map;
debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, "
"%#x-%#x)\n", sock, io->map, io->flags, "%#llx-%#llx)\n", sock, io->map, io->flags,
io->speed, io->start, io->stop); io->speed, (unsigned long long)io->start,
(unsigned long long)io->stop);
map = io->map; map = io->map;
return 0; return 0;
...@@ -515,8 +516,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) ...@@ -515,8 +516,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem)
#endif #endif
debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, "
"%#lx, %#x)\n", sock, map, mem->flags, "%#llx, %#x)\n", sock, map, mem->flags,
mem->speed, mem->static_start, mem->card_start); mem->speed, (unsigned long long)mem->static_start,
mem->card_start);
/* /*
* sanity check * sanity check
......
...@@ -975,8 +975,9 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) ...@@ -975,8 +975,9 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
#define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start)
dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, " dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, "
"%#4.4x-%#4.4x)\n", lsock, io->map, io->flags, "%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags,
io->speed, io->start, io->stop); io->speed, (unsigned long long)io->start,
(unsigned long long)io->stop);
if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff) if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff)
|| (io->stop > 0xffff) || (io->stop < io->start)) || (io->stop > 0xffff) || (io->stop < io->start))
...@@ -1055,8 +1056,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, ...@@ -1055,8 +1056,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock,
pcmconf8xx_t *pcmcia = s->pcmcia; pcmconf8xx_t *pcmcia = s->pcmcia;
dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, "
"%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags,
mem->speed, mem->static_start, mem->card_start); mem->speed, (unsigned long long)mem->static_start,
mem->card_start);
if ((mem->map >= PCMCIA_MEM_WIN_NO) if ((mem->map >= PCMCIA_MEM_WIN_NO)
// || ((mem->s) >= PCMCIA_MEM_WIN_SIZE) // || ((mem->s) >= PCMCIA_MEM_WIN_SIZE)
...@@ -1107,8 +1109,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, ...@@ -1107,8 +1109,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock,
} }
dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, "
"%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags,
mem->speed, mem->static_start, mem->card_start); mem->speed, (unsigned long long)mem->static_start,
mem->card_start);
/* copy the struct and modify the copy */ /* copy the struct and modify the copy */
......
...@@ -881,7 +881,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, ...@@ -881,7 +881,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
mutex_lock(&s->skt_mutex); mutex_lock(&s->skt_mutex);
pcmcia_validate_mem(s); pcmcia_validate_mem(s);
mutex_unlock(&s->skt_mutex); mutex_unlock(&s->skt_mutex);
ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo.Chains); ret = pccard_validate_cis(s, &buf->cisinfo.Chains);
break; break;
case DS_SUSPEND_CARD: case DS_SUSPEND_CARD:
ret = pcmcia_suspend_card(s); ret = pcmcia_suspend_card(s);
......
...@@ -641,6 +641,12 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, ...@@ -641,6 +641,12 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
if ((ret = pci_enable_device(dev))) if ((ret = pci_enable_device(dev)))
goto err_out_free_mem; goto err_out_free_mem;
if (!pci_resource_start(dev, 0)) {
printk(KERN_INFO "pd6729: refusing to load the driver "
"as the io_base is 0.\n");
goto err_out_free_mem;
}
printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge "
"at 0x%llx on irq %d\n", "at 0x%llx on irq %d\n",
(unsigned long long)pci_resource_start(dev, 0), dev->irq); (unsigned long long)pci_resource_start(dev, 0), dev->irq);
......
...@@ -206,6 +206,7 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base, ...@@ -206,6 +206,7 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base,
/* First, what does a floating port look like? */ /* First, what does a floating port look like? */
b = kzalloc(256, GFP_KERNEL); b = kzalloc(256, GFP_KERNEL);
if (!b) { if (!b) {
printk("\n");
dev_printk(KERN_ERR, &s->dev, dev_printk(KERN_ERR, &s->dev,
"do_io_probe: unable to kmalloc 256 bytes"); "do_io_probe: unable to kmalloc 256 bytes");
return; return;
...@@ -275,7 +276,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res, ...@@ -275,7 +276,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
s->cis_mem.res = res; s->cis_mem.res = res;
s->cis_virt = ioremap(res->start, s->map_size); s->cis_virt = ioremap(res->start, s->map_size);
if (s->cis_virt) { if (s->cis_virt) {
ret = pccard_validate_cis(s, BIND_FN_ALL, count); ret = pccard_validate_cis(s, count);
/* invalidate mapping and CIS cache */ /* invalidate mapping and CIS cache */
iounmap(s->cis_virt); iounmap(s->cis_virt);
s->cis_virt = NULL; s->cis_virt = NULL;
......
...@@ -336,8 +336,9 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m ...@@ -336,8 +336,9 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m
struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock); struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
unsigned short speed = map->speed; unsigned short speed = map->speed;
debug(skt, 2, "map %u speed %u start 0x%08x stop 0x%08x\n", debug(skt, 2, "map %u speed %u start 0x%08llx stop 0x%08llx\n",
map->map, map->speed, map->start, map->stop); map->map, map->speed, (unsigned long long)map->start,
(unsigned long long)map->stop);
debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n", debug(skt, 2, "flags: %s%s%s%s%s%s%s%s\n",
(map->flags==0)?"<NONE>":"", (map->flags==0)?"<NONE>":"",
(map->flags&MAP_ACTIVE)?"ACTIVE ":"", (map->flags&MAP_ACTIVE)?"ACTIVE ":"",
......
...@@ -300,7 +300,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj, ...@@ -300,7 +300,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT))
return -ENODEV; return -ENODEV;
if (pccard_validate_cis(s, BIND_FN_ALL, &chains)) if (pccard_validate_cis(s, &chains))
return -EIO; return -EIO;
if (!chains) if (!chains)
return -ENODATA; return -ENODATA;
......
...@@ -732,8 +732,8 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) ...@@ -732,8 +732,8 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
u_short base, len, ioctl; u_short base, len, ioctl;
debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, "
"%#x-%#x)\n", psock, io->map, io->flags, "%#llx-%#llx)\n", psock, io->map, io->flags, io->speed,
io->speed, io->start, io->stop); (unsigned long long)io->start, (unsigned long long)io->stop);
if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) || if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
(io->stop < io->start)) return -EINVAL; (io->stop < io->start)) return -EINVAL;
tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT)); tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment