2021-03-23 01:11:09

by Zhangshaokun

[permalink] [raw]
Subject: [PATCH] locking/mutex: Remove repeated declaration

Commit 0cd39f4600ed ("locking/seqlock, headers: Untangle the spaghetti monster")
introduces 'struct ww_acquire_ctx' again, remove the repeated declaration.

Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: Boqun Feng <[email protected]>
Signed-off-by: Shaokun Zhang <[email protected]>
---
include/linux/mutex.h | 2 --
1 file changed, 2 deletions(-)

diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 0cd631a19727..d80c0e22c822 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -20,8 +20,6 @@
#include <linux/osq_lock.h>
#include <linux/debug_locks.h>

-struct ww_acquire_ctx;
-
/*
* Simple, straightforward mutexes with strict semantics:
*
--
2.7.4


2021-03-23 01:40:48

by Waiman Long

[permalink] [raw]
Subject: Re: [PATCH] locking/mutex: Remove repeated declaration

On 3/22/21 9:09 PM, Shaokun Zhang wrote:
> Commit 0cd39f4600ed ("locking/seqlock, headers: Untangle the spaghetti monster")
> introduces 'struct ww_acquire_ctx' again, remove the repeated declaration.
>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: Waiman Long <[email protected]>
> Cc: Boqun Feng <[email protected]>
> Signed-off-by: Shaokun Zhang <[email protected]>
> ---
> include/linux/mutex.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/include/linux/mutex.h b/include/linux/mutex.h
> index 0cd631a19727..d80c0e22c822 100644
> --- a/include/linux/mutex.h
> +++ b/include/linux/mutex.h
> @@ -20,8 +20,6 @@
> #include <linux/osq_lock.h>
> #include <linux/debug_locks.h>
>
> -struct ww_acquire_ctx;
> -
> /*
> * Simple, straightforward mutexes with strict semantics:
> *

Yes, it is duplicated.

Acked-by: Waiman Long <[email protected]>

2021-03-23 11:26:15

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] locking/mutex: Remove repeated declaration


* Shaokun Zhang <[email protected]> wrote:

> Commit 0cd39f4600ed ("locking/seqlock, headers: Untangle the spaghetti monster")
> introduces 'struct ww_acquire_ctx' again, remove the repeated declaration.
>
> Cc: Peter Zijlstra <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: Waiman Long <[email protected]>
> Cc: Boqun Feng <[email protected]>
> Signed-off-by: Shaokun Zhang <[email protected]>
> ---
> include/linux/mutex.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/include/linux/mutex.h b/include/linux/mutex.h
> index 0cd631a19727..d80c0e22c822 100644
> --- a/include/linux/mutex.h
> +++ b/include/linux/mutex.h
> @@ -20,8 +20,6 @@
> #include <linux/osq_lock.h>
> #include <linux/debug_locks.h>
>
> -struct ww_acquire_ctx;
> -
> /*
> * Simple, straightforward mutexes with strict semantics:
> *

Please also group the pre-declarations together, that's the canonical
pattern we use in headers.

I.e. have something like this at the top:

struct ww_class;
struct ww_acquire_ctx;

Thanks,

Ingo

2021-03-24 09:27:24

by Zhangshaokun

[permalink] [raw]
Subject: Re: [PATCH] locking/mutex: Remove repeated declaration

Hi Ingo,

On 2021/3/23 19:23, Ingo Molnar wrote:
>
> * Shaokun Zhang <[email protected]> wrote:
>
>> Commit 0cd39f4600ed ("locking/seqlock, headers: Untangle the spaghetti monster")
>> introduces 'struct ww_acquire_ctx' again, remove the repeated declaration.
>>
>> Cc: Peter Zijlstra <[email protected]>
>> Cc: Ingo Molnar <[email protected]>
>> Cc: Will Deacon <[email protected]>
>> Cc: Waiman Long <[email protected]>
>> Cc: Boqun Feng <[email protected]>
>> Signed-off-by: Shaokun Zhang <[email protected]>
>> ---
>> include/linux/mutex.h | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/include/linux/mutex.h b/include/linux/mutex.h
>> index 0cd631a19727..d80c0e22c822 100644
>> --- a/include/linux/mutex.h
>> +++ b/include/linux/mutex.h
>> @@ -20,8 +20,6 @@
>> #include <linux/osq_lock.h>
>> #include <linux/debug_locks.h>
>>
>> -struct ww_acquire_ctx;
>> -
>> /*
>> * Simple, straightforward mutexes with strict semantics:
>> *
>
> Please also group the pre-declarations together, that's the canonical
> pattern we use in headers.

Ok,

>
> I.e. have something like this at the top:
>

Got it, I will do it in next version.

Thanks,
Shaokun

> struct ww_class;
> struct ww_acquire_ctx;
>
> Thanks,
>
> Ingo
> .
>