linux/drivers/clocksource
Luca Ceresoli 9722c3b66e 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 directly.

Most usages are trivially converted as they do not use those two
parameters, as expected. The non-trivial cases are:

 - drivers/clk/clk.c, of_clk_get_parent_name(): easily doable anyway
 - drivers/clk/clk-si5351.c, si5351_dt_parse(): this is more complex as the
   checks had to be replicated in a different way, making code more verbose
   and somewhat uglier, but I refrained from a full rework to keep as much
   of the original code untouched having no hardware to test my changes

All the changes have been build tested. The few for which I have the
hardware have been runtime-tested too.

Reviewed-by: Andre Przywara <andre.przywara@arm.com> # drivers/clk/sunxi/clk-simple-gates.c, drivers/clk/sunxi/clk-sun8i-bus-gates.c
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> # drivers/gpio/gpio-brcmstb.c
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> # drivers/irqchip/irq-atmel-aic-common.c
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # drivers/iio/adc/ti_am335x_adc.c
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> # drivers/pwm/pwm-samsung.c
Acked-by: Richard Leitner <richard.leitner@linux.dev> # drivers/usb/misc/usb251xb.c
Acked-by: Mark Brown <broonie@kernel.org> # sound/soc/codecs/arizona.c
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> # sound/soc/codecs/arizona.c
Acked-by: Michael Ellerman <mpe@ellerman.id.au> # arch/powerpc/sysdev/xive/spapr.c
Acked-by: Stephen Boyd <sboyd@kernel.org> # clk
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Acked-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20240724-of_property_for_each_u32-v3-1-bea82ce429e2@bootlin.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
2024-07-25 06:53:47 -05:00
..
acpi_pm.c
arc_timer.c
arm_arch_timer.c clocksource/drivers/arm_arch_timer: Remove unnecessary ‘0’ values from irq 2024-07-12 16:07:05 +02:00
arm_global_timer.c clocksource/driver/arm_global_timer: Remove unnecessary ‘0’ values from err 2024-07-12 16:07:05 +02:00
armv7m_systick.c
asm9260_timer.c
bcm2835_timer.c
bcm_kona_timer.c
clksrc-dbx500-prcmu.c
clksrc_st_lpc.c
clps711x-timer.c
dummy_timer.c
dw_apb_timer.c
dw_apb_timer_of.c
em_sti.c
exynos_mct.c
hyperv_timer.c
i8253.c
ingenic-ost.c
ingenic-sysost.c
ingenic-timer.c
jcore-pit.c
Kconfig clocksource/drivers/realtek: Add timer driver for rtl-otto platforms 2024-07-12 16:07:06 +02:00
Makefile clocksource/drivers/realtek: Add timer driver for rtl-otto platforms 2024-07-12 16:07:06 +02:00
mips-gic-timer.c clocksource/drivers/mips-gic-timer: Correct sched_clock width 2024-07-12 16:07:05 +02:00
mmio.c
mps2-timer.c
mxs_timer.c
nomadik-mtu.c
numachip.c
renesas-ostm.c clocksource/drivers/renesas-ostm: Avoid reprobe after successful early probe 2024-05-10 10:41:52 +02:00
samsung_pwm_timer.c of: remove internal arguments from of_property_for_each_u32() 2024-07-25 06:53:47 -05:00
scx200_hrt.c
sh_cmt.c clocksource/drivers/sh_cmt: Address race condition for clock events 2024-07-12 16:07:05 +02:00
sh_mtu2.c
sh_tmu.c
timer-armada-370-xp.c
timer-atmel-pit.c
timer-atmel-st.c
timer-atmel-tcb.c
timer-cadence-ttc.c
timer-clint.c riscv: Use IPIs for remote cache/TLB flushes by default 2024-04-29 10:49:26 -07:00
timer-cs5535.c
timer-davinci.c
timer-digicolor.c
timer-ep93xx.c
timer-fsl-ftm.c
timer-fttmr010.c
timer-goldfish.c
timer-gx6605s.c
timer-gxp.c
timer-imx-gpt.c
timer-imx-sysctr.c
timer-imx-tpm.c
timer-integrator-ap.c
timer-ixp4xx.c
timer-keystone.c
timer-loongson1-pwm.c
timer-lpc32xx.c
timer-mediatek-cpux.c
timer-mediatek.c
timer-meson6.c
timer-microchip-pit64b.c
timer-milbeaut.c
timer-mp-csky.c
timer-msc313e.c
timer-npcm7xx.c
timer-of.c
timer-of.h
timer-orion.c
timer-owl.c
timer-pistachio.c
timer-probe.c
timer-pxa.c
timer-qcom.c
timer-rda.c
timer-riscv.c A set of updates for clocksource and clockevent drivers: 2024-03-23 14:42:45 -07:00
timer-rockchip.c
timer-rtl-otto.c clocksource/drivers/realtek: Add timer driver for rtl-otto platforms 2024-07-12 16:07:06 +02:00
timer-sp.h
timer-sp804.c
timer-sprd.c
timer-stm32-lp.c
timer-stm32.c
timer-sun4i.c
timer-sun5i.c
timer-tegra.c
timer-tegra186.c
timer-ti-32k.c
timer-ti-dm-systimer.c
timer-ti-dm.c clocksource/drivers/timer-ti-dm: Remove an unused field in struct dmtimer 2024-05-10 10:41:52 +02:00
timer-versatile.c
timer-vf-pit.c
timer-vt8500.c
timer-zevio.c