Commit 3ce341ad authored by Luca Ellero's avatar Luca Ellero Committed by Greg Kroah-Hartman

staging: ced1401: fix ced_copy_user_space()

Rename camel case arguments and locals in function ced_copy_user_space()
Signed-off-by: default avatarLuca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5d87900e
...@@ -448,57 +448,65 @@ int ced_send_chars(struct ced_data *ced) ...@@ -448,57 +448,65 @@ int ced_send_chars(struct ced_data *ced)
***************************************************************************/ ***************************************************************************/
static void ced_copy_user_space(struct ced_data *ced, int n) static void ced_copy_user_space(struct ced_data *ced, int n)
{ {
unsigned int nArea = ced->staged_id; unsigned int area = ced->staged_id;
if (nArea < MAX_TRANSAREAS) { if (area < MAX_TRANSAREAS) {
/* area to be used */ /* area to be used */
struct transarea *pArea = &ced->trans_def[nArea]; struct transarea *ta = &ced->trans_def[area];
unsigned int dwOffset = unsigned int offset =
ced->staged_done + ced->staged_offset + pArea->base_offset; ced->staged_done + ced->staged_offset + ta->base_offset;
char *pCoherBuf = ced->coher_staged_io; /* coherent buffer */ char *coher_buf = ced->coher_staged_io; /* coherent buffer */
if (!pArea->used) { if (!ta->used) {
dev_err(&ced->interface->dev, "%s: area %d unused\n", dev_err(&ced->interface->dev, "%s: area %d unused\n",
__func__, nArea); __func__, area);
return; return;
} }
while (n) { while (n) {
int nPage = dwOffset >> PAGE_SHIFT; /* page number in table */ /* page number in table */
if (nPage < pArea->n_pages) { int page = offset >> PAGE_SHIFT;
char *pvAddress =
(char *)kmap_atomic(pArea->pages[nPage]); if (page < ta->n_pages) {
if (pvAddress) { char *address =
unsigned int uiPageOff = dwOffset & (PAGE_SIZE - 1); /* offset into the page */ (char *)kmap_atomic(ta->pages[page]);
size_t uiXfer = PAGE_SIZE - uiPageOff; /* max to transfer on this page */ if (address) {
if (uiXfer > n) /* limit byte count if too much */ /* offset into the page */
uiXfer = n; /* for the page */ unsigned int page_off =
offset & (PAGE_SIZE - 1);
/* max to transfer on this page */
size_t xfer = PAGE_SIZE - page_off;
/* limit byte count if too much */
/* for the page */
if (xfer > n)
xfer = n;
if (ced->staged_read) if (ced->staged_read)
memcpy(pvAddress + uiPageOff, memcpy(address + page_off,
pCoherBuf, uiXfer); coher_buf, xfer);
else else
memcpy(pCoherBuf, memcpy(coher_buf,
pvAddress + uiPageOff, address + page_off,
uiXfer); xfer);
kunmap_atomic(pvAddress); kunmap_atomic(address);
dwOffset += uiXfer; offset += xfer;
pCoherBuf += uiXfer; coher_buf += xfer;
n -= uiXfer; n -= xfer;
} else { } else {
dev_err(&ced->interface->dev, dev_err(&ced->interface->dev,
"%s: did not map page %d\n", "%s: did not map page %d\n",
__func__, nPage); __func__, page);
return; return;
} }
} else { } else {
dev_err(&ced->interface->dev, dev_err(&ced->interface->dev,
"%s: exceeded pages %d\n", "%s: exceeded pages %d\n",
__func__, nPage); __func__, page);
return; return;
} }
} }
} else } else
dev_err(&ced->interface->dev, "%s: bad area %d\n", dev_err(&ced->interface->dev, "%s: bad area %d\n",
__func__, nArea); __func__, area);
} }
/* Forward declarations for stuff used circularly */ /* Forward declarations for stuff used circularly */
......
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