aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2200.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ipw2200.c')
-rw-r--r--drivers/net/wireless/ipw2200.c90
1 files changed, 43 insertions, 47 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 7c45ba53f379..7ac57f1fc18b 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -2403,14 +2403,13 @@ static int ipw_set_random_seed(struct ipw_priv *priv)
2403 2403
2404static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off) 2404static int ipw_send_card_disable(struct ipw_priv *priv, u32 phy_off)
2405{ 2405{
2406 __le32 v = cpu_to_le32(phy_off);
2406 if (!priv) { 2407 if (!priv) {
2407 IPW_ERROR("Invalid args\n"); 2408 IPW_ERROR("Invalid args\n");
2408 return -1; 2409 return -1;
2409 } 2410 }
2410 2411
2411 phy_off = cpu_to_le32(phy_off); 2412 return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(v), &v);
2412 return ipw_send_cmd_pdu(priv, IPW_CMD_CARD_DISABLE, sizeof(phy_off),
2413 &phy_off);
2414} 2413}
2415 2414
2416static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power) 2415static int ipw_send_tx_power(struct ipw_priv *priv, struct ipw_tx_power *power)
@@ -2499,7 +2498,7 @@ static int ipw_send_frag_threshold(struct ipw_priv *priv, u16 frag)
2499 2498
2500static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode) 2499static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
2501{ 2500{
2502 u32 param; 2501 __le32 param;
2503 2502
2504 if (!priv) { 2503 if (!priv) {
2505 IPW_ERROR("Invalid args\n"); 2504 IPW_ERROR("Invalid args\n");
@@ -2510,17 +2509,16 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
2510 * level */ 2509 * level */
2511 switch (mode) { 2510 switch (mode) {
2512 case IPW_POWER_BATTERY: 2511 case IPW_POWER_BATTERY:
2513 param = IPW_POWER_INDEX_3; 2512 param = cpu_to_le32(IPW_POWER_INDEX_3);
2514 break; 2513 break;
2515 case IPW_POWER_AC: 2514 case IPW_POWER_AC:
2516 param = IPW_POWER_MODE_CAM; 2515 param = cpu_to_le32(IPW_POWER_MODE_CAM);
2517 break; 2516 break;
2518 default: 2517 default:
2519 param = mode; 2518 param = cpu_to_le32(mode);
2520 break; 2519 break;
2521 } 2520 }
2522 2521
2523 param = cpu_to_le32(param);
2524 return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), 2522 return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param),
2525 &param); 2523 &param);
2526} 2524}
@@ -2654,13 +2652,13 @@ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac)
2654static void ipw_eeprom_init_sram(struct ipw_priv *priv) 2652static void ipw_eeprom_init_sram(struct ipw_priv *priv)
2655{ 2653{
2656 int i; 2654 int i;
2657 u16 *eeprom = (u16 *) priv->eeprom; 2655 __le16 *eeprom = (__le16 *) priv->eeprom;
2658 2656
2659 IPW_DEBUG_TRACE(">>\n"); 2657 IPW_DEBUG_TRACE(">>\n");
2660 2658
2661 /* read entire contents of eeprom into private buffer */ 2659 /* read entire contents of eeprom into private buffer */
2662 for (i = 0; i < 128; i++) 2660 for (i = 0; i < 128; i++)
2663 eeprom[i] = le16_to_cpu(eeprom_read_u16(priv, (u8) i)); 2661 eeprom[i] = cpu_to_le16(eeprom_read_u16(priv, (u8) i));
2664 2662
2665 /* 2663 /*
2666 If the data looks correct, then copy it to our private 2664 If the data looks correct, then copy it to our private
@@ -3040,17 +3038,17 @@ static void ipw_arc_release(struct ipw_priv *priv)
3040} 3038}
3041 3039
3042struct fw_chunk { 3040struct fw_chunk {
3043 u32 address; 3041 __le32 address;
3044 u32 length; 3042 __le32 length;
3045}; 3043};
3046 3044
3047static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) 3045static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len)
3048{ 3046{
3049 int rc = 0, i, addr; 3047 int rc = 0, i, addr;
3050 u8 cr = 0; 3048 u8 cr = 0;
3051 u16 *image; 3049 __le16 *image;
3052 3050
3053 image = (u16 *) data; 3051 image = (__le16 *) data;
3054 3052
3055 IPW_DEBUG_TRACE(">> \n"); 3053 IPW_DEBUG_TRACE(">> \n");
3056 3054
@@ -3097,7 +3095,7 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len)
3097 /* load new ipw uCode */ 3095 /* load new ipw uCode */
3098 for (i = 0; i < len / 2; i++) 3096 for (i = 0; i < len / 2; i++)
3099 ipw_write_reg16(priv, IPW_BASEBAND_CONTROL_STORE, 3097 ipw_write_reg16(priv, IPW_BASEBAND_CONTROL_STORE,
3100 cpu_to_le16(image[i])); 3098 le16_to_cpu(image[i]));
3101 3099
3102 /* enable DINO */ 3100 /* enable DINO */
3103 ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0); 3101 ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0);
@@ -3116,11 +3114,11 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len)
3116 3114
3117 if (cr & DINO_RXFIFO_DATA) { 3115 if (cr & DINO_RXFIFO_DATA) {
3118 /* alive_command_responce size is NOT multiple of 4 */ 3116 /* alive_command_responce size is NOT multiple of 4 */
3119 u32 response_buffer[(sizeof(priv->dino_alive) + 3) / 4]; 3117 __le32 response_buffer[(sizeof(priv->dino_alive) + 3) / 4];
3120 3118
3121 for (i = 0; i < ARRAY_SIZE(response_buffer); i++) 3119 for (i = 0; i < ARRAY_SIZE(response_buffer); i++)
3122 response_buffer[i] = 3120 response_buffer[i] =
3123 le32_to_cpu(ipw_read_reg32(priv, 3121 cpu_to_le32(ipw_read_reg32(priv,
3124 IPW_BASEBAND_RX_FIFO_READ)); 3122 IPW_BASEBAND_RX_FIFO_READ));
3125 memcpy(&priv->dino_alive, response_buffer, 3123 memcpy(&priv->dino_alive, response_buffer,
3126 sizeof(priv->dino_alive)); 3124 sizeof(priv->dino_alive));
@@ -4396,9 +4394,10 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4396 struct ipw_rx_notification *notif) 4394 struct ipw_rx_notification *notif)
4397{ 4395{
4398 DECLARE_MAC_BUF(mac); 4396 DECLARE_MAC_BUF(mac);
4397 u16 size = le16_to_cpu(notif->size);
4399 notif->size = le16_to_cpu(notif->size); 4398 notif->size = le16_to_cpu(notif->size);
4400 4399
4401 IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, notif->size); 4400 IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, size);
4402 4401
4403 switch (notif->subtype) { 4402 switch (notif->subtype) {
4404 case HOST_NOTIFICATION_STATUS_ASSOCIATED:{ 4403 case HOST_NOTIFICATION_STATUS_ASSOCIATED:{
@@ -4453,20 +4452,17 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4453 if ((sizeof 4452 if ((sizeof
4454 (struct 4453 (struct
4455 ieee80211_assoc_response) 4454 ieee80211_assoc_response)
4456 <= notif->size) 4455 <= size)
4457 && (notif->size <= 2314)) { 4456 && (size <= 2314)) {
4458 struct 4457 struct
4459 ieee80211_rx_stats 4458 ieee80211_rx_stats
4460 stats = { 4459 stats = {
4461 .len = 4460 .len = size - 1,
4462 notif->
4463 size - 1,
4464 }; 4461 };
4465 4462
4466 IPW_DEBUG_QOS 4463 IPW_DEBUG_QOS
4467 ("QoS Associate " 4464 ("QoS Associate "
4468 "size %d\n", 4465 "size %d\n", size);
4469 notif->size);
4470 ieee80211_rx_mgt(priv-> 4466 ieee80211_rx_mgt(priv->
4471 ieee, 4467 ieee,
4472 (struct 4468 (struct
@@ -4671,20 +4667,20 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4671 struct notif_channel_result *x = 4667 struct notif_channel_result *x =
4672 &notif->u.channel_result; 4668 &notif->u.channel_result;
4673 4669
4674 if (notif->size == sizeof(*x)) { 4670 if (size == sizeof(*x)) {
4675 IPW_DEBUG_SCAN("Scan result for channel %d\n", 4671 IPW_DEBUG_SCAN("Scan result for channel %d\n",
4676 x->channel_num); 4672 x->channel_num);
4677 } else { 4673 } else {
4678 IPW_DEBUG_SCAN("Scan result of wrong size %d " 4674 IPW_DEBUG_SCAN("Scan result of wrong size %d "
4679 "(should be %zd)\n", 4675 "(should be %zd)\n",
4680 notif->size, sizeof(*x)); 4676 size, sizeof(*x));
4681 } 4677 }
4682 break; 4678 break;
4683 } 4679 }
4684 4680
4685 case HOST_NOTIFICATION_STATUS_SCAN_COMPLETED:{ 4681 case HOST_NOTIFICATION_STATUS_SCAN_COMPLETED:{
4686 struct notif_scan_complete *x = &notif->u.scan_complete; 4682 struct notif_scan_complete *x = &notif->u.scan_complete;
4687 if (notif->size == sizeof(*x)) { 4683 if (size == sizeof(*x)) {
4688 IPW_DEBUG_SCAN 4684 IPW_DEBUG_SCAN
4689 ("Scan completed: type %d, %d channels, " 4685 ("Scan completed: type %d, %d channels, "
4690 "%d status\n", x->scan_type, 4686 "%d status\n", x->scan_type,
@@ -4692,7 +4688,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4692 } else { 4688 } else {
4693 IPW_ERROR("Scan completed of wrong size %d " 4689 IPW_ERROR("Scan completed of wrong size %d "
4694 "(should be %zd)\n", 4690 "(should be %zd)\n",
4695 notif->size, sizeof(*x)); 4691 size, sizeof(*x));
4696 } 4692 }
4697 4693
4698 priv->status &= 4694 priv->status &=
@@ -4758,13 +4754,13 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4758 case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{ 4754 case HOST_NOTIFICATION_STATUS_FRAG_LENGTH:{
4759 struct notif_frag_length *x = &notif->u.frag_len; 4755 struct notif_frag_length *x = &notif->u.frag_len;
4760 4756
4761 if (notif->size == sizeof(*x)) 4757 if (size == sizeof(*x))
4762 IPW_ERROR("Frag length: %d\n", 4758 IPW_ERROR("Frag length: %d\n",
4763 le16_to_cpu(x->frag_length)); 4759 le16_to_cpu(x->frag_length));
4764 else 4760 else
4765 IPW_ERROR("Frag length of wrong size %d " 4761 IPW_ERROR("Frag length of wrong size %d "
4766 "(should be %zd)\n", 4762 "(should be %zd)\n",
4767 notif->size, sizeof(*x)); 4763 size, sizeof(*x));
4768 break; 4764 break;
4769 } 4765 }
4770 4766
@@ -4772,7 +4768,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4772 struct notif_link_deterioration *x = 4768 struct notif_link_deterioration *x =
4773 &notif->u.link_deterioration; 4769 &notif->u.link_deterioration;
4774 4770
4775 if (notif->size == sizeof(*x)) { 4771 if (size == sizeof(*x)) {
4776 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE, 4772 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE,
4777 "link deterioration: type %d, cnt %d\n", 4773 "link deterioration: type %d, cnt %d\n",
4778 x->silence_notification_type, 4774 x->silence_notification_type,
@@ -4782,7 +4778,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4782 } else { 4778 } else {
4783 IPW_ERROR("Link Deterioration of wrong size %d " 4779 IPW_ERROR("Link Deterioration of wrong size %d "
4784 "(should be %zd)\n", 4780 "(should be %zd)\n",
4785 notif->size, sizeof(*x)); 4781 size, sizeof(*x));
4786 } 4782 }
4787 break; 4783 break;
4788 } 4784 }
@@ -4798,10 +4794,10 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4798 4794
4799 case HOST_NOTIFICATION_STATUS_BEACON_STATE:{ 4795 case HOST_NOTIFICATION_STATUS_BEACON_STATE:{
4800 struct notif_beacon_state *x = &notif->u.beacon_state; 4796 struct notif_beacon_state *x = &notif->u.beacon_state;
4801 if (notif->size != sizeof(*x)) { 4797 if (size != sizeof(*x)) {
4802 IPW_ERROR 4798 IPW_ERROR
4803 ("Beacon state of wrong size %d (should " 4799 ("Beacon state of wrong size %d (should "
4804 "be %zd)\n", notif->size, sizeof(*x)); 4800 "be %zd)\n", size, sizeof(*x));
4805 break; 4801 break;
4806 } 4802 }
4807 4803
@@ -4816,7 +4812,7 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4816 4812
4817 case HOST_NOTIFICATION_STATUS_TGI_TX_KEY:{ 4813 case HOST_NOTIFICATION_STATUS_TGI_TX_KEY:{
4818 struct notif_tgi_tx_key *x = &notif->u.tgi_tx_key; 4814 struct notif_tgi_tx_key *x = &notif->u.tgi_tx_key;
4819 if (notif->size == sizeof(*x)) { 4815 if (size == sizeof(*x)) {
4820 IPW_ERROR("TGi Tx Key: state 0x%02x sec type " 4816 IPW_ERROR("TGi Tx Key: state 0x%02x sec type "
4821 "0x%02x station %d\n", 4817 "0x%02x station %d\n",
4822 x->key_state, x->security_type, 4818 x->key_state, x->security_type,
@@ -4826,14 +4822,14 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4826 4822
4827 IPW_ERROR 4823 IPW_ERROR
4828 ("TGi Tx Key of wrong size %d (should be %zd)\n", 4824 ("TGi Tx Key of wrong size %d (should be %zd)\n",
4829 notif->size, sizeof(*x)); 4825 size, sizeof(*x));
4830 break; 4826 break;
4831 } 4827 }
4832 4828
4833 case HOST_NOTIFICATION_CALIB_KEEP_RESULTS:{ 4829 case HOST_NOTIFICATION_CALIB_KEEP_RESULTS:{
4834 struct notif_calibration *x = &notif->u.calibration; 4830 struct notif_calibration *x = &notif->u.calibration;
4835 4831
4836 if (notif->size == sizeof(*x)) { 4832 if (size == sizeof(*x)) {
4837 memcpy(&priv->calib, x, sizeof(*x)); 4833 memcpy(&priv->calib, x, sizeof(*x));
4838 IPW_DEBUG_INFO("TODO: Calibration\n"); 4834 IPW_DEBUG_INFO("TODO: Calibration\n");
4839 break; 4835 break;
@@ -4841,12 +4837,12 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4841 4837
4842 IPW_ERROR 4838 IPW_ERROR
4843 ("Calibration of wrong size %d (should be %zd)\n", 4839 ("Calibration of wrong size %d (should be %zd)\n",
4844 notif->size, sizeof(*x)); 4840 size, sizeof(*x));
4845 break; 4841 break;
4846 } 4842 }
4847 4843
4848 case HOST_NOTIFICATION_NOISE_STATS:{ 4844 case HOST_NOTIFICATION_NOISE_STATS:{
4849 if (notif->size == sizeof(u32)) { 4845 if (size == sizeof(u32)) {
4850 priv->exp_avg_noise = 4846 priv->exp_avg_noise =
4851 exponential_average(priv->exp_avg_noise, 4847 exponential_average(priv->exp_avg_noise,
4852 (u8) (le32_to_cpu(notif->u.noise.value) & 0xff), 4848 (u8) (le32_to_cpu(notif->u.noise.value) & 0xff),
@@ -4856,14 +4852,14 @@ static void ipw_rx_notification(struct ipw_priv *priv,
4856 4852
4857 IPW_ERROR 4853 IPW_ERROR
4858 ("Noise stat is wrong size %d (should be %zd)\n", 4854 ("Noise stat is wrong size %d (should be %zd)\n",
4859 notif->size, sizeof(u32)); 4855 size, sizeof(u32));
4860 break; 4856 break;
4861 } 4857 }
4862 4858
4863 default: 4859 default:
4864 IPW_DEBUG_NOTIF("Unknown notification: " 4860 IPW_DEBUG_NOTIF("Unknown notification: "
4865 "subtype=%d,flags=0x%2x,size=%d\n", 4861 "subtype=%d,flags=0x%2x,size=%d\n",
4866 notif->subtype, notif->flags, notif->size); 4862 notif->subtype, notif->flags, size);
4867 } 4863 }
4868} 4864}
4869 4865
@@ -6767,7 +6763,7 @@ static int ipw_wx_set_mlme(struct net_device *dev,
6767{ 6763{
6768 struct ipw_priv *priv = ieee80211_priv(dev); 6764 struct ipw_priv *priv = ieee80211_priv(dev);
6769 struct iw_mlme *mlme = (struct iw_mlme *)extra; 6765 struct iw_mlme *mlme = (struct iw_mlme *)extra;
6770 u16 reason; 6766 __le16 reason;
6771 6767
6772 reason = cpu_to_le16(mlme->reason_code); 6768 reason = cpu_to_le16(mlme->reason_code);
6773 6769
@@ -10438,18 +10434,18 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,
10438 rt_hdr->it_present = 0; /* after all, it's just an idea */ 10434 rt_hdr->it_present = 0; /* after all, it's just an idea */
10439 rt_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_CHANNEL); 10435 rt_hdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_CHANNEL);
10440 10436
10441 *(u16*)skb_put(dst, sizeof(u16)) = cpu_to_le16( 10437 *(__le16*)skb_put(dst, sizeof(u16)) = cpu_to_le16(
10442 ieee80211chan2mhz(priv->channel)); 10438 ieee80211chan2mhz(priv->channel));
10443 if (priv->channel > 14) /* 802.11a */ 10439 if (priv->channel > 14) /* 802.11a */
10444 *(u16*)skb_put(dst, sizeof(u16)) = 10440 *(__le16*)skb_put(dst, sizeof(u16)) =
10445 cpu_to_le16(IEEE80211_CHAN_OFDM | 10441 cpu_to_le16(IEEE80211_CHAN_OFDM |
10446 IEEE80211_CHAN_5GHZ); 10442 IEEE80211_CHAN_5GHZ);
10447 else if (priv->ieee->mode == IEEE_B) /* 802.11b */ 10443 else if (priv->ieee->mode == IEEE_B) /* 802.11b */
10448 *(u16*)skb_put(dst, sizeof(u16)) = 10444 *(__le16*)skb_put(dst, sizeof(u16)) =
10449 cpu_to_le16(IEEE80211_CHAN_CCK | 10445 cpu_to_le16(IEEE80211_CHAN_CCK |
10450 IEEE80211_CHAN_2GHZ); 10446 IEEE80211_CHAN_2GHZ);
10451 else /* 802.11g */ 10447 else /* 802.11g */
10452 *(u16*)skb_put(dst, sizeof(u16)) = 10448 *(__le16*)skb_put(dst, sizeof(u16)) =
10453 cpu_to_le16(IEEE80211_CHAN_OFDM | 10449 cpu_to_le16(IEEE80211_CHAN_OFDM |
10454 IEEE80211_CHAN_2GHZ); 10450 IEEE80211_CHAN_2GHZ);
10455 10451