Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: ced1401: fix ced_free_circ_block()

Rename camel case arguments and locals in function ced_free_circ_block()

Signed-off-by: Luca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Luca Ellero and committed by
Greg Kroah-Hartman
f4a86b65 7b7f6020

+57 -46
+56 -45
drivers/staging/ced1401/ced_ioc.c
··· 1456 1456 ** 1457 1457 ** Frees a block of circularly-transferred data and returns the next one. 1458 1458 ****************************************************************************/ 1459 - int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB) 1459 + int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *ucb) 1460 1460 { 1461 - int iReturn = U14ERR_NOERROR; 1462 - unsigned int nArea, uStart, uSize; 1461 + int ret = U14ERR_NOERROR; 1462 + unsigned int area, start, size; 1463 1463 TCIRCBLOCK cb; 1464 1464 1465 1465 dev_dbg(&ced->interface->dev, "%s\n", __func__); 1466 1466 1467 - if (copy_from_user(&cb, pCB, sizeof(cb))) 1467 + if (copy_from_user(&cb, ucb, sizeof(cb))) 1468 1468 return -EFAULT; 1469 1469 1470 1470 mutex_lock(&ced->io_mutex); 1471 1471 1472 - nArea = cb.nArea; /* Retrieve parameters first */ 1473 - uStart = cb.dwOffset; 1474 - uSize = cb.dwSize; 1472 + area = cb.nArea; /* Retrieve parameters first */ 1473 + start = cb.dwOffset; 1474 + size = cb.dwSize; 1475 1475 cb.dwOffset = 0; /* then set default result (nothing) */ 1476 1476 cb.dwSize = 0; 1477 1477 1478 - if (nArea < MAX_TRANSAREAS) { /* The area number must be OK */ 1478 + if (area < MAX_TRANSAREAS) { /* The area number must be OK */ 1479 1479 /* Pointer to relevant info */ 1480 - struct transarea *pArea = &ced->trans_def[nArea]; 1480 + struct transarea *ta = &ced->trans_def[area]; 1481 + 1481 1482 spin_lock_irq(&ced->staged_lock); /* Lock others out */ 1482 1483 1483 - if ((pArea->used) && (pArea->circular) && /* Must be circular area */ 1484 - (pArea->circ_to_host)) { /* For now at least must be to host */ 1485 - bool bWaiting = false; 1484 + if ((ta->used) && (ta->circular) && /* Must be circular area */ 1485 + (ta->circ_to_host)) { /* For now at least must be to host */ 1486 + bool waiting = false; 1486 1487 1487 - if ((pArea->blocks[0].size >= uSize) && /* Got anything? */ 1488 - (pArea->blocks[0].offset == uStart)) { /* Must be legal data */ 1489 - pArea->blocks[0].size -= uSize; 1490 - pArea->blocks[0].offset += uSize; 1491 - if (pArea->blocks[0].size == 0) { /* Have we emptied this block? */ 1492 - if (pArea->blocks[1].size) { /* Is there a second block? */ 1493 - pArea->blocks[0] = pArea->blocks[1]; /* Copy down block 2 data */ 1494 - pArea->blocks[1].size = 0; /* and mark the second block as unused */ 1495 - pArea->blocks[1].offset = 0; 1488 + if ((ta->blocks[0].size >= size) && /* Got anything? */ 1489 + (ta->blocks[0].offset == start)) { /* Must be legal data */ 1490 + ta->blocks[0].size -= size; 1491 + ta->blocks[0].offset += size; 1492 + 1493 + /* Have we emptied this block? */ 1494 + if (ta->blocks[0].size == 0) { 1495 + /* Is there a second block? */ 1496 + if (ta->blocks[1].size) { 1497 + /* Copy down block 2 data */ 1498 + ta->blocks[0] = ta->blocks[1]; 1499 + /* and mark the second */ 1500 + /* block as unused */ 1501 + ta->blocks[1].size = 0; 1502 + ta->blocks[1].offset = 0; 1496 1503 } else 1497 - pArea->blocks[0].offset = 0; 1504 + ta->blocks[0].offset = 0; 1498 1505 } 1499 1506 1500 1507 dev_dbg(&ced->interface->dev, 1501 - "%s: free %d bytes at %d, return %d bytes at %d, wait=%d\n", 1502 - __func__, uSize, uStart, 1503 - pArea->blocks[0].size, 1504 - pArea->blocks[0].offset, 1508 + "%s: free %d bytes at %d, " 1509 + "return %d bytes at %d, wait=%d\n", 1510 + __func__, size, start, 1511 + ta->blocks[0].size, 1512 + ta->blocks[0].offset, 1505 1513 ced->xfer_waiting); 1506 1514 1507 - /* Return the next available block of memory as well */ 1508 - if (pArea->blocks[0].size > 0) { /* Got anything? */ 1515 + /* Return the next available block of */ 1516 + /* memory as well */ 1517 + if (ta->blocks[0].size > 0) {/* Got anything? */ 1509 1518 cb.dwOffset = 1510 - pArea->blocks[0].offset; 1511 - cb.dwSize = pArea->blocks[0].size; 1519 + ta->blocks[0].offset; 1520 + cb.dwSize = ta->blocks[0].size; 1512 1521 } 1513 1522 1514 - bWaiting = ced->xfer_waiting; 1515 - if (bWaiting && ced->staged_urb_pending) { 1523 + waiting = ced->xfer_waiting; 1524 + if (waiting && ced->staged_urb_pending) { 1516 1525 dev_err(&ced->interface->dev, 1517 - "%s: ERROR: waiting xfer and staged Urb pending!\n", 1526 + "%s: ERROR: waiting xfer and " 1527 + "staged Urb pending!\n", 1518 1528 __func__); 1519 - bWaiting = false; 1529 + waiting = false; 1520 1530 } 1521 1531 } else { 1522 1532 dev_err(&ced->interface->dev, 1523 - "%s: ERROR: freeing %d bytes at %d, block 0 is %d bytes at %d\n", 1524 - __func__, uSize, uStart, 1525 - pArea->blocks[0].size, 1526 - pArea->blocks[0].offset); 1527 - iReturn = U14ERR_NOMEMORY; 1533 + "%s: ERROR: freeing %d bytes at %d, " 1534 + "block 0 is %d bytes at %d\n", 1535 + __func__, size, start, 1536 + ta->blocks[0].size, 1537 + ta->blocks[0].offset); 1538 + ret = U14ERR_NOMEMORY; 1528 1539 } 1529 1540 1530 1541 /* If we have one, kick off pending transfer */ 1531 - if (bWaiting) { /* Got a block xfer waiting? */ 1542 + if (waiting) { /* Got a block xfer waiting? */ 1532 1543 int RWMStat = 1533 1544 ced_read_write_mem(ced, 1534 1545 !ced->dma_info.outward, ··· 1552 1541 __func__, RWMStat); 1553 1542 } 1554 1543 } else 1555 - iReturn = U14ERR_NOTSET; 1544 + ret = U14ERR_NOTSET; 1556 1545 1557 1546 spin_unlock_irq(&ced->staged_lock); 1558 1547 } else 1559 - iReturn = U14ERR_BADAREA; 1548 + ret = U14ERR_BADAREA; 1560 1549 1561 - if (copy_to_user(pCB, &cb, sizeof(cb))) 1562 - iReturn = -EFAULT; 1550 + if (copy_to_user(ucb, &cb, sizeof(cb))) 1551 + ret = -EFAULT; 1563 1552 1564 1553 mutex_unlock(&ced->io_mutex); 1565 - return iReturn; 1554 + return ret; 1566 1555 }
+1 -1
drivers/staging/ced1401/usb1401.h
··· 254 254 extern int ced_set_circular(struct ced_data *ced, 255 255 struct transfer_area_desc __user *utd); 256 256 extern int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *ucb); 257 - extern int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB); 257 + extern int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *ucb); 258 258 extern int ced_wait_event(struct ced_data *ced, int area, int time_out); 259 259 extern int ced_test_event(struct ced_data *ced, int area); 260 260 #endif