Skip to contentSkip to conversation

ath10k: kill unnecessary macros

PATCH New Bartosz Markowski 2 participants 7 messages Apr 22, 2013 – Apr 23, 2013 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath10k: kill unnecessary macros

* use iowrite32/ioread32 directly
* fix comment

Bartosz Markowski (3):
ath10k: kill A_PCIE_LOCAL_REG_READ
ath10k: kill A_PCIE_LOCAL_REG_WRITE
ath10k: fix comment to reflect time in mili-seconds

 drivers/net/wireless/ath/ath10k/pci.c |   19 ++++++++-----------
 drivers/net/wireless/ath/ath10k/pci.h |   11 ++---------
 2 files changed, 10 insertions(+), 20 deletions(-)
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/3 ath10k: kill A_PCIE_LOCAL_REG_READ

---
 drivers/net/wireless/ath/ath10k/pci.c |    8 +++-----
 drivers/net/wireless/ath/ath10k/pci.h |    3 ---
 2 files changed, 3 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +3 -5
index e75b36b..6e3f51f 100644
@@ -2125,13 +2125,12 @@ static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
 	}
 
 	/* Put Target, including PCIe, into RESET. */
-	val = A_PCIE_LOCAL_REG_READ(mem, SOC_GLOBAL_RESET_ADDRESS_T(ar));
+	val = ioread32(mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + SOC_GLOBAL_RESET_ADDRESS_T(ar));
 	val |= 1;
 	A_PCIE_LOCAL_REG_WRITE(mem, SOC_GLOBAL_RESET_ADDRESS_T(ar), val);
 
 	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (A_PCIE_LOCAL_REG_READ(mem, RTC_STATE_ADDRESS_T(ar)) &
-					  RTC_STATE_COLD_RESET_MASK_T(ar))
+		if (ioread32(mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + RTC_STATE_ADDRESS_T(ar)) & RTC_STATE_COLD_RESET_MASK_T(ar))
 			break;
 		msleep(1);
 	}
@@ -2141,8 +2140,7 @@ static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
 	A_PCIE_LOCAL_REG_WRITE(mem, SOC_GLOBAL_RESET_ADDRESS_T(ar), val);
 
 	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
-		if (!(A_PCIE_LOCAL_REG_READ(mem, RTC_STATE_ADDRESS_T(ar)) &
-					    RTC_STATE_COLD_RESET_MASK_T(ar)))
+		if (!(ioread32(mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + RTC_STATE_ADDRESS_T(ar)) & RTC_STATE_COLD_RESET_MASK_T(ar)))
 			break;
 		msleep(1);
 	}
drivers/net/wireless/ath/ath10k/pci.h +0 -3
index a3b5e88..fc2fe91 100644
@@ -228,9 +228,6 @@ static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar)
 	return ar->hif.priv;
 }
 
-#define A_PCIE_LOCAL_REG_READ(mem, addr) \
-	ioread32((mem) + PCIE_LOCAL_BASE_ADDRESS_T(ar) + (u32)(addr))
-
 #define A_PCIE_LOCAL_REG_WRITE(mem, addr, val) \
 	iowrite32((val),		       \
 		  ((mem) + PCIE_LOCAL_BASE_ADDRESS_T(ar) + (u32)(addr)))
Signature · 1 line
1.7.10
#2 lore raw

PATCH 1/3 ath10k: kill A_PCIE_LOCAL_REG_READ

Quoted 1 line · Bartosz Markowski

[...]

drivers/net/wireless/ath/ath10k/pci.h static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar) · line 232

Quoted 2 lines
drivers/net/wireless/ath/ath10k/pci.h +0 -2
-#define A_PCIE_LOCAL_REG_READ(mem, addr) \
-	ioread32((mem) + PCIE_LOCAL_BASE_ADDRESS_T(ar) + (u32)(addr))

I think it would be better to convert this to a function and call it ath10k_pci_reg_read32() or something like that. And the same for the write function.

Signature · 1 line
Kalle Valo
#3 lore raw

PATCH 1/3 ath10k: kill A_PCIE_LOCAL_REG_READ

Quoted 11 lines · Kalle Valo
Quoted 1 line · Bartosz Markowski

[...]

drivers/net/wireless/ath/ath10k/pci.h static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar) · line 232

Quoted 2 lines
drivers/net/wireless/ath/ath10k/pci.h +0 -2
-#define A_PCIE_LOCAL_REG_READ(mem, addr) \
-	ioread32((mem) + PCIE_LOCAL_BASE_ADDRESS_T(ar) + (u32)(addr))

I think it would be better to convert this to a function and call it ath10k_pci_reg_read32() or something like that. And the same for the write function.

ok

#4 lore raw

PATCH 2/3 ath10k: kill A_PCIE_LOCAL_REG_WRITE

