From: Stephan Gerhold Date: Mon, 7 Apr 2025 16:59:25 +0000 (+0200) Subject: board: dragonboard410c: Drop UNSTUFF_BITS() macro X-Git-Tag: v2025.07-rc1~78^2~9 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7d3009b39d4f0ba0300e9312f51387d3ed343e2;p=pandora-u-boot.git board: dragonboard410c: Drop UNSTUFF_BITS() macro 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 Reviewed-by: Neil Armstrong Reviewed-by: Link: https://lore.kernel.org/r/20250407-db410c-fixes-v1-4-524aefbc8bb4@linaro.org Signed-off-by: Caleb Connolly --- diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c index 744ac4fda8e..b3f9a097e78 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)