Skip to contentSkip to conversation

remove unnecessary pci_set_drvdata()

PATCH In review Jingoo Han 3 participants 24 messages Sep 23, 2013 – Sep 24, 2013

Subsystems (12)
lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

cover remove unnecessary pci_set_drvdata()

Since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound), the driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/arcmsr/arcmsr_hba.c          |    1 -
 drivers/scsi/atp870u.c                    |    2 --
 drivers/scsi/bfa/bfad.c                   |    1 -
 drivers/scsi/csiostor/csio_init.c         |    2 --
 drivers/scsi/dc395x.c                     |    1 -
 drivers/scsi/fnic/fnic_main.c             |    1 -
 drivers/scsi/gdth.c                       |    2 --
 drivers/scsi/hpsa.c                       |    1 -
 drivers/scsi/lpfc/lpfc_init.c             |    3 ---
 drivers/scsi/megaraid/megaraid_mbox.c     |    6 ------
 drivers/scsi/megaraid/megaraid_sas_base.c |    5 -----
 drivers/scsi/mvsas/mv_init.c              |    1 -
 drivers/scsi/mvumi.c                      |    2 --
 drivers/scsi/pm8001/pm8001_init.c         |    1 -
 drivers/scsi/pmcraid.c                    |    1 -
 drivers/scsi/qla2xxx/qla_os.c             |    1 -
 drivers/scsi/qla4xxx/ql4_os.c             |    1 -
 drivers/scsi/stex.c                       |    2 --
 drivers/scsi/tmscsim.c                    |    1 -
 drivers/scsi/ufs/ufshcd-pci.c             |    1 -
 drivers/scsi/vmw_pvscsi.c                 |    2 --
 21 files changed, 38 deletions(-)
author
#1 lore raw

PATCH 1/20 lpfc 8.3.42: remove unnecessary pci_set_drvdata()

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/lpfc/lpfc_init.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +0 -3
index 647f5bf..3dfd38c 100644
@@ -4581,8 +4581,6 @@ lpfc_disable_pci_dev(struct lpfc_hba *phba)
 	/* Release PCI resource and disable PCI device */
 	pci_release_selected_regions(pdev, bars);
 	pci_disable_device(pdev);
-	/* Null out PCI private reference to driver */
-	pci_set_drvdata(pdev, NULL);
 
 	return;
 }
@@ -9429,7 +9427,6 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev)
 	/* Disable interrupt */
 	lpfc_sli_disable_intr(phba);
 
-	pci_set_drvdata(pdev, NULL);
 	scsi_host_put(shost);
 
 	/*
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH 2/20 arcmsr: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/arcmsr/arcmsr_hba.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/arcmsr/arcmsr_hba.c +0 -1
index 33c52bc..97fd450 100644
@@ -1035,7 +1035,6 @@ static void arcmsr_remove(struct pci_dev *pdev)
 	pci_release_regions(pdev);
 	scsi_host_put(host);
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 }
 
 static void arcmsr_shutdown(struct pci_dev *pdev)
Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH 3/20 atp870u: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/atp870u.c |    2 --
 1 file changed, 2 deletions(-)
drivers/scsi/atp870u.c +0 -2
index 15a629d..a795d81 100644
@@ -3144,8 +3144,6 @@ static void atp870u_remove (struct pci_dev *pdev)
 	atp870u_free_tables(pshost);
 	printk(KERN_INFO "scsi_host_put : %p\n",pshost);
 	scsi_host_put(pshost);
-	printk(KERN_INFO "pci_set_drvdata : %p\n",pdev);
-	pci_set_drvdata(pdev, NULL);	
 }
 MODULE_LICENSE("GPL");
 
Signature · 1 line
1.7.10.4
author
#4 lore raw

PATCH 4/20 bfa: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/bfa/bfad.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/bfa/bfad.c +0 -1
index f8ca7be..2e6e3ac 100644
@@ -833,7 +833,6 @@ bfad_pci_uninit(struct pci_dev *pdev, struct bfad_s *bfad)
 	/* Disable PCIE Advanced Error Recovery (AER) */
 	pci_disable_pcie_error_reporting(pdev);
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 }
 
 bfa_status_t
Signature · 1 line
1.7.10.4
author
#5 lore raw

PATCH 5/20 csiostor: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/csiostor/csio_init.c |    2 --
 1 file changed, 2 deletions(-)
