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

Staging: ced1401: Fixes 'open brace should be on the previous line'.

Fixes checkpatch warnings 'open brace should be on the previous line'.

Signed-off-by: Elena Ufimtseva <ufimtseva@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Elena Ufimtseva and committed by
Greg Kroah-Hartman
e035b590 d9f8374b

+81 -143
+38 -70
drivers/staging/ced1401/ced_ioc.c
··· 118 118 buffer[n] = 0; /* terminate for debug purposes */ 119 119 120 120 mutex_lock(&pdx->io_mutex); /* Protect disconnect from new i/o */ 121 - if (n > 0) /* do nothing if nowt to do! */ 122 - { 121 + if (n > 0) { /* do nothing if nowt to do! */ 123 122 dev_dbg(&pdx->interface->dev, "%s n=%d>%s<", __func__, n, 124 123 buffer); 125 124 iReturn = PutChars(pdx, buffer, n); ··· 197 198 *error = pdx->statBuf[1]; 198 199 199 200 nDevice = pdx->udev->descriptor.bcdDevice >> 8; /* 1401 type code value */ 200 - switch (nDevice) /* so we can clean up current state */ 201 - { 201 + switch (nDevice) { /* so we can clean up current state */ 202 202 case 0: 203 203 pdx->sCurrentState = U14ERR_U1401; 204 204 break; ··· 230 232 /* We can fill this in when we know how we will implement the staged transfer stuff */ 231 233 spin_lock_irq(&pdx->stagedLock); 232 234 233 - if (pdx->bStagedUrbPending) /* anything to be cancelled? May need more... */ 234 - { 235 + if (pdx->bStagedUrbPending) { /* anything to be cancelled? May need more... */ 235 236 dev_info(&pdx->interface - dev, 236 237 "ReadWrite_Cancel about to cancel Urb"); 237 238 /* Clear the staging done flag */ ··· 318 321 /* release the io_mutex because if we don't, we will deadlock due to system */ 319 322 /* calls back into the driver. */ 320 323 mutex_unlock(&pdx->io_mutex); /* locked, so we will not get system calls */ 321 - if (iReturn >= 0) /* if we failed */ 322 - { 324 + if (iReturn >= 0) { /* if we failed */ 323 325 iReturn = usb_reset_device(pdx->udev); /* try to do the reset */ 324 326 usb_unlock_device(pdx->udev); /* undo the lock */ 325 327 } 326 328 327 329 mutex_lock(&pdx->io_mutex); /* hold stuff off while we wait */ 328 330 pdx->dwDMAFlag = MODE_CHAR; /* Clear DMA mode flag regardless! */ 329 - if (iReturn == 0) /* if all is OK still */ 330 - { 331 + if (iReturn == 0) { /* if all is OK still */ 331 332 unsigned int state; 332 333 iReturn = InSelfTest(pdx, &state); /* see if likely in self test */ 333 - if (iReturn > 0) /* do we need to wait for self-test? */ 334 - { 334 + if (iReturn > 0) { /* do we need to wait for self-test? */ 335 335 unsigned long ulTimeOut = jiffies + 30 * HZ; /* when to give up */ 336 336 while ((iReturn > 0) && time_before(jiffies, ulTimeOut)) { 337 337 schedule(); /* let other stuff run */ ··· 374 380 bTestBuff, bShortTest); 375 381 376 382 if ((bTestBuff) && /* Buffer check requested, and... */ 377 - (pdx->dwNumInput || pdx->dwNumOutput)) /* ...characters were in the buffer? */ 378 - { 383 + (pdx->dwNumInput || pdx->dwNumOutput)) { /* ...characters were in the buffer? */ 379 384 bShortTest = false; /* Then do the full test */ 380 385 dev_dbg(&pdx->interface->dev, 381 386 "%s will reset as buffers not empty", __func__); 382 387 } 383 388 384 - if (bShortTest || !bCanReset) /* Still OK to try the short test? */ 385 - { /* Always test if no reset - we want state update */ 389 + if (bShortTest || !bCanReset) { /* Still OK to try the short test? */ 390 + /* Always test if no reset - we want state update */ 386 391 unsigned int state, error; 387 392 dev_dbg(&pdx->interface->dev, "%s->Get1401State", __func__); 388 - if (Get1401State(pdx, &state, &error) == U14ERR_NOERROR) /* Check on the 1401 state */ 389 - { 393 + if (Get1401State(pdx, &state, &error) == U14ERR_NOERROR) { /* Check on the 1401 state */ 390 394 if ((state & 0xFF) == 0) /* If call worked, check the status value */ 391 395 bRet = true; /* If that was zero, all is OK, no reset needed */ 392 396 } 393 397 } 394 398 395 - if (!bRet && bCanReset) /* If all not OK, then */ 396 - { 399 + if (!bRet && bCanReset) { /* If all not OK, then */ 397 400 dev_info(&pdx->interface->dev, "%s->Is1401 %d %d %d %d", 398 401 __func__, bShortTest, pdx->sCurrentState, bTestBuff, 399 402 pdx->bForceReset); ··· 430 439 SendChars(pdx); /* and send any buffered chars */ 431 440 432 441 spin_lock_irq(&pdx->charInLock); 433 - if (pdx->dwNumInput > 0) /* worth looking */ 434 - { 442 + if (pdx->dwNumInput > 0) { /* worth looking */ 435 443 iReturn = pdx->inputBuffer[pdx->dwInBuffGet++]; 436 444 if (pdx->dwInBuffGet >= INBUF_SZ) 437 445 pdx->dwInBuffGet = 0; ··· 472 482 if (nAvailable > n) /* read max of space in pUser... */ 473 483 nAvailable = n; /* ...or input characters */ 474 484 475 - if (nAvailable > 0) /* worth looking? */ 476 - { 485 + if (nAvailable > 0) { /* worth looking? */ 477 486 char buffer[INBUF_SZ + 1]; /* space for a linear copy of data */ 478 487 int nGot = 0; 479 488 int nCopyToUser; /* number to copy to user */ ··· 486 497 pdx->dwInBuffGet = 0; /* wrap buffer pointer */ 487 498 488 499 buffer[nGot++] = cData; /* save the output */ 489 - } 490 - while ((nGot < nAvailable) && cData); 500 + } while ((nGot < nAvailable) && cData); 491 501 492 502 nCopyToUser = nGot; /* what to copy... */ 493 - if (cData) /* do we need null */ 494 - { 503 + if (cData) { /* do we need null */ 495 504 buffer[nGot] = (char)0; /* make it tidy */ 496 505 if (nGot < n) /* if space in user buffer... */ 497 506 ++nCopyToUser; /* ...copy the 0 as well. */ ··· 543 556 SendChars(pdx); /* and send any buffered chars */ 544 557 spin_lock_irq(&pdx->charInLock); /* Get protection */ 545 558 546 - if (pdx->dwNumInput > 0) /* worth looking? */ 547 - { 559 + if (pdx->dwNumInput > 0) { /* worth looking? */ 548 560 unsigned int dwIndex = pdx->dwInBuffGet; /* start at first available */ 549 561 unsigned int dwEnd = pdx->dwInBuffPut; /* Position for search end */ 550 562 do { ··· 552 566 553 567 if (dwIndex >= INBUF_SZ) /* see if we fall off buff */ 554 568 dwIndex = 0; 555 - } 556 - while (dwIndex != dwEnd); /* go to last available */ 569 + } while (dwIndex != dwEnd); /* go to last available */ 557 570 } 558 571 559 572 spin_unlock_irq(&pdx->charInLock); ··· 630 645 } 631 646 spin_unlock_irq(&pdx->stagedLock); 632 647 633 - if (pPages) /* if we decided to release the memory */ 634 - { 648 + if (pPages) { /* if we decided to release the memory */ 635 649 /* Now we must undo the pinning down of the pages. We will assume the worst and mark */ 636 650 /* all the pages as dirty. Don't be tempted to move this up above as you must not be */ 637 651 /* holding a spin lock to do this stuff as it is not atomic. */ ··· 698 714 up_read(&current->mm->mmap_sem); /* release the semaphore */ 699 715 dev_dbg(&pdx->interface->dev, "%s nPages = %d", __func__, nPages); 700 716 701 - if (nPages > 0) /* if we succeeded */ 702 - { 717 + if (nPages > 0) { /* if we succeeded */ 703 718 /* If you are tempted to use page_address (form LDD3), forget it. You MUST use */ 704 719 /* kmap() or kmap_atomic() to get a virtual address. page_address will give you */ 705 720 /* (null) or at least it does in this context with an x86 machine. */ ··· 797 814 TRANSAREA *pTA = &pdx->rTransDef[te.wAreaNum]; 798 815 mutex_lock(&pdx->io_mutex); /* make sure we have no competitor */ 799 816 spin_lock_irq(&pdx->stagedLock); 800 - if (pTA->bUsed) /* area must be in use */ 801 - { 817 + if (pTA->bUsed) { /* area must be in use */ 802 818 pTA->dwEventSt = te.dwStart; /* set area regions */ 803 819 pTA->dwEventSz = te.dwLength; /* set size (0 cancels it) */ 804 820 pTA->bEventToHost = te.wFlags & 1; /* set the direction */ ··· 1012 1030 if (iReturn == U14ERR_NOERROR) /* Only accept zero if it happens twice */ 1013 1031 iReturn = Get1401State(pdx, &state, &error); 1014 1032 1015 - if (iReturn != U14ERR_NOERROR) /* Self-test can cause comms errors */ 1016 - { /* so we assume still testing */ 1033 + if (iReturn != U14ERR_NOERROR) { /* Self-test can cause comms errors */ 1034 + /* so we assume still testing */ 1017 1035 dev_err(&pdx->interface->dev, 1018 1036 "%s Get1401State=%d, assuming still testing", __func__, 1019 1037 iReturn); ··· 1022 1040 iReturn = U14ERR_NOERROR; 1023 1041 } 1024 1042 1025 - if ((state == -1) && (error == -1)) /* If Get1401State had problems */ 1026 - { 1043 + if ((state == -1) && (error == -1)) { /* If Get1401State had problems */ 1027 1044 dev_err(&pdx->interface->dev, 1028 1045 "%s Get1401State failed, assuming still testing", 1029 1046 __func__); ··· 1030 1049 error = 0; 1031 1050 } 1032 1051 1033 - if ((state & 0xFF) == 0x80) /* If we are still in self-test */ 1034 - { 1035 - if (state & 0x00FF0000) /* Have we got an error? */ 1036 - { 1052 + if ((state & 0xFF) == 0x80) { /* If we are still in self-test */ 1053 + if (state & 0x00FF0000) { /* Have we got an error? */ 1037 1054 gst.code = (state & 0x00FF0000) >> 16; /* read the error code */ 1038 1055 gst.x = error & 0x0000FFFF; /* Error data X */ 1039 1056 gst.y = (error & 0xFFFF0000) >> 16; /* and data Y */ 1040 1057 dev_dbg(&pdx->interface->dev, "Self-test error code %d", 1041 1058 gst.code); 1042 - } else /* No error, check for timeout */ 1043 - { 1059 + } else { /* No error, check for timeout */ 1044 1060 unsigned long ulNow = jiffies; /* get current time */ 1045 1061 if (time_after(ulNow, pdx->ulSelfTestTime)) { 1046 1062 gst.code = -2; /* Flag the timeout */ ··· 1052 1074 dev_dbg(&pdx->interface->dev, "Self-test done"); 1053 1075 } 1054 1076 1055 - if (gst.code < 0) /* If we have a problem or finished */ 1056 - { /* If using the 2890 we should reset properly */ 1077 + if (gst.code < 0) { /* If we have a problem or finished */ 1078 + /* If using the 2890 we should reset properly */ 1057 1079 if ((pdx->nPipes == 4) && (pdx->s1401Type <= TYPEPOWER)) 1058 1080 Is1401(pdx); /* Get 1401 reset and OK */ 1059 1081 else ··· 1362 1384 cb.dwOffset = 0; /* set default result (nothing) */ 1363 1385 cb.dwSize = 0; 1364 1386 1365 - if (nArea < MAX_TRANSAREAS) /* The area number must be OK */ 1366 - { 1387 + if (nArea < MAX_TRANSAREAS) { /* The area number must be OK */ 1367 1388 TRANSAREA *pArea = &pdx->rTransDef[nArea]; /* Pointer to relevant info */ 1368 1389 spin_lock_irq(&pdx->stagedLock); /* Lock others out */ 1369 1390 1370 1391 if ((pArea->bUsed) && (pArea->bCircular) && /* Must be circular area */ 1371 - (pArea->bCircToHost)) /* For now at least must be to host */ 1372 - { 1373 - if (pArea->aBlocks[0].dwSize > 0) /* Got anything? */ 1374 - { 1392 + (pArea->bCircToHost)) { /* For now at least must be to host */ 1393 + if (pArea->aBlocks[0].dwSize > 0) { /* Got anything? */ 1375 1394 cb.dwOffset = pArea->aBlocks[0].dwOffset; 1376 1395 cb.dwSize = pArea->aBlocks[0].dwSize; 1377 1396 dev_dbg(&pdx->interface->dev, ··· 1413 1438 cb.dwOffset = 0; /* then set default result (nothing) */ 1414 1439 cb.dwSize = 0; 1415 1440 1416 - if (nArea < MAX_TRANSAREAS) /* The area number must be OK */ 1417 - { 1441 + if (nArea < MAX_TRANSAREAS) { /* The area number must be OK */ 1418 1442 TRANSAREA *pArea = &pdx->rTransDef[nArea]; /* Pointer to relevant info */ 1419 1443 spin_lock_irq(&pdx->stagedLock); /* Lock others out */ 1420 1444 1421 1445 if ((pArea->bUsed) && (pArea->bCircular) && /* Must be circular area */ 1422 - (pArea->bCircToHost)) /* For now at least must be to host */ 1423 - { 1446 + (pArea->bCircToHost)) { /* For now at least must be to host */ 1424 1447 bool bWaiting = false; 1425 1448 1426 1449 if ((pArea->aBlocks[0].dwSize >= uSize) && /* Got anything? */ 1427 - (pArea->aBlocks[0].dwOffset == uStart)) /* Must be legal data */ 1428 - { 1450 + (pArea->aBlocks[0].dwOffset == uStart)) { /* Must be legal data */ 1429 1451 pArea->aBlocks[0].dwSize -= uSize; 1430 1452 pArea->aBlocks[0].dwOffset += uSize; 1431 - if (pArea->aBlocks[0].dwSize == 0) /* Have we emptied this block? */ 1432 - { 1433 - if (pArea->aBlocks[1].dwSize) /* Is there a second block? */ 1434 - { 1453 + if (pArea->aBlocks[0].dwSize == 0) { /* Have we emptied this block? */ 1454 + if (pArea->aBlocks[1].dwSize) { /* Is there a second block? */ 1435 1455 pArea->aBlocks[0] = pArea->aBlocks[1]; /* Copy down block 2 data */ 1436 1456 pArea->aBlocks[1].dwSize = 0; /* and mark the second block as unused */ 1437 1457 pArea->aBlocks[1].dwOffset = 0; ··· 1442 1472 pdx->bXFerWaiting); 1443 1473 1444 1474 /* Return the next available block of memory as well */ 1445 - if (pArea->aBlocks[0].dwSize > 0) /* Got anything? */ 1446 - { 1475 + if (pArea->aBlocks[0].dwSize > 0) { /* Got anything? */ 1447 1476 cb.dwOffset = 1448 1477 pArea->aBlocks[0].dwOffset; 1449 1478 cb.dwSize = pArea->aBlocks[0].dwSize; ··· 1465 1496 } 1466 1497 1467 1498 /* If we have one, kick off pending transfer */ 1468 - if (bWaiting) /* Got a block xfer waiting? */ 1469 - { 1499 + if (bWaiting) { /* Got a block xfer waiting? */ 1470 1500 int RWMStat = 1471 1501 ReadWriteMem(pdx, !pdx->rDMAInfo.bOutWard, 1472 1502 pdx->rDMAInfo.wIdent,
+38 -63
drivers/staging/ced1401/usb1401.c
··· 298 298 if (pdx->dwOutBuffGet >= OUTBUF_SZ) /* Can't do this any earlier as data could be overwritten */ 299 299 pdx->dwOutBuffGet = 0; 300 300 301 - if (pdx->dwNumOutput > 0) /* if more to be done... */ 302 - { 301 + if (pdx->dwNumOutput > 0) { /* if more to be done... */ 303 302 int nPipe = 0; /* The pipe number to use */ 304 303 int iReturn; 305 304 char *pDat = &pdx->outputBuffer[pdx->dwOutBuffGet]; ··· 346 347 347 348 if ((!pdx->bSendCharsPending) && /* Not currently sending */ 348 349 (pdx->dwNumOutput > 0) && /* has characters to output */ 349 - (CanAcceptIoRequests(pdx))) /* and current activity is OK */ 350 - { 350 + (CanAcceptIoRequests(pdx))) { /* and current activity is OK */ 351 351 unsigned int dwCount = pdx->dwNumOutput; /* Get a copy of the character count */ 352 352 pdx->bSendCharsPending = true; /* Set flag to lock out other threads */ 353 353 ··· 541 543 pdx->StagedDone, pdx->StagedLength); 542 544 543 545 if ((pdx->StagedDone == pdx->StagedLength) || /* If no more to do */ 544 - (bCancel)) /* or this IRP was cancelled */ 545 - { 546 + (bCancel)) { /* or this IRP was cancelled */ 546 547 TRANSAREA *pArea = &pdx->rTransDef[pdx->StagedId]; /* Transfer area info */ 547 548 dev_dbg(&pdx->interface->dev, 548 549 "%s transfer done, bytes %d, cancel %d", __func__, ··· 552 555 /* add this to the end of a growing block or to use it to start a new block unless the code */ 553 556 /* that calculates the offset to use (in ReadWriteMem) is totally duff. */ 554 557 if ((pArea->bCircular) && (pArea->bCircToHost) && (!bCancel) && /* Time to sort out circular buffer info? */ 555 - (pdx->StagedRead)) /* Only for tohost transfers for now */ 556 - { 557 - if (pArea->aBlocks[1].dwSize > 0) /* If block 1 is in use we must append to it */ 558 - { 558 + (pdx->StagedRead)) { /* Only for tohost transfers for now */ 559 + if (pArea->aBlocks[1].dwSize > 0) { /* If block 1 is in use we must append to it */ 559 560 if (pdx->StagedOffset == 560 561 (pArea->aBlocks[1].dwOffset + 561 562 pArea->aBlocks[1].dwSize)) { ··· 575 580 pArea->aBlocks[1].dwSize, 576 581 pArea->aBlocks[1].dwOffset); 577 582 } 578 - } else /* If block 1 is not used, we try to add to block 0 */ 579 - { 580 - if (pArea->aBlocks[0].dwSize > 0) /* Got stored block 0 information? */ 581 - { /* Must append onto the existing block 0 */ 583 + } else { /* If block 1 is not used, we try to add to block 0 */ 584 + if (pArea->aBlocks[0].dwSize > 0) { /* Got stored block 0 information? */ 585 + /* Must append onto the existing block 0 */ 582 586 if (pdx->StagedOffset == 583 587 (pArea->aBlocks[0].dwOffset + 584 588 pArea->aBlocks[0].dwSize)) { ··· 588 594 dwSize, 589 595 pArea->aBlocks[0]. 590 596 dwOffset); 591 - } else /* If it doesn't append, put into new block 1 */ 592 - { 597 + } else { /* If it doesn't append, put into new block 1 */ 593 598 pArea->aBlocks[1].dwOffset = 594 599 pdx->StagedOffset; 595 600 pArea->aBlocks[1].dwSize = ··· 600 607 pArea->aBlocks[1]. 601 608 dwOffset); 602 609 } 603 - } else /* No info stored yet, just save in block 0 */ 604 - { 610 + } else { /* No info stored yet, just save in block 0 */ 605 611 pArea->aBlocks[0].dwOffset = 606 612 pdx->StagedOffset; 607 613 pArea->aBlocks[0].dwSize = ··· 613 621 } 614 622 } 615 623 616 - if (!bCancel) /* Don't generate an event if cancelled */ 617 - { 624 + if (!bCancel) { /* Don't generate an event if cancelled */ 618 625 dev_dbg(&pdx->interface->dev, 619 626 "RWM_Complete, bCircular %d, bToHost %d, eStart %d, eSize %d", 620 627 pArea->bCircular, pArea->bEventToHost, 621 628 pArea->dwEventSt, pArea->dwEventSz); 622 629 if ((pArea->dwEventSz) && /* Set a user-mode event... */ 623 - (pdx->StagedRead == pArea->bEventToHost)) /* ...on transfers in this direction? */ 624 - { 630 + (pdx->StagedRead == pArea->bEventToHost)) { /* ...on transfers in this direction? */ 625 631 int iWakeUp = 0; /* assume */ 626 632 /* If we have completed the right sort of DMA transfer then set the event to notify */ 627 633 /* the user code to wake up anyone that is waiting. */ 628 634 if ((pArea->bCircular) && /* Circular areas use a simpler test */ 629 - (pArea->bCircToHost)) /* only in supported direction */ 630 - { /* Is total data waiting up to size limit? */ 635 + (pArea->bCircToHost)) { /* only in supported direction */ 636 + /* Is total data waiting up to size limit? */ 631 637 unsigned int dwTotal = 632 638 pArea->aBlocks[0].dwSize + 633 639 pArea->aBlocks[1].dwSize; ··· 651 661 652 662 pdx->dwDMAFlag = MODE_CHAR; /* Switch back to char mode before ReadWriteMem call */ 653 663 654 - if (!bCancel) /* Don't look for waiting transfer if cancelled */ 655 - { 664 + if (!bCancel) { /* Don't look for waiting transfer if cancelled */ 656 665 /* If we have a transfer waiting, kick it off */ 657 - if (pdx->bXFerWaiting) /* Got a block xfer waiting? */ 658 - { 666 + if (pdx->bXFerWaiting) { /* Got a block xfer waiting? */ 659 667 int iReturn; 660 668 dev_info(&pdx->interface->dev, 661 669 "*** RWM_Complete *** pending transfer will now be set up!!!"); ··· 707 719 if (nPipe < 0) /* and trap case that should never happen */ 708 720 return U14ERR_FAIL; 709 721 710 - if (!CanAcceptIoRequests(pdx)) /* got sudden remove? */ 711 - { 722 + if (!CanAcceptIoRequests(pdx)) { /* got sudden remove? */ 712 723 dev_info(&pdx->interface->dev, "%s sudden remove, giving up", 713 724 __func__); 714 725 return U14ERR_FAIL; /* could do with a better error */ ··· 764 777 { 765 778 TRANSAREA *pArea = &pdx->rTransDef[wIdent]; /* Transfer area info */ 766 779 767 - if (!CanAcceptIoRequests(pdx)) /* Are we in a state to accept new requests? */ 768 - { 780 + if (!CanAcceptIoRequests(pdx)) { /* Are we in a state to accept new requests? */ 769 781 dev_err(&pdx->interface->dev, "%s can't accept requests", 770 782 __func__); 771 783 return U14ERR_FAIL; ··· 784 798 return U14ERR_NOERROR; 785 799 } 786 800 787 - if (dwLen == 0) /* allow 0-len read or write; just return success */ 788 - { 801 + if (dwLen == 0) { /* allow 0-len read or write; just return success */ 789 802 dev_dbg(&pdx->interface->dev, 790 803 "%s OK; zero-len read/write request", __func__); 791 804 return U14ERR_NOERROR; 792 805 } 793 806 794 807 if ((pArea->bCircular) && /* Circular transfer? */ 795 - (pArea->bCircToHost) && (Read)) /* In a supported direction */ 796 - { /* If so, we sort out offset ourself */ 808 + (pArea->bCircToHost) && (Read)) { /* In a supported direction */ 809 + /* If so, we sort out offset ourself */ 797 810 bool bWait = false; /* Flag for transfer having to wait */ 798 811 799 812 dev_dbg(&pdx->interface->dev, 800 813 "Circular buffers are %d at %d and %d at %d", 801 814 pArea->aBlocks[0].dwSize, pArea->aBlocks[0].dwOffset, 802 815 pArea->aBlocks[1].dwSize, pArea->aBlocks[1].dwOffset); 803 - if (pArea->aBlocks[1].dwSize > 0) /* Using the second block already? */ 804 - { 816 + if (pArea->aBlocks[1].dwSize > 0) { /* Using the second block already? */ 805 817 dwOffs = pArea->aBlocks[1].dwOffset + pArea->aBlocks[1].dwSize; /* take offset from that */ 806 818 bWait = (dwOffs + dwLen) > pArea->aBlocks[0].dwOffset; /* Wait if will overwrite block 0? */ 807 819 bWait |= (dwOffs + dwLen) > pArea->dwLength; /* or if it overflows the buffer */ 808 - } else /* Area 1 not in use, try to use area 0 */ 809 - { 820 + } else { /* Area 1 not in use, try to use area 0 */ 810 821 if (pArea->aBlocks[0].dwSize == 0) /* Reset block 0 if not in use */ 811 822 pArea->aBlocks[0].dwOffset = 0; 812 823 dwOffs = 813 824 pArea->aBlocks[0].dwOffset + 814 825 pArea->aBlocks[0].dwSize; 815 - if ((dwOffs + dwLen) > pArea->dwLength) /* Off the end of the buffer? */ 816 - { 826 + if ((dwOffs + dwLen) > pArea->dwLength) { /* Off the end of the buffer? */ 817 827 pArea->aBlocks[1].dwOffset = 0; /* Set up to use second block */ 818 828 dwOffs = 0; 819 829 bWait = (dwOffs + dwLen) > pArea->aBlocks[0].dwOffset; /* Wait if will overwrite block 0? */ ··· 817 835 } 818 836 } 819 837 820 - if (bWait) /* This transfer will have to wait? */ 821 - { 838 + if (bWait) { /* This transfer will have to wait? */ 822 839 pdx->bXFerWaiting = true; /* Flag we are waiting */ 823 840 dev_dbg(&pdx->interface->dev, 824 841 "%s xfer waiting for circular buffer space", ··· 858 877 bool bRead = false; 859 878 unsigned int dDone = *pdDone; 860 879 861 - if (dDone < dGot) /* If there is more data */ 862 - { 880 + if (dDone < dGot) { /* If there is more data */ 863 881 *pChar = (unsigned char)pBuf[dDone]; /* Extract the next char */ 864 882 dDone++; /* Increment the done count */ 865 883 *pdDone = dDone; ··· 1037 1057 /* I have no idea what this next test is about. '?' is 0x3f, which is area 3, code */ 1038 1058 /* 15. At the moment, this is not used, so it does no harm, but unless someone can */ 1039 1059 /* tell me what this is for, it should be removed from this and the Windows driver. */ 1040 - if (pCh[0] == '?') /* Is this an information response */ 1041 - { /* Parse and save the information */ 1060 + if (pCh[0] == '?') { /* Is this an information response */ 1061 + /* Parse and save the information */ 1042 1062 } else { 1043 1063 spin_lock(&pdx->stagedLock); /* Lock others out */ 1044 1064 1045 - if (ReadDMAInfo(&pdx->rDMAInfo, pdx, pCh, dwCount)) /* Get DMA parameters */ 1046 - { 1065 + if (ReadDMAInfo(&pdx->rDMAInfo, pdx, pCh, dwCount)) { /* Get DMA parameters */ 1047 1066 unsigned short wTransType = pdx->rDMAInfo.wTransType; /* check transfer type */ 1048 1067 1049 1068 dev_dbg(&pdx->interface->dev, ··· 1050 1071 pdx->rDMAInfo.bOutWard ? "1401" : "host", 1051 1072 pdx->rDMAInfo.dwOffset, pdx->rDMAInfo.dwSize); 1052 1073 1053 - if (pdx->bXFerWaiting) /* Check here for badly out of kilter... */ 1054 - { /* This can never happen, really */ 1074 + if (pdx->bXFerWaiting) { /* Check here for badly out of kilter... */ 1075 + /* This can never happen, really */ 1055 1076 dev_err(&pdx->interface->dev, 1056 1077 "ERROR: DMA setup while transfer still waiting"); 1057 - spin_unlock(&pdx->stagedLock); 1078 + spin_unlock(&pdx->stagedLock); 1058 1079 } else { 1059 1080 if ((wTransType == TM_EXTTOHOST) 1060 1081 || (wTransType == TM_EXTTO1401)) { ··· 1094 1115 DEVICE_EXTENSION *pdx = pUrb->context; 1095 1116 int nGot = pUrb->actual_length; /* what we transferred */ 1096 1117 1097 - if (pUrb->status) /* Do we have a problem to handle? */ 1098 - { 1118 + if (pUrb->status) { /* Do we have a problem to handle? */ 1099 1119 int nPipe = pdx->nPipes == 4 ? 1 : 0; /* The pipe number to use for error */ 1100 1120 /* sync/async unlink faults aren't errors... just saying device removed or stopped */ 1101 1121 if (! ··· 1116 1138 spin_lock(&pdx->charInLock); /* already at irq level */ 1117 1139 pdx->bPipeError[nPipe] = 1; /* Flag an error for later */ 1118 1140 } else { 1119 - if ((nGot > 1) && ((pdx->pCoherCharIn[0] & 0x7f) == 0x1b)) /* Esc sequence? */ 1120 - { 1141 + if ((nGot > 1) && ((pdx->pCoherCharIn[0] & 0x7f) == 0x1b)) { /* Esc sequence? */ 1121 1142 Handle1401Esc(pdx, &pdx->pCoherCharIn[1], nGot - 1); /* handle it */ 1122 1143 spin_lock(&pdx->charInLock); /* already at irq level */ 1123 1144 } else { ··· 1174 1197 (pdx->dwNumInput < (INBUF_SZ / 2)) && /* and there is some space */ 1175 1198 (pdx->dwDMAFlag == MODE_CHAR) && /* not doing any DMA */ 1176 1199 (!pdx->bXFerWaiting) && /* no xfer waiting to start */ 1177 - (CanAcceptIoRequests(pdx))) /* and activity is generally OK */ 1178 - { /* then off we go */ 1200 + (CanAcceptIoRequests(pdx))) { /* and activity is generally OK */ 1201 + /* then off we go */ 1179 1202 unsigned int nMax = INBUF_SZ - pdx->dwNumInput; /* max we could read */ 1180 1203 int nPipe = pdx->nPipes == 4 ? 1 : 0; /* The pipe number to use */ 1181 1204 ··· 1371 1394 if (!pdx) 1372 1395 goto error; 1373 1396 1374 - for (i = 0; i < MAX_TRANSAREAS; ++i) /* Initialise the wait queues */ 1375 - { 1397 + for (i = 0; i < MAX_TRANSAREAS; ++i) { /* Initialise the wait queues */ 1376 1398 init_waitqueue_head(&pdx->rTransDef[i].wqEvent); 1377 1399 } 1378 1400 ··· 1447 1471 pdx->bInterval); 1448 1472 } 1449 1473 /* Detect USB2 by checking last ep size (64 if USB1) */ 1450 - if (i == pdx->nPipes - 1) /* if this is the last ep (bulk) */ 1451 - { 1474 + if (i == pdx->nPipes - 1) { /* if this is the last ep (bulk) */ 1452 1475 pdx->bIsUSB2 = 1453 1476 le16_to_cpu(endpoint->wMaxPacketSize) > 64; 1454 1477 dev_info(&pdx->interface->dev, "USB%d",
+4 -8
drivers/staging/ced1401/usb1401.h
··· 93 93 #define CR_CHAR_80 0x8d /* and with bit 7 set */ 94 94 95 95 /* A structure holding information about a block of memory for use in circular transfers */ 96 - typedef struct circBlk 97 - { 96 + typedef struct circBlk { 98 97 volatile UINT dwOffset; /* Offset within area of block start */ 99 98 volatile UINT dwSize; /* Size of the block, in bytes (0 = unused) */ 100 99 } CIRCBLK; 101 100 102 101 /* A structure holding all of the information about a transfer area - an area of */ 103 102 /* memory set up for use either as a source or destination in DMA transfers. */ 104 - typedef struct transarea 105 - { 103 + typedef struct transarea { 106 104 void *lpvBuff; /* User address of xfer area saved for completeness */ 107 105 UINT dwBaseOffset; /* offset to start of xfer area in first page */ 108 106 UINT dwLength; /* Length of xfer area, in bytes */ ··· 119 121 120 122 /* The DMADESC structure is used to hold information on the transfer in progress. It */ 121 123 /* is set up by ReadDMAInfo, using information sent by the 1401 in an escape sequence. */ 122 - typedef struct dmadesc 123 - { 124 + typedef struct dmadesc { 124 125 unsigned short wTransType; /* transfer type as TM_xxx above */ 125 126 unsigned short wIdent; /* identifier word */ 126 127 unsigned int dwSize; /* bytes to transfer */ ··· 133 136 134 137 /* Structure to hold all of our device specific stuff. We are making this as similar as we */ 135 138 /* can to the Windows driver to help in our understanding of what is going on. */ 136 - typedef struct _DEVICE_EXTENSION 137 - { 139 + typedef struct _DEVICE_EXTENSION { 138 140 char inputBuffer[INBUF_SZ]; /* The two buffers */ 139 141 char outputBuffer[OUTBUF_SZ]; /* accessed by the host functions */ 140 142 volatile unsigned int dwNumInput; /* num of chars in input buffer */
+1 -2
drivers/staging/ced1401/use14_ioc.h
··· 269 269 270 270 typedef TCSBLOCK* LPTCSBLOCK; 271 271 272 - typedef struct paramBlk 273 - { 272 + typedef struct paramBlk { 274 273 short sState; 275 274 TCSBLOCK csBlock; 276 275 } PARAMBLK;