Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1238446

Re: [PATCH 08/14] RFC: usb/host/fotg210: convert macro to inline function

From Felipe Balbi <balbi@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH 08/14] RFC: usb/host/fotg210: convert macro to inline function
Date 2015-10-02 19:40 +0200
Message-ID <qfctk-1MB-15@gated-at.bofh.it> (permalink)
References <q91Kj-2gb-19@gated-at.bofh.it> <qbaT7-1N0-3@gated-at.bofh.it> <qbaT7-1N0-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Mon, Sep 21, 2015 at 05:01:12PM +0200, Peter Senna Tschudin wrote:
> 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 <peter.senna@gmail.com>

looks good

> ---
>  drivers/usb/host/fotg210-hcd.c | 27 ++++++++++++++++-----------
>  1 file changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
> index 4032ed0..82cd5da 100644
> --- a/drivers/usb/host/fotg210-hcd.c
> +++ b/drivers/usb/host/fotg210-hcd.c
> @@ -331,17 +331,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)
>  {
> -- 
> 2.1.0
> 

-- 
balbi

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 08/14] RFC: usb/host/fotg210: convert macro to inline  function Felipe Balbi <balbi@ti.com> - 2015-10-02 19:40 +0200

csiph-web