Skip to content

Commit

Permalink
usb/host/fotg210: convert macro to inline function
Browse files Browse the repository at this point in the history
This patch convert the macro speed_char in an inline function. The goal
of this patch is to make the code easier to read.

Signed-off-by: Peter Senna Tschudin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
petersenna authored and gregkh committed Oct 17, 2015
1 parent 05ebc36 commit c4d66b5
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions drivers/usb/host/fotg210-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,22 @@ struct debug_buffer {
size_t alloc_size;
};

#define speed_char(info1)({ char tmp; \
switch (info1 & (3 << 12)) { \
case QH_FULL_SPEED: \
tmp = 'f'; break; \
case QH_LOW_SPEED: \
tmp = 'l'; break; \
case QH_HIGH_SPEED: \
tmp = 'h'; break; \
default: \
tmp = '?'; break; \
} tmp; })
static inline char speed_char(u32 scratch)
{
switch (scratch & (3 << 12)) {
case QH_FULL_SPEED:
return 'f';

case QH_LOW_SPEED:
return 'l';

case QH_HIGH_SPEED:
return 'h';

default:
return '?';
}
}

static inline char token_mark(struct fotg210_hcd *fotg210, __hc32 token)
{
Expand Down

0 comments on commit c4d66b5

Please sign in to comment.