rt2x00: Cleanup ring entry handlers
PATCH 23/28 rt2x00: Cleanup ring entry handlers
Cleanup access to the data and descriptor fields inside a ring entry. PCI devices can use the direct pointers instead of the inlined functions. Also move the generic functions for eeprom/descriptor access to rt2x00.h
Signed-off-by Ivo van Doorn <[email protected]>
---
drivers/net/wireless/mac80211/rt2x00/rt2400pci.c +4 -51
@@ -192,53 +192,6 @@ rf_write:rt2x00_register_write (rt2x00dev,RFCSR , reg); } -/* -* EEPROM access. -* The EEPROM is being accessed by word index. -*/ -static void *rt2x00_eeprom_addr (const struct rt2x00_dev *rt2x00dev, -const u8 word) -{ -return (void *)&rt2x00dev->eeprom[word]; -} - -static void rt2x00_eeprom_read (const struct rt2x00_dev *rt2x00dev, -const u8 word,u16 *data) -{ - *data =le16_to_cpu (rt2x00dev->eeprom[word]); -} - -static void rt2x00_eeprom_write (const struct rt2x00_dev *rt2x00dev, -const u8 word,u16 data) -{ - rt2x00dev->eeprom[word] =cpu_to_le16 (data); -} - -/* -* TX/RX Descriptor access functions. -*/ -static inline void *rt2x00_data_addr (struct data_entry *entry) -{ -return entry->data_addr; -} - -static inline struct data_desc *rt2x00_desc_addr (struct data_entry *entry) -{ -return entry->priv; -} - -static inline void rt2x00_desc_read (struct data_desc *desc, -const u8 word,u32 *value) -{ - *value =le32_to_cpu (desc->word[word]); -} - -static inline void rt2x00_desc_write (struct data_desc *desc, -const u8 word,const u32 value) -{ - desc->word[word] =cpu_to_le32 (value); -} -#ifdef CONFIG_RT2X00_DEBUGFS #define CSR_OFFSET (__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) )
@@ -930,7 +883,7 @@ static void rt2400pci_init_rxring(struct rt2x00_dev *rt2x00dev, ring->type = ring_type;for (i =0 ; i < ring->stats.limit; i++) { - rxd =rt2x00_desc_addr (&ring->entry[i]); + rxd = ring->entry[i].priv;rt2x00_desc_read (rxd,2 , &word); rt2x00_set_field32(&word, RXD_W2_BUFFER_LENGTH,
@@ -963,7 +916,7 @@ static void rt2400pci_init_txring(struct rt2x00_dev *rt2x00dev, ring->type = ring_type;for (i =0 ; i < ring->stats.limit; i++) { - txd =rt2x00_desc_addr (&ring->entry[i]); + txd = ring->entry[i].priv;rt2x00_desc_read (txd,1 , &word); rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS,
@@ -1871,8 +1824,8 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw,/* * Update the beacon entry. */ -memcpy (rt2x00_data_addr (entry), skb->data, skb->len); -rt2400pci_write_tx_desc (rt2x00dev,rt2x00_desc_addr (entry), +memcpy (entry->data_addr, skb->data, skb->len); +rt2400pci_write_tx_desc (rt2x00dev, entry->priv, (struct ieee80211_hdr *)skb->data, skb->len, control);return 0 ;
drivers/net/wireless/mac80211/rt2x00/rt2500pci.c +4 -51
79 lines not on this page · raw message
drivers/net/wireless/mac80211/rt2x00/rt2500usb.c +0 -37
@@ -234,43 +234,6 @@ rf_write:rt2x00_register_write (rt2x00dev,PHY_CSR10 , reg); } -/* -* EEPROM access. -* The EEPROM is being accessed by word index. -*/ -static void *rt2x00_eeprom_addr (const struct rt2x00_dev *rt2x00dev, -const u8 word) -{ -return (void *)&rt2x00dev->eeprom[word]; -} - -static void rt2x00_eeprom_read (const struct rt2x00_dev *rt2x00dev, -const u8 word,u16 *data) -{ - *data =le16_to_cpu (rt2x00dev->eeprom[word]); -} - -static void rt2x00_eeprom_write (const struct rt2x00_dev *rt2x00dev, -const u8 word,u16 data) -{ - rt2x00dev->eeprom[word] =cpu_to_le16 (data); -} - -/* -* TX/RX Descriptor access functions. -*/ -static inline void rt2x00_desc_read (struct data_desc *desc, -const u8 word,u32 *value) -{ - *value =le32_to_cpu (desc->word[word]); -} - -static inline void rt2x00_desc_write (struct data_desc *desc, -const u8 word,const u32 value) -{ - desc->word[word] =cpu_to_le32 (value); -} -#ifdef CONFIG_RT2X00_DEBUGFS #define CSR_OFFSET (__word) ( CSR_REG_BASE + ((__word) * sizeof(u16)) )
drivers/net/wireless/mac80211/rt2x00/rt2x00.h +37 -0
@@ -701,6 +701,21 @@ static inline int rt2x00_ring_free(struct data_ring *ring) }/* +* TX/RX Descriptor access functions. +*/ +static inline void rt2x00_desc_read (struct data_desc *desc, +const u8 word,u32 *value) +{ + *value =le32_to_cpu (desc->word[word]); +} + +static inline void rt2x00_desc_write (struct data_desc *desc, +const u8 word,const u32 value) +{ + desc->word[word] =cpu_to_le32 (value); +} + +/* * To optimize the quality of the link we need to store * the quality of received frames and periodically * optimize the link.
@@ -1165,6 +1180,28 @@ static inline struct data_ring* rt2x00_get_ring(return NULL ; } +/* +* EEPROM access. +* The EEPROM is being accessed by word index. +*/ +static inline void *rt2x00_eeprom_addr (const struct rt2x00_dev *rt2x00dev, +const u8 word) +{ +return (void *)&rt2x00dev->eeprom[word]; +} + +static inline void rt2x00_eeprom_read (const struct rt2x00_dev *rt2x00dev, +const u8 word,u16 *data) +{ + *data =le16_to_cpu (rt2x00dev->eeprom[word]); +} + +static inline void rt2x00_eeprom_write (const struct rt2x00_dev *rt2x00dev, +const u8 word,u16 data) +{ + rt2x00dev->eeprom[word] =cpu_to_le16 (data); +} +static inline void rt2x00_update_tx_stats (struct rt2x00_dev *rt2x00dev,struct ieee80211_tx_status *tx_status,const int status,const int is_ack,const int is_rts)
drivers/net/wireless/mac80211/rt2x00/rt61pci.c +4 -51
79 lines not on this page · raw message
drivers/net/wireless/mac80211/rt2x00/rt73usb.c +0 -37
@@ -230,43 +230,6 @@ rf_write:rt2x00_register_write (rt2x00dev,PHY_CSR4 , reg); } -/* -* EEPROM access. -* The EEPROM is being accessed by word index. -*/ -static void *rt2x00_eeprom_addr (const struct rt2x00_dev *rt2x00dev, -const u8 word) -{ -return (void *)&rt2x00dev->eeprom[word]; -} - -static void rt2x00_eeprom_read (const struct rt2x00_dev *rt2x00dev, -const u8 word,u16 *data) -{ - *data =le16_to_cpu (rt2x00dev->eeprom[word]); -} - -static void rt2x00_eeprom_write (const struct rt2x00_dev *rt2x00dev, -const u8 word,u16 data) -{ - rt2x00dev->eeprom[word] =cpu_to_le16 (data); -} - -/* -* TX/RX Descriptor access functions. -*/ -static inline void rt2x00_desc_read (struct data_desc *desc, -const u8 word,u32 *value) -{ - *value =le32_to_cpu (desc->word[word]); -} - -static inline void rt2x00_desc_write (struct data_desc *desc, -const u8 word,const u32 value) -{ - desc->word[word] =cpu_to_le32 (value); -} -#ifdef CONFIG_RT2X00_DEBUGFS #define CSR_OFFSET (__word) ( CSR_REG_BASE + ((__word) * sizeof(u32)) )