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

pinctrl: zynq: Use define directive for PIN_CONFIG_IO_STANDARD

Clang warns when one enumerated type is implicitly converted to another:

drivers/pinctrl/pinctrl-zynq.c:985:18: warning: implicit conversion from
enumeration type 'enum zynq_pin_config_param' to different enumeration
type 'enum pin_config_param' [-Wenum-conversion]
{"io-standard", PIN_CONFIG_IOSTANDARD, zynq_iostd_lvcmos18},
~ ^~~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-zynq.c:990:16: warning: implicit conversion from
enumeration type 'enum zynq_pin_config_param' to different enumeration
type 'enum pin_config_param' [-Wenum-conversion]
= { PCONFDUMP(PIN_CONFIG_IOSTANDARD, "IO-standard", NULL, true),
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/pinctrl/pinconf-generic.h:163:11: note: expanded from
macro 'PCONFDUMP'
.param = a, .display = b, .format = c, .has_arg = d \
^
2 warnings generated.

It is expected that pinctrl drivers can extend pin_config_param because
of the gap between PIN_CONFIG_END and PIN_CONFIG_MAX so this conversion
isn't an issue. Most drivers that take advantage of this define the
PIN_CONFIG variables as constants, rather than enumerated values. Do the
same thing here so that Clang no longer warns.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Nathan Chancellor and committed by
Linus Walleij
cd8a145a f24bfb39

+3 -6
+3 -6
drivers/pinctrl/pinctrl-zynq.c
··· 971 971 zynq_iostd_max 972 972 }; 973 973 974 - /** 975 - * enum zynq_pin_config_param - possible pin configuration parameters 976 - * @PIN_CONFIG_IOSTANDARD: if the pin can select an IO standard, the argument to 974 + /* 975 + * PIN_CONFIG_IOSTANDARD: if the pin can select an IO standard, the argument to 977 976 * this parameter (on a custom format) tells the driver which alternative 978 977 * IO standard to use. 979 978 */ 980 - enum zynq_pin_config_param { 981 - PIN_CONFIG_IOSTANDARD = PIN_CONFIG_END + 1, 982 - }; 979 + #define PIN_CONFIG_IOSTANDARD (PIN_CONFIG_END + 1) 983 980 984 981 static const struct pinconf_generic_params zynq_dt_params[] = { 985 982 {"io-standard", PIN_CONFIG_IOSTANDARD, zynq_iostd_lvcmos18},