drivers/scsi/csiostor/csio_init.c +0 -2
index 00346fe..1aafc33 100644
@@ -1010,7 +1010,6 @@ err_lnode_exit:
 	csio_hw_stop(hw);
 	spin_unlock_irq(&hw->lock);
 	csio_lnodes_unblock_request(hw);
-	pci_set_drvdata(hw->pdev, NULL);
 	csio_lnodes_exit(hw, 0);
 	csio_hw_free(hw);
 err_pci_exit:
@@ -1044,7 +1043,6 @@ static void csio_remove_one(struct pci_dev *pdev)
 
 	csio_lnodes_exit(hw, 0);
 	csio_hw_free(hw);
-	pci_set_drvdata(pdev, NULL);
 	csio_pci_exit(pdev, &bars);
 }
 
Signature · 1 line
1.7.10.4
author
#6 lore raw

PATCH 6/20 fnic: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/fnic/fnic_main.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/fnic/fnic_main.c +0 -1
index bbf81ea..889b594 100644
@@ -996,7 +996,6 @@ static void fnic_remove(struct pci_dev *pdev)
 	fnic_iounmap(fnic);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 	scsi_host_put(lp->host);
 }
 
Signature · 1 line
1.7.10.4
author
#7 lore raw

PATCH 7/20 gdth: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/gdth.c |    2 --
 1 file changed, 2 deletions(-)
drivers/scsi/gdth.c +0 -2
index 6d55b4e..ee4fa40 100644
@@ -594,8 +594,6 @@ static void gdth_pci_remove_one(struct pci_dev *pdev)
 {
 	gdth_ha_str *ha = pci_get_drvdata(pdev);
 
-	pci_set_drvdata(pdev, NULL);
-
 	list_del(&ha->list);
 	gdth_remove_one(ha);
 
Signature · 1 line
1.7.10.4
author
#8 lore raw

PATCH 8/20 hpsa: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/hpsa.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/hpsa.c +0 -1
index 891c86b..df72d4a 100644
@@ -5018,7 +5018,6 @@ static void hpsa_remove_one(struct pci_dev *pdev)
 	kfree(h->hba_inquiry_data);
 	pci_disable_device(pdev);
 	pci_release_regions(pdev);
-	pci_set_drvdata(pdev, NULL);
 	kfree(h);
 }
 
Signature · 1 line
1.7.10.4
author
#9 lore raw

PATCH 9/20 megaraid: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/megaraid/megaraid_mbox.c     |    6 ------
 drivers/scsi/megaraid/megaraid_sas_base.c |    5 -----
 2 files changed, 11 deletions(-)
drivers/scsi/megaraid/megaraid_mbox.c +0 -6
index 515c962..d1a4b82 100644
@@ -534,7 +534,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	return 0;
 
 out_cmm_unreg:
-	pci_set_drvdata(pdev, NULL);
 	megaraid_cmm_unregister(adapter);
 out_fini_mbox:
 	megaraid_fini_mbox(adapter);
@@ -594,11 +593,6 @@ megaraid_detach_one(struct pci_dev *pdev)
 	// detach from the IO sub-system
 	megaraid_io_detach(adapter);
 
-	// reset the device state in the PCI structure. We check this
-	// condition when we enter here. If the device state is NULL,
-	// that would mean the device has already been removed
-	pci_set_drvdata(pdev, NULL);
-
 	// Unregister from common management module
 	//
 	// FIXME: this must return success or failure for conditions if there
drivers/scsi/megaraid/megaraid_sas_base.c +0 -5
index 3020921..a6efc1e 100644
@@ -4449,7 +4449,6 @@ retry_irq_register:
 	megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
 	megasas_mgmt_info.max_index--;
 
-	pci_set_drvdata(pdev, NULL);
 	instance->instancet->disable_intr(instance);
 	if (instance->msix_vectors)
 		for (i = 0 ; i < instance->msix_vectors; i++)
@@ -4805,8 +4804,6 @@ static void megasas_detach_one(struct pci_dev *pdev)
 		}
 	}
 
-	pci_set_drvdata(instance->pdev, NULL);
-
 	instance->instancet->disable_intr(instance);
 
 	if (instance->msix_vectors)
@@ -4848,8 +4845,6 @@ static void megasas_detach_one(struct pci_dev *pdev)
 				instance->evt_detail, instance->evt_detail_h);
 	scsi_host_put(host);
 
-	pci_set_drvdata(pdev, NULL);
-
 	pci_disable_device(pdev);
 
 	return;
