From: Greg KH <gregkh@linuxfoundation.org>
To: Zheng Yongjun <zhengyongjun3@huawei.com>
Cc: nsaenzjulienne@suse.de, bcm-kernel-feedback-list@broadcom.com,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 -next] staging: vc04_services: use DEFINE_MUTEX() for mutex lock
Date: Tue, 5 Jan 2021 07:02:45 +0100 [thread overview]
Message-ID: <X/QBBTBwz12mrQrM@kroah.com> (raw)
In-Reply-To: <20210105020547.19042-1-zhengyongjun3@huawei.com>
On Tue, Jan 05, 2021 at 10:05:47AM +0800, Zheng Yongjun wrote:
> mutex lock can be initialized automatically with DEFINE_MUTEX()
> rather than explicitly calling mutex_init().
>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
> .../vc04_services/interface/vchiq_arm/vchiq_connected.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
> index 79b75efa6868..938307f39b9c 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
> @@ -12,15 +12,13 @@ static int g_connected;
> static int g_num_deferred_callbacks;
> static VCHIQ_CONNECTED_CALLBACK_T g_deferred_callback[MAX_CALLBACKS];
> static int g_once_init;
> -static struct mutex g_connected_mutex;
> +static DEFINE_MUTEX(g_connected_mutex);
>
> /* Function to initialize our lock */
> static void connected_init(void)
> {
> - if (!g_once_init) {
> - mutex_init(&g_connected_mutex);
> + if (!g_once_init)
> g_once_init = 1;
> - }
Why do you still need g_once_init now?
prev parent reply other threads:[~2021-01-05 6:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 2:05 Zheng Yongjun
2021-01-05 6:02 ` Greg KH [this message]
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=X/QBBTBwz12mrQrM@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsaenzjulienne@suse.de \
--cc=zhengyongjun3@huawei.com \
/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
all inboxes | Powered by JetHome®