Skip to contentSkip to conversation

staging/slicoss: remove not-needed ASSERT

PATCH In review Devendra Naga 3 participants 7 messages Jul 9, 2012 – Jul 11, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 staging/slicoss: remove not-needed ASSERT

As the private pointer is valid at the remove of driver, and remove wont' be called if probe fails, so no point for checking of ASSERT

---
 drivers/staging/slicoss/slicoss.c |    1 -
 1 file changed, 1 deletion(-)
drivers/staging/slicoss/slicoss.c +0 -1
index d2b82a7..a511a2b 100644
@@ -3196,7 +3196,6 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 	struct sliccard *card;
 	struct mcast_address *mcaddr, *mlist;
 
-	ASSERT(adapter);
 	slic_adapter_freeresources(adapter);
 	slic_unmap_mmio_space(adapter);
 	unregister_netdev(dev);
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/3 staging/slicoss: disable pci device at remove

at probe we enabled the device, and we should disable it at remove.

---
 drivers/staging/slicoss/slicoss.c |    1 +
 1 file changed, 1 insertion(+)
drivers/staging/slicoss/slicoss.c +1 -0
index a511a2b..5bd3825 100644
@@ -3234,6 +3234,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 	}
 	free_netdev(dev);
 	pci_release_regions(pcidev);
+	pci_disable_device(pcidev);
 }
 
 static int slic_entry_halt(struct net_device *dev)
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 3/3 staging/slicoss: return -ENODEV if no devid matches

In reply to Devendra Naga

if no case matches we are simply asserting and doing break. and i think we may need to return that -ENODEV , no device is present, rather assert'ing.

---
 drivers/staging/slicoss/slicoss.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/slicoss/slicoss.c +1 -2
index 5bd3825..56829fc 100644
@@ -3746,8 +3746,7 @@ static u32 slic_card_locate(struct adapter *adapter)
 		rdhostid_offset = SLIC_RDHOSTID_1GB;
 		break;
 	default:
-		ASSERT(0);
-		break;
+		return -ENODEV;
 	}
 
 	hostid_reg =
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 2/3] staging/slicoss: disable pci device at remove

In reply to Devendra Naga
Quoted 12 lines · Devendra Naga

at probe we enabled the device, and we should disable it at remove.

---
 drivers/staging/slicoss/slicoss.c |    1 +
 1 file changed, 1 insertion(+)
drivers/staging/slicoss/slicoss.c +0 -0
index a511a2b..5bd3825 100644

drivers/staging/slicoss/slicoss.c static void __devexit slic_entry_remove(struct pci_dev *pcidev) · line 3237

Quoted 4 lines
drivers/staging/slicoss/slicoss.c +1 -0
@@ -3234,6 +3234,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 	}
 	free_netdev(dev);
 	pci_release_regions(pcidev);
+	pci_disable_device(pcidev);

No, you really shouldn't do this, see the many times this has come up on the linux-kernel mailing list for why.

thanks,

greg k-h

#3 lore raw

Re: [PATCH 2/3] staging/slicoss: disable pci device at remove

Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Devendra Naga

at probe we enabled the device, and we should disable it at remove.

---
 drivers/staging/slicoss/slicoss.c |    1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

drivers/staging/slicoss/slicoss.c static void __devexit slic_entry_remove(struct pci_dev *pcidev) · line 3237

Quoted 9 lines
drivers/staging/slicoss/slicoss.c +1 -0
index a511a2b..5bd3825 100644
@@ -3234,6 +3234,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 	}
 	free_netdev(dev);
 	pci_release_regions(pcidev);
+	pci_disable_device(pcidev);

No, you really shouldn't do this, see the many times this has come up on the linux-kernel mailing list for why.

I haven't see this? Why don't you want to disable a device at remove time? Because we put the disable in the generic pci layer?

Eric

#4 lore raw

Re: [PATCH 2/3] staging/slicoss: disable pci device at remove

Quoted 23 lines · Eric W. Biederman
Quoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Devendra Naga

at probe we enabled the device, and we should disable it at remove.

---
 drivers/staging/slicoss/slicoss.c |    1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

drivers/staging/slicoss/slicoss.c static void __devexit slic_entry_remove(struct pci_dev *pcidev) · line 3237

Quoted 9 lines
drivers/staging/slicoss/slicoss.c +1 -0
index a511a2b..5bd3825 100644
@@ -3234,6 +3234,7 @@ static void __devexit slic_entry_remove(struct pci_dev *pcidev)
 	}
 	free_netdev(dev);
 	pci_release_regions(pcidev);
+	pci_disable_device(pcidev);

No, you really shouldn't do this, see the many times this has come up on the linux-kernel mailing list for why.

Quoted 2 lines

I haven't see this? Why don't you want to disable a device at remove time? Because we put the disable in the generic pci layer?

For some reason, I thought we didn't do this because of other "interfaces" on the same card might then be shut down. But I must have been thinking of something else, as lots of drivers do this, so adding it here looks to be correct.

So, sorry Devendra, you were right, care to resend this so I can apply it?

thanks,

greg k-h

#5 lore raw

Re: [PATCH 2/3] staging/slicoss: disable pci device at remove

Quoted 11 lines · Greg Kroah-Hartman
Quoted 2 lines

I haven't see this? Why don't you want to disable a device at remove time? Because we put the disable in the generic pci layer?

For some reason, I thought we didn't do this because of other "interfaces" on the same card might then be shut down. But I must have been thinking of something else, as lots of drivers do this, so adding it here looks to be correct.

So, sorry Devendra, you were right, care to resend this so I can apply it?

Hi Greg,

I will send the patch out in few hrs, with V2 name.

Actually i was referring to the discussion here in this link,

https://lkml.org/lkml/2005/2/13/82

it says about if the request regions fails we do not disable the device, as the other driver may be using the device. since the remove function of the driver is calling, which means that probe succeeded, so i think its fine to call pci_disable_device at driver_remove.

Quoted 3 lines

thanks,

greg k-h

Thanks,
devendra.