Signature · 1 line
1.7.10.4
author
#10 lore raw

PATCH 10/20 mvumi: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/mvumi.c |    2 --
 1 file changed, 2 deletions(-)
drivers/scsi/mvumi.c +0 -2
index d0b6a03..3206ba3 100644
@@ -2583,7 +2583,6 @@ static int mvumi_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	return 0;
 
 fail_io_attach:
-	pci_set_drvdata(pdev, NULL);
 	mhba->instancet->disable_intr(mhba);
 	free_irq(mhba->pdev->irq, mhba);
 fail_init_irq:
@@ -2618,7 +2617,6 @@ static void mvumi_detach_one(struct pci_dev *pdev)
 	free_irq(mhba->pdev->irq, mhba);
 	mvumi_release_fw(mhba);
 	scsi_host_put(host);
-	pci_set_drvdata(pdev, NULL);
 	pci_disable_device(pdev);
 	dev_dbg(&pdev->dev, "driver is removed!\n");
 }
Signature · 1 line
1.7.10.4
author
#11 lore raw

PATCH 11/20 mvsas: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/mvsas/mv_init.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/mvsas/mv_init.c +0 -1
index 7b7381d..5ff978b 100644
@@ -657,7 +657,6 @@ static void mvs_pci_remove(struct pci_dev *pdev)
 	tasklet_kill(&((struct mvs_prv_info *)sha->lldd_ha)->mv_tasklet);
 #endif
 
-	pci_set_drvdata(pdev, NULL);
 	sas_unregister_ha(sha);
 	sas_remove_host(mvi->shost);
 	scsi_remove_host(mvi->shost);
Signature · 1 line
1.7.10.4
author
#12 lore raw

PATCH 12/20 pm80xx: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/pm8001/pm8001_init.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/pm8001/pm8001_init.c +0 -1
index f7c1896..0dba7c7 100644
@@ -873,7 +873,6 @@ static void pm8001_pci_remove(struct pci_dev *pdev)
 	struct pm8001_hba_info *pm8001_ha;
 	int i;
 	pm8001_ha = sha->lldd_ha;
-	pci_set_drvdata(pdev, NULL);
 	sas_unregister_ha(sha);
 	sas_remove_host(pm8001_ha->shost);
 	list_del(&pm8001_ha->list);
Signature · 1 line
1.7.10.4
author
#13 lore raw

PATCH 13/20 pmcraid: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/pmcraid.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/pmcraid.c +0 -1
index 1eb7b028..e43db77 100644
@@ -6049,7 +6049,6 @@ out_release_regions:
 
 out_disable_device:
 	atomic_dec(&pmcraid_adapter_count);
-	pci_set_drvdata(pdev, NULL);
 	pci_disable_device(pdev);
 	return -ENODEV;
 }
Signature · 1 line
1.7.10.4
author
#14 lore raw

PATCH 14/20 qla2xxx: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/qla2xxx/qla_os.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_os.c +0 -1
index 9f01bbb..1db4819 100644
@@ -3183,7 +3183,6 @@ qla2x00_remove_one(struct pci_dev *pdev)
 	pci_disable_pcie_error_reporting(pdev);
 
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 }
 
 static void
Signature · 1 line
1.7.10.4
author
#15 lore raw

PATCH 15/20 qla4xxx: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/qla4xxx/ql4_os.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/qla4xxx/ql4_os.c +0 -1
index f8a0a26..1be6cef 100644
@@ -7400,7 +7400,6 @@ static void qla4xxx_remove_adapter(struct pci_dev *pdev)
 
 	pci_disable_pcie_error_reporting(pdev);
 	pci_disable_device(pdev);
