All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ibmvnic: Bail from ibmvnic_open if driver is already open
@ 2018-03-12 18:47 John Allen
  2018-03-12 19:01 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: John Allen @ 2018-03-12 18:47 UTC (permalink / raw)
  To: netdev; +Cc: Thomas Falcon, Nathan Fontenot

If the driver is already in the "open" state, don't attempt the procedure
for opening the driver.

Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
---
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 7be4b06..98c4f75 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1057,6 +1057,9 @@ static int ibmvnic_open(struct net_device *netdev)

 	mutex_lock(&adapter->reset_lock);

+	if (adapter->state == VNIC_OPEN)
+		return 0;
+
 	if (adapter->state != VNIC_CLOSED) {
 		rc = ibmvnic_login(netdev);
 		if (rc) {

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

* Re: [PATCH net-next] ibmvnic: Bail from ibmvnic_open if driver is already open
  2018-03-12 18:47 [PATCH net-next] ibmvnic: Bail from ibmvnic_open if driver is already open John Allen
@ 2018-03-12 19:01 ` Andrew Lunn
  2018-03-12 19:06   ` John Allen
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2018-03-12 19:01 UTC (permalink / raw)
  To: John Allen; +Cc: netdev, Thomas Falcon, Nathan Fontenot

On Mon, Mar 12, 2018 at 01:47:51PM -0500, John Allen wrote:
> If the driver is already in the "open" state, don't attempt the procedure
> for opening the driver.
> 
> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
> ---
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 7be4b06..98c4f75 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -1057,6 +1057,9 @@ static int ibmvnic_open(struct net_device *netdev)
> 
>  	mutex_lock(&adapter->reset_lock);
> 
> +	if (adapter->state == VNIC_OPEN)
> +		return 0;
> +

I've not looked at the actual code, but what about the lock it just
took and does not unlock before returning?

	Andrew

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

* Re: [PATCH net-next] ibmvnic: Bail from ibmvnic_open if driver is already open
  2018-03-12 19:01 ` Andrew Lunn
@ 2018-03-12 19:06   ` John Allen
  0 siblings, 0 replies; 3+ messages in thread
From: John Allen @ 2018-03-12 19:06 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev, Thomas Falcon, Nathan Fontenot

On 03/12/2018 02:01 PM, Andrew Lunn wrote:
> On Mon, Mar 12, 2018 at 01:47:51PM -0500, John Allen wrote:
>> If the driver is already in the "open" state, don't attempt the procedure
>> for opening the driver.
>>
>> Signed-off-by: John Allen <jallen@linux.vnet.ibm.com>
>> ---
>> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
>> index 7be4b06..98c4f75 100644
>> --- a/drivers/net/ethernet/ibm/ibmvnic.c
>> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
>> @@ -1057,6 +1057,9 @@ static int ibmvnic_open(struct net_device *netdev)
>>
>>  	mutex_lock(&adapter->reset_lock);
>>
>> +	if (adapter->state == VNIC_OPEN)
>> +		return 0;
>> +
> 
> I've not looked at the actual code, but what about the lock it just
> took and does not unlock before returning?
Ah yes, I missed that. I will update and send a new version.

> 
> 	Andrew
> 

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

end of thread, other threads:[~2018-03-12 19:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-12 18:47 [PATCH net-next] ibmvnic: Bail from ibmvnic_open if driver is already open John Allen
2018-03-12 19:01 ` Andrew Lunn
2018-03-12 19:06   ` John Allen

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.