2024-04-23 11:25:37

by Tiwei Bie

[permalink] [raw]
Subject: [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm

The __switch_mm function is defined in the user code, and is called
by the kernel code. It should be declared in a shared header.

Fixes: 4dc706c2f292 ("um: take um_mmu.h to asm/mmu.h, clean asm/mmu_context.h a bit")
Signed-off-by: Tiwei Bie <[email protected]>
---
arch/um/include/asm/mmu.h | 2 --
arch/um/include/shared/skas/mm_id.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h
index a7555e43ed14..f2923c767bb9 100644
--- a/arch/um/include/asm/mmu.h
+++ b/arch/um/include/asm/mmu.h
@@ -14,8 +14,6 @@ typedef struct mm_context {
struct uml_arch_mm_context arch;
} mm_context_t;

-extern void __switch_mm(struct mm_id * mm_idp);
-
/* Avoid tangled inclusion with asm/ldt.h */
extern long init_new_ldt(struct mm_context *to_mm, struct mm_context *from_mm);
extern void free_ldt(struct mm_context *mm);
diff --git a/arch/um/include/shared/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h
index e82e203f5f41..bdfab67174ff 100644
--- a/arch/um/include/shared/skas/mm_id.h
+++ b/arch/um/include/shared/skas/mm_id.h
@@ -15,4 +15,6 @@ struct mm_id {
int kill;
};

+extern void __switch_mm(struct mm_id *mm_idp);
+
#endif
--
2.34.1



2024-04-23 11:29:36

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm

On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
>
> --- a/arch/um/include/shared/skas/mm_id.h
> +++ b/arch/um/include/shared/skas/mm_id.h
> @@ -15,4 +15,6 @@ struct mm_id {
> int kill;
> };
>
> +extern void __switch_mm(struct mm_id *mm_idp);
>

Maybe drop the extern while at it?

johannes

2024-04-23 12:22:35

by Tiwei Bie

[permalink] [raw]
Subject: Re: [PATCH 2/7] um: Fix the -Wmissing-prototypes warning for __switch_mm

On 4/23/24 7:29 PM, Johannes Berg wrote:
> On Tue, 2024-04-23 at 19:24 +0800, Tiwei Bie wrote:
>>
>> --- a/arch/um/include/shared/skas/mm_id.h
>> +++ b/arch/um/include/shared/skas/mm_id.h
>> @@ -15,4 +15,6 @@ struct mm_id {
>> int kill;
>> };
>>
>> +extern void __switch_mm(struct mm_id *mm_idp);
>>
>
> Maybe drop the extern while at it?

Sure, will do. I also prefer to drop the extern.
Thanks for the review! :)

Regards,
Tiwei