From: Jim C. <jim...@gm...> - 2012-05-15 07:51:49
|
With this patch, USB-only compiles cleanly. In effect, it adds stub functions (static inlines) for every function that compiler complained about. It does so via a new macro: decl_or_stub(proto, stubret), which may be too-clever-by-half (or not clever enough). The macro expands either as a prototype, or with a "static inline" prefix and an "empty" body. The main shortcoming with the new macro is that it must be redefined for each conditional combination desired (only 1 is needed here), because macros cannot contain #if constructs. There may be a high-fu way to do this better, please suggest it if you know how. Despite its weakness, it works, and eliminates a large repetetive block of fn-protos, so keep it. Signed-off-by: Jim Cromie <jim...@gm...> --- merge.h | 171 +++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 121 insertions(+), 50 deletions(-) diff --git a/merge.h b/merge.h index 8e529b0..34a39af 100644 --- a/merge.h +++ b/merge.h @@ -27,74 +27,148 @@ static void __exit acx_debugfs_exit(void) { } #endif /* defined CONFIG_DEBUG_FS */ #if defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM +#define decl_or_stub(proto, stubret) proto; +#else +#define decl_or_stub(proto, stubret) static inline proto stubret +#endif -#include <linux/interrupt.h> +decl_or_stub( + void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, + u32 rx_queue_start), + { } ) -irqreturn_t acx_interrupt(int irq, void *dev_id); +decl_or_stub( + int acx_create_hostdesc_queues(acx_device_t *adev), + { return 0; } ) -void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start); +decl_or_stub( + void acx_free_desc_queues(acx_device_t *adev), + { } ) -int acx_create_hostdesc_queues(acx_device_t *adev); -void acx_free_desc_queues(acx_device_t *adev); +decl_or_stub( + int _acx_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf), + { return 0; } ) -void acx_log_rxbuffer(const acx_device_t *adev); -void acx_log_txbuffer(acx_device_t *adev); +decl_or_stub( + int _acx_write_phy_reg(acx_device_t *adev, u32 reg, u8 value), + { return 0; } ) -void acx_op_stop(struct ieee80211_hw *hw); -int acx_op_start(struct ieee80211_hw *hw); +decl_or_stub( + void acx_irq_enable(acx_device_t *adev), + { } ) -void acx_handle_info_irq(acx_device_t *adev); +decl_or_stub( + void acx_irq_disable(acx_device_t *adev), + { } ) +decl_or_stub( + int acx_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf), + { return 0; } ) -int _acx_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf); -int _acx_write_phy_reg(acx_device_t *adev, u32 reg, u8 value); +decl_or_stub( + char *acx_proc_eeprom_output(int *length, acx_device_t *adev), + { return (char*) NULL; } ) -void acx_irq_enable(acx_device_t *adev); -void acx_irq_disable(acx_device_t *adev); +decl_or_stub( + void acx_up(struct ieee80211_hw *hw), + { } ) -int acx_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf); -char *acx_proc_eeprom_output(int *length, acx_device_t *adev); +decl_or_stub( + void acx_set_interrupt_mask(acx_device_t *adev), + { } ) -void acx_up(struct ieee80211_hw *hw); +decl_or_stub( + void acx_show_card_eeprom_id(acx_device_t *adev), + { } ) -void acx_set_interrupt_mask(acx_device_t *adev); +decl_or_stub( + unsigned int acx_tx_clean_txdesc(acx_device_t *adev), + { return 0; } ) -void acx_show_card_eeprom_id(acx_device_t *adev); +decl_or_stub( + int acx_reset_dev(acx_device_t *adev), + { return 0; } ) -unsigned int acx_tx_clean_txdesc(acx_device_t *adev); +/* wrappers on acx_upload_radio(adev, filename */ +decl_or_stub( + int acxmem_upload_radio(acx_device_t *adev), + { return 0; } ) -void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, - struct ieee80211_tx_info *info, struct sk_buff *skb); +decl_or_stub( + int acxpci_upload_radio(acx_device_t *adev), + { return 0; } ) -void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque); -void acx_process_rxdesc(acx_device_t *adev); +decl_or_stub( + void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue), + { } ) -void acx_delete_dma_regions(acx_device_t *adev); -int acx_reset_dev(acx_device_t *adev); -int acx_verify_init(acx_device_t *adev); +decl_or_stub( + void _acx_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, + struct ieee80211_tx_info *info, struct sk_buff *skb), + { } ) -void acx_clean_txdesc_emergency(acx_device_t *adev); -void acx_irq_work(struct work_struct *work); +decl_or_stub( + void acx_irq_work(struct work_struct *work), + { } ) -u32 acx_read_cmd_type_status(acx_device_t *adev); -void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); +decl_or_stub( + int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, + u32 offset), + { return 0; } ) -int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, - u32 offset); -int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, - u32 offset); -int acxmem_upload_fw(acx_device_t *adev); +decl_or_stub( + int acx_validate_fw(acx_device_t *adev, + const firmware_image_t *fw_image, u32 offset), + { return 0; } ) -/* wrappers on acx_upload_radio(adev, filename */ -int acxmem_upload_radio(acx_device_t *adev); -int acxpci_upload_radio(acx_device_t *adev); +decl_or_stub( + u32 acx_read_cmd_type_status(acx_device_t *adev), + { return 0; } ) + +decl_or_stub( + void acx_write_cmd_type_status(acx_device_t *adev, u16 type, + u16 status), + { } ) + +decl_or_stub( + int acx_op_start(struct ieee80211_hw *hw), + { return 0; } ) + +decl_or_stub( + void acx_op_stop(struct ieee80211_hw *hw), + { } ) + +decl_or_stub( + irqreturn_t acx_interrupt(int irq, void *dev_id), + { return (irqreturn_t) NULL; } ) + +decl_or_stub( + void acx_delete_dma_regions(acx_device_t *adev), + { } ) + +decl_or_stub( + void acx_power_led(acx_device_t * adev, int enable), + { } ) -void acx_power_led(acx_device_t * adev, int enable); +decl_or_stub( + void acx_clean_txdesc_emergency(acx_device_t *adev), + { } ) +decl_or_stub( + void acx_log_rxbuffer(const acx_device_t *adev), + { } ) -// #if !(defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM) +decl_or_stub( + void acx_log_txbuffer(acx_device_t *adev), + { } ) +decl_or_stub( + void *_acx_get_txbuf(acx_device_t * adev, tx_t * tx_opaque), + { return (void*) NULL; } ) + +//void acx_process_rxdesc(acx_device_t *adev); + +#if (defined CONFIG_ACX_MAC80211_PCI || defined CONFIG_ACX_MAC80211_MEM) void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); @@ -113,20 +187,17 @@ static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev, #else /* !(CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM) */ -static inline void acx_create_desc_queues(acx_device_t *adev, - u32 tx_queue_start, u32 rx_queue_start) -{ } - -static inline void acxmem_update_queue_indicator(acx_device_t *adev, - int txqueue) -{ } +static inline txdesc_t* acx_get_txdesc(acx_device_t *adev, int index) +{ return (txdesc_t*) NULL; } static inline txdesc_t* acx_advance_txdesc(acx_device_t *adev, - txdesc_t* txdesc, int inc) + txdesc_t* txdesc, int inc) { return (txdesc_t*) NULL; } /* empty stub here, real one in merge.c */ #define ACX_FREE_QUEUES(adev, _dir_) + #endif /* !(CONFIG_ACX_MAC80211_PCI || CONFIG_ACX_MAC80211_MEM) */ + #endif /* _MERGE_H_ */ -- 1.7.10.1.487.ga3935e6 |