Re: [PATCH v2 08/12] staging: ks7010: replace GetUInt32 macro with inline function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 23, 2018 at 02:05:16PM +0100, Sergio Paracuellos wrote:
> This commit replaces GetUInt32 with inline function renaming
> it to get_uint32.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx>
> ---
>  drivers/staging/ks7010/michael_mic.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/michael_mic.c b/drivers/staging/ks7010/michael_mic.c
> index 9de31b4..6829cb5 100644
> --- a/drivers/staging/ks7010/michael_mic.c
> +++ b/drivers/staging/ks7010/michael_mic.c
> @@ -15,8 +15,11 @@
>  #include "michael_mic.h"
>  
>  // Convert from Byte[] to UInt32 in a portable way
> -#define getUInt32(A, B)	((uint32_t)(A[B + 0] << 0) \
> -		+ (A[B + 1] << 8) + (A[B + 2] << 16) + (A[B + 3] << 24))
> +static inline u32 get_uint32(const u8 *buf, u8 pos)
> +{
> +	return (u32)((buf[pos] << 0) + (buf[pos + 1] << 8) +
> +		     (buf[pos + 2] << 16) + (buf[pos + 3] << 24));
> +}

Why not just use get_unaligned_le32()?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux