linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] um: kunit: resolve missing prototypes warning
@ 2024-09-04 13:50 Gabriele Monaco
  2024-09-04 13:56 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriele Monaco @ 2024-09-04 13:50 UTC (permalink / raw)
  To: Arnd Bergmann, linux-arch, linux-kernel
  Cc: Brendan Higgins, David Gow, Rae Moar, linux-kselftest, kunit-dev,
	Richard Weinberger, Anton Ivanov, Johannes Berg, linux-um,
	Gabriele Monaco

While building for KUnit with default settings, the build is generating
the following compilation warnings.

```
$ make ARCH=um O=.kunit --jobs=16
../lib/iomap.c:156:5: warning: no previous prototype for
‘ioread64_lo_hi’ [-Wmissing-prototypes]
  156 | u64 ioread64_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
[...]
```

The warning happens because the prototypes are defined in
`asm-generic/iomap.h` only when `readq` and `writeq` are defined.
For UM, those function get some default definitions but are currently
defined _after_ the prototypes for `ioread64*`/`iowrite64*` functions.
Moving the inclusion of `asm-generic/iomap.h` fixes it.

Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
 include/asm-generic/io.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 80de699bf6af..0b02c8e38f20 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -13,10 +13,6 @@
 #include <linux/types.h>
 #include <linux/instruction_pointer.h>
 
-#ifdef CONFIG_GENERIC_IOMAP
-#include <asm-generic/iomap.h>
-#endif
-
 #include <asm/mmiowb.h>
 #include <asm-generic/pci_iomap.h>
 
@@ -295,6 +291,10 @@ static inline void writeq(u64 value, volatile void __iomem *addr)
 #endif
 #endif /* CONFIG_64BIT */
 
+#ifdef CONFIG_GENERIC_IOMAP
+#include <asm-generic/iomap.h>
+#endif
+
 /*
  * {read,write}{b,w,l,q}_relaxed() are like the regular version, but
  * are not guaranteed to provide ordering against spinlocks or memory

base-commit: 67784a74e258a467225f0e68335df77acd67b7ab
-- 
2.46.0



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

* Re: [PATCH] um: kunit: resolve missing prototypes warning
  2024-09-04 13:50 [PATCH] um: kunit: resolve missing prototypes warning Gabriele Monaco
@ 2024-09-04 13:56 ` Johannes Berg
  2024-09-04 15:51   ` Gabriele Monaco
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2024-09-04 13:56 UTC (permalink / raw)
  To: Gabriele Monaco, Arnd Bergmann, linux-arch, linux-kernel
  Cc: Brendan Higgins, David Gow, Rae Moar, linux-kselftest, kunit-dev,
	Richard Weinberger, Anton Ivanov, linux-um

On Wed, 2024-09-04 at 15:50 +0200, Gabriele Monaco wrote:
> While building for KUnit with default settings, the build is generating
> the following compilation warnings.
> 
> ```
> $ make ARCH=um O=.kunit --jobs=16
> ../lib/iomap.c:156:5: warning: no previous prototype for
> ‘ioread64_lo_hi’ [-Wmissing-prototypes]
>   156 | u64 ioread64_lo_hi(const void __iomem *addr)
>       |     ^~~~~~~~~~~~~~
> [...]
> ```
> 
> The warning happens because the prototypes are defined in
> `asm-generic/iomap.h` only when `readq` and `writeq` are defined.
> For UM, those function get some default definitions but are currently
> defined _after_ the prototypes for `ioread64*`/`iowrite64*` functions.
> Moving the inclusion of `asm-generic/iomap.h` fixes it.
> 
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
> ---
>  include/asm-generic/io.h | 8 ++++----

I get that you have this on kunit on ARCH=um, but that makes it neither
a kunit nor a um patch :)

Arnd had originally wanted to fix this another way, but that got
dropped. I don't know if this fix is right, though I can see that it
works. I have the same workaround in my tree, but I'm really not
convinced that it doesn't have side-effects on other architectures.

johannes


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

* Re: [PATCH] um: kunit: resolve missing prototypes warning
  2024-09-04 13:56 ` Johannes Berg
@ 2024-09-04 15:51   ` Gabriele Monaco
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriele Monaco @ 2024-09-04 15:51 UTC (permalink / raw)
  To: Johannes Berg, Arnd Bergmann, linux-arch, linux-kernel
  Cc: Brendan Higgins, David Gow, Rae Moar, linux-kselftest, kunit-dev,
	Richard Weinberger, linux-um


First of all, thanks for the quick reply

> I get that you have this on kunit on ARCH=um, but that makes it
> neither
> a kunit nor a um patch :)

Well, yes I wasn't entirely sure how to put it, sure people from
UM/KUnit know what this is about, but I agree perhaps the patch title
can be a bit misleading.

> Arnd had originally wanted to fix this another way, but that got
> dropped. I don't know if this fix is right, though I can see that it
> works. I have the same workaround in my tree, but I'm really not
> convinced that it doesn't have side-effects on other architectures.

I thought about doing it differently, perhaps using an additional
header file or even re-arranging the macro dependency, this seemed to
me the easiest and perhaps less risky for other architectures, but I
get the concerns.

I could perform some further analyses building it for multiple targets
(besides _it builds_ I mean), if you have anything specific in mind.

Gabriele



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

end of thread, other threads:[~2024-09-04 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 13:50 [PATCH] um: kunit: resolve missing prototypes warning Gabriele Monaco
2024-09-04 13:56 ` Johannes Berg
2024-09-04 15:51   ` Gabriele Monaco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).