linux-um archives
 help / color / mirror / Atom feed
From: "Tiwei Bie" <tiwei.btw@antgroup.com>
To: richard@nod.at, anton.ivanov@cambridgegreys.com,
	johannes@sipsolutions.net
Cc: <linux-um@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	"Tiwei Bie" <tiwei.btw@antgroup.com>
Subject: [PATCH 6/7] um: Fix -Wmissing-prototypes warnings for __vdso_*
Date: Tue, 23 Apr 2024 19:24:56 +0800	[thread overview]
Message-ID: <20240423112457.2409319-7-tiwei.btw@antgroup.com> (raw)
In-Reply-To: <20240423112457.2409319-1-tiwei.btw@antgroup.com>

The VDSO functions are defined as globals and intended to be called
from userspace. Let's just workaround the -Wmissing-prototypes warnings
by declaring them locally.

This will address below -Wmissing-prototypes warnings:

arch/x86/um/vdso/um_vdso.c:16:5: warning: no previous prototype for ‘__vdso_clock_gettime’ [-Wmissing-prototypes]
arch/x86/um/vdso/um_vdso.c:30:5: warning: no previous prototype for ‘__vdso_gettimeofday’ [-Wmissing-prototypes]
arch/x86/um/vdso/um_vdso.c:44:21: warning: no previous prototype for ‘__vdso_time’ [-Wmissing-prototypes]
arch/x86/um/vdso/um_vdso.c:57:1: warning: no previous prototype for ‘__vdso_getcpu’ [-Wmissing-prototypes]

Meanwhile, also fix the "WARNING: Prefer 'unsigned int *' to bare use
of 'unsigned *'" checkpatch warning.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
 arch/x86/um/vdso/um_vdso.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/um/vdso/um_vdso.c b/arch/x86/um/vdso/um_vdso.c
index ff0f3b4b6c45..cbae2584124f 100644
--- a/arch/x86/um/vdso/um_vdso.c
+++ b/arch/x86/um/vdso/um_vdso.c
@@ -13,6 +13,12 @@
 #include <linux/getcpu.h>
 #include <asm/unistd.h>
 
+/* workaround for -Wmissing-prototypes warnings */
+int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts);
+int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
+__kernel_old_time_t __vdso_time(__kernel_old_time_t *t);
+long __vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused);
+
 int __vdso_clock_gettime(clockid_t clock, struct __kernel_old_timespec *ts)
 {
 	long ret;
@@ -54,7 +60,7 @@ __kernel_old_time_t __vdso_time(__kernel_old_time_t *t)
 __kernel_old_time_t time(__kernel_old_time_t *t) __attribute__((weak, alias("__vdso_time")));
 
 long
-__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
+__vdso_getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *unused)
 {
 	/*
 	 * UML does not support SMP, we can cheat here. :)
@@ -68,5 +74,5 @@ __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
 	return 0;
 }
 
-long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
+long getcpu(unsigned int *cpu, unsigned int *node, struct getcpu_cache *tcache)
 	__attribute__((weak, alias("__vdso_getcpu")));
-- 
2.34.1



  parent reply	other threads:[~2024-04-23 11:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 11:24 [PATCH 0/7] um: A follow-up series of -Wmissing-prototypes fixes Tiwei Bie
2024-04-23 11:24 ` [PATCH 1/7] um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn Tiwei Bie
2024-04-23 11:24 ` [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm Tiwei Bie
2024-04-23 11:29   ` Johannes Berg
2024-04-23 12:11     ` Tiwei Bie
2024-04-23 11:24 ` [PATCH 3/7] um: Fix the -Wmissing-prototypes warning for get_thread_reg Tiwei Bie
2024-04-23 11:30   ` Johannes Berg
2024-04-23 11:24 ` [PATCH 4/7] um: Fix the declaration of kasan_map_memory Tiwei Bie
2024-04-23 11:24 ` [PATCH 5/7] um: Add an internal header shared among the user code Tiwei Bie
2024-04-23 11:30   ` Johannes Berg
2024-04-23 12:09     ` Tiwei Bie
2024-04-23 12:22       ` Johannes Berg
2024-04-23 12:29         ` Tiwei Bie
2024-04-23 11:24 ` Tiwei Bie [this message]
2024-04-23 11:24 ` [PATCH 7/7] um: Remove unused do_get_thread_area function Tiwei Bie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240423112457.2409319-7-tiwei.btw@antgroup.com \
    --to=tiwei.btw@antgroup.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox