rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH
PATCH 1/1 rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH
Clang warns when one enumerated type is implicitly converted to another:
drivers/rtc/rtc-omap.c:574:21: warning: implicit conversion from enumeration type 'enum rtc_pin_config_param' to different enumeration type 'enum pin_config_param' [-Wenum-conversion]
{"ti,active-high", PIN_CONFIG_ACTIVE_HIGH, 0},
~ ^~~~~~~~~~~~~~~~~~~~~~drivers/rtc/rtc-omap.c:579:12: warning: implicit conversion from enumeration type 'enum rtc_pin_config_param' to different enumeration type 'enum pin_config_param' [-Wenum-conversion]
PCONFDUMP(PIN_CONFIG_ACTIVE_HIGH, "input active high", NULL, false), ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~./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.
--- drivers/rtc/rtc-omap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-omap.c +1 -3
@@ -566,9 +566,7 @@ static const struct pinctrl_ops rtc_pinctrl_ops = { .dt_free_map = pinconf_generic_dt_free_map, }; -enum rtc_pin_config_param { -PIN_CONFIG_ACTIVE_HIGH =PIN_CONFIG_END +1 , -}; +#define PIN_CONFIG_ACTIVE_HIGH (PIN_CONFIG_END + 1)static const struct pinconf_generic_params rtc_params[] = { {"ti,active-high" ,PIN_CONFIG_ACTIVE_HIGH ,0 },
Signature · 1 line
2.19.1
Quoted 47 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another:
drivers/rtc/rtc-omap.c:574:21: warning: implicit conversion from enumeration type 'enumrtc_pin_config_param' to different enumeration type 'enumpin_config_param' [-Wenum-conversion]{"ti,active-high", PIN_CONFIG_ACTIVE_HIGH, 0}, ~ ^~~~~~~~~~~~~~~~~~~~~~
drivers/rtc/rtc-omap.c:579:12: warning: implicit conversion from enumeration type 'enumrtc_pin_config_param' to different enumeration type 'enumpin_config_param' [-Wenum-conversion]
PCONFDUMP(PIN_CONFIG_ACTIVE_HIGH, "input active high", NULL, false), ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~./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_parambecause of the gap betweenPIN_CONFIG_ENDandPIN_CONFIG_MAXso this conversion isn't an issue. Most drivers that take advantage of this define thePIN_CONFIGvariables as constants, rather than enumerated values. Do the same thing here so that Clang no longer warns.Signed-off-by Nathan Chancellor <[email protected]>--- drivers/rtc/rtc-omap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/rtc/rtc-omap.c +1
-4@@ -566,9 +566,7 @@ static const struct pinctrl_ops rtc_pinctrl_ops = { .dt_free_map = pinconf_generic_dt_free_map, }; -enum rtc_pin_config_param { -PIN_CONFIG_ACTIVE_HIGH =PIN_CONFIG_END +1 , -}; +#define PIN_CONFIG_ACTIVE_HIGH (PIN_CONFIG_END + 1)static const struct pinconf_generic_params rtc_params[] = { {"ti,active-high" ,PIN_CONFIG_ACTIVE_HIGH ,0 }, --
Quoted 2 lines
2.19.1
Bumping for review
Signature · 2 lines
Thanks, ~Nick Desaulniers
Quoted 24 lines · Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another:
drivers/rtc/rtc-omap.c:574:21: warning: implicit conversion from enumeration type 'enumrtc_pin_config_param' to different enumeration type 'enumpin_config_param' [-Wenum-conversion]{"ti,active-high", PIN_CONFIG_ACTIVE_HIGH, 0}, ~ ^~~~~~~~~~~~~~~~~~~~~~
drivers/rtc/rtc-omap.c:579:12: warning: implicit conversion from enumeration type 'enumrtc_pin_config_param' to different enumeration type 'enumpin_config_param' [-Wenum-conversion]
PCONFDUMP(PIN_CONFIG_ACTIVE_HIGH, "input active high", NULL, false), ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~./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_parambecause of the gap betweenPIN_CONFIG_ENDandPIN_CONFIG_MAXso this conversion isn't an issue. Most drivers that take advantage of this define thePIN_CONFIGvariables as constants, rather than enumerated values. Do the same thing here so that Clang no longer warns.
Quoted 6 lines
Signed-off-by Nathan Chancellor <[email protected]>--- drivers/rtc/rtc-omap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
Applied, thanks.
Signature · 3 lines
Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com