* [PATCH] tools/gpio/gpio-event-mon: fix warning
@ 2018-02-21 21:33 Anders Roxell
2018-02-21 21:41 ` Daniel Díaz Rodríguez
2018-03-01 14:27 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Anders Roxell @ 2018-02-21 21:33 UTC (permalink / raw)
To: linus.walleij; +Cc: linux-gpio, linux-kernel, Anders Roxell
PRIu64 is defined in user space to match libc's uint64_t definition.
However, gpioevent_data structure in the kernel is defined using the
kernel's own __u64 type.
gpio-event-mon.c: In function ‘monitor_device’:
gpio-event-mon.c:102:19: warning: format ‘%lu’ expects argument of type
‘long unsigned int’, but argument 3 has type ‘__u64 {aka long long
unsigned int}’ [-Wformat=]
fprintf(stdout, "GPIO EVENT %" PRIu64 ": ", event.timestamp);
^~~~~~~~~~~~~~
LD /tmp/kselftest/gpiogpio-event-mon-in.o
LINK /tmp/kselftest/gpiogpio-event-mon
Fix is to replace PRIu64 with llu, which we know is what the kernel uses
for __u64.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
tools/gpio/gpio-event-mon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c
index dac4d4131d9b..c864544efe05 100644
--- a/tools/gpio/gpio-event-mon.c
+++ b/tools/gpio/gpio-event-mon.c
@@ -99,7 +99,7 @@ int monitor_device(const char *device_name,
ret = -EIO;
break;
}
- fprintf(stdout, "GPIO EVENT %" PRIu64 ": ", event.timestamp);
+ fprintf(stdout, "GPIO EVENT %llu: ", event.timestamp);
switch (event.id) {
case GPIOEVENT_EVENT_RISING_EDGE:
fprintf(stdout, "rising edge");
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/gpio/gpio-event-mon: fix warning
2018-02-21 21:33 [PATCH] tools/gpio/gpio-event-mon: fix warning Anders Roxell
@ 2018-02-21 21:41 ` Daniel Díaz Rodríguez
2018-03-01 14:27 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Díaz Rodríguez @ 2018-02-21 21:41 UTC (permalink / raw)
To: Anders Roxell; +Cc: linus.walleij, linux-gpio, open list
On 21 February 2018 at 15:33, Anders Roxell <anders.roxell@linaro.org> wrote:
> PRIu64 is defined in user space to match libc's uint64_t definition.
> However, gpioevent_data structure in the kernel is defined using the
> kernel's own __u64 type.
>
> gpio-event-mon.c: In function ‘monitor_device’:
> gpio-event-mon.c:102:19: warning: format ‘%lu’ expects argument of type
> ‘long unsigned int’, but argument 3 has type ‘__u64 {aka long long
> unsigned int}’ [-Wformat=]
> fprintf(stdout, "GPIO EVENT %" PRIu64 ": ", event.timestamp);
> ^~~~~~~~~~~~~~
> LD /tmp/kselftest/gpiogpio-event-mon-in.o
> LINK /tmp/kselftest/gpiogpio-event-mon
>
> Fix is to replace PRIu64 with llu, which we know is what the kernel uses
> for __u64.
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Tested-by: Daniel Díaz <daniel.diaz@linaro.org>
> ---
> tools/gpio/gpio-event-mon.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/gpio/gpio-event-mon.c b/tools/gpio/gpio-event-mon.c
> index dac4d4131d9b..c864544efe05 100644
> --- a/tools/gpio/gpio-event-mon.c
> +++ b/tools/gpio/gpio-event-mon.c
> @@ -99,7 +99,7 @@ int monitor_device(const char *device_name,
> ret = -EIO;
> break;
> }
> - fprintf(stdout, "GPIO EVENT %" PRIu64 ": ", event.timestamp);
> + fprintf(stdout, "GPIO EVENT %llu: ", event.timestamp);
> switch (event.id) {
> case GPIOEVENT_EVENT_RISING_EDGE:
> fprintf(stdout, "rising edge");
> --
> 2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/gpio/gpio-event-mon: fix warning
2018-02-21 21:33 [PATCH] tools/gpio/gpio-event-mon: fix warning Anders Roxell
2018-02-21 21:41 ` Daniel Díaz Rodríguez
@ 2018-03-01 14:27 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-03-01 14:27 UTC (permalink / raw)
To: Anders Roxell; +Cc: open list:GPIO SUBSYSTEM, linux-kernel
On Wed, Feb 21, 2018 at 10:33 PM, Anders Roxell
<anders.roxell@linaro.org> wrote:
> PRIu64 is defined in user space to match libc's uint64_t definition.
> However, gpioevent_data structure in the kernel is defined using the
> kernel's own __u64 type.
>
> gpio-event-mon.c: In function ‘monitor_device’:
> gpio-event-mon.c:102:19: warning: format ‘%lu’ expects argument of type
> ‘long unsigned int’, but argument 3 has type ‘__u64 {aka long long
> unsigned int}’ [-Wformat=]
> fprintf(stdout, "GPIO EVENT %" PRIu64 ": ", event.timestamp);
> ^~~~~~~~~~~~~~
> LD /tmp/kselftest/gpiogpio-event-mon-in.o
> LINK /tmp/kselftest/gpiogpio-event-mon
>
> Fix is to replace PRIu64 with llu, which we know is what the kernel uses
> for __u64.
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Patch applied with Daniel's test tag.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-01 14:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-21 21:33 [PATCH] tools/gpio/gpio-event-mon: fix warning Anders Roxell
2018-02-21 21:41 ` Daniel Díaz Rodríguez
2018-03-01 14:27 ` Linus Walleij
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.