All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH
@ 2018-11-01  0:55 Nathan Chancellor
  2018-11-12 19:25 ` Nick Desaulniers
  2018-11-12 22:17 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2018-11-01  0:55 UTC (permalink / raw)
  To: Alessandro Zummo, Alexandre Belloni
  Cc: linux-rtc, linux-kernel, Nick Desaulniers, 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 '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.

Link: https://github.com/ClangBuiltLinux/linux/issues/144
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 drivers/rtc/rtc-omap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 320b4a520eb3..bbff0e2deb84 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -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},
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH
  2018-11-01  0:55 [PATCH] rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH Nathan Chancellor
@ 2018-11-12 19:25 ` Nick Desaulniers
  2018-11-12 22:17 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2018-11-12 19:25 UTC (permalink / raw)
  To: alexandre.belloni, a.zummo; +Cc: linux-rtc, LKML, Nathan Chancellor

On Wed, Oct 31, 2018 at 5:55 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> 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.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/144
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/rtc/rtc-omap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
> index 320b4a520eb3..bbff0e2deb84 100644
> --- a/drivers/rtc/rtc-omap.c
> +++ b/drivers/rtc/rtc-omap.c
> @@ -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},
> --
> 2.19.1
>

Bumping for review

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH
  2018-11-01  0:55 [PATCH] rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH Nathan Chancellor
  2018-11-12 19:25 ` Nick Desaulniers
@ 2018-11-12 22:17 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2018-11-12 22:17 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Alessandro Zummo, linux-rtc, linux-kernel, Nick Desaulniers

On 31/10/2018 17:55:02-0700, Nathan Chancellor wrote:
> 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.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/144
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  drivers/rtc/rtc-omap.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-12 22:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01  0:55 [PATCH] rtc: omap: Use define directive for PIN_CONFIG_ACTIVE_HIGH Nathan Chancellor
2018-11-12 19:25 ` Nick Desaulniers
2018-11-12 22:17 ` Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.