Skip to content

Commit

Permalink
atg: Move to a switch
Browse files Browse the repository at this point in the history
No functional changes.
Move to a switch statement instead of the current if else.

Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
  • Loading branch information
Shubhrajyoti Datta authored and Michal Simek committed Feb 23, 2016
1 parent ebc8535 commit d9234bc
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions drivers/misc/xilinx_trafgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,16 +370,19 @@ static void xtg_access_rams(struct xtg_dev_info *tg, int where,
{
u32 index;

for (index = 0; count > 0; index++, count -= 4) {
if (flags) {
if (flags & XTG_WRITE_RAM_ZERO)
writel(0x0, tg->regs + where + index * 4);
else
writel(data[index],
tg->regs + where + index * 4);
} else {
switch (flags) {
case XTG_WRITE_RAM_ZERO:
for (index = 0; count > 0; index++, count -= 4)
writel(0x0, tg->regs + where + index * 4);
break;
case XTG_WRITE_RAM:
for (index = 0; count > 0; index++, count -= 4)
writel(data[index], tg->regs + where + index * 4);
break;
case XTG_READ_RAM:
for (index = 0; count > 0; index++, count -= 4)
data[index] = readl(tg->regs + where + index * 4);
}
break;
}
}

Expand Down

0 comments on commit d9234bc

Please sign in to comment.