* [PATCH 3/5] Net: ath5k, use int as retval
[not found] <2713029743177393055@pripojeni.net>
2007-08-28 15:59 ` [PATCH 2/5] Net: ath5k, switch to ioread/iowrite Jiri Slaby
@ 2007-08-28 16:00 ` Jiri Slaby
2007-08-30 12:40 ` John W. Linville
2007-08-28 16:00 ` [PATCH 4/5] Net: ath5k, license is GPLv2 Jiri Slaby
2007-08-28 16:01 ` [PATCH 5/5] Net: ath5k, kconfig changes Jiri Slaby
3 siblings, 1 reply; 32+ messages in thread
From: Jiri Slaby @ 2007-08-28 16:00 UTC (permalink / raw)
To: linville; +Cc: linux-kernel, linux-wireless, netdev
ath5k, use int as retval
Convert some functions to return int and proper negative return value on
error as we are used to.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
commit ceeaf6b9aac9daaa41ec38fbba3d2c1972af4470
tree 44cd0736147325e35c32274eb53bd543fb1510a9
parent 64b9d0578668fe8c7a43eadace673bc3e57fc22b
author Jiri Slaby <jirislaby@gmail.com> Tue, 28 Aug 2007 16:10:36 +0200
committer Jiri Slaby <jirislaby@gmail.com> Tue, 28 Aug 2007 16:24:57 +0200
drivers/net/wireless/ath5k.h | 27 +++---
drivers/net/wireless/ath5k_base.c | 2
drivers/net/wireless/ath5k_hw.c | 169 +++++++++++++++++--------------------
3 files changed, 91 insertions(+), 107 deletions(-)
diff --git a/drivers/net/wireless/ath5k.h b/drivers/net/wireless/ath5k.h
index 26f1229..0c6f3f5 100644
--- a/drivers/net/wireless/ath5k.h
+++ b/drivers/net/wireless/ath5k.h
@@ -919,10 +919,10 @@ extern int ath5k_hw_stop_rx_dma(struct ath_hw *hal);
extern u32 ath5k_hw_get_rx_buf(struct ath_hw *hal);
extern void ath5k_hw_put_rx_buf(struct ath_hw *hal, u32 phys_addr);
extern int ath5k_hw_tx_start(struct ath_hw *hal, unsigned int queue);
-extern bool ath5k_hw_stop_tx_dma(struct ath_hw *hal, unsigned int queue);
+extern int ath5k_hw_stop_tx_dma(struct ath_hw *hal, unsigned int queue);
extern u32 ath5k_hw_get_tx_buf(struct ath_hw *hal, unsigned int queue);
extern int ath5k_hw_put_tx_buf(struct ath_hw *hal, unsigned int queue, u32 phys_addr);
-extern bool ath5k_hw_update_tx_triglevel(struct ath_hw *hal, bool increase);
+extern int ath5k_hw_update_tx_triglevel(struct ath_hw *hal, bool increase);
/* Interrupt handling */
extern bool ath5k_hw_is_intr_pending(struct ath_hw *hal);
extern int ath5k_hw_get_isr(struct ath_hw *hal, enum ath5k_int *interrupt_mask);
@@ -930,19 +930,19 @@ extern enum ath5k_int ath5k_hw_set_intr(struct ath_hw *hal, enum ath5k_int new_m
/* EEPROM access functions */
extern int ath5k_hw_set_regdomain(struct ath_hw *hal, u16 regdomain);
/* Protocol Control Unit Functions */
-extern void ath5k_hw_set_opmode(struct ath_hw *hal);
+extern int ath5k_hw_set_opmode(struct ath_hw *hal);
/* BSSID Functions */
extern void ath5k_hw_get_lladdr(struct ath_hw *hal, u8 *mac);
-extern bool ath5k_hw_set_lladdr(struct ath_hw *hal, const u8 *mac);
+extern int ath5k_hw_set_lladdr(struct ath_hw *hal, const u8 *mac);
extern void ath5k_hw_set_associd(struct ath_hw *hal, const u8 *bssid, u16 assoc_id);
-extern bool ath5k_hw_set_bssid_mask(struct ath_hw *hal, const u8 *mask);
+extern int ath5k_hw_set_bssid_mask(struct ath_hw *hal, const u8 *mask);
/* Receive start/stop functions */
extern void ath5k_hw_start_rx_pcu(struct ath_hw *hal);
extern void ath5k_hw_stop_pcu_recv(struct ath_hw *hal);
/* RX Filter functions */
extern void ath5k_hw_set_mcast_filter(struct ath_hw *hal, u32 filter0, u32 filter1);
-extern bool ath5k_hw_set_mcast_filterindex(struct ath_hw *hal, u32 index);
-extern bool ath5k_hw_clear_mcast_filter_idx(struct ath_hw *hal, u32 index);
+extern int ath5k_hw_set_mcast_filterindex(struct ath_hw *hal, u32 index);
+extern int ath5k_hw_clear_mcast_filter_idx(struct ath_hw *hal, u32 index);
extern u32 ath5k_hw_get_rx_filter(struct ath_hw *ah);
extern void ath5k_hw_set_rx_filter(struct ath_hw *ah, u32 filter);
/* Beacon related functions */
@@ -950,14 +950,14 @@ extern u32 ath5k_hw_get_tsf32(struct ath_hw *hal);
extern u64 ath5k_hw_get_tsf64(struct ath_hw *hal);
extern void ath5k_hw_reset_tsf(struct ath_hw *hal);
extern void ath5k_hw_init_beacon(struct ath_hw *hal, u32 next_beacon, u32 interval);
-extern void ath5k_hw_set_beacon_timers(struct ath_hw *hal, const struct ath5k_beacon_state *state);
+extern int ath5k_hw_set_beacon_timers(struct ath_hw *hal, const struct ath5k_beacon_state *state);
extern void ath5k_hw_reset_beacon(struct ath_hw *hal);
-extern bool ath5k_hw_wait_for_beacon(struct ath_hw *hal, unsigned long phys_addr);
+extern int ath5k_hw_wait_for_beacon(struct ath_hw *hal, unsigned long phys_addr);
extern void ath5k_hw_update_mib_counters(struct ath_hw *hal, struct ath5k_mib_stats *statistics);
/* ACK/CTS Timeouts */
-extern bool ath5k_hw_set_ack_timeout(struct ath_hw *hal, unsigned int timeout);
+extern int ath5k_hw_set_ack_timeout(struct ath_hw *hal, unsigned int timeout);
extern unsigned int ath5k_hw_get_ack_timeout(struct ath_hw *hal);
-extern bool ath5k_hw_set_cts_timeout(struct ath_hw *hal, unsigned int timeout);
+extern int ath5k_hw_set_cts_timeout(struct ath_hw *hal, unsigned int timeout);
extern unsigned int ath5k_hw_get_cts_timeout(struct ath_hw *hal);
/* Key table (WEP) functions */
extern int ath5k_hw_reset_key(struct ath_hw *hal, u16 entry);
@@ -971,7 +971,7 @@ extern int ath5k_hw_get_tx_queueprops(struct ath_hw *hal, int queue, struct ath5
extern void ath5k_hw_release_tx_queue(struct ath_hw *hal, unsigned int queue);
extern int ath5k_hw_reset_tx_queue(struct ath_hw *hal, unsigned int queue);
extern u32 ath5k_hw_num_tx_pending(struct ath_hw *hal, unsigned int queue);
-extern bool ath5k_hw_set_slot_time(struct ath_hw *hal, unsigned int slot_time);
+extern int ath5k_hw_set_slot_time(struct ath_hw *hal, unsigned int slot_time);
extern unsigned int ath5k_hw_get_slot_time(struct ath_hw *hal);
/* Hardware Descriptor Functions */
extern int ath5k_hw_setup_rx_desc(struct ath_hw *hal, struct ath_desc *desc, u32 size, unsigned int flags);
@@ -987,9 +987,6 @@ extern u16 ath5k_get_regdomain(struct ath_hw *hal);
/* Misc functions */
extern void ath5k_hw_dump_state(struct ath_hw *hal);
extern int ath5k_hw_get_capability(struct ath_hw *hal, enum ath5k_capability_type cap_type, u32 capability, u32 *result);
-bool ath5k_hw_query_pspoll_support(struct ath_hw *hal);
-bool ath5k_hw_enable_pspoll(struct ath_hw *hal, u8 *bssid, u16 assoc_id);
-bool ath5k_hw_disable_pspoll(struct ath_hw *hal);
/* Initial register settings functions */
diff --git a/drivers/net/wireless/ath5k_base.c b/drivers/net/wireless/ath5k_base.c
index 4bbccf9..5ee36b5 100644
--- a/drivers/net/wireless/ath5k_base.c
+++ b/drivers/net/wireless/ath5k_base.c
@@ -577,7 +577,7 @@ static void ath_beacon_send(struct ath_softc *sc)
* This should never fail since we check above that no frames
* are still pending on the queue.
*/
- if (unlikely(!ath5k_hw_stop_tx_dma(ah, sc->bhalq))) {
+ if (unlikely(ath5k_hw_stop_tx_dma(ah, sc->bhalq))) {
printk(KERN_WARNING "ath: beacon queue %u didn't stop?\n",
sc->bhalq);
/* NB: the HAL still stops DMA, so proceed */
diff --git a/drivers/net/wireless/ath5k_hw.c b/drivers/net/wireless/ath5k_hw.c
index d92da20..a15aa21 100644
--- a/drivers/net/wireless/ath5k_hw.c
+++ b/drivers/net/wireless/ath5k_hw.c
@@ -61,6 +61,9 @@ static int ath5k_hw_get_capabilities(struct ath_hw *);
static int ath5k_eeprom_init(struct ath_hw *);
static int ath5k_eeprom_read_mac(struct ath_hw *, u8 *);
+static int ath5k_hw_enable_pspoll(struct ath_hw *, u8 *, u16);
+static int ath5k_hw_disable_pspoll(struct ath_hw *);
+
/*
* Enable to overwrite the country code (use "00" for debug)
*/
@@ -1265,8 +1268,7 @@ int ath5k_hw_tx_start(struct ath_hw *hal, unsigned int queue)
* Stop DMA transmit for a specific queue
* (see also QCU/DCU functions)
*/
-bool
-ath5k_hw_stop_tx_dma(struct ath_hw *hal, unsigned int queue)
+int ath5k_hw_stop_tx_dma(struct ath_hw *hal, unsigned int queue)
{
unsigned int i = 100;
u32 tx_queue, pending;
@@ -1276,7 +1278,7 @@ ath5k_hw_stop_tx_dma(struct ath_hw *hal, unsigned int queue)
/* Return if queue is declared inactive */
if (hal->ah_txq[queue].tqi_type == AR5K_TX_QUEUE_INACTIVE)
- return false;
+ return -EIO;
if (hal->ah_version == AR5K_AR5210) {
tx_queue = ath5k_hw_reg_read(hal, AR5K_CR);
@@ -1295,7 +1297,7 @@ ath5k_hw_stop_tx_dma(struct ath_hw *hal, unsigned int queue)
ath5k_hw_reg_write(hal, 0, AR5K_BSR);
break;
default:
- return false;
+ return -EINVAL;
}
/* Stop queue */
@@ -1318,8 +1320,8 @@ ath5k_hw_stop_tx_dma(struct ath_hw *hal, unsigned int queue)
ath5k_hw_reg_write(hal, 0, AR5K_QCU_TXD);
}
- /* TODO: Check for success else return false */
- return true;
+ /* TODO: Check for success else return error */
+ return 0;
}
/*
@@ -1404,11 +1406,10 @@ int ath5k_hw_put_tx_buf(struct ath_hw *hal, unsigned int queue, u32 phys_addr)
/*
* Update tx trigger level
*/
-bool
-ath5k_hw_update_tx_triglevel(struct ath_hw *hal, bool increase)
+int ath5k_hw_update_tx_triglevel(struct ath_hw *hal, bool increase)
{
u32 trigger_level, imr;
- bool status = false;
+ int ret = -EIO;
AR5K_TRACE;
@@ -1437,7 +1438,7 @@ ath5k_hw_update_tx_triglevel(struct ath_hw *hal, bool increase)
AR5K_REG_WRITE_BITS(hal, AR5K_TXCFG,
AR5K_TXCFG_TXFULL, trigger_level);
- status = true;
+ ret = 0;
done:
/*
@@ -1445,7 +1446,7 @@ done:
*/
ath5k_hw_set_intr(hal, imr);
- return status;
+ return ret;
}
/*
@@ -2252,8 +2253,7 @@ static int ath5k_hw_get_capabilities(struct ath_hw *hal)
/*
* Set Operation mode
*/
-void
-ath5k_hw_set_opmode(struct ath_hw *hal)
+int ath5k_hw_set_opmode(struct ath_hw *hal)
{
u32 pcu_reg, beacon_reg, low_id, high_id;
@@ -2288,7 +2288,7 @@ ath5k_hw_set_opmode(struct ath_hw *hal)
break;
default:
- return;
+ return -EINVAL;
}
/*
@@ -2304,6 +2304,8 @@ ath5k_hw_set_opmode(struct ath_hw *hal)
*/
if (hal->ah_version == AR5K_AR5210)
ath5k_hw_reg_write(hal, beacon_reg, AR5K_BCR);
+
+ return 0;
}
/*
@@ -2322,8 +2324,7 @@ void ath5k_hw_get_lladdr(struct ath_hw *hal, u8 *mac)
/*
* Set station id
*/
-bool
-ath5k_hw_set_lladdr(struct ath_hw *hal, const u8 *mac)
+int ath5k_hw_set_lladdr(struct ath_hw *hal, const u8 *mac)
{
u32 low_id, high_id;
@@ -2337,14 +2338,13 @@ ath5k_hw_set_lladdr(struct ath_hw *hal, const u8 *mac)
ath5k_hw_reg_write(hal, low_id, AR5K_STA_ID0);
ath5k_hw_reg_write(hal, high_id, AR5K_STA_ID1);
- return true;
+ return 0;
}
/*
* Set BSSID
*/
-void
-ath5k_hw_set_associd(struct ath_hw *hal, const u8 *bssid, u16 assoc_id)
+void ath5k_hw_set_associd(struct ath_hw *hal, const u8 *bssid, u16 assoc_id)
{
u32 low_id, high_id;
u16 tim_offset = 0;
@@ -2381,8 +2381,7 @@ ath5k_hw_set_associd(struct ath_hw *hal, const u8 *bssid, u16 assoc_id)
/*
* Set BSSID mask on 5212
*/
-bool
-ath5k_hw_set_bssid_mask(struct ath_hw *hal, const u8 *mask)
+int ath5k_hw_set_bssid_mask(struct ath_hw *hal, const u8 *mask)
{
u32 low_id, high_id;
AR5K_TRACE;
@@ -2394,10 +2393,10 @@ ath5k_hw_set_bssid_mask(struct ath_hw *hal, const u8 *mask)
ath5k_hw_reg_write(hal, low_id, AR5K_BSS_IDM0);
ath5k_hw_reg_write(hal, high_id, AR5K_BSS_IDM1);
- return true;
+ return 0;
}
- return false;
+ return -EIO;
}
/*
@@ -2407,8 +2406,7 @@ ath5k_hw_set_bssid_mask(struct ath_hw *hal, const u8 *mask)
/*
* Start receive on PCU
*/
-void
-ath5k_hw_start_rx_pcu(struct ath_hw *hal)
+void ath5k_hw_start_rx_pcu(struct ath_hw *hal)
{
AR5K_TRACE;
AR5K_REG_DISABLE_BITS(hal, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
@@ -2417,8 +2415,7 @@ ath5k_hw_start_rx_pcu(struct ath_hw *hal)
/*
* Stop receive on PCU
*/
-void
-ath5k_hw_stop_pcu_recv(struct ath_hw *hal)
+void ath5k_hw_stop_pcu_recv(struct ath_hw *hal)
{
AR5K_TRACE;
AR5K_REG_ENABLE_BITS(hal, AR5K_DIAG_SW, AR5K_DIAG_SW_DIS_RX);
@@ -2431,8 +2428,7 @@ ath5k_hw_stop_pcu_recv(struct ath_hw *hal)
/*
* Set multicast filter
*/
-void
-ath5k_hw_set_mcast_filter(struct ath_hw *hal, u32 filter0, u32 filter1)
+void ath5k_hw_set_mcast_filter(struct ath_hw *hal, u32 filter0, u32 filter1)
{
AR5K_TRACE;
/* Set the multicat filter */
@@ -2443,46 +2439,43 @@ ath5k_hw_set_mcast_filter(struct ath_hw *hal, u32 filter0, u32 filter1)
/*
* Set multicast filter by index
*/
-bool
-ath5k_hw_set_mcast_filterindex(struct ath_hw *hal, u32 index)
+int ath5k_hw_set_mcast_filterindex(struct ath_hw *hal, u32 index)
{
AR5K_TRACE;
if (index >= 64)
- return false;
+ return -EINVAL;
else if (index >= 32)
AR5K_REG_ENABLE_BITS(hal, AR5K_MCAST_FILTER1,
(1 << (index - 32)));
else
AR5K_REG_ENABLE_BITS(hal, AR5K_MCAST_FILTER0, (1 << index));
- return true;
+ return 0;
}
/*
* Clear Multicast filter by index
*/
-bool
-ath5k_hw_clear_mcast_filter_idx(struct ath_hw *hal, u32 index)
+int ath5k_hw_clear_mcast_filter_idx(struct ath_hw *hal, u32 index)
{
AR5K_TRACE;
if (index >= 64)
- return false;
+ return -EINVAL;
else if (index >= 32)
AR5K_REG_DISABLE_BITS(hal, AR5K_MCAST_FILTER1,
(1 << (index - 32)));
else
AR5K_REG_DISABLE_BITS(hal, AR5K_MCAST_FILTER0, (1 << index));
- return true;
+ return 0;
}
/*
* Get current rx filter
*/
-u32
-ath5k_hw_get_rx_filter(struct ath_hw *ah)
+u32 ath5k_hw_get_rx_filter(struct ath_hw *ah)
{
u32 data, filter = 0;
@@ -2624,8 +2617,7 @@ void ath5k_hw_init_beacon(struct ath_hw *hal, u32 next_beacon, u32 interval)
/*
* Set beacon timers
*/
-void
-ath5k_hw_set_beacon_timers(struct ath_hw *hal,
+int ath5k_hw_set_beacon_timers(struct ath_hw *hal,
const struct ath5k_beacon_state *state)
{
u32 cfp_period, next_cfp, dtim, interval, next_beacon;
@@ -2645,7 +2637,7 @@ ath5k_hw_set_beacon_timers(struct ath_hw *hal,
AR5K_TRACE;
/* Return on an invalid beacon state */
if (state->bs_interval < 1)
- return;
+ return -EINVAL;
interval = state->bs_interval;
dtim = state->bs_dtim_period;
@@ -2725,7 +2717,7 @@ ath5k_hw_set_beacon_timers(struct ath_hw *hal,
dtim = state->bs_sleep_duration;
if (interval > dtim)
- return;
+ return -EINVAL;
next_beacon = interval == dtim ? state->bs_next_dtim :
state->bs_next_beacon;
@@ -2745,13 +2737,14 @@ ath5k_hw_set_beacon_timers(struct ath_hw *hal,
AR5K_REG_SM(interval, AR5K_SLEEP2_TIM_PER) |
AR5K_REG_SM(dtim, AR5K_SLEEP2_DTIM_PER), AR5K_SLEEP2);
}
+
+ return 0;
}
/*
* Reset beacon timers
*/
-void
-ath5k_hw_reset_beacon(struct ath_hw *hal)
+void ath5k_hw_reset_beacon(struct ath_hw *hal)
{
AR5K_TRACE;
/*
@@ -2771,11 +2764,10 @@ ath5k_hw_reset_beacon(struct ath_hw *hal)
* Wait for beacon queue to finish
* TODO: This function's name is misleading, rename
*/
-bool
-ath5k_hw_wait_for_beacon(struct ath_hw *hal, unsigned long phys_addr)
+int ath5k_hw_wait_for_beacon(struct ath_hw *hal, unsigned long phys_addr)
{
unsigned int i;
- bool ret;
+ int ret;
AR5K_TRACE;
@@ -2802,17 +2794,17 @@ ath5k_hw_wait_for_beacon(struct ath_hw *hal, unsigned long phys_addr)
ath5k_hw_reg_write(hal, AR5K_BCR_TQ1V | AR5K_BCR_BDMAE,
AR5K_BCR);
- return false;
+ return -EIO;
}
- ret = true;
+ ret = 0;
} else {
/*5211/5212*/
ret = ath5k_hw_register_timeout(hal,
AR5K_QUEUE_STATUS(AR5K_TX_QUEUE_ID_BEACON),
- AR5K_QCU_STS_FRMPENDCNT, 0, false) ? false : true;
+ AR5K_QCU_STS_FRMPENDCNT, 0, false);
if (AR5K_REG_READ_Q(hal, AR5K_QCU_TXE, AR5K_TX_QUEUE_ID_BEACON))
- return false;
+ return -EIO;
}
return ret;
@@ -2821,8 +2813,7 @@ ath5k_hw_wait_for_beacon(struct ath_hw *hal, unsigned long phys_addr)
/*
* Update mib counters (statistics)
*/
-void
-ath5k_hw_update_mib_counters(struct ath_hw *hal,
+void ath5k_hw_update_mib_counters(struct ath_hw *hal,
struct ath5k_mib_stats *statistics)
{
AR5K_TRACE;
@@ -2849,58 +2840,54 @@ ath5k_hw_update_mib_counters(struct ath_hw *hal,
/*
* Set ACK timeout on PCU
*/
-bool
-ath5k_hw_set_ack_timeout(struct ath_hw *hal, unsigned int timeout)
+int ath5k_hw_set_ack_timeout(struct ath_hw *hal, unsigned int timeout)
{
AR5K_TRACE;
if (ath5k_hw_clocktoh(AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_ACK),
hal->ah_turbo) <= timeout)
- return false;
+ return -EINVAL;
AR5K_REG_WRITE_BITS(hal, AR5K_TIME_OUT, AR5K_TIME_OUT_ACK,
ath5k_hw_htoclock(timeout, hal->ah_turbo));
- return true;
+ return 0;
}
/*
* Read the ACK timeout from PCU
*/
-unsigned int
-ath5k_hw_get_ack_timeout(struct ath_hw *hal)
+unsigned int ath5k_hw_get_ack_timeout(struct ath_hw *hal)
{
AR5K_TRACE;
- return (ath5k_hw_clocktoh(AR5K_REG_MS(ath5k_hw_reg_read(hal,
- AR5K_TIME_OUT), AR5K_TIME_OUT_ACK), hal->ah_turbo));
+ return ath5k_hw_clocktoh(AR5K_REG_MS(ath5k_hw_reg_read(hal,
+ AR5K_TIME_OUT), AR5K_TIME_OUT_ACK), hal->ah_turbo);
}
/*
* Set CTS timeout on PCU
*/
-bool
-ath5k_hw_set_cts_timeout(struct ath_hw *hal, unsigned int timeout)
+int ath5k_hw_set_cts_timeout(struct ath_hw *hal, unsigned int timeout)
{
AR5K_TRACE;
if (ath5k_hw_clocktoh(AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_CTS),
hal->ah_turbo) <= timeout)
- return false;
+ return -EINVAL;
AR5K_REG_WRITE_BITS(hal, AR5K_TIME_OUT, AR5K_TIME_OUT_CTS,
ath5k_hw_htoclock(timeout, hal->ah_turbo));
- return true;
+ return 0;
}
/*
* Read CTS timeout from PCU
*/
-unsigned int
-ath5k_hw_get_cts_timeout(struct ath_hw *hal)
+unsigned int ath5k_hw_get_cts_timeout(struct ath_hw *hal)
{
AR5K_TRACE;
- return (ath5k_hw_clocktoh(AR5K_REG_MS(ath5k_hw_reg_read(hal,
- AR5K_TIME_OUT), AR5K_TIME_OUT_CTS), hal->ah_turbo));
+ return ath5k_hw_clocktoh(AR5K_REG_MS(ath5k_hw_reg_read(hal,
+ AR5K_TIME_OUT), AR5K_TIME_OUT_CTS), hal->ah_turbo);
}
/*
@@ -3388,8 +3375,7 @@ int ath5k_hw_reset_tx_queue(struct ath_hw *hal, unsigned int queue)
* Get number of pending frames
* for a specific queue [5211+]
*/
-u32
-ath5k_hw_num_tx_pending(struct ath_hw *hal, unsigned int queue) {
+u32 ath5k_hw_num_tx_pending(struct ath_hw *hal, unsigned int queue) {
AR5K_TRACE;
AR5K_ASSERT_ENTRY(queue, hal->ah_capabilities.cap_queues.q_tx_num);
@@ -3407,12 +3393,11 @@ ath5k_hw_num_tx_pending(struct ath_hw *hal, unsigned int queue) {
/*
* Set slot time
*/
-bool
-ath5k_hw_set_slot_time(struct ath_hw *hal, unsigned int slot_time)
+int ath5k_hw_set_slot_time(struct ath_hw *hal, unsigned int slot_time)
{
AR5K_TRACE;
if (slot_time < AR5K_SLOT_TIME_9 || slot_time > AR5K_SLOT_TIME_MAX)
- return false;
+ return -EINVAL;
if (hal->ah_version == AR5K_AR5210)
ath5k_hw_reg_write(hal, ath5k_hw_htoclock(slot_time,
@@ -3420,19 +3405,18 @@ ath5k_hw_set_slot_time(struct ath_hw *hal, unsigned int slot_time)
else
ath5k_hw_reg_write(hal, slot_time, AR5K_DCU_GBL_IFS_SLOT);
- return true;
+ return 0;
}
/*
* Get slot time
*/
-unsigned int
-ath5k_hw_get_slot_time(struct ath_hw *hal)
+unsigned int ath5k_hw_get_slot_time(struct ath_hw *hal)
{
AR5K_TRACE;
if (hal->ah_version == AR5K_AR5210)
- return (ath5k_hw_clocktoh(ath5k_hw_reg_read(hal,
- AR5K_SLOT_TIME) & 0xffff, hal->ah_turbo));
+ return ath5k_hw_clocktoh(ath5k_hw_reg_read(hal,
+ AR5K_SLOT_TIME) & 0xffff, hal->ah_turbo);
else
return ath5k_hw_reg_read(hal, AR5K_DCU_GBL_IFS_SLOT) & 0xffff;
}
@@ -4358,38 +4342,41 @@ yes:
return 0;
}
-bool
-ath5k_hw_query_pspoll_support(struct ath_hw *hal)
+#if 0
+static bool ath5k_hw_query_pspoll_support(struct ath_hw *hal)
{
AR5K_TRACE;
+
if (hal->ah_version == AR5K_AR5210)
- return(true);
+ return true;
return false;
}
+#endif
-bool
-ath5k_hw_enable_pspoll(struct ath_hw *hal, u8 *bssid, u16 assoc_id)
+static int ath5k_hw_enable_pspoll(struct ath_hw *hal, u8 *bssid,
+ u16 assoc_id)
{
AR5K_TRACE;
+
if (hal->ah_version == AR5K_AR5210) {
AR5K_REG_DISABLE_BITS(hal, AR5K_STA_ID1,
AR5K_STA_ID1_NO_PSPOLL | AR5K_STA_ID1_DEFAULT_ANTENNA);
- return true;
+ return 0;
}
- return false;
+ return -EIO;
}
-bool
-ath5k_hw_disable_pspoll(struct ath_hw *hal)
+static int ath5k_hw_disable_pspoll(struct ath_hw *hal)
{
AR5K_TRACE;
+
if (hal->ah_version == AR5K_AR5210) {
AR5K_REG_ENABLE_BITS(hal, AR5K_STA_ID1,
AR5K_STA_ID1_NO_PSPOLL | AR5K_STA_ID1_DEFAULT_ANTENNA);
- return true;
+ return 0;
}
- return false;
+ return -EIO;
}
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 4/5] Net: ath5k, license is GPLv2
[not found] <2713029743177393055@pripojeni.net>
2007-08-28 15:59 ` [PATCH 2/5] Net: ath5k, switch to ioread/iowrite Jiri Slaby
2007-08-28 16:00 ` [PATCH 3/5] Net: ath5k, use int as retval Jiri Slaby
@ 2007-08-28 16:00 ` Jiri Slaby
2007-08-28 17:11 ` Christoph Hellwig
2007-08-29 9:59 ` Johannes Berg
2007-08-28 16:01 ` [PATCH 5/5] Net: ath5k, kconfig changes Jiri Slaby
3 siblings, 2 replies; 32+ messages in thread
From: Jiri Slaby @ 2007-08-28 16:00 UTC (permalink / raw)
To: linville; +Cc: linux-kernel, linux-wireless, netdev
ath5k, license is GPLv2
The files are available only under GPLv2 since now.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
commit 330c2ab9a53ddce27003218bd546034e8eeeff17
tree b24cecd991fbe3046d5c5269c61e0090427e4fd3
parent ceeaf6b9aac9daaa41ec38fbba3d2c1972af4470
author Jiri Slaby <jirislaby@gmail.com> Tue, 28 Aug 2007 16:27:51 +0200
committer Jiri Slaby <jirislaby@gmail.com> Tue, 28 Aug 2007 16:27:51 +0200
drivers/net/wireless/ath5k.h | 12 +-----------
drivers/net/wireless/ath5k_base.c | 22 +++-------------------
drivers/net/wireless/ath5k_base.h | 33 +--------------------------------
drivers/net/wireless/ath5k_hw.c | 13 +------------
drivers/net/wireless/ath5k_hw.h | 12 +-----------
drivers/net/wireless/ath5k_reg.h | 31 +------------------------------
drivers/net/wireless/ath5k_regdom.c | 4 +---
drivers/net/wireless/ath5k_regdom.h | 4 +---
8 files changed, 10 insertions(+), 121 deletions(-)
diff --git a/drivers/net/wireless/ath5k.h b/drivers/net/wireless/ath5k.h
index 0c6f3f5..c76b97b 100644
--- a/drivers/net/wireless/ath5k.h
+++ b/drivers/net/wireless/ath5k.h
@@ -2,17 +2,7 @@
* Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org>
* Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com>
*
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * This file is released under GPLv2
*/
#ifndef _ATH5K_H
diff --git a/drivers/net/wireless/ath5k_base.c b/drivers/net/wireless/ath5k_base.c
index 5ee36b5..8703988 100644
--- a/drivers/net/wireless/ath5k_base.c
+++ b/drivers/net/wireless/ath5k_base.c
@@ -4,25 +4,9 @@
* Copyright (c) 2007 Jiri Slaby <jirislaby@gmail.com>
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
- * redistribution must be conditioned upon including a substantially
- * similar Disclaimer requirement for further binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
+ * This file is released under GPLv2
*/
+
#define ATH_PCI_VERSION "0.9.5.0-BSD"
#include <linux/version.h>
@@ -2530,5 +2514,5 @@ module_exit(exit_ath_pci);
MODULE_AUTHOR("Jiri Slaby");
MODULE_DESCRIPTION("Support for Atheros 802.11 wireless LAN cards.");
MODULE_SUPPORTED_DEVICE("Atheros WLAN cards");
-MODULE_LICENSE("Dual BSD/GPL");
+MODULE_LICENSE("GPL v2");
MODULE_VERSION(ATH_PCI_VERSION " (EXPERIMENTAL)");
diff --git a/drivers/net/wireless/ath5k_base.h b/drivers/net/wireless/ath5k_base.h
index 15560ad..aa07dfb 100644
--- a/drivers/net/wireless/ath5k_base.h
+++ b/drivers/net/wireless/ath5k_base.h
@@ -2,38 +2,7 @@
* Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
- * redistribution must be conditioned upon including a substantially
- * similar Disclaimer requirement for further binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGES.
- *
- * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.20 2005/01/24 20:31:24 sam Exp $
+ * This file is released under GPLv2
*/
/*
diff --git a/drivers/net/wireless/ath5k_hw.c b/drivers/net/wireless/ath5k_hw.c
index a15aa21..3c44179 100644
--- a/drivers/net/wireless/ath5k_hw.c
+++ b/drivers/net/wireless/ath5k_hw.c
@@ -3,18 +3,7 @@
* Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com>
* Copyright (c) 2007 Jiri Slaby <jirislaby@gmail.com>
*
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
+ * This file is released under GPLv2
*/
/*
diff --git a/drivers/net/wireless/ath5k_hw.h b/drivers/net/wireless/ath5k_hw.h
index 55ae849..3d24d48 100644
--- a/drivers/net/wireless/ath5k_hw.h
+++ b/drivers/net/wireless/ath5k_hw.h
@@ -2,17 +2,7 @@
* Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org>
* Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com>
*
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * This file is released under GPLv2
*/
#include <linux/delay.h>
diff --git a/drivers/net/wireless/ath5k_reg.h b/drivers/net/wireless/ath5k_reg.h
index c6142d2..870efa1 100644
--- a/drivers/net/wireless/ath5k_reg.h
+++ b/drivers/net/wireless/ath5k_reg.h
@@ -2,36 +2,7 @@
* Copyright (c) 2007 Nick Kossifidis <mickflemm@gmail.com>
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
- * redistribution must be conditioned upon including a substantially
- * similar Disclaimer requirement for further binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGES.
+ * This file is released under GPLv2
*/
/*
diff --git a/drivers/net/wireless/ath5k_regdom.c b/drivers/net/wireless/ath5k_regdom.c
index c345da8..067c837 100644
--- a/drivers/net/wireless/ath5k_regdom.c
+++ b/drivers/net/wireless/ath5k_regdom.c
@@ -1,9 +1,7 @@
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net>
*
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
+ * This file is released under GPLv2
*/
/*
diff --git a/drivers/net/wireless/ath5k_regdom.h b/drivers/net/wireless/ath5k_regdom.h
index ebaeabe..d36bec6 100644
--- a/drivers/net/wireless/ath5k_regdom.h
+++ b/drivers/net/wireless/ath5k_regdom.h
@@ -1,9 +1,7 @@
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
*
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
+ * This file is released under GPLv2
*/
#ifndef _IEEE80211_REGDOMAIN_H_
^ permalink raw reply related [flat|nested] 32+ messages in thread* [PATCH 5/5] Net: ath5k, kconfig changes
[not found] <2713029743177393055@pripojeni.net>
` (2 preceding siblings ...)
2007-08-28 16:00 ` [PATCH 4/5] Net: ath5k, license is GPLv2 Jiri Slaby
@ 2007-08-28 16:01 ` Jiri Slaby
2007-08-28 17:13 ` Christoph Hellwig
3 siblings, 1 reply; 32+ messages in thread
From: Jiri Slaby @ 2007-08-28 16:01 UTC (permalink / raw)
To: linville; +Cc: linux-kernel, linux-wireless, netdev
ath5k, kconfig changes
- build 5120, 5111 and 5112 optionally
- alter Kconfig text
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
commit 0902114e92b19bc080780f21f98807688244fc8f
tree d7b4a039e4d14ae73faf1b33907c38825d198461
parent 330c2ab9a53ddce27003218bd546034e8eeeff17
author Jiri Slaby <jirislaby@gmail.com> Tue, 28 Aug 2007 17:39:44 +0200
committer Jiri Slaby <jirislaby@gmail.com> Tue, 28 Aug 2007 17:39:44 +0200
drivers/net/wireless/Kconfig | 30 +++++++++++++++++++--------
drivers/net/wireless/ath5k_hw_inivals.c | 35 ++++++++++++++++++++++++++++---
drivers/net/wireless/ath5k_hw_phy.c | 24 +++++++++++++++++++++
3 files changed, 77 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 00b4fcd..a4608f9 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -856,18 +856,30 @@ config IWL3945
will be called iwl3945.ko.
config ATH5K
- tristate "Atheros 5xxx wireless cards support"
- depends on MAC80211
- depends on PCI
- default m
+ tristate "Atheros 5xxx PCI/Cardbus wireless cards"
+ depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
---help---
- This module adds support for atheros 5xxx (e.g. 5212) wireless
- cards. If you have this card in your PC, select this to be build.
+ Say Y here if you intend to attach an Atheros 5xxx
+ series Cardbus or PCI wireless Ethernet networking card to
+ your computer. This driver uses mac80211 stack.
- This driver uses the kernel's mac80211 subsystem.
+ To compile this driver as a module, choose M here: the module will be
+ called ath5k. If unsure, say M.
- If you choose to build a module, it'll be called ath5k. Say M if
- unsure.
+config ATH5K_AR5210
+ bool "Support AR5210"
+ depends on ATH5K
+ default y
+
+config ATH5K_AR5211
+ bool "Support AR5211"
+ depends on ATH5K
+ default y
+
+config ATH5K_AR5212
+ bool "Support AR5212"
+ depends on ATH5K
+ default y
source "drivers/net/wireless/hostap/Kconfig"
source "drivers/net/wireless/bcm43xx/Kconfig"
diff --git a/drivers/net/wireless/ath5k_hw_inivals.c b/drivers/net/wireless/ath5k_hw_inivals.c
index 062e03d..0531ad3 100644
--- a/drivers/net/wireless/ath5k_hw_inivals.c
+++ b/drivers/net/wireless/ath5k_hw_inivals.c
@@ -38,6 +38,7 @@ struct ath5k_ini_mode {
u32 mode_value[5];
};
+#ifdef CONFIG_ATH5K_AR5210
/* Initial register settings for AR5210 */
static const struct ath5k_ini ar5210_ini[] = {
/* PCU and MAC registers */
@@ -249,7 +250,9 @@ static const struct ath5k_ini ar5210_ini[] = {
{ AR5K_PHY(52), 0x00000014 },
{ AR5K_PHY_ACT, AR5K_PHY_ACT_ENABLE },
};
+#endif
+#ifdef CONFIG_ATH5K_AR5211
/* Initial register settings for AR5211 */
static const struct ath5k_ini ar5211_ini[] = {
{ AR5K_RXDP, 0x00000000 },
@@ -448,7 +451,9 @@ static const struct ath5k_ini_mode ar5211_ini_mode[] = {
{ AR5K_RF_BUFFER_CONTROL_4,
{ 0x00000010, 0x00000014, 0x00000010, 0x00000010, 0x00000010 } },
};
+#endif
+#ifdef CONFIG_ATH5K_AR5212
/* Initial register settings for AR5212 */
static const struct ath5k_ini ar5212_ini[] = {
{ AR5K_RXDP, 0x00000000 },
@@ -842,12 +847,14 @@ static const struct ath5k_ini_mode ar5212_rf5112_ini_mode[] = {
{ AR5K_PHY_GAIN_2GHZ,
{ 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 } },
};
+#endif
/*
* Initial BaseBand Gain settings for RF5111/5112 (only AR5210 comes with
* RF5110 so initial BB Gain settings are included in AR5K_AR5210_INI)
*/
+#if defined(CONFIG_ATH5K_AR5211) || defined (CONFIG_ATH5K_AR5212)
/* RF5111 Initial BaseBand Gain settings */
static const struct ath5k_ini rf5111_ini_bbgain[] = {
{ AR5K_BB_GAIN(0), 0x00000000 },
@@ -915,7 +922,9 @@ static const struct ath5k_ini rf5111_ini_bbgain[] = {
{ AR5K_BB_GAIN(62), 0x00000002 },
{ AR5K_BB_GAIN(63), 0x00000016 },
};
+#endif
+#ifdef CONFIG_ATH5K_AR5212
/* RF 5112 Initial BaseBand Gain settings */
static const struct ath5k_ini rf5112_ini_bbgain[] = {
{ AR5K_BB_GAIN(0), 0x00000000 },
@@ -983,7 +992,10 @@ static const struct ath5k_ini rf5112_ini_bbgain[] = {
{ AR5K_BB_GAIN(62), 0x00000010 },
{ AR5K_BB_GAIN(63), 0x0000001a },
};
+#endif
+#if defined(CONFIG_ATH5K_AR5210) || defined(CONFIG_ATH5K_AR5211) \
+ || defined(CONFIG_ATH5K_AR5212)
/*
* Write initial register dump
*/
@@ -1014,7 +1026,12 @@ static void ath5k_hw_ini_registers(struct ath_hw *hal, unsigned int size,
}
}
}
+#endif
+#if defined(CONFIG_ATH5K_AR5211) || defined(CONFIG_ATH5K_AR5212)
+/*
+ * Write initial mode-specific register dump
+ */
static void ath5k_hw_ini_mode_registers(struct ath_hw *hal,
unsigned int size, const struct ath5k_ini_mode *ini_mode,
u8 mode)
@@ -1028,6 +1045,7 @@ static void ath5k_hw_ini_mode_registers(struct ath_hw *hal,
}
}
+#endif
int ath5k_hw_write_initvals(struct ath_hw *hal, u8 mode, bool change_channel)
{
@@ -1035,6 +1053,7 @@ int ath5k_hw_write_initvals(struct ath_hw *hal, u8 mode, bool change_channel)
* Write initial mode-specific settings
*/
/*For 5212*/
+#ifdef CONFIG_ATH5K_AR5212
if (hal->ah_version == AR5K_AR5212) {
ath5k_hw_ini_mode_registers(hal, ARRAY_SIZE(ar5212_ini_mode),
ar5212_ini_mode, mode);
@@ -1047,16 +1066,19 @@ int ath5k_hw_write_initvals(struct ath_hw *hal, u8 mode, bool change_channel)
ARRAY_SIZE(ar5212_rf5112_ini_mode),
ar5212_rf5112_ini_mode, mode);
}
+#endif
+#ifdef CONFIG_ATH5K_AR5211
/*For 5211*/
if (hal->ah_version == AR5K_AR5211)
ath5k_hw_ini_mode_registers(hal, ARRAY_SIZE(ar5211_ini_mode),
ar5211_ini_mode, mode);
+#endif
/* For 5210 mode settings check out ath5k_hw_reset_tx_queue */
/*
* Write initial settings common for all modes
*/
- /*For 5212*/
+#ifdef CONFIG_ATH5K_AR5212
if (hal->ah_version == AR5K_AR5212) {
ath5k_hw_ini_registers(hal, ARRAY_SIZE(ar5212_ini),
ar5212_ini, change_channel);
@@ -1075,16 +1097,23 @@ int ath5k_hw_write_initvals(struct ath_hw *hal, u8 mode, bool change_channel)
ARRAY_SIZE(rf5111_ini_bbgain),
rf5111_ini_bbgain, change_channel);
}
- } else if (hal->ah_version == AR5K_AR5211) {
+ }
+#endif
+#ifdef CONFIG_ATH5K_AR5211
+ if (hal->ah_version == AR5K_AR5211) {
ath5k_hw_ini_registers(hal, ARRAY_SIZE(ar5211_ini),
ar5211_ini, change_channel);
/* AR5211 only comes with 5111 */
ath5k_hw_ini_registers(hal, ARRAY_SIZE(rf5111_ini_bbgain),
rf5111_ini_bbgain, change_channel);
- } else if (hal->ah_version == AR5K_AR5210) {
+ }
+#endif
+#ifdef CONFIG_ATH5K_AR5210
+ if (hal->ah_version == AR5K_AR5210) {
ath5k_hw_ini_registers(hal, ARRAY_SIZE(ar5210_ini),
ar5210_ini, change_channel);
}
+#endif
return 0;
}
diff --git a/drivers/net/wireless/ath5k_hw_phy.c b/drivers/net/wireless/ath5k_hw_phy.c
index 899b79e..510bf86 100644
--- a/drivers/net/wireless/ath5k_hw_phy.c
+++ b/drivers/net/wireless/ath5k_hw_phy.c
@@ -35,6 +35,7 @@ struct ath5k_gain_opt {
const struct ath5k_gain_opt_step go_step[AR5K_GAIN_STEP_COUNT];
};
+#if defined(CONFIG_ATH5K_AR5211) || defined(CONFIG_ATH5K_AR5212)
/* RF5111 mode-specific init registers */
static const struct ath5k_ini_rf rfregs_5111[] = {
{ 0, 0x989c,
@@ -214,8 +215,10 @@ static const struct ath5k_gain_opt rfgain_opt_5111 = {
{ { 2, 1, 1, 0 }, -6 }
}
};
+#endif
/* RF5112 mode-specific init registers */
+#ifdef CONFIG_ATH5K_AR5212
static const struct ath5k_ini_rf rfregs_5112[] = {
{ 1, 0x98d4,
/* mode a/XR mode aTurbo mode b mode g mode gTurbo */
@@ -529,6 +532,7 @@ static const struct ath5k_gain_opt rfgain_opt_5112 = {
{ { 0, 1, 0, 1, 1, 0, 1 }, -16 },
}
};
+#endif
/*
* Used to modify RF Banks before writing them to AR5K_RF_BUFFER
@@ -661,12 +665,16 @@ static s32 ath5k_hw_rfregs_gain_adjust(struct ath_hw *hal)
int ret = 0;
switch (hal->ah_radio) {
+#if defined(CONFIG_ATH5K_AR5211) || defined(CONFIG_ATH5K_AR5212)
case AR5K_RF5111:
go = &rfgain_opt_5111;
break;
+#endif
+#if defined(CONFIG_ATH5K_AR5212)
case AR5K_RF5112:
go = &rfgain_opt_5112;
break;
+#endif
default:
return 0;
}
@@ -715,6 +723,7 @@ done:
return ret;
}
+#if defined(CONFIG_ATH5K_AR5211) || defined(CONFIG_ATH5K_AR5212)
/*
* Read EEPROM Calibration data, modify RF Banks and Initialize RF5111
*/
@@ -815,7 +824,9 @@ static int ath5k_hw_rf5111_rfregs(struct ath_hw *hal,
return 0;
}
+#endif
+#ifdef CONFIG_ATH5K_AR5212
/*
* Read EEPROM Calibration data, modify RF Banks and Initialize RF5112
*/
@@ -910,6 +921,7 @@ static int ath5k_hw_rf5112_rfregs(struct ath_hw *hal,
return 0;
}
+#endif
/*
* Initialize RF
@@ -921,10 +933,13 @@ int ath5k_hw_rfregs(struct ath_hw *hal, struct ieee80211_channel *channel,
int ret;
switch (hal->ah_radio) {
+#if defined(CONFIG_ATH5K_AR5211) || defined(CONFIG_ATH5K_AR5212)
case AR5K_RF5111:
hal->ah_rf_banks_size = sizeof(rfregs_5111);
func = ath5k_hw_rf5111_rfregs;
break;
+#endif
+#ifdef CONFIG_ATH5K_AR5212
case AR5K_RF5112:
if (hal->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A)
hal->ah_rf_banks_size = sizeof(rfregs_5112a);
@@ -932,6 +947,7 @@ int ath5k_hw_rfregs(struct ath_hw *hal, struct ieee80211_channel *channel,
hal->ah_rf_banks_size = sizeof(rfregs_5112);
func = ath5k_hw_rf5112_rfregs;
break;
+#endif
default:
return -EINVAL;
}
@@ -958,14 +974,18 @@ int ath5k_hw_rfgain(struct ath_hw *hal, unsigned int freq)
unsigned int i, size;
switch (hal->ah_radio) {
+#if defined(CONFIG_ATH5K_AR5211) || defined(CONFIG_ATH5K_AR5212)
case AR5K_RF5111:
ath5k_rfg = rfgain_5111;
size = ARRAY_SIZE(rfgain_5111);
break;
+#endif
+#ifdef CONFIG_ATH5K_AR5212
case AR5K_RF5112:
ath5k_rfg = rfgain_5112;
size = ARRAY_SIZE(rfgain_5112);
break;
+#endif
default:
return -EINVAL;
}
@@ -1031,6 +1051,7 @@ int ath5k_hw_set_rfgain_opt(struct ath_hw *hal)
{
/* Initialize the gain optimization values */
switch (hal->ah_radio) {
+#if defined(CONFIG_ATH5K_AR5211) || defined(CONFIG_ATH5K_AR5212)
case AR5K_RF5111:
hal->ah_gain.g_step_idx = rfgain_opt_5111.go_default;
hal->ah_gain.g_step =
@@ -1039,6 +1060,8 @@ int ath5k_hw_set_rfgain_opt(struct ath_hw *hal)
hal->ah_gain.g_high = 35;
hal->ah_gain.g_active = 1;
break;
+#endif
+#ifdef CONFIG_ATH5K_AR5212
case AR5K_RF5112:
hal->ah_gain.g_step_idx = rfgain_opt_5112.go_default;
hal->ah_gain.g_step =
@@ -1047,6 +1070,7 @@ int ath5k_hw_set_rfgain_opt(struct ath_hw *hal)
hal->ah_gain.g_high = 85;
hal->ah_gain.g_active = 1;
break;
+#endif
default:
return -EINVAL;
}
^ permalink raw reply related [flat|nested] 32+ messages in thread