Skip to contentSkip to conversation

wifi: ath12k: remove redundant pci_set_drvdata() call

PATCH New Alexander Minchev 3 participants 6 messages Nov 26, 2025 – Jan 16 Qualcomm ATH12K wireless driver

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

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
index a12c8379cb46..7bf98618ac1e 100644
@@ -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
Reviewed-by on v1 1/1
#2 lore raw
Quoted 7 lines · Alexander Minchev

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

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
---
 drivers/net/wireless/ath/ath12k/pci.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/ath12k/pci.c +0 -0
index a12c8379cb46..7bf98618ac1e 100644

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;
#3 lore raw

PATCH v2 1/1 wifi: ath12k: remove redundant pci_set_drvdata() call

In reply to Alexander Minchev

Hi,

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

#4 lore raw

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
index a12c8379cb46..7bf98618ac1e 100644
@@ -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
Applied
#5 lore raw
Quoted 4 lines · Alexander Minchev

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.

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_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.

[...]

Applied, thanks!

[1/1] wifi: ath12k: remove redundant pci_set_drvdata() call

      commit: 8fb264d1a0c5b3feae5f492ee2bc2997b71b63e3

Best regards,

Signature · 1 line
Jeff Johnson <[email protected]>