ath9k: use common read/write ops on pci and debug code
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Thu, 24 Sep 2009 03:06:59 +0000 (23:06 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 Oct 2009 20:39:41 +0000 (16:39 -0400)
PCI and debug code will not be shared between ath9k and
ath9k_htc, so make that code use the common read/write ops.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/debug.c
drivers/net/wireless/ath/ath9k/pci.c

index 5dfc0e97d96d9f9967b5996df8fdb43f8087c926..352914cae6d8b4611ac4db5a8652d41be0d93ed8 100644 (file)
 
 #include "ath9k.h"
 
 
 #include "ath9k.h"
 
+#define REG_WRITE_D(_ah, _reg, _val) \
+       ath9k_hw_common(_ah)->ops->write((_ah), (_val), (_reg))
+#define REG_READ_D(_ah, _reg) \
+       ath9k_hw_common(_ah)->ops->read((_ah), (_reg))
+
 static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
 module_param_named(debug, ath9k_debug, uint, 0);
 
 static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
 module_param_named(debug, ath9k_debug, uint, 0);
 
@@ -82,7 +87,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
 
        ath9k_ps_wakeup(sc);
 
 
        ath9k_ps_wakeup(sc);
 
-       REG_WRITE(ah, AR_MACMISC,
+       REG_WRITE_D(ah, AR_MACMISC,
                  ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
                   (AR_MACMISC_MISC_OBS_BUS_1 <<
                    AR_MACMISC_MISC_OBS_BUS_MSB_S)));
                  ((AR_MACMISC_DMA_OBS_LINE_8 << AR_MACMISC_DMA_OBS_S) |
                   (AR_MACMISC_MISC_OBS_BUS_1 <<
                    AR_MACMISC_MISC_OBS_BUS_MSB_S)));
@@ -94,7 +99,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
                if (i % 4 == 0)
                        len += snprintf(buf + len, sizeof(buf) - len, "\n");
 
                if (i % 4 == 0)
                        len += snprintf(buf + len, sizeof(buf) - len, "\n");
 
-               val[i] = REG_READ(ah, AR_DMADBG_0 + (i * sizeof(u32)));
+               val[i] = REG_READ_D(ah, AR_DMADBG_0 + (i * sizeof(u32)));
                len += snprintf(buf + len, sizeof(buf) - len, "%d: %08x ",
                                i, val[i]);
        }
                len += snprintf(buf + len, sizeof(buf) - len, "%d: %08x ",
                                i, val[i]);
        }
@@ -144,9 +149,9 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
                (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17);
 
        len += snprintf(buf + len, sizeof(buf) - len, "pcu observe: 0x%x \n",
                (val[6] & 0x0001e000) >> 13, (val[6] & 0x001e0000) >> 17);
 
        len += snprintf(buf + len, sizeof(buf) - len, "pcu observe: 0x%x \n",
-                       REG_READ(ah, AR_OBS_BUS_1));
+                       REG_READ_D(ah, AR_OBS_BUS_1));
        len += snprintf(buf + len, sizeof(buf) - len,
        len += snprintf(buf + len, sizeof(buf) - len,
-                       "AR_CR: 0x%x \n", REG_READ(ah, AR_CR));
+                       "AR_CR: 0x%x \n", REG_READ_D(ah, AR_CR));
 
        ath9k_ps_restore(sc);
 
 
        ath9k_ps_restore(sc);
 
@@ -363,12 +368,12 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
                                aphy->chan_idx, aphy->chan_is_ht);
        }
 
                                aphy->chan_idx, aphy->chan_is_ht);
        }
 
-       put_unaligned_le32(REG_READ(sc->sc_ah, AR_STA_ID0), addr);
-       put_unaligned_le16(REG_READ(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4);
+       put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr);
+       put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4);
        len += snprintf(buf + len, sizeof(buf) - len,
                        "addr: %pM\n", addr);
        len += snprintf(buf + len, sizeof(buf) - len,
                        "addr: %pM\n", addr);
-       put_unaligned_le32(REG_READ(sc->sc_ah, AR_BSSMSKL), addr);
-       put_unaligned_le16(REG_READ(sc->sc_ah, AR_BSSMSKU) & 0xffff, addr + 4);
+       put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_BSSMSKL), addr);
+       put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_BSSMSKU) & 0xffff, addr + 4);
        len += snprintf(buf + len, sizeof(buf) - len,
                        "addrmask: %pM\n", addr);
 
        len += snprintf(buf + len, sizeof(buf) - len,
                        "addrmask: %pM\n", addr);
 
index a1001ffdd389d7f8dc37d51550608b5eb8060939..b2a45ce626980794bca79de0817c7182f5cb75f6 100644 (file)
@@ -65,7 +65,7 @@ static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
 {
        struct ath_hw *ah = (struct ath_hw *) common->ah;
 
 {
        struct ath_hw *ah = (struct ath_hw *) common->ah;
 
-       (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
+       common->ops->read(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
 
        if (!ath9k_hw_wait(ah,
                           AR_EEPROM_STATUS_DATA,
 
        if (!ath9k_hw_wait(ah,
                           AR_EEPROM_STATUS_DATA,
@@ -75,7 +75,7 @@ static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
                return false;
        }
 
                return false;
        }
 
-       *data = MS(REG_READ(ah, AR_EEPROM_STATUS_DATA),
+       *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
                   AR_EEPROM_STATUS_DATA_VAL);
 
        return true;
                   AR_EEPROM_STATUS_DATA_VAL);
 
        return true;