diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-10-19 02:33:38 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-30 16:50:37 -0400 |
commit | 431ba3c6dce0256eafde43af221504f99a2fcc0a (patch) | |
tree | d5c116ddd94adb34c788af277b08fd72c26670e5 | |
parent | 574d6b122d37549bc2817a4939d238f3d8b41da4 (diff) |
ath9k_hw: simplify ath9k_hw_rf_alloc_ext_banks()
This is calling an allocation and checking for it, simplify
this process in a macro.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/phy.c | 72 |
1 files changed, 20 insertions, 52 deletions
diff --git a/drivers/net/wireless/ath/ath9k/phy.c b/drivers/net/wireless/ath/ath9k/phy.c index f3136b2dfb75..923ea0b45174 100644 --- a/drivers/net/wireless/ath/ath9k/phy.c +++ b/drivers/net/wireless/ath/ath9k/phy.c | |||
@@ -416,64 +416,32 @@ ath9k_hw_rf_free(struct ath_hw *ah) | |||
416 | */ | 416 | */ |
417 | int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah) | 417 | int ath9k_hw_rf_alloc_ext_banks(struct ath_hw *ah) |
418 | { | 418 | { |
419 | #define ATH_ALLOC_BANK(bank, size) do { \ | ||
420 | bank = kzalloc((sizeof(u32) * size), GFP_KERNEL); \ | ||
421 | if (!bank) { \ | ||
422 | ath_print(common, ATH_DBG_FATAL, \ | ||
423 | "Cannot allocate RF banks\n"); \ | ||
424 | return -ENOMEM; \ | ||
425 | } \ | ||
426 | } while (0); | ||
427 | |||
419 | struct ath_common *common = ath9k_hw_common(ah); | 428 | struct ath_common *common = ath9k_hw_common(ah); |
420 | 429 | ||
421 | BUG_ON(AR_SREV_9280_10_OR_LATER(ah)); | 430 | BUG_ON(AR_SREV_9280_10_OR_LATER(ah)); |
422 | 431 | ||
423 | ah->analogBank0Data = | 432 | ATH_ALLOC_BANK(ah->analogBank0Data, ah->iniBank0.ia_rows); |
424 | kzalloc((sizeof(u32) * | 433 | ATH_ALLOC_BANK(ah->analogBank1Data, ah->iniBank1.ia_rows); |
425 | ah->iniBank0.ia_rows), GFP_KERNEL); | 434 | ATH_ALLOC_BANK(ah->analogBank2Data, ah->iniBank2.ia_rows); |
426 | ah->analogBank1Data = | 435 | ATH_ALLOC_BANK(ah->analogBank3Data, ah->iniBank3.ia_rows); |
427 | kzalloc((sizeof(u32) * | 436 | ATH_ALLOC_BANK(ah->analogBank6Data, ah->iniBank6.ia_rows); |
428 | ah->iniBank1.ia_rows), GFP_KERNEL); | 437 | ATH_ALLOC_BANK(ah->analogBank6TPCData, ah->iniBank6TPC.ia_rows); |
429 | ah->analogBank2Data = | 438 | ATH_ALLOC_BANK(ah->analogBank7Data, ah->iniBank7.ia_rows); |
430 | kzalloc((sizeof(u32) * | 439 | ATH_ALLOC_BANK(ah->addac5416_21, |
431 | ah->iniBank2.ia_rows), GFP_KERNEL); | 440 | ah->iniAddac.ia_rows * ah->iniAddac.ia_columns); |
432 | ah->analogBank3Data = | 441 | ATH_ALLOC_BANK(ah->bank6Temp, ah->iniBank6.ia_rows); |
433 | kzalloc((sizeof(u32) * | ||
434 | ah->iniBank3.ia_rows), GFP_KERNEL); | ||
435 | ah->analogBank6Data = | ||
436 | kzalloc((sizeof(u32) * | ||
437 | ah->iniBank6.ia_rows), GFP_KERNEL); | ||
438 | ah->analogBank6TPCData = | ||
439 | kzalloc((sizeof(u32) * | ||
440 | ah->iniBank6TPC.ia_rows), GFP_KERNEL); | ||
441 | ah->analogBank7Data = | ||
442 | kzalloc((sizeof(u32) * | ||
443 | ah->iniBank7.ia_rows), GFP_KERNEL); | ||
444 | |||
445 | if (ah->analogBank0Data == NULL | ||
446 | || ah->analogBank1Data == NULL | ||
447 | || ah->analogBank2Data == NULL | ||
448 | || ah->analogBank3Data == NULL | ||
449 | || ah->analogBank6Data == NULL | ||
450 | || ah->analogBank6TPCData == NULL | ||
451 | || ah->analogBank7Data == NULL) { | ||
452 | ath_print(common, ATH_DBG_FATAL, | ||
453 | "Cannot allocate RF banks\n"); | ||
454 | return -ENOMEM; | ||
455 | } | ||
456 | |||
457 | ah->addac5416_21 = | ||
458 | kzalloc((sizeof(u32) * | ||
459 | ah->iniAddac.ia_rows * | ||
460 | ah->iniAddac.ia_columns), GFP_KERNEL); | ||
461 | if (ah->addac5416_21 == NULL) { | ||
462 | ath_print(common, ATH_DBG_FATAL, | ||
463 | "Cannot allocate addac5416_21\n"); | ||
464 | return -ENOMEM; | ||
465 | } | ||
466 | |||
467 | ah->bank6Temp = | ||
468 | kzalloc((sizeof(u32) * | ||
469 | ah->iniBank6.ia_rows), GFP_KERNEL); | ||
470 | if (ah->bank6Temp == NULL) { | ||
471 | ath_print(common, ATH_DBG_FATAL, | ||
472 | "Cannot allocate bank6Temp\n"); | ||
473 | return -ENOMEM; | ||
474 | } | ||
475 | 442 | ||
476 | return 0; | 443 | return 0; |
444 | #undef ATH_ALLOC_BANK | ||
477 | } | 445 | } |
478 | 446 | ||
479 | /** | 447 | /** |