mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qunqin Zhao <zhaoqunqin@loongson.cn>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: lee@kernel.org, jarkko@kernel.org, linux-kernel@vger.kernel.org,
	loongarch@lists.linux.dev, davem@davemloft.net,
	linux-crypto@vger.kernel.org, peterhuewe@gmx.de, jgg@ziepe.ca,
	linux-integrity@vger.kernel.org,
	Yinggang Gu <guyinggang@loongson.cn>,
	Huacai Chen <chenhuacai@loongson.cn>
Subject: Re: [PATCH v10 2/5] crypto: loongson - add Loongson RNG driver support
Date: Tue, 17 Jun 2025 17:49:53 +0800	[thread overview]
Message-ID: <4efdb35f-dfb0-c44f-b3ec-7ca98717820c@loongson.cn> (raw)
In-Reply-To: <aElLJY9MnkEQx935@gondor.apana.org.au>


在 2025/6/11 下午5:23, Herbert Xu 写道:
> On Wed, May 28, 2025 at 02:59:41PM +0800, Qunqin Zhao wrote:
>> +	if (!rng_devices.is_init) {
>> +		ret = crypto_register_rng(&loongson_rng_alg);
>> +		if (ret) {
>> +			dev_err(&pdev->dev, "failed to register crypto(%d)\n", ret);
>> +			return ret;
>> +		}
>> +		INIT_LIST_HEAD(&rng_devices.list);
>> +		mutex_init(&rng_devices.lock);
>> +		rng_devices.is_init = true;
>> +	}
> This doesn't look right.  What stops two devices from both entering
> this code path when is_init == false?

Will use __MUTEX_INITIALIZER  macro to statically initialize 
rng_devices. lock,

and then use this lock to stop two devices form both entering this code 
path.


Thanks,

Qunqin

>
> Cheers,


  reply	other threads:[~2025-06-17  9:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28  6:59 [PATCH v10 0/5] Add Loongson Security Engine chip driver Qunqin Zhao
2025-05-28  6:59 ` [PATCH v10 1/5] mfd: Add support for Loongson Security Engine chip controller Qunqin Zhao
2025-05-28  6:59 ` [PATCH v10 2/5] crypto: loongson - add Loongson RNG driver support Qunqin Zhao
2025-06-11  9:23   ` Herbert Xu
2025-06-17  9:49     ` Qunqin Zhao [this message]
2025-05-28  6:59 ` [PATCH v10 3/5] MAINTAINERS: Add entry for Loongson crypto driver Qunqin Zhao
2025-05-28  6:59 ` [PATCH v10 4/5] tpm: Add a driver for Loongson TPM device Qunqin Zhao
2025-05-28  7:57   ` Stefano Garzarella
2025-05-28  8:42     ` Qunqin Zhao
2025-05-28  9:00       ` Stefano Garzarella
2025-05-28  9:24         ` Qunqin Zhao
2025-05-28  9:34           ` Qunqin Zhao
2025-05-28  9:53             ` Stefano Garzarella
2025-05-29  2:16               ` Qunqin Zhao
2025-05-28  9:36           ` Stefano Garzarella
2025-05-28  7:17 ` [PATCH v10 0/5] Add Loongson Security Engine chip driver Huacai Chen
2025-05-28  7:42   ` Yanteng Si
2025-05-28  8:05   ` Qunqin Zhao
2025-05-28  8:17     ` Huacai Chen
2025-05-28  9:14       ` Yanteng Si
2025-05-28 10:25         ` Huacai Chen

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=4efdb35f-dfb0-c44f-b3ec-7ca98717820c@loongson.cn \
    --to=zhaoqunqin@loongson.cn \
    --cc=chenhuacai@loongson.cn \
    --cc=davem@davemloft.net \
    --cc=guyinggang@loongson.cn \
    --cc=herbert@gondor.apana.org.au \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=lee@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=peterhuewe@gmx.de \
    /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®