Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mmc: dw_mmc-rockchip: switch to FIELD_PREP_WM16 macro

The era of hand-rolled HIWORD_UPDATE macros is over, at least for those
drivers that use constant masks.

Switch to the new FIELD_PREP_WM16 macro in hw_bitfield.h, which has
error checking. Instead of redefining the driver's HIWORD_UPDATE macro
in this case, replace the two only instances of it with the new macro,
as I could test that they result in an equivalent value.

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>

authored by

Nicolas Frattaroli and committed by
Yury Norov
47975a87 21368fcb

+5 -4
+5 -4
drivers/mmc/host/dw_mmc-rockchip.c
··· 6 6 #include <linux/module.h> 7 7 #include <linux/platform_device.h> 8 8 #include <linux/clk.h> 9 + #include <linux/hw_bitfield.h> 9 10 #include <linux/mmc/host.h> 10 11 #include <linux/of_address.h> 11 12 #include <linux/mmc/slot-gpio.h> ··· 25 24 #define ROCKCHIP_MMC_DELAYNUM_OFFSET 2 26 25 #define ROCKCHIP_MMC_DELAYNUM_MASK (0xff << ROCKCHIP_MMC_DELAYNUM_OFFSET) 27 26 #define ROCKCHIP_MMC_DELAY_ELEMENT_PSEC 60 28 - #define HIWORD_UPDATE(val, mask, shift) \ 29 - ((val) << (shift) | (mask) << ((shift) + 16)) 30 27 31 28 static const unsigned int freqs[] = { 100000, 200000, 300000, 400000 }; 32 29 ··· 147 148 raw_value |= nineties; 148 149 149 150 if (sample) 150 - mci_writel(host, TIMING_CON1, HIWORD_UPDATE(raw_value, 0x07ff, 1)); 151 + mci_writel(host, TIMING_CON1, 152 + FIELD_PREP_WM16(GENMASK(11, 1), raw_value)); 151 153 else 152 - mci_writel(host, TIMING_CON0, HIWORD_UPDATE(raw_value, 0x07ff, 1)); 154 + mci_writel(host, TIMING_CON0, 155 + FIELD_PREP_WM16(GENMASK(11, 1), raw_value)); 153 156 154 157 dev_dbg(host->dev, "set %s_phase(%d) delay_nums=%u actual_degrees=%d\n", 155 158 sample ? "sample" : "drv", degrees, delay_num,