of: remove internal arguments from of_property_for_each_u32()
The of_property_for_each_u32() macro needs five parameters, two of which are primarily meant as internal variables for the macro itself (in the for() clause). Yet these two parameters are used by a few drivers, and this can be considered misuse or at least bad practice. Now that the kernel uses C11 to build, these two parameters can be avoided by declaring them internally, thus changing this pattern: struct property *prop; const __be32 *p; u32 val; of_property_for_each_u32(np, "xyz", prop, p, val) { ... } to this: u32 val; of_property_for_each_u32(np, "xyz", val) { ... } However two variables cannot be declared in the for clause even with C11, so declare one struct that contain the two variables we actually need. As the variables inside this struct are not meant to be used by users of this macro, give the struct instance the noticeable name "_it" so it is visible during code reviews, helping to avoid new code to use it direct...
Showing
- arch/powerpc/sysdev/xive/native.c 1 addition, 3 deletionsarch/powerpc/sysdev/xive/native.c
- arch/powerpc/sysdev/xive/spapr.c 1 addition, 2 deletionsarch/powerpc/sysdev/xive/spapr.c
- drivers/bus/ti-sysc.c 1 addition, 3 deletionsdrivers/bus/ti-sysc.c
- drivers/clk/clk-conf.c 1 addition, 3 deletionsdrivers/clk/clk-conf.c
- drivers/clk/clk-si5351.c 26 additions, 17 deletionsdrivers/clk/clk-si5351.c
- drivers/clk/clk.c 5 additions, 7 deletionsdrivers/clk/clk.c
- drivers/clk/qcom/common.c 1 addition, 3 deletionsdrivers/clk/qcom/common.c
- drivers/clk/sunxi/clk-simple-gates.c 1 addition, 3 deletionsdrivers/clk/sunxi/clk-simple-gates.c
- drivers/clk/sunxi/clk-sun8i-bus-gates.c 1 addition, 3 deletionsdrivers/clk/sunxi/clk-sun8i-bus-gates.c
- drivers/clocksource/samsung_pwm_timer.c 1 addition, 3 deletionsdrivers/clocksource/samsung_pwm_timer.c
- drivers/gpio/gpio-brcmstb.c 1 addition, 4 deletionsdrivers/gpio/gpio-brcmstb.c
- drivers/iio/adc/ti_am335x_adc.c 1 addition, 3 deletionsdrivers/iio/adc/ti_am335x_adc.c
- drivers/irqchip/irq-atmel-aic-common.c 1 addition, 3 deletionsdrivers/irqchip/irq-atmel-aic-common.c
- drivers/irqchip/irq-pic32-evic.c 1 addition, 3 deletionsdrivers/irqchip/irq-pic32-evic.c
- drivers/mfd/ti_am335x_tscadc.c 1 addition, 3 deletionsdrivers/mfd/ti_am335x_tscadc.c
- drivers/pinctrl/nxp/pinctrl-s32cc.c 1 addition, 3 deletionsdrivers/pinctrl/nxp/pinctrl-s32cc.c
- drivers/pinctrl/pinctrl-k210.c 1 addition, 3 deletionsdrivers/pinctrl/pinctrl-k210.c
- drivers/pwm/pwm-samsung.c 1 addition, 3 deletionsdrivers/pwm/pwm-samsung.c
- drivers/tty/sysrq.c 1 addition, 3 deletionsdrivers/tty/sysrq.c
- drivers/usb/misc/usb251xb.c 1 addition, 3 deletionsdrivers/usb/misc/usb251xb.c
Please register or sign in to comment