aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cistpl.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-03-20 15:03:57 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-05-10 04:23:18 -0400
commit5c128e84324ca9389bc5f7d39f6b18f6de4a58ec (patch)
tree603f269717cd5c9183071629553b273b79d161ba /drivers/pcmcia/cistpl.c
parentb9300aa7449f6636b188743d09199dcf27b1a4b4 (diff)
pcmcia: move high level CIS access code to separate file
No code changes. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/cistpl.c')
-rw-r--r--drivers/pcmcia/cistpl.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index 854959cada3a..e0b09e71d5c0 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1362,106 +1362,6 @@ EXPORT_SYMBOL(pcmcia_parse_tuple);
1362 1362
1363 1363
1364/** 1364/**
1365 * pccard_read_tuple() - internal CIS tuple access
1366 * @s: the struct pcmcia_socket where the card is inserted
1367 * @function: the device function we loop for
1368 * @code: which CIS code shall we look for?
1369 * @parse: buffer where the tuple shall be parsed (or NULL, if no parse)
1370 *
1371 * pccard_read_tuple() reads out one tuple and attempts to parse it
1372 */
1373int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
1374 cisdata_t code, void *parse)
1375{
1376 tuple_t tuple;
1377 cisdata_t *buf;
1378 int ret;
1379
1380 buf = kmalloc(256, GFP_KERNEL);
1381 if (buf == NULL) {
1382 dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n");
1383 return -ENOMEM;
1384 }
1385 tuple.DesiredTuple = code;
1386 tuple.Attributes = 0;
1387 if (function == BIND_FN_ALL)
1388 tuple.Attributes = TUPLE_RETURN_COMMON;
1389 ret = pccard_get_first_tuple(s, function, &tuple);
1390 if (ret != 0)
1391 goto done;
1392 tuple.TupleData = buf;
1393 tuple.TupleOffset = 0;
1394 tuple.TupleDataMax = 255;
1395 ret = pccard_get_tuple_data(s, &tuple);
1396 if (ret != 0)
1397 goto done;
1398 ret = pcmcia_parse_tuple(&tuple, parse);
1399done:
1400 kfree(buf);
1401 return ret;
1402}
1403
1404
1405/**
1406 * pccard_loop_tuple() - loop over tuples in the CIS
1407 * @s: the struct pcmcia_socket where the card is inserted
1408 * @function: the device function we loop for
1409 * @code: which CIS code shall we look for?
1410 * @parse: buffer where the tuple shall be parsed (or NULL, if no parse)
1411 * @priv_data: private data to be passed to the loop_tuple function.
1412 * @loop_tuple: function to call for each CIS entry of type @function. IT
1413 * gets passed the raw tuple, the paresed tuple (if @parse is
1414 * set) and @priv_data.
1415 *
1416 * pccard_loop_tuple() loops over all CIS entries of type @function, and
1417 * calls the @loop_tuple function for each entry. If the call to @loop_tuple
1418 * returns 0, the loop exits. Returns 0 on success or errorcode otherwise.
1419 */
1420int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
1421 cisdata_t code, cisparse_t *parse, void *priv_data,
1422 int (*loop_tuple) (tuple_t *tuple,
1423 cisparse_t *parse,
1424 void *priv_data))
1425{
1426 tuple_t tuple;
1427 cisdata_t *buf;
1428 int ret;
1429
1430 buf = kzalloc(256, GFP_KERNEL);
1431 if (buf == NULL) {
1432 dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n");
1433 return -ENOMEM;
1434 }
1435
1436 tuple.TupleData = buf;
1437 tuple.TupleDataMax = 255;
1438 tuple.TupleOffset = 0;
1439 tuple.DesiredTuple = code;
1440 tuple.Attributes = 0;
1441
1442 ret = pccard_get_first_tuple(s, function, &tuple);
1443 while (!ret) {
1444 if (pccard_get_tuple_data(s, &tuple))
1445 goto next_entry;
1446
1447 if (parse)
1448 if (pcmcia_parse_tuple(&tuple, parse))
1449 goto next_entry;
1450
1451 ret = loop_tuple(&tuple, parse, priv_data);
1452 if (!ret)
1453 break;
1454
1455next_entry:
1456 ret = pccard_get_next_tuple(s, function, &tuple);
1457 }
1458
1459 kfree(buf);
1460 return ret;
1461}
1462
1463
1464/**
1465 * pccard_validate_cis() - check whether card has a sensible CIS 1365 * pccard_validate_cis() - check whether card has a sensible CIS
1466 * @s: the struct pcmcia_socket we are to check 1366 * @s: the struct pcmcia_socket we are to check
1467 * @info: returns the number of tuples in the (valid) CIS, or 0 1367 * @info: returns the number of tuples in the (valid) CIS, or 0