[PATCH 09/30] staging: mt7621-mmc: Remove function uffs

NeilBrown neil at brown.name
Sun Apr 29 22:28:26 UTC 2018


On Sun, Apr 29 2018, Christian Lütke-Stetzkamp wrote:

> The function uffs that is implemented by this driver returns the same
> values as the kernel function ffs. So the uffs function is removed and
> the calls to it are replaced with calls to ffs.

This difference is that uffs receives and returns an "unsigned int".
Maybe not a significant difference, but worth mentioning that you
noticed it and reasoned that it wasn't significant.

> @@ -1004,13 +975,13 @@ static inline void sdr_clr_bits(void __iomem *reg, u32 bs)
>  do {								\
>  	volatile unsigned int tv = sdr_read32(reg);			\
>  	tv &= ~(field);							\
> -	tv |= ((val) << (uffs((unsigned int)field) - 1));		\
> +	tv |= ((val) << (ffs((unsigned int)field) - 1));		\

Given that ffs() takes an "int", it is odd to cast "field" to an
unsigned int to pass it.
"field" is always a constant int, so no cast is needed.

Thanks,
NeilBrown


>  	sdr_write32(reg, tv);						\
>  } while (0)
>  #define sdr_get_field(reg, field, val)					\
>  do {								\
>  	volatile unsigned int tv = sdr_read32(reg);			\
> -	val = ((tv & (field)) >> (uffs((unsigned int)field) - 1));	\
> +	val = ((tv & (field)) >> (ffs((unsigned int)field) - 1));	\
>  } while (0)
>  
>  #endif
> -- 
> 2.16.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20180430/ea1b2f69/attachment.asc>


More information about the devel mailing list