[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <34060476-86e5-42fb-a139-6790487c1568@csgroup.eu>
Date: Thu, 7 Dec 2023 12:28:08 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Andy Shevchenko <andy.shevchenko@...il.com>,
George Stark <gnstark@...utedevices.com>
CC: Hans de Goede <hdegoede@...hat.com>, "pavel@....cz" <pavel@....cz>,
"lee@...nel.org" <lee@...nel.org>,
"vadimp@...dia.com" <vadimp@...dia.com>,
"mpe@...erman.id.au" <mpe@...erman.id.au>,
"npiggin@...il.com" <npiggin@...il.com>,
"mazziesaccount@...il.com" <mazziesaccount@...il.com>,
"jic23@...nel.org" <jic23@...nel.org>,
"peterz@...radead.org" <peterz@...radead.org>,
Waiman Long <longman@...hat.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"will@...nel.org" <will@...nel.org>,
"boqun.feng@...il.com" <boqun.feng@...il.com>,
"linux-leds@...r.kernel.org" <linux-leds@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"kernel@...utedevices.com" <kernel@...utedevices.com>
Subject: Re: [PATCH v2 01/10] devm-helpers: introduce devm_mutex_init
Le 07/12/2023 à 13:02, Andy Shevchenko a écrit :
> On Thu, Dec 7, 2023 at 1:23 AM George Stark <gnstark@...utedevices.com> wrote:
>> On 12/7/23 01:37, Christophe Leroy wrote:
>>> Le 06/12/2023 à 23:14, Christophe Leroy a écrit :
>
> ...
>
>>> Looking at it closer, I have the feeling that you want to do similar to
>>> devm_gpio_request() in linux/gpio.h :
>>>
>>> In linux/mutex.h, add a prototype for devm_mutex_init() when
>>> CONFIG_DEBUG_MUTEXES is defined and an empty static inline otherwise.
>>> Then define devm_mutex_init() in kernel/locking/mutex-debug.c
>>
>> Yes, this would be almost perfect decision. BTW just as in linux/gpio.h
>> we wouldn't have to include whole "linux/device.h" into mutex.h, only
>> add forward declaration of struct device;
>
> In case you place it into a C-file. Otherwise you need a header for
> the API and that is not acceptable for mutex.h.
>
Right, that's the reason why I'm suggesting to define devm_mutex_init()
in kernel/locking/mutex-debug.c.
In linux/mutex.h, you define a stub for when CONFIG_DEBUG_MUTEXES is not
set, and the prototype of devm_mutex_init() when CONFIG_DEBUG_MUTEXES is
set.
Powered by blists - more mailing lists