All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DWC2: intializes the spin_lock earlier in the probe
@ 2014-05-22 12:10 Jean-Jacques Hiblot
  2014-05-22 18:48 ` Paul Zimmerman
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Jacques Hiblot @ 2014-05-22 12:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-usb, gregkh, paulz, Jean-Jacques Hiblot

The spinlock hsotg->lock is intialized at the end of the probe. However it
may be used from within dwc2_hcd_init(). This patch moves the
initialization before the call to dwc2_hcd_init(). This make the locking
correctness validator happy.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
---
 drivers/usb/dwc2/platform.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 37a8ab0..55fb30d 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -156,6 +156,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
 		params.dma_desc_enable = prop;
 	}
 
+	spin_lock_init(&hsotg->lock);
+
 	if (IS_ENABLED(CONFIG_USB_DWC2_HOST)) {
 		retval = dwc2_hcd_init(hsotg, irq, &params);
 		if (retval)
@@ -175,7 +177,6 @@ static int dwc2_driver_probe(struct platform_device *dev)
 		if (retval)
 			return retval;
 	}
-	spin_lock_init(&hsotg->lock);
 
 	platform_set_drvdata(dev, hsotg);
 	return retval;
-- 
1.9.2


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

* RE: [PATCH] DWC2: intializes the spin_lock earlier in the probe
  2014-05-22 12:10 [PATCH] DWC2: intializes the spin_lock earlier in the probe Jean-Jacques Hiblot
@ 2014-05-22 18:48 ` Paul Zimmerman
  2014-05-23  7:17   ` Jean-Jacques Hiblot
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Zimmerman @ 2014-05-22 18:48 UTC (permalink / raw)
  To: Jean-Jacques Hiblot, linux-kernel; +Cc: linux-usb, gregkh

> From: Jean-Jacques Hiblot [mailto:jjhiblot@traphandler.com]
> Sent: Thursday, May 22, 2014 5:10 AM
> 
> The spinlock hsotg->lock is intialized at the end of the probe. However it
> may be used from within dwc2_hcd_init(). This patch moves the
> initialization before the call to dwc2_hcd_init(). This make the locking
> correctness validator happy.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
> ---
>  drivers/usb/dwc2/platform.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 37a8ab0..55fb30d 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -156,6 +156,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  		params.dma_desc_enable = prop;
>  	}
> 
> +	spin_lock_init(&hsotg->lock);
> +
>  	if (IS_ENABLED(CONFIG_USB_DWC2_HOST)) {
>  		retval = dwc2_hcd_init(hsotg, irq, &params);
>  		if (retval)
> @@ -175,7 +177,6 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  		if (retval)
>  			return retval;
>  	}
> -	spin_lock_init(&hsotg->lock);
> 
>  	platform_set_drvdata(dev, hsotg);
>  	return retval;
> --

Hmm. What tree is this against? platform.c in both Linus' tree and in
Greg's usb-next tree does not have a call to spin_lock_init().

-- 
Paul


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

* Re: [PATCH] DWC2: intializes the spin_lock earlier in the probe
  2014-05-22 18:48 ` Paul Zimmerman
@ 2014-05-23  7:17   ` Jean-Jacques Hiblot
  0 siblings, 0 replies; 3+ messages in thread
From: Jean-Jacques Hiblot @ 2014-05-23  7:17 UTC (permalink / raw)
  To: linux-usb; +Cc: linux-kernel, gregkh

My mistake. It actually comes not from the mainline but from the altera tree.
Sorry for the noise

2014-05-22 20:48 GMT+02:00 Paul Zimmerman <Paul.Zimmerman@synopsys.com>:
>
>> From: Jean-Jacques Hiblot [mailto:jjhiblot@traphandler.com]
>> Sent: Thursday, May 22, 2014 5:10 AM
>>
>> The spinlock hsotg->lock is intialized at the end of the probe. However it
>> may be used from within dwc2_hcd_init(). This patch moves the
>> initialization before the call to dwc2_hcd_init(). This make the locking
>> correctness validator happy.
>>
>> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
>> ---
>>  drivers/usb/dwc2/platform.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
>> index 37a8ab0..55fb30d 100644
>> --- a/drivers/usb/dwc2/platform.c
>> +++ b/drivers/usb/dwc2/platform.c
>> @@ -156,6 +156,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
>>               params.dma_desc_enable = prop;
>>       }
>>
>> +     spin_lock_init(&hsotg->lock);
>> +
>>       if (IS_ENABLED(CONFIG_USB_DWC2_HOST)) {
>>               retval = dwc2_hcd_init(hsotg, irq, &params);
>>               if (retval)
>> @@ -175,7 +177,6 @@ static int dwc2_driver_probe(struct platform_device *dev)
>>               if (retval)
>>                       return retval;
>>       }
>> -     spin_lock_init(&hsotg->lock);
>>
>>       platform_set_drvdata(dev, hsotg);
>>       return retval;
>> --
>
> Hmm. What tree is this against? platform.c in both Linus' tree and in
> Greg's usb-next tree does not have a call to spin_lock_init().
>
> --
> Paul
>

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

end of thread, other threads:[~2014-05-23  7:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-22 12:10 [PATCH] DWC2: intializes the spin_lock earlier in the probe Jean-Jacques Hiblot
2014-05-22 18:48 ` Paul Zimmerman
2014-05-23  7:17   ` Jean-Jacques Hiblot

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.