wifi: ath12k: remove redundant pci_set_drvdata() call
PATCH 1/1 wifi: ath12k: remove redundant pci_set_drvdata() call
Hi,
this patch removes a redundant pci_set_drvdata() call in ath12k_pci_probe() and keeps a single call after initialization is complete.
I noticed the same double function call in ath11k's pci.c in the same context, but I do not have ath11k compatible hardware to test a similar change there.
Thanks,
Alex
PATCH 1/1 wifi: ath12k: remove redundant pci_set_drvdata() call
pci_set_drvdata() is called twice in ath12k_pci_probe() with the same pointer. Remove the earlier call so drvdata is set after ath12k_base and ath12k_pci initialization is complete.
Having two calls might suggest that drvdata needs to be set early for some reason, even though it is not used until after the 'ab' struct ath12k_base is fully populated. even though exact placement is not critical, keeping a single pci_set_drvdata() at the end of the initialization makes it clearer that drvdata points to a fully initialized structure and avoids confusion for future changes.
Tested on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3
--- drivers/net/wireless/ath/ath12k/pci.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/ath12k/pci.c +0 -1
@@ -1580,7 +1580,6 @@ static int ath12k_pci_probe(struct pci_dev *pdev, } ab->dev = &pdev->dev; -pci_set_drvdata (pdev, ab); ab_pci =ath12k_pci_priv (ab); ab_pci->dev_id = pci_dev->device; ab_pci->ab = ab;
Signature · 1 line
2.52.0
Quoted 7 lines · Alexander Minchev
pci_set_drvdata()is called twice inath12k_pci_probe()with the same pointer. Remove the earlier call so drvdata is set afterath12k_baseandath12k_pciinitialization is complete.Having two calls might suggest that drvdata needs to be set early for some reason, even though it is not used until after the 'ab' struct
ath12k_baseis fully populated. even though exact placement is
nit: s/even/Even/
Quoted 4 lines
not critical, keeping a single
pci_set_drvdata()at the end of the initialization makes it clearer that drvdata points to a fully initialized structure and avoids confusion for future changes.
==>
Quoted 2 lines
Tested on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3
<==
nit: this has to be on the same line
Quoted 11 lines
Signed-off-by Alexander Minchev <[email protected]>--- drivers/net/wireless/ath/ath12k/pci.c | 1 - 1 file changed, 1 deletion(-)drivers/net/wireless/ath/ath12k/pci.c +0
-0
drivers/net/wireless/ath/ath12k/pci.c static int ath12k_pci_probe(struct pci_dev *pdev, · line 1585
Quoted 7 lines
drivers/net/wireless/ath/ath12k/pci.c +0
-1@@ -1580,7 +1580,6 @@ static int ath12k_pci_probe(struct pci_dev *pdev, } ab->dev = &pdev->dev; -pci_set_drvdata (pdev, ab); ab_pci =ath12k_pci_priv (ab); ab_pci->dev_id = pci_dev->device; ab_pci->ab = ab;
PATCH v2 1/1 wifi: ath12k: remove redundant pci_set_drvdata() call
In reply to Alexander MinchevHi,
thank you for the prompt review, I appreciate it. The issues are addressed in this v2. Please let me know if anything else needs to be changed.
Thanks,
Alex
PATCH v2 1/1 wifi: ath12k: remove redundant pci_set_drvdata() call
pci_set_drvdata() is called twice in ath12k_pci_probe() with the same pointer. Remove the earlier call so drvdata is set after ath12k_base and ath12k_pci initialization is complete.
Having two calls might suggest that drvdata needs to be set early for some reason, even though it is not used until after the 'ab' struct ath12k_base is fully populated. Even though exact placement is not critical, keeping a single pci_set_drvdata() at the end of the initialization makes it clearer that drvdata points to a fully initialized structure and avoids confusion for future changes.
Tested on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00302-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.115823.3
--- drivers/net/wireless/ath/ath12k/pci.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/ath12k/pci.c +0 -1
@@ -1580,7 +1580,6 @@ static int ath12k_pci_probe(struct pci_dev *pdev, } ab->dev = &pdev->dev; -pci_set_drvdata (pdev, ab); ab_pci =ath12k_pci_priv (ab); ab_pci->dev_id = pci_dev->device; ab_pci->ab = ab;
Signature · 1 line
2.52.0
Jeff Johnson
AppliedQuoted 4 lines · Alexander Minchev
pci_set_drvdata()is called twice inath12k_pci_probe()with the same pointer. Remove the earlier call so drvdata is set afterath12k_baseandath12k_pciinitialization is complete.
Quoted 8 lines
Having two calls might suggest that drvdata needs to be set early for some reason, even though it is not used until after the 'ab' struct
ath12k_baseis fully populated. Even though exact placement is not critical, keeping a singlepci_set_drvdata()at the end of the initialization makes it clearer that drvdata points to a fully initialized structure and avoids confusion for future changes.[...]
Applied, thanks!
[1/1] wifi: ath12k: remove redundant pci_set_drvdata() call
commit: 8fb264d1a0c5b3feae5f492ee2bc2997b71b63e3
Best regards,
Signature · 1 line
Jeff Johnson <[email protected]>