[PATCH 04/13] board: dragonboard410c: Drop UNSTUFF_BITS() macro
Neil Armstrong
neil.armstrong at linaro.org
Mon Apr 7 20:07:42 CEST 2025
On 07/04/2025 18:59, Stephan Gerhold wrote:
> This was originally taken from Linux, but at this point it's an inline
> function upstream and no longer a macro. Given that we just want to extract
> the serial number from the MMC CID, let's just inline that specifically.
> This is also the style used in the MMC core code within U-Boot.
>
> Signed-off-by: Stephan Gerhold <stephan.gerhold at linaro.org>
> ---
> board/qualcomm/dragonboard410c/dragonboard410c.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
> index c33529d31869b17c7a30ec83af1199d01db472f5..61d68e7f0c6bed16861e6ceaefd2c7dc94807d65 100644
> --- a/board/qualcomm/dragonboard410c/dragonboard410c.c
> +++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
> @@ -22,21 +22,6 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> -/* UNSTUFF_BITS macro taken from Linux Kernel: drivers/mmc/core/sd.c */
> -#define UNSTUFF_BITS(resp, start, size) \
> - ({ \
> - const int __size = size; \
> - const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
> - const int __off = 3 - ((start) / 32); \
> - const int __shft = (start) & 31; \
> - u32 __res; \
> - \
> - __res = resp[__off] >> __shft; \
> - if (__size + __shft > 32) \
> - __res |= resp[__off - 1] << ((32 - __shft) % 32); \
> - __res & __mask; \
> - })
> -
> static u32 msm_board_serial(void)
> {
> struct mmc *mmc_dev;
> @@ -48,7 +33,8 @@ static u32 msm_board_serial(void)
> if (mmc_init(mmc_dev))
> return 0;
>
> - return UNSTUFF_BITS(mmc_dev->cid, 16, 32);
> + /* MMC serial number */
> + return mmc_dev->cid[2] << 16 | mmc_dev->cid[3] >> 16;
> }
>
> static void msm_generate_mac_addr(u8 *mac)
>
Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
More information about the U-Boot
mailing list