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

staging: ced1401: fix ced_read_dma_info()

Rename camel case arguments and locals in function ced_read_dma_info()
Signed-off-by: default avatarLuca Ellero <luca.ellero@brickedbrain.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bcee5d0
...@@ -1028,66 +1028,71 @@ static bool ced_read_huff(volatile unsigned int *word, char *buf, ...@@ -1028,66 +1028,71 @@ static bool ced_read_huff(volatile unsigned int *word, char *buf,
** the transfer request. Returns FALSE if 1401 fails to respond or obselete ** the transfer request. Returns FALSE if 1401 fails to respond or obselete
** code from 1401 or bad parameters. ** code from 1401 or bad parameters.
** **
** The pBuf char pointer does not include the initial escape character, so ** The buf char pointer does not include the initial escape character, so
** we start handling the data at offset zero. ** we start handling the data at offset zero.
** **
*****************************************************************************/ *****************************************************************************/
static bool ced_read_dma_info(volatile struct dmadesc *pDmaDesc, static bool ced_read_dma_info(volatile struct dmadesc *dma_desc,
struct ced_data *ced, struct ced_data *ced,
char *pBuf, unsigned int dwCount) char *buf, unsigned int count)
{ {
bool bResult = false; /* assume we won't succeed */ bool retval = false; /* assume we won't succeed */
unsigned char ucData; unsigned char c;
unsigned int dDone = 0; /* We haven't parsed anything so far */ unsigned int n_done = 0; /* We haven't parsed anything so far */
dev_dbg(&ced->interface->dev, "%s\n", __func__); dev_dbg(&ced->interface->dev, "%s\n", __func__);
if (ced_read_char(&ucData, pBuf, &dDone, dwCount)) { if (ced_read_char(&c, buf, &n_done, count)) {
unsigned char ucTransCode = (ucData & 0x0F); /* get code for transfer type */ /* get code for transfer type */
unsigned short wIdent = ((ucData >> 4) & 0x07); /* and area identifier */ unsigned char trans_code = (c & 0x0F);
/* and area identifier */
unsigned short ident = ((c >> 4) & 0x07);
/* fill in the structure we were given */ /* fill in the structure we were given */
pDmaDesc->trans_type = ucTransCode; /* type of transfer */ dma_desc->trans_type = trans_code; /* type of transfer */
pDmaDesc->ident = wIdent; /* area to use */ dma_desc->ident = ident; /* area to use */
pDmaDesc->size = 0; /* initialise other bits */ dma_desc->size = 0; /* initialise other bits */
pDmaDesc->offset = 0; dma_desc->offset = 0;
dev_dbg(&ced->interface->dev, "%s: type: %d ident: %d\n", dev_dbg(&ced->interface->dev, "%s: type: %d ident: %d\n",
__func__, pDmaDesc->trans_type, pDmaDesc->ident); __func__, dma_desc->trans_type, dma_desc->ident);
pDmaDesc->outward = (ucTransCode != TM_EXTTOHOST); /* set transfer direction */ /* set transfer direction */
dma_desc->outward = (trans_code != TM_EXTTOHOST);
switch (ucTransCode) { switch (trans_code) {
case TM_EXTTOHOST: /* Extended linear transfer modes (the only ones!) */
/* Extended linear transfer modes (the only ones!) */
case TM_EXTTOHOST:
case TM_EXTTO1401: case TM_EXTTO1401:
{ {
bResult = retval =
ced_read_huff(&(pDmaDesc->offset), pBuf, ced_read_huff(&(dma_desc->offset), buf,
&dDone, dwCount) &n_done, count)
&& ced_read_huff(&(pDmaDesc->size), pBuf, && ced_read_huff(&(dma_desc->size), buf,
&dDone, dwCount); &n_done, count);
if (bResult) { if (retval) {
dev_dbg(&ced->interface->dev, dev_dbg(&ced->interface->dev,
"%s: xfer offset & size %d %d\n", "%s: xfer offset & size %d %d\n",
__func__, pDmaDesc->offset, __func__, dma_desc->offset,
pDmaDesc->size); dma_desc->size);
if ((wIdent >= MAX_TRANSAREAS) || /* Illegal area number, or... */ if ((ident >= MAX_TRANSAREAS) || /* Illegal area number, or... */
(!ced->trans_def[wIdent].used) || /* area not set up, or... */ (!ced->trans_def[ident].used) || /* area not set up, or... */
(pDmaDesc->offset > ced->trans_def[wIdent].length) || /* range/size */ (dma_desc->offset > ced->trans_def[ident].length) || /* range/size */
((pDmaDesc->offset + ((dma_desc->offset +
pDmaDesc->size) > dma_desc->size) >
(ced->trans_def[wIdent]. (ced->trans_def[ident].
length))) { length))) {
bResult = false; /* bad parameter(s) */ retval = false; /* bad parameter(s) */
dev_dbg(&ced->interface->dev, dev_dbg(&ced->interface->dev,
"%s: bad param - id %d, bUsed %d, offset %d, size %d, area length %d\n", "%s: bad param - id %d, bUsed %d, offset %d, size %d, area length %d\n",
__func__, wIdent, __func__, ident,
ced->trans_def[wIdent]. ced->trans_def[ident].
used, used,
pDmaDesc->offset, dma_desc->offset,
pDmaDesc->size, dma_desc->size,
ced->trans_def[wIdent]. ced->trans_def[ident].
length); length);
} }
} }
...@@ -1097,13 +1102,14 @@ static bool ced_read_dma_info(volatile struct dmadesc *pDmaDesc, ...@@ -1097,13 +1102,14 @@ static bool ced_read_dma_info(volatile struct dmadesc *pDmaDesc,
break; break;
} }
} else } else
bResult = false; retval = false;
if (!bResult) /* now check parameters for validity */ if (!retval) /* now check parameters for validity */
dev_err(&ced->interface->dev, "%s: error reading Esc sequence\n", dev_err(&ced->interface->dev,
"%s: error reading Esc sequence\n",
__func__); __func__);
return bResult; return retval;
} }
/**************************************************************************** /****************************************************************************
......
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