Commit 077e02d0 authored by Luca Ellero's avatar Luca Ellero Committed by Greg Kroah-Hartman

staging: ced1401: rename members of struct circ_blk

Rename members with CamelCase and Hungarian notation
Signed-off-by: default avatarLuca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1cc7b53c
......@@ -710,10 +710,10 @@ static int ced_set_area(struct ced_data *ced, int nArea, char __user *puBuf,
pTA->bCircular = bCircular;
pTA->bCircToHost = bCircToHost;
pTA->aBlocks[0].dwOffset = 0;
pTA->aBlocks[0].dwSize = 0;
pTA->aBlocks[1].dwOffset = 0;
pTA->aBlocks[1].dwSize = 0;
pTA->aBlocks[0].offset = 0;
pTA->aBlocks[0].size = 0;
pTA->aBlocks[1].offset = 0;
pTA->aBlocks[1].size = 0;
pTA->bUsed = true; /* This is now a used block */
spin_unlock_irq(&ced->stagedLock);
......@@ -1361,9 +1361,9 @@ int ced_get_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB)
if ((pArea->bUsed) && (pArea->bCircular) && /* Must be circular area */
(pArea->bCircToHost)) { /* For now at least must be to host */
if (pArea->aBlocks[0].dwSize > 0) { /* Got anything? */
cb.dwOffset = pArea->aBlocks[0].dwOffset;
cb.dwSize = pArea->aBlocks[0].dwSize;
if (pArea->aBlocks[0].size > 0) { /* Got anything? */
cb.dwOffset = pArea->aBlocks[0].offset;
cb.dwSize = pArea->aBlocks[0].size;
dev_dbg(&ced->interface->dev,
"%s: return block 0: %d bytes at %d\n",
__func__, cb.dwSize, cb.dwOffset);
......@@ -1415,31 +1415,31 @@ int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB)
(pArea->bCircToHost)) { /* For now at least must be to host */
bool bWaiting = false;
if ((pArea->aBlocks[0].dwSize >= uSize) && /* Got anything? */
(pArea->aBlocks[0].dwOffset == uStart)) { /* Must be legal data */
pArea->aBlocks[0].dwSize -= uSize;
pArea->aBlocks[0].dwOffset += uSize;
if (pArea->aBlocks[0].dwSize == 0) { /* Have we emptied this block? */
if (pArea->aBlocks[1].dwSize) { /* Is there a second block? */
if ((pArea->aBlocks[0].size >= uSize) && /* Got anything? */
(pArea->aBlocks[0].offset == uStart)) { /* Must be legal data */
pArea->aBlocks[0].size -= uSize;
pArea->aBlocks[0].offset += uSize;
if (pArea->aBlocks[0].size == 0) { /* Have we emptied this block? */
if (pArea->aBlocks[1].size) { /* Is there a second block? */
pArea->aBlocks[0] = pArea->aBlocks[1]; /* Copy down block 2 data */
pArea->aBlocks[1].dwSize = 0; /* and mark the second block as unused */
pArea->aBlocks[1].dwOffset = 0;
pArea->aBlocks[1].size = 0; /* and mark the second block as unused */
pArea->aBlocks[1].offset = 0;
} else
pArea->aBlocks[0].dwOffset = 0;
pArea->aBlocks[0].offset = 0;
}
dev_dbg(&ced->interface->dev,
"%s: free %d bytes at %d, return %d bytes at %d, wait=%d\n",
__func__, uSize, uStart,
pArea->aBlocks[0].dwSize,
pArea->aBlocks[0].dwOffset,
pArea->aBlocks[0].size,
pArea->aBlocks[0].offset,
ced->bXFerWaiting);
/* Return the next available block of memory as well */
if (pArea->aBlocks[0].dwSize > 0) { /* Got anything? */
if (pArea->aBlocks[0].size > 0) { /* Got anything? */
cb.dwOffset =
pArea->aBlocks[0].dwOffset;
cb.dwSize = pArea->aBlocks[0].dwSize;
pArea->aBlocks[0].offset;
cb.dwSize = pArea->aBlocks[0].size;
}
bWaiting = ced->bXFerWaiting;
......@@ -1453,8 +1453,8 @@ int ced_free_circ_block(struct ced_data *ced, TCIRCBLOCK __user *pCB)
dev_err(&ced->interface->dev,
"%s: ERROR: freeing %d bytes at %d, block 0 is %d bytes at %d\n",
__func__, uSize, uStart,
pArea->aBlocks[0].dwSize,
pArea->aBlocks[0].dwOffset);
pArea->aBlocks[0].size,
pArea->aBlocks[0].offset);
iReturn = U14ERR_NOMEMORY;
}
......
......@@ -554,62 +554,62 @@ static void staged_callback(struct urb *pUrb)
/* that calculates the offset to use (in ced_read_write_mem) is totally duff. */
if ((pArea->bCircular) && (pArea->bCircToHost) && (!bCancel) && /* Time to sort out circular buffer info? */
(ced->StagedRead)) { /* Only for tohost transfers for now */
if (pArea->aBlocks[1].dwSize > 0) { /* If block 1 is in use we must append to it */
if (pArea->aBlocks[1].size > 0) { /* If block 1 is in use we must append to it */
if (ced->StagedOffset ==
(pArea->aBlocks[1].dwOffset +
pArea->aBlocks[1].dwSize)) {
pArea->aBlocks[1].dwSize +=
(pArea->aBlocks[1].offset +
pArea->aBlocks[1].size)) {
pArea->aBlocks[1].size +=
ced->StagedLength;
dev_dbg(&ced->interface->dev,
"RWM_Complete, circ block 1 now %d bytes at %d\n",
pArea->aBlocks[1].dwSize,
pArea->aBlocks[1].dwOffset);
pArea->aBlocks[1].size,
pArea->aBlocks[1].offset);
} else {
/* Here things have gone very, very, wrong, but I cannot see how this can actually be achieved */
pArea->aBlocks[1].dwOffset =
pArea->aBlocks[1].offset =
ced->StagedOffset;
pArea->aBlocks[1].dwSize =
pArea->aBlocks[1].size =
ced->StagedLength;
dev_err(&ced->interface->dev,
"%s: ERROR, circ block 1 re-started %d bytes at %d\n",
__func__,
pArea->aBlocks[1].dwSize,
pArea->aBlocks[1].dwOffset);
pArea->aBlocks[1].size,
pArea->aBlocks[1].offset);
}
} else { /* If block 1 is not used, we try to add to block 0 */
if (pArea->aBlocks[0].dwSize > 0) { /* Got stored block 0 information? */
if (pArea->aBlocks[0].size > 0) { /* Got stored block 0 information? */
/* Must append onto the existing block 0 */
if (ced->StagedOffset ==
(pArea->aBlocks[0].dwOffset +
pArea->aBlocks[0].dwSize)) {
pArea->aBlocks[0].dwSize += ced->StagedLength; /* Just add this transfer in */
(pArea->aBlocks[0].offset +
pArea->aBlocks[0].size)) {
pArea->aBlocks[0].size += ced->StagedLength; /* Just add this transfer in */
dev_dbg(&ced->interface->dev,
"RWM_Complete, circ block 0 now %d bytes at %d\n",
pArea->aBlocks[0].
dwSize,
size,
pArea->aBlocks[0].
dwOffset);
offset);
} else { /* If it doesn't append, put into new block 1 */
pArea->aBlocks[1].dwOffset =
pArea->aBlocks[1].offset =
ced->StagedOffset;
pArea->aBlocks[1].dwSize =
pArea->aBlocks[1].size =
ced->StagedLength;
dev_dbg(&ced->interface->dev,
"RWM_Complete, circ block 1 started %d bytes at %d\n",
pArea->aBlocks[1].
dwSize,
size,
pArea->aBlocks[1].
dwOffset);
offset);
}
} else { /* No info stored yet, just save in block 0 */
pArea->aBlocks[0].dwOffset =
pArea->aBlocks[0].offset =
ced->StagedOffset;
pArea->aBlocks[0].dwSize =
pArea->aBlocks[0].size =
ced->StagedLength;
dev_dbg(&ced->interface->dev,
"RWM_Complete, circ block 0 started %d bytes at %d\n",
pArea->aBlocks[0].dwSize,
pArea->aBlocks[0].dwOffset);
pArea->aBlocks[0].size,
pArea->aBlocks[0].offset);
}
}
}
......@@ -628,8 +628,8 @@ static void staged_callback(struct urb *pUrb)
(pArea->bCircToHost)) { /* only in supported direction */
/* Is total data waiting up to size limit? */
unsigned int dwTotal =
pArea->aBlocks[0].dwSize +
pArea->aBlocks[1].dwSize;
pArea->aBlocks[0].size +
pArea->aBlocks[1].size;
iWakeUp = (dwTotal >= pArea->dwEventSz);
} else {
unsigned int transEnd =
......@@ -799,22 +799,22 @@ int ced_read_write_mem(struct ced_data *ced, bool Read, unsigned short wIdent,
dev_dbg(&ced->interface->dev,
"Circular buffers are %d at %d and %d at %d\n",
pArea->aBlocks[0].dwSize, pArea->aBlocks[0].dwOffset,
pArea->aBlocks[1].dwSize, pArea->aBlocks[1].dwOffset);
if (pArea->aBlocks[1].dwSize > 0) { /* Using the second block already? */
dwOffs = pArea->aBlocks[1].dwOffset + pArea->aBlocks[1].dwSize; /* take offset from that */
bWait = (dwOffs + dwLen) > pArea->aBlocks[0].dwOffset; /* Wait if will overwrite block 0? */
pArea->aBlocks[0].size, pArea->aBlocks[0].offset,
pArea->aBlocks[1].size, pArea->aBlocks[1].offset);
if (pArea->aBlocks[1].size > 0) { /* Using the second block already? */
dwOffs = pArea->aBlocks[1].offset + pArea->aBlocks[1].size; /* take offset from that */
bWait = (dwOffs + dwLen) > pArea->aBlocks[0].offset; /* Wait if will overwrite block 0? */
bWait |= (dwOffs + dwLen) > pArea->dwLength; /* or if it overflows the buffer */
} else { /* Area 1 not in use, try to use area 0 */
if (pArea->aBlocks[0].dwSize == 0) /* Reset block 0 if not in use */
pArea->aBlocks[0].dwOffset = 0;
if (pArea->aBlocks[0].size == 0) /* Reset block 0 if not in use */
pArea->aBlocks[0].offset = 0;
dwOffs =
pArea->aBlocks[0].dwOffset +
pArea->aBlocks[0].dwSize;
pArea->aBlocks[0].offset +
pArea->aBlocks[0].size;
if ((dwOffs + dwLen) > pArea->dwLength) { /* Off the end of the buffer? */
pArea->aBlocks[1].dwOffset = 0; /* Set up to use second block */
pArea->aBlocks[1].offset = 0; /* Set up to use second block */
dwOffs = 0;
bWait = (dwOffs + dwLen) > pArea->aBlocks[0].dwOffset; /* Wait if will overwrite block 0? */
bWait = (dwOffs + dwLen) > pArea->aBlocks[0].offset; /* Wait if will overwrite block 0? */
bWait |= (dwOffs + dwLen) > pArea->dwLength; /* or if it overflows the buffer */
}
}
......
......@@ -95,8 +95,8 @@
/* A structure holding information about a block */
/* of memory for use in circular transfers */
struct circ_blk {
volatile UINT dwOffset; /* Offset within area of block start */
volatile UINT dwSize; /* Size of the block, in bytes (0 = unused) */
volatile UINT offset; /* Offset within area of block start */
volatile UINT size; /* Size of the block, in bytes (0 = unused) */
};
/* A structure holding all of the information about a transfer area - an area of */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment