linux/drivers/usb/misc
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
..
sisusbvga USB: sisusbvga: Add endpoint checks 2023-04-20 11:43:22 +02:00
adutux.c usb: misc: adutux: use swap() 2021-08-05 12:31:34 +02:00
apple-mfi-fastcharge.c USB: apple-mfi-fastcharge: Fix use after free in probe 2020-12-04 16:48:07 +01:00
appledisplay.c usb: appledisplay: use module_usb_driver to simplify the code 2020-09-22 10:37:19 +02:00
brcmstb-usb-pinmap.c usb: misc: brcmstb-usb-pinmap: add IRQ check 2021-08-13 13:05:50 +02:00
chaoskey.c hwrng: core - treat default_quality as a maximum and default to 1024 2022-11-18 16:59:34 +08:00
cypress_cy7c63.c USB: misc: Remove unnecessary NULL values 2023-08-04 14:48:55 +02:00
cytherm.c USB: misc: Remove unnecessary NULL values 2023-08-04 14:48:55 +02:00
ehset.c usb: misc: ehset: fix wrong if condition 2023-07-27 10:37:30 +02:00
emi26.c
emi62.c
ezusb.c usb: misc: add missing MODULE_DESCRIPTION() macros 2024-06-20 19:18:24 +02:00
idmouse.c usb: idmouse: fix an uninit-value in idmouse_open 2022-09-27 10:37:09 +02:00
iowarrior.c USB: misc: iowarrior: remove redundant assignment to variable io_res 2023-11-22 12:02:53 +00:00
isight_firmware.c usb: misc: add missing MODULE_DESCRIPTION() macros 2024-06-20 19:18:24 +02:00
Kconfig usb: misc: onboard_hub: rename to onboard_dev 2024-03-27 07:57:16 +01:00
ldusb.c usb: ldusb: replace ternary operator with max_t() 2022-07-14 16:09:56 +02:00
legousbtower.c USB: make devnode() callback in usb_class_driver take a const * 2022-10-20 12:11:56 +02:00
lvstest.c usb: remove third argument of usb_maxpacket() 2022-04-23 10:33:53 +02:00
Makefile usb: misc: onboard_hub: rename to onboard_dev 2024-03-27 07:57:16 +01:00
onboard_usb_dev_pdevs.c usb: misc: onboard_hub: rename to onboard_dev 2024-03-27 07:57:16 +01:00
onboard_usb_dev.c usb: misc: onboard_usb_dev: Add match function 2024-06-27 16:06:51 +02:00
onboard_usb_dev.h usb: misc: onboard_dev: add support for XMOS XVF3500 2024-03-27 07:57:16 +01:00
qcom_eud.c usb: misc: eud: Add IRQ check for platform_get_irq() 2023-11-22 12:02:53 +00:00
trancevibrator.c USB: trancevibrator: fix control-request direction 2021-05-21 20:10:43 +02:00
usb251xb.c of: remove internal arguments from of_property_for_each_u32() 2024-07-25 06:53:47 -05:00
usb3503.c usb: misc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-06-20 19:18:57 +02:00
usb4604.c usb: misc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-06-20 19:18:57 +02:00
usb-ljca.c usb: misc: ljca: Fix double free in error handling path 2024-03-26 11:01:23 +01:00
usblcd.c USB: usblcd: Remove the superfluous break 2020-08-28 09:48:33 +02:00
usbsevseg.c USB: misc: Remove unnecessary NULL values 2023-08-04 14:48:55 +02:00
usbtest.c usb: usbtest: fix a type promotion bug 2023-10-08 07:50:36 +02:00
uss720.c usb: misc: uss720: check for incompatible versions of the Belkin F5U002 2024-04-04 17:07:48 +02:00
yurex.c usb: misc: add missing MODULE_DESCRIPTION() macros 2024-06-20 19:18:24 +02:00