In reply to Bartosz Markowski
---
 drivers/net/wireless/ath/ath10k/pci.c |   11 +++++------
 drivers/net/wireless/ath/ath10k/pci.h |    4 ----
 2 files changed, 5 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +5 -6
index 6e3f51f..48e4f86 100644
@@ -2116,8 +2116,8 @@ static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
 	if (!mem)
 		return;
 
-	A_PCIE_LOCAL_REG_WRITE(mem, PCIE_SOC_WAKE_ADDRESS_T(ar),
-			       PCIE_SOC_WAKE_V_MASK_T(ar));
+	iowrite32(PCIE_SOC_WAKE_V_MASK_T(ar), mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + PCIE_SOC_WAKE_ADDRESS_T(ar));
+
 	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
 		if (ath10k_pci_target_is_awake(ar))
 			break;
@@ -2127,7 +2127,7 @@ static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
 	/* Put Target, including PCIe, into RESET. */
 	val = ioread32(mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + SOC_GLOBAL_RESET_ADDRESS_T(ar));
 	val |= 1;
-	A_PCIE_LOCAL_REG_WRITE(mem, SOC_GLOBAL_RESET_ADDRESS_T(ar), val);
+	iowrite32(val, mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + SOC_GLOBAL_RESET_ADDRESS_T(ar));
 
 	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
 		if (ioread32(mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + RTC_STATE_ADDRESS_T(ar)) & RTC_STATE_COLD_RESET_MASK_T(ar))
@@ -2137,7 +2137,7 @@ static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
 
 	/* Pull Target, including PCIe, out of RESET. */
 	val &= ~1;
-	A_PCIE_LOCAL_REG_WRITE(mem, SOC_GLOBAL_RESET_ADDRESS_T(ar), val);
+	iowrite32(val, mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + SOC_GLOBAL_RESET_ADDRESS_T(ar));
 
 	for (i = 0; i < ATH_PCI_RESET_WAIT_MAX; i++) {
 		if (!(ioread32(mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + RTC_STATE_ADDRESS_T(ar)) & RTC_STATE_COLD_RESET_MASK_T(ar)))
@@ -2145,8 +2145,7 @@ static void ath10k_pci_device_reset(struct ath10k_pci *ar_pci)
 		msleep(1);
 	}
 
-	A_PCIE_LOCAL_REG_WRITE(mem, PCIE_SOC_WAKE_ADDRESS_T(ar),
-			       PCIE_SOC_WAKE_RESET_T(ar));
+	iowrite32(PCIE_SOC_WAKE_RESET_T(ar), mem + PCIE_LOCAL_BASE_ADDRESS_T(ar) + PCIE_SOC_WAKE_ADDRESS_T(ar));
 }
 
 static void ath10k_pci_dump_features(struct ath10k_pci *ar_pci)
drivers/net/wireless/ath/ath10k/pci.h +0 -4
index fc2fe91..a1a498b 100644
@@ -228,10 +228,6 @@ static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar)
 	return ar->hif.priv;
 }
 
-#define A_PCIE_LOCAL_REG_WRITE(mem, addr, val) \
-	iowrite32((val),		       \
-		  ((mem) + PCIE_LOCAL_BASE_ADDRESS_T(ar) + (u32)(addr)))
-
 #define ATH_PCI_RESET_WAIT_MAX 10 /* Ms */
 #define PCIE_WAKE_TIMEOUT 5000	/* 5Ms */
 
Signature · 1 line
1.7.10
#5 lore raw

PATCH 3/3 ath10k: fix comment to reflect time in mili-seconds

In reply to Bartosz Markowski
---
 drivers/net/wireless/ath/ath10k/pci.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/pci.h +2 -2
index a1a498b..4b0351f 100644
@@ -228,8 +228,8 @@ static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar)
 	return ar->hif.priv;
 }
 
-#define ATH_PCI_RESET_WAIT_MAX 10 /* Ms */
-#define PCIE_WAKE_TIMEOUT 5000	/* 5Ms */
+#define ATH_PCI_RESET_WAIT_MAX 10 /* ms */
+#define PCIE_WAKE_TIMEOUT 5000	/* 5ms */
 
 #define BAR_NUM 0
 
Signature · 1 line
1.7.10
#6 lore raw

cover ath10k: kill unnecessary macros

In reply to Bartosz Markowski
Quoted 7 lines · Bartosz Markowski

* use iowrite32/ioread32 directly
* fix comment

Bartosz Markowski (3):
ath10k: kill A_PCIE_LOCAL_REG_READ
ath10k: kill A_PCIE_LOCAL_REG_WRITE
ath10k: fix comment to reflect time in mili-seconds

Thanks. Patch 1-2 dropped, patch 3 applied.

Signature · 1 line
Kalle Valo