linux/drivers/iio
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
..
accel IIO: 2nd set of new device support, features and cleanup for 6.11 2024-07-04 11:04:20 +02:00
adc of: remove internal arguments from of_property_for_each_u32() 2024-07-25 06:53:47 -05:00
addac iio: addac: ad74413r: simplify with spi_get_device_match_data() 2024-06-13 19:19:24 +01:00
afe iio: afe: rescale: Accept only offset channels 2023-10-17 20:25:32 +01:00
amplifiers iio: amplifiers: hmc425a: add support for LTC6373 Instrumentation Amplifier 2024-02-28 19:26:36 +00:00
buffer iio: buffer-dmaengine: Support new DMABUF based userspace API 2024-06-30 11:29:28 +01:00
cdc iio: cdc: ad7150: relax return value check for IRQ get 2023-08-01 18:55:55 +01:00
chemical Merge 6.10-rc6 into char-misc-next 2024-07-01 13:55:39 +02:00
common iio: common: scmi_iio: convert to dev_err_probe() 2024-06-30 12:27:41 +01:00
dac IIO: 2nd set of new device support, features and cleanup for 6.11 2024-07-04 11:04:20 +02:00
dummy iio: dummy: Use automatic lock and direct mode cleanup. 2024-02-17 16:16:10 +00:00
filter drivers: iio: filter: admv8818: add bypass mode 2023-08-08 09:51:06 +01:00
frequency iio: frequency: adf4350: add clk provider 2024-06-25 21:04:49 +01:00
gyro iio: gyro: adis16260: make use of the new lock helpers 2024-06-25 21:04:50 +01:00
health iio: health: max30102: make use of regmap_set_bits() 2024-06-25 21:04:46 +01:00
humidity Merge 6.10-rc6 into char-misc-next 2024-07-01 13:55:39 +02:00
imu iio: imu: adis16475: make use of the new lock helpers 2024-06-25 21:04:50 +01:00
light Char/Misc and other driver changes for 6.11-rc1 2024-07-19 15:55:08 -07:00
magnetometer iio: magnetometer: mmc35240: make use of regmap_set_bits() 2024-06-25 21:04:47 +01:00
multiplexer iio: multiplexer: Remove an unused field in struct mux 2024-05-27 09:48:56 +01:00
orientation iio: orientation: hid-sensor-rotation: Convert to platform remove callback returning void 2023-09-23 15:06:56 +01:00
position iio: position: hid-sensor-custom-intel-hinge: Convert to platform remove callback returning void 2023-09-23 15:06:56 +01:00
potentiometer iio: potentiometer: max5487: Drop ACPI_PTR() usage 2024-01-23 22:06:55 +00:00
potentiostat iio: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-05-27 09:48:57 +01:00
pressure iio: pressure: bmp280-core: make use of regmap_clear_bits() 2024-06-25 21:04:48 +01:00
proximity iio: proximity: sx_common: make use of regmap_clear_bits(), regmap_set_bits() 2024-06-25 21:04:48 +01:00
resolver iio: resolver: ad2s1210: add reset gpio support 2023-11-16 19:10:25 +00:00
temperature iio: temperature: ltc2983: convert to dev_err_probe() 2024-06-30 12:27:25 +01:00
test iio: test: gts: test available times and gains sorting 2024-05-27 09:48:56 +01:00
trigger iio: trigger: stm32-timer-trigger: make use of regmap_clear_bits(), regmap_set_bits() 2024-06-25 21:04:48 +01:00
iio_core_trigger.h
iio_core.h iio: Add iio_read_channel_label to inkern API 2024-06-28 20:06:56 +01:00
industrialio-acpi.c iio: core: Add iio_read_acpi_mount_matrix() helper function 2024-04-29 20:53:25 +01:00
industrialio-backend.c iio: backend: make use of dev_err_cast_probe() 2024-06-30 12:27:33 +01:00
industrialio-buffer.c iio: core: Add new DMABUF interface infrastructure 2024-06-30 11:29:17 +01:00
industrialio-configfs.c
industrialio-core.c iio: Add iio_read_channel_label to inkern API 2024-06-28 20:06:56 +01:00
industrialio-event.c iio: event: use sizeof(*pointer) instead of sizeof(type) 2024-06-13 19:19:23 +01:00
industrialio-gts-helper.c iio: Fix the sorting functionality in iio_gts_build_avail_time_table 2024-05-27 09:48:56 +01:00
industrialio-sw-device.c iio: Don't use bare "unsigned" 2022-07-01 11:19:08 +01:00
industrialio-sw-trigger.c iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails 2022-11-12 17:53:35 +00:00
industrialio-trigger.c iio: trigger: Fix condition for own trigger 2024-06-17 20:49:02 +01:00
industrialio-triggered-event.c
inkern.c iio: Add iio_read_channel_label to inkern API 2024-06-28 20:06:56 +01:00
Kconfig iio: core: Add new DMABUF interface infrastructure 2024-06-30 11:29:17 +01:00
Makefile iio: core: Add iio_read_acpi_mount_matrix() helper function 2024-04-29 20:53:25 +01:00
TODO iio: core: move 'mlock' to 'struct iio_dev_opaque' 2022-11-23 19:44:00 +00:00