From c54b679ddcd91604fd0d144cd793a0ddbd0ae03d Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 6 Mar 2008 17:36:53 -0800 Subject: iwlwifi: queue functions cleanup This patch moves 1. iwl_queue_inc_wrap and int iwl_queue_dec_wrap into iwl-helpers.h these two functions are identical to common for both iwl3956 and iwl4965 2. renames x2_queue_used to iwl3945_x2_queue_used 3. exports iwl3945_queue_space out of iwl3964-base.c Signed-off-by: Tomas Winkler Signed-off-by: Reinette Chatre Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-helpers.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/net/wireless/iwlwifi/iwl-helpers.h') diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h index 8993cca81b4..736b88881b0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-helpers.h +++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h @@ -254,6 +254,26 @@ static inline u8 iwl_get_dma_hi_address(dma_addr_t addr) return sizeof(addr) > sizeof(u32) ? (addr >> 16) >> 16 : 0; } +/** + * iwl_queue_inc_wrap - increment queue index, wrap back to beginning + * @index -- current index + * @n_bd -- total number of entries in queue (must be power of 2) + */ +static inline int iwl_queue_inc_wrap(int index, int n_bd) +{ + return ++index & (n_bd - 1); +} + +/** + * iwl_queue_dec_wrap - decrement queue index, wrap back to end + * @index -- current index + * @n_bd -- total number of entries in queue (must be power of 2) + */ +static inline int iwl_queue_dec_wrap(int index, int n_bd) +{ + return --index & (n_bd - 1); +} + /* TODO: Move fw_desc functions to iwl-pci.ko */ static inline void iwl_free_fw_desc(struct pci_dev *pci_dev, struct fw_desc *desc) -- cgit v1.2.3