-	pci_set_drvdata(pdev, NULL);
 }
 
 /**
Signature · 1 line
1.7.10.4
author
#16 lore raw

PATCH 16/20 stex: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/stex.c |    2 --
 1 file changed, 2 deletions(-)
drivers/scsi/stex.c +0 -2
index 325c31c..1aa4bef 100644
@@ -1790,8 +1790,6 @@ static void stex_remove(struct pci_dev *pdev)
 
 	scsi_remove_host(hba->host);
 
-	pci_set_drvdata(pdev, NULL);
-
 	stex_hba_stop(hba);
 
 	stex_hba_free(hba);
Signature · 1 line
1.7.10.4
author
#17 lore raw

PATCH 17/20 ufs: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/ufs/ufshcd-pci.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/ufs/ufshcd-pci.c +0 -1
index a823cf4..8b95312 100644
@@ -132,7 +132,6 @@ static void ufshcd_pci_remove(struct pci_dev *pdev)
 	pm_runtime_forbid(&pdev->dev);
 	pm_runtime_get_noresume(&pdev->dev);
 	ufshcd_remove(hba);
-	pci_set_drvdata(pdev, NULL);
 }
 
 /**
Signature · 1 line
1.7.10.4
author
#18 lore raw

PATCH 18/20 vmw_pvscsi: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/vmw_pvscsi.c |    2 --
 1 file changed, 2 deletions(-)
drivers/scsi/vmw_pvscsi.c +0 -2
index 3bfaa66..b9755ec 100644
@@ -1405,7 +1405,6 @@ out_release_resources:
 out_free_host:
 	scsi_host_put(host);
 out_disable_device:
-	pci_set_drvdata(pdev, NULL);
 	pci_disable_device(pdev);
 
 	return error;
@@ -1445,7 +1444,6 @@ static void pvscsi_remove(struct pci_dev *pdev)
 
 	scsi_host_put(host);
 
-	pci_set_drvdata(pdev, NULL);
 	pci_disable_device(pdev);
 }
 
Signature · 1 line
1.7.10.4
author
#19 lore raw

PATCH 19/20 dc395x: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/dc395x.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/dc395x.c +0 -1
index e73445b..61c7cb7 100644
@@ -4859,7 +4859,6 @@ static void dc395x_remove_one(struct pci_dev *dev)
 	adapter_uninit(acb);
 	pci_disable_device(dev);
 	scsi_host_put(scsi_host);
-	pci_set_drvdata(dev, NULL);
 }
 
 
Signature · 1 line
1.7.10.4
author
#20 lore raw

PATCH 20/20 tmscsim: remove unnecessary pci_set_drvdata()

In reply to Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

---
 drivers/scsi/tmscsim.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/tmscsim.c +0 -1
index 9327f5f..b06a1de 100644
@@ -2553,7 +2553,6 @@ static void dc390_remove_one(struct pci_dev *dev)
 
 	pci_disable_device(dev);
 	scsi_host_put(scsi_host);
-	pci_set_drvdata(dev, NULL);
 }
 
 static struct pci_device_id tmscsim_pci_tbl[] = {
Signature · 1 line
1.7.10.4
Acked-by on v1 20/20
#21 lore raw

Re: [PATCH 20/20] [SCSI] tmscsim: remove unnecessary pci_set_drvdata()

Quoted 5 lines · Jingoo Han

The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

Thanks
Guennadi

Quoted 20 lines
---
 drivers/scsi/tmscsim.c |    1 -
 1 file changed, 1 deletion(-)
drivers/scsi/tmscsim.c +0 -1
index 9327f5f..b06a1de 100644
@@ -2553,7 +2553,6 @@ static void dc390_remove_one(struct pci_dev *dev)
 
 	pci_disable_device(dev);
 	scsi_host_put(scsi_host);
-	pci_set_drvdata(dev, NULL);
 }
 
 static struct pci_device_id tmscsim_pci_tbl[] = {
Signature · 1 line
1.7.10.4

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

maintainer
#22 lore raw
In reply to Jingoo Han
Quoted 5 lines · Jingoo Han

Since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound), the driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

Look, these are particularly pointless patches. The null setting is only on teardown; the fact that we set something to NULL that should already be null doesn't matter at all the extra cycles simply won't be noticed. Please roll them into a single patch and send them to Jiří Kosina and the trivial tree (cc'd) he'll take care of checking and applying them (assuming they meet his criteria for worth bothering with).

Thanks,

James

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#23 lore raw
Quoted 7 lines · James Bottomley
Quoted 5 lines · Jingoo Han

Since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound), the driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL.

Quoted 8 lines

Look, these are particularly pointless patches. The null setting is only on teardown; the fact that we set something to NULL that should already be null doesn't matter at all the extra cycles simply won't be noticed. Please roll them into a single patch and send them to Jiří Kosina and the trivial tree (cc'd) he'll take care of checking and applying them (assuming they meet his criteria for worth bothering with).

OK, I see.
I squashed all 20 patches into a single patch, and sent the single patch to Jiri Kosina and the trivial tree, as you mentioned.
Thank you for your guidance.

Best regards,
Jingoo Han

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html