All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] crypto: bfin_crc: ignore duplicated registration of the same algorithm
@ 2014-04-11  9:30 Sonic Zhang
  2014-04-11  9:33 ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: Sonic Zhang @ 2014-04-11  9:30 UTC (permalink / raw)
  To: Marek Vasut, Herbert Xu; +Cc: linux-crypto, adi-buildroot-devel, Sonic Zhang

From: Sonic Zhang <sonic.zhang@analog.com>

in case of multiple crc devices are probed.
Call platform_set_drvdata() before adding new CRC device into the list.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
v3-change:
- check list_is_singular() before register the algorithm

 drivers/crypto/bfin_crc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c
index cea3e8c..892b6d2 100644
--- a/drivers/crypto/bfin_crc.c
+++ b/drivers/crypto/bfin_crc.c
@@ -665,19 +665,19 @@ static int bfin_crypto_crc_probe(struct platform_device *pdev)
 	if (timeout == 0)
 		dev_info(&pdev->dev, "init crc poly timeout\n");
 
+	platform_set_drvdata(pdev, crc);
+
 	spin_lock(&crc_list.lock);
 	list_add(&crc->list, &crc_list.dev_list);
 	spin_unlock(&crc_list.lock);
 
-	platform_set_drvdata(pdev, crc);
-
-	ret = crypto_register_ahash(&algs);
-	if (ret) {
-		spin_lock(&crc_list.lock);
-		list_del(&crc->list);
-		spin_unlock(&crc_list.lock);
-		dev_err(&pdev->dev, "Cann't register crypto ahash device\n");
-		goto out_error_dma;
+	if (list_is_singular(&crc_list.dev_list)) {
+		ret = crypto_register_ahash(&algs);
+		if (ret) {
+			dev_err(&pdev->dev,
+				"Cann't register crypto ahash device\n");
+			goto out_error_dma;
+		}
 	}
 
 	dev_info(&pdev->dev, "initialized\n");
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] crypto: bfin_crc: ignore duplicated registration of the same algorithm
  2014-04-11  9:30 [PATCH v3 1/2] crypto: bfin_crc: ignore duplicated registration of the same algorithm Sonic Zhang
@ 2014-04-11  9:33 ` Marek Vasut
  2014-04-14  4:23   ` Sonic Zhang
  2014-04-16 13:49   ` Herbert Xu
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Vasut @ 2014-04-11  9:33 UTC (permalink / raw)
  To: Sonic Zhang; +Cc: Herbert Xu, linux-crypto, adi-buildroot-devel, Sonic Zhang

On Friday, April 11, 2014 at 11:30:25 AM, Sonic Zhang wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> in case of multiple crc devices are probed.
> Call platform_set_drvdata() before adding new CRC device into the list.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
> ---
> v3-change:
> - check list_is_singular() before register the algorithm
> 
>  drivers/crypto/bfin_crc.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c
> index cea3e8c..892b6d2 100644
> --- a/drivers/crypto/bfin_crc.c
> +++ b/drivers/crypto/bfin_crc.c
> @@ -665,19 +665,19 @@ static int bfin_crypto_crc_probe(struct
> platform_device *pdev) if (timeout == 0)
>  		dev_info(&pdev->dev, "init crc poly timeout\n");
> 
> +	platform_set_drvdata(pdev, crc);
> +
>  	spin_lock(&crc_list.lock);
>  	list_add(&crc->list, &crc_list.dev_list);
>  	spin_unlock(&crc_list.lock);
> 
> -	platform_set_drvdata(pdev, crc);
> -
> -	ret = crypto_register_ahash(&algs);
> -	if (ret) {
> -		spin_lock(&crc_list.lock);
> -		list_del(&crc->list);
> -		spin_unlock(&crc_list.lock);
> -		dev_err(&pdev->dev, "Cann't register crypto ahash device\n");
> -		goto out_error_dma;
> +	if (list_is_singular(&crc_list.dev_list)) {
> +		ret = crypto_register_ahash(&algs);
> +		if (ret) {
> +			dev_err(&pdev->dev,
> +				"Cann't register crypto ahash device\n");

"Cann't" with two Ns ;-/

Well, add "Reviewed-by: Marek Vasut <marex@denx.de>" into the next go please :)

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] crypto: bfin_crc: ignore duplicated registration of the same algorithm
  2014-04-11  9:33 ` Marek Vasut
@ 2014-04-14  4:23   ` Sonic Zhang
  2014-04-16 13:49   ` Herbert Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Sonic Zhang @ 2014-04-14  4:23 UTC (permalink / raw)
  To: Marek Vasut; +Cc: Herbert Xu, linux-crypto, adi-buildroot-devel, Sonic Zhang

Hi Herbert,

Could you please review this patch?

Thanks

Sonic Zhang

