diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 12:42:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 12:42:59 -0500 |
commit | d9b2c4d0b03c721808c0d259e43a27f1e80205bc (patch) | |
tree | f17a4166f62ee14faa1401a6cbd353a4ab8c77cb /drivers/pcmcia/cistpl.c | |
parent | 27d16d08717faeaa8afd1b736a096dbaab90f08e (diff) | |
parent | 5fa9167a1bf5f5a4b7282f5e7ac56a4a5a1fa044 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (50 commits)
pcmcia: rework the irq_req_t typedef
pcmcia: remove deprecated handle_to_dev() macro
pcmcia: pcmcia_request_window() doesn't need a pointer to a pointer
pcmcia: remove unused "window_t" typedef
pcmcia: move some window-related code to pcmcia_ioctl.c
pcmcia: Change window_handle_t logic to unsigned long
pcmcia: Pass struct pcmcia_socket to pcmcia_get_mem_page()
pcmcia: Pass struct pcmcia_device to pcmcia_map_mem_page()
pcmcia: Pass struct pcmcia_device to pcmcia_release_window()
drivers/pcmcia: remove unnecessary kzalloc
pcmcia: correct handling for Zoomed Video registers in topic.h
pcmcia: fix printk formats
pcmcia: autoload module pcmcia
pcmcia/staging: update comedi drivers
PCMCIA: stop duplicating pci_irq in soc_pcmcia_socket
PCMCIA: ss: allow PCI IRQs > 255
PCMCIA: soc_common: remove 'dev' member from soc_pcmcia_socket
PCMCIA: soc_common: constify soc_pcmcia_socket ops member
PCMCIA: sa1111: remove duplicated initializers
PCMCIA: sa1111: wrap soc_pcmcia_socket to contain sa1111 specific data
...
Diffstat (limited to 'drivers/pcmcia/cistpl.c')
-rw-r--r-- | drivers/pcmcia/cistpl.c | 71 |
1 files changed, 66 insertions, 5 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 6c4a4fc83630..8c1b73cf021b 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c | |||
@@ -138,7 +138,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
138 | void __iomem *sys, *end; | 138 | void __iomem *sys, *end; |
139 | unsigned char *buf = ptr; | 139 | unsigned char *buf = ptr; |
140 | 140 | ||
141 | cs_dbg(s, 3, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); | 141 | dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); |
142 | 142 | ||
143 | if (attr & IS_INDIRECT) { | 143 | if (attr & IS_INDIRECT) { |
144 | /* Indirect accesses use a bunch of special registers at fixed | 144 | /* Indirect accesses use a bunch of special registers at fixed |
@@ -190,7 +190,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
190 | addr = 0; | 190 | addr = 0; |
191 | } | 191 | } |
192 | } | 192 | } |
193 | cs_dbg(s, 3, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", | 193 | dev_dbg(&s->dev, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", |
194 | *(u_char *)(ptr+0), *(u_char *)(ptr+1), | 194 | *(u_char *)(ptr+0), *(u_char *)(ptr+1), |
195 | *(u_char *)(ptr+2), *(u_char *)(ptr+3)); | 195 | *(u_char *)(ptr+2), *(u_char *)(ptr+3)); |
196 | return 0; | 196 | return 0; |
@@ -204,7 +204,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, | |||
204 | void __iomem *sys, *end; | 204 | void __iomem *sys, *end; |
205 | unsigned char *buf = ptr; | 205 | unsigned char *buf = ptr; |
206 | 206 | ||
207 | cs_dbg(s, 3, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); | 207 | dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); |
208 | 208 | ||
209 | if (attr & IS_INDIRECT) { | 209 | if (attr & IS_INDIRECT) { |
210 | /* Indirect accesses use a bunch of special registers at fixed | 210 | /* Indirect accesses use a bunch of special registers at fixed |
@@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ | |||
584 | ofs += link[1] + 2; | 584 | ofs += link[1] + 2; |
585 | } | 585 | } |
586 | if (i == MAX_TUPLES) { | 586 | if (i == MAX_TUPLES) { |
587 | cs_dbg(s, 1, "cs: overrun in pcmcia_get_next_tuple\n"); | 587 | dev_dbg(&s->dev, "cs: overrun in pcmcia_get_next_tuple\n"); |
588 | return -ENOSPC; | 588 | return -ENOSPC; |
589 | } | 589 | } |
590 | 590 | ||
@@ -1440,7 +1440,7 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse) | |||
1440 | break; | 1440 | break; |
1441 | } | 1441 | } |
1442 | if (ret) | 1442 | if (ret) |
1443 | __cs_dbg(0, "parse_tuple failed %d\n", ret); | 1443 | pr_debug("parse_tuple failed %d\n", ret); |
1444 | return ret; | 1444 | return ret; |
1445 | } | 1445 | } |
1446 | EXPORT_SYMBOL(pcmcia_parse_tuple); | 1446 | EXPORT_SYMBOL(pcmcia_parse_tuple); |
@@ -1482,6 +1482,67 @@ done: | |||
1482 | } | 1482 | } |
1483 | EXPORT_SYMBOL(pccard_read_tuple); | 1483 | EXPORT_SYMBOL(pccard_read_tuple); |
1484 | 1484 | ||
1485 | |||
1486 | /** | ||
1487 | * pccard_loop_tuple() - loop over tuples in the CIS | ||
1488 | * @s: the struct pcmcia_socket where the card is inserted | ||
1489 | * @function: the device function we loop for | ||
1490 | * @code: which CIS code shall we look for? | ||
1491 | * @parse: buffer where the tuple shall be parsed (or NULL, if no parse) | ||
1492 | * @priv_data: private data to be passed to the loop_tuple function. | ||
1493 | * @loop_tuple: function to call for each CIS entry of type @function. IT | ||
1494 | * gets passed the raw tuple, the paresed tuple (if @parse is | ||
1495 | * set) and @priv_data. | ||
1496 | * | ||
1497 | * pccard_loop_tuple() loops over all CIS entries of type @function, and | ||
1498 | * calls the @loop_tuple function for each entry. If the call to @loop_tuple | ||
1499 | * returns 0, the loop exits. Returns 0 on success or errorcode otherwise. | ||
1500 | */ | ||
1501 | int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, | ||
1502 | cisdata_t code, cisparse_t *parse, void *priv_data, | ||
1503 | int (*loop_tuple) (tuple_t *tuple, | ||
1504 | cisparse_t *parse, | ||
1505 | void *priv_data)) | ||
1506 | { | ||
1507 | tuple_t tuple; | ||
1508 | cisdata_t *buf; | ||
1509 | int ret; | ||
1510 | |||
1511 | buf = kzalloc(256, GFP_KERNEL); | ||
1512 | if (buf == NULL) { | ||
1513 | dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n"); | ||
1514 | return -ENOMEM; | ||
1515 | } | ||
1516 | |||
1517 | tuple.TupleData = buf; | ||
1518 | tuple.TupleDataMax = 255; | ||
1519 | tuple.TupleOffset = 0; | ||
1520 | tuple.DesiredTuple = code; | ||
1521 | tuple.Attributes = 0; | ||
1522 | |||
1523 | ret = pccard_get_first_tuple(s, function, &tuple); | ||
1524 | while (!ret) { | ||
1525 | if (pccard_get_tuple_data(s, &tuple)) | ||
1526 | goto next_entry; | ||
1527 | |||
1528 | if (parse) | ||
1529 | if (pcmcia_parse_tuple(&tuple, parse)) | ||
1530 | goto next_entry; | ||
1531 | |||
1532 | ret = loop_tuple(&tuple, parse, priv_data); | ||
1533 | if (!ret) | ||
1534 | break; | ||
1535 | |||
1536 | next_entry: | ||
1537 | ret = pccard_get_next_tuple(s, function, &tuple); | ||
1538 | } | ||
1539 | |||
1540 | kfree(buf); | ||
1541 | return ret; | ||
1542 | } | ||
1543 | EXPORT_SYMBOL(pccard_loop_tuple); | ||
1544 | |||
1545 | |||
1485 | /*====================================================================== | 1546 | /*====================================================================== |
1486 | 1547 | ||
1487 | This tries to determine if a card has a sensible CIS. It returns | 1548 | This tries to determine if a card has a sensible CIS. It returns |