forked from Minki/linux
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
This commit is contained in:
commit
49b766ec12
@ -1463,6 +1463,8 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t
|
||||
return -ENOMEM;
|
||||
}
|
||||
tuple.DesiredTuple = code;
|
||||
tuple.Attributes = 0;
|
||||
if (function == BIND_FN_ALL)
|
||||
tuple.Attributes = TUPLE_RETURN_COMMON;
|
||||
ret = pccard_get_first_tuple(s, function, &tuple);
|
||||
if (ret != 0)
|
||||
@ -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;
|
||||
cisparse_t *p;
|
||||
@ -1515,30 +1517,30 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned
|
||||
count = reserved = 0;
|
||||
tuple->DesiredTuple = RETURN_FIRST_TUPLE;
|
||||
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)
|
||||
goto done;
|
||||
|
||||
/* First tuple should be DEVICE; we should really have either that
|
||||
or a CFTABLE_ENTRY of some sort */
|
||||
if ((tuple->TupleCode == CISTPL_DEVICE) ||
|
||||
(pccard_read_tuple(s, function, 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, p) == 0) ||
|
||||
(pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY_CB, p) == 0))
|
||||
dev_ok++;
|
||||
|
||||
/* 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
|
||||
cards have only a broken VERS_2 tuple; hence the bogus test. */
|
||||
if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == 0) ||
|
||||
(pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) ||
|
||||
(pccard_read_tuple(s, function, CISTPL_VERS_2, p) != -ENOSPC))
|
||||
if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) ||
|
||||
(pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) ||
|
||||
(pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC))
|
||||
ident_ok++;
|
||||
|
||||
if (!dev_ok && !ident_ok)
|
||||
goto done;
|
||||
|
||||
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)
|
||||
break;
|
||||
if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) ||
|
||||
|
@ -197,8 +197,7 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
|
||||
cisdata_t code, void *parse);
|
||||
int pcmcia_replace_cis(struct pcmcia_socket *s,
|
||||
const u8 *data, const size_t len);
|
||||
int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function,
|
||||
unsigned int *count);
|
||||
int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count);
|
||||
|
||||
/* rsrc_mgr.c */
|
||||
int pcmcia_validate_mem(struct pcmcia_socket *s);
|
||||
|
@ -547,7 +547,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
|
||||
if (!vers1)
|
||||
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)) {
|
||||
p_dev->manf_id = manf_id.manf;
|
||||
p_dev->card_id = manf_id.card;
|
||||
@ -581,9 +581,9 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
|
||||
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)) {
|
||||
for (i=0; i < vers1->ns; i++) {
|
||||
for (i = 0; i < min_t(unsigned int, 4, vers1->ns); i++) {
|
||||
char *tmp;
|
||||
unsigned int length;
|
||||
|
||||
@ -733,7 +733,7 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
|
||||
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) {
|
||||
ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n");
|
||||
return -ENODEV;
|
||||
|
@ -1053,8 +1053,8 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io)
|
||||
u_char map, ioctl;
|
||||
|
||||
debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#x-%#x)\n", sock, io->map, io->flags,
|
||||
io->speed, io->start, io->stop);
|
||||
"%#llx-%#llx)\n", sock, io->map, io->flags, io->speed,
|
||||
(unsigned long long)io->start, (unsigned long long)io->stop);
|
||||
map = io->map;
|
||||
if ((map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
|
||||
(io->stop < io->start)) return -EINVAL;
|
||||
|
@ -537,8 +537,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io)
|
||||
u_char map;
|
||||
|
||||
debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#lx-%#lx)\n", sock, io->map, io->flags,
|
||||
io->speed, io->start, io->stop);
|
||||
"%#llx-%#llx)\n", sock, io->map, io->flags,
|
||||
io->speed, (unsigned long long)io->start,
|
||||
(unsigned long long)io->stop);
|
||||
map = io->map;
|
||||
|
||||
return 0;
|
||||
@ -554,8 +555,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem)
|
||||
pcc_socket_t *t = &socket[sock];
|
||||
|
||||
debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#lx, %#x)\n", sock, map, mem->flags,
|
||||
mem->speed, mem->static_start, mem->card_start);
|
||||
"%#llx, %#x)\n", sock, map, mem->flags,
|
||||
mem->speed, (unsigned long long)mem->static_start,
|
||||
mem->card_start);
|
||||
|
||||
/*
|
||||
* sanity check
|
||||
|
@ -492,8 +492,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io)
|
||||
u_char map;
|
||||
|
||||
debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#x-%#x)\n", sock, io->map, io->flags,
|
||||
io->speed, io->start, io->stop);
|
||||
"%#llx-%#llx)\n", sock, io->map, io->flags,
|
||||
io->speed, (unsigned long long)io->start,
|
||||
(unsigned long long)io->stop);
|
||||
map = io->map;
|
||||
|
||||
return 0;
|
||||
@ -515,8 +516,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem)
|
||||
#endif
|
||||
|
||||
debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#lx, %#x)\n", sock, map, mem->flags,
|
||||
mem->speed, mem->static_start, mem->card_start);
|
||||
"%#llx, %#x)\n", sock, map, mem->flags,
|
||||
mem->speed, (unsigned long long)mem->static_start,
|
||||
mem->card_start);
|
||||
|
||||
/*
|
||||
* sanity check
|
||||
|
@ -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)
|
||||
|
||||
dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#4.4x-%#4.4x)\n", lsock, io->map, io->flags,
|
||||
io->speed, io->start, io->stop);
|
||||
"%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags,
|
||||
io->speed, (unsigned long long)io->start,
|
||||
(unsigned long long)io->stop);
|
||||
|
||||
if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0xffff)
|
||||
|| (io->stop > 0xffff) || (io->stop < io->start))
|
||||
@ -1055,8 +1056,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock,
|
||||
pcmconf8xx_t *pcmcia = s->pcmcia;
|
||||
|
||||
dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags,
|
||||
mem->speed, mem->static_start, mem->card_start);
|
||||
"%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags,
|
||||
mem->speed, (unsigned long long)mem->static_start,
|
||||
mem->card_start);
|
||||
|
||||
if ((mem->map >= PCMCIA_MEM_WIN_NO)
|
||||
// || ((mem->s) >= PCMCIA_MEM_WIN_SIZE)
|
||||
@ -1107,8 +1109,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock,
|
||||
}
|
||||
|
||||
dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags,
|
||||
mem->speed, mem->static_start, mem->card_start);
|
||||
"%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags,
|
||||
mem->speed, (unsigned long long)mem->static_start,
|
||||
mem->card_start);
|
||||
|
||||
/* copy the struct and modify the copy */
|
||||
|
||||
|
@ -881,7 +881,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
|
||||
mutex_lock(&s->skt_mutex);
|
||||
pcmcia_validate_mem(s);
|
||||
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;
|
||||
case DS_SUSPEND_CARD:
|
||||
ret = pcmcia_suspend_card(s);
|
||||
|
@ -641,6 +641,12 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev,
|
||||
if ((ret = pci_enable_device(dev)))
|
||||
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 "
|
||||
"at 0x%llx on irq %d\n",
|
||||
(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,
|
||||
/* First, what does a floating port look like? */
|
||||
b = kzalloc(256, GFP_KERNEL);
|
||||
if (!b) {
|
||||
printk("\n");
|
||||
dev_printk(KERN_ERR, &s->dev,
|
||||
"do_io_probe: unable to kmalloc 256 bytes");
|
||||
return;
|
||||
@ -275,7 +276,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
|
||||
s->cis_mem.res = res;
|
||||
s->cis_virt = ioremap(res->start, s->map_size);
|
||||
if (s->cis_virt) {
|
||||
ret = pccard_validate_cis(s, BIND_FN_ALL, count);
|
||||
ret = pccard_validate_cis(s, count);
|
||||
/* invalidate mapping and CIS cache */
|
||||
iounmap(s->cis_virt);
|
||||
s->cis_virt = NULL;
|
||||
|
@ -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);
|
||||
unsigned short speed = map->speed;
|
||||
|
||||
debug(skt, 2, "map %u speed %u start 0x%08x stop 0x%08x\n",
|
||||
map->map, map->speed, map->start, map->stop);
|
||||
debug(skt, 2, "map %u speed %u start 0x%08llx stop 0x%08llx\n",
|
||||
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",
|
||||
(map->flags==0)?"<NONE>":"",
|
||||
(map->flags&MAP_ACTIVE)?"ACTIVE ":"",
|
||||
|
@ -300,7 +300,7 @@ static ssize_t pccard_show_cis(struct kobject *kobj,
|
||||
|
||||
if (!(s->state & SOCKET_PRESENT))
|
||||
return -ENODEV;
|
||||
if (pccard_validate_cis(s, BIND_FN_ALL, &chains))
|
||||
if (pccard_validate_cis(s, &chains))
|
||||
return -EIO;
|
||||
if (!chains)
|
||||
return -ENODATA;
|
||||
|
@ -732,8 +732,8 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
|
||||
u_short base, len, ioctl;
|
||||
|
||||
debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, "
|
||||
"%#x-%#x)\n", psock, io->map, io->flags,
|
||||
io->speed, io->start, io->stop);
|
||||
"%#llx-%#llx)\n", psock, io->map, io->flags, io->speed,
|
||||
(unsigned long long)io->start, (unsigned long long)io->stop);
|
||||
if ((io->map > 1) || (io->start > 0xffff) || (io->stop > 0xffff) ||
|
||||
(io->stop < io->start)) return -EINVAL;
|
||||
tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT));
|
||||
|
Loading…
Reference in New Issue
Block a user