On Fri, Apr 11, 2014 at 5:33 PM, Marek Vasut <marex@denx.de> wrote:
> On Friday, April 11, 2014 at 11:30:25 AM, Sonic Zhang wrote:
>> From: Sonic Zhang <sonic.zhang@analog.com>
>>
>> in case of multiple crc devices are probed.
>> Call platform_set_drvdata() before adding new CRC device into the list.
>>
>> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
>> ---
>> v3-change:
>> - check list_is_singular() before register the algorithm
>>
>>  drivers/crypto/bfin_crc.c | 18 +++++++++---------
>>  1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c
>> index cea3e8c..892b6d2 100644
>> --- a/drivers/crypto/bfin_crc.c
>> +++ b/drivers/crypto/bfin_crc.c
>> @@ -665,19 +665,19 @@ static int bfin_crypto_crc_probe(struct
>> platform_device *pdev) if (timeout == 0)
>>               dev_info(&pdev->dev, "init crc poly timeout\n");
>>
>> +     platform_set_drvdata(pdev, crc);
>> +
>>       spin_lock(&crc_list.lock);
>>       list_add(&crc->list, &crc_list.dev_list);
>>       spin_unlock(&crc_list.lock);
>>
>> -     platform_set_drvdata(pdev, crc);
>> -
>> -     ret = crypto_register_ahash(&algs);
>> -     if (ret) {
>> -             spin_lock(&crc_list.lock);
>> -             list_del(&crc->list);
>> -             spin_unlock(&crc_list.lock);
>> -             dev_err(&pdev->dev, "Cann't register crypto ahash device\n");
>> -             goto out_error_dma;
>> +     if (list_is_singular(&crc_list.dev_list)) {
>> +             ret = crypto_register_ahash(&algs);
>> +             if (ret) {
>> +                     dev_err(&pdev->dev,
>> +                             "Cann't register crypto ahash device\n");
>
> "Cann't" with two Ns ;-/
>
> Well, add "Reviewed-by: Marek Vasut <marex@denx.de>" into the next go please :)
>
> Best regards,
> Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/2] crypto: bfin_crc: ignore duplicated registration of the same algorithm
  2014-04-11  9:33 ` Marek Vasut
  2014-04-14  4:23   ` Sonic Zhang
@ 2014-04-16 13:49   ` Herbert Xu
  1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2014-04-16 13:49 UTC (permalink / raw)
  To: Marek Vasut; +Cc: Sonic Zhang, linux-crypto, adi-buildroot-devel, Sonic Zhang

On Fri, Apr 11, 2014 at 11:33:37AM +0200, Marek Vasut wrote:
> On Friday, April 11, 2014 at 11:30:25 AM, Sonic Zhang wrote:
> > From: Sonic Zhang <sonic.zhang@analog.com>
> > 
> > in case of multiple crc devices are probed.
> > Call platform_set_drvdata() before adding new CRC device into the list.
> > 
> > Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
> > ---
> > v3-change:
> > - check list_is_singular() before register the algorithm
> > 
> >  drivers/crypto/bfin_crc.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/crypto/bfin_crc.c b/drivers/crypto/bfin_crc.c
> > index cea3e8c..892b6d2 100644
> > --- a/drivers/crypto/bfin_crc.c
> > +++ b/drivers/crypto/bfin_crc.c
> > @@ -665,19 +665,19 @@ static int bfin_crypto_crc_probe(struct
> > platform_device *pdev) if (timeout == 0)
> >  		dev_info(&pdev->dev, "init crc poly timeout\n");
> > 
> > +	platform_set_drvdata(pdev, crc);
> > +
> >  	spin_lock(&crc_list.lock);
> >  	list_add(&crc->list, &crc_list.dev_list);
> >  	spin_unlock(&crc_list.lock);
> > 
> > -	platform_set_drvdata(pdev, crc);
> > -
> > -	ret = crypto_register_ahash(&algs);
> > -	if (ret) {
> > -		spin_lock(&crc_list.lock);
> > -		list_del(&crc->list);
> > -		spin_unlock(&crc_list.lock);
> > -		dev_err(&pdev->dev, "Cann't register crypto ahash device\n");
> > -		goto out_error_dma;
> > +	if (list_is_singular(&crc_list.dev_list)) {
> > +		ret = crypto_register_ahash(&algs);
> > +		if (ret) {
> > +			dev_err(&pdev->dev,
> > +				"Cann't register crypto ahash device\n");
> 
> "Cann't" with two Ns ;-/
> 
> Well, add "Reviewed-by: Marek Vasut <marex@denx.de>" into the next go please :)

Both patches applied and I've fixed the typo.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-16 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-11  9:30 [PATCH v3 1/2] crypto: bfin_crc: ignore duplicated registration of the same algorithm Sonic Zhang
2014-04-11  9:33 ` Marek Vasut
2014-04-14  4:23   ` Sonic Zhang
2014-04-16 13:49   ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.