aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/main.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-08 15:04:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:19 -0500
commitaa21c004f80bdf943736c62dccf0c0398d7824f3 (patch)
tree6815328775d3b5ec46bb342c4c256cde0f223863 /drivers/net/wireless/libertas/main.c
parentf86a93e1b2d05a7a38a48c91f8fb8fc7e8f1c734 (diff)
libertas: kill struct lbs_adapter
There seems to be no reason for a separate structure; move it all into struct lbs_private. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r--drivers/net/wireless/libertas/main.c326
1 files changed, 146 insertions, 180 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 7155f4818167..243cdea419c2 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -257,8 +257,7 @@ static ssize_t lbs_rtap_get(struct device *dev,
257 struct device_attribute *attr, char * buf) 257 struct device_attribute *attr, char * buf)
258{ 258{
259 struct lbs_private *priv = to_net_dev(dev)->priv; 259 struct lbs_private *priv = to_net_dev(dev)->priv;
260 struct lbs_adapter *adapter = priv->adapter; 260 return snprintf(buf, 5, "0x%X\n", priv->monitormode);
261 return snprintf(buf, 5, "0x%X\n", adapter->monitormode);
262} 261}
263 262
264/** 263/**
@@ -269,31 +268,30 @@ static ssize_t lbs_rtap_set(struct device *dev,
269{ 268{
270 int monitor_mode; 269 int monitor_mode;
271 struct lbs_private *priv = to_net_dev(dev)->priv; 270 struct lbs_private *priv = to_net_dev(dev)->priv;
272 struct lbs_adapter *adapter = priv->adapter;
273 271
274 sscanf(buf, "%x", &monitor_mode); 272 sscanf(buf, "%x", &monitor_mode);
275 if (monitor_mode != LBS_MONITOR_OFF) { 273 if (monitor_mode != LBS_MONITOR_OFF) {
276 if(adapter->monitormode == monitor_mode) 274 if(priv->monitormode == monitor_mode)
277 return strlen(buf); 275 return strlen(buf);
278 if (adapter->monitormode == LBS_MONITOR_OFF) { 276 if (priv->monitormode == LBS_MONITOR_OFF) {
279 if (adapter->mode == IW_MODE_INFRA) 277 if (priv->mode == IW_MODE_INFRA)
280 lbs_send_deauthentication(priv); 278 lbs_send_deauthentication(priv);
281 else if (adapter->mode == IW_MODE_ADHOC) 279 else if (priv->mode == IW_MODE_ADHOC)
282 lbs_stop_adhoc_network(priv); 280 lbs_stop_adhoc_network(priv);
283 lbs_add_rtap(priv); 281 lbs_add_rtap(priv);
284 } 282 }
285 adapter->monitormode = monitor_mode; 283 priv->monitormode = monitor_mode;
286 } 284 }
287 285
288 else { 286 else {
289 if (adapter->monitormode == LBS_MONITOR_OFF) 287 if (priv->monitormode == LBS_MONITOR_OFF)
290 return strlen(buf); 288 return strlen(buf);
291 adapter->monitormode = LBS_MONITOR_OFF; 289 priv->monitormode = LBS_MONITOR_OFF;
292 lbs_remove_rtap(priv); 290 lbs_remove_rtap(priv);
293 291
294 if (adapter->currenttxskb) { 292 if (priv->currenttxskb) {
295 dev_kfree_skb_any(adapter->currenttxskb); 293 dev_kfree_skb_any(priv->currenttxskb);
296 adapter->currenttxskb = NULL; 294 priv->currenttxskb = NULL;
297 } 295 }
298 296
299 /* Wake queues, command thread, etc. */ 297 /* Wake queues, command thread, etc. */
@@ -302,7 +300,7 @@ static ssize_t lbs_rtap_set(struct device *dev,
302 300
303 lbs_prepare_and_send_command(priv, 301 lbs_prepare_and_send_command(priv,
304 CMD_802_11_MONITOR_MODE, CMD_ACT_SET, 302 CMD_802_11_MONITOR_MODE, CMD_ACT_SET,
305 CMD_OPTION_WAITFORRSP, 0, &adapter->monitormode); 303 CMD_OPTION_WAITFORRSP, 0, &priv->monitormode);
306 return strlen(buf); 304 return strlen(buf);
307} 305}
308 306
@@ -382,14 +380,13 @@ static struct attribute_group lbs_mesh_attr_group = {
382static int pre_open_check(struct net_device *dev) 380static int pre_open_check(struct net_device *dev)
383{ 381{
384 struct lbs_private *priv = (struct lbs_private *) dev->priv; 382 struct lbs_private *priv = (struct lbs_private *) dev->priv;
385 struct lbs_adapter *adapter = priv->adapter;
386 int i = 0; 383 int i = 0;
387 384
388 while (!adapter->fw_ready && i < 20) { 385 while (!priv->fw_ready && i < 20) {
389 i++; 386 i++;
390 msleep_interruptible(100); 387 msleep_interruptible(100);
391 } 388 }
392 if (!adapter->fw_ready) { 389 if (!priv->fw_ready) {
393 lbs_pr_err("firmware not ready\n"); 390 lbs_pr_err("firmware not ready\n");
394 return -1; 391 return -1;
395 } 392 }
@@ -406,19 +403,18 @@ static int pre_open_check(struct net_device *dev)
406static int lbs_dev_open(struct net_device *dev) 403static int lbs_dev_open(struct net_device *dev)
407{ 404{
408 struct lbs_private *priv = (struct lbs_private *) dev->priv; 405 struct lbs_private *priv = (struct lbs_private *) dev->priv;
409 struct lbs_adapter *adapter = priv->adapter;
410 406
411 lbs_deb_enter(LBS_DEB_NET); 407 lbs_deb_enter(LBS_DEB_NET);
412 408
413 priv->open = 1; 409 priv->open = 1;
414 410
415 if (adapter->connect_status == LBS_CONNECTED) 411 if (priv->connect_status == LBS_CONNECTED)
416 netif_carrier_on(priv->dev); 412 netif_carrier_on(priv->dev);
417 else 413 else
418 netif_carrier_off(priv->dev); 414 netif_carrier_off(priv->dev);
419 415
420 if (priv->mesh_dev) { 416 if (priv->mesh_dev) {
421 if (adapter->mesh_connect_status == LBS_CONNECTED) 417 if (priv->mesh_connect_status == LBS_CONNECTED)
422 netif_carrier_on(priv->mesh_dev); 418 netif_carrier_on(priv->mesh_dev);
423 else 419 else
424 netif_carrier_off(priv->mesh_dev); 420 netif_carrier_off(priv->mesh_dev);
@@ -442,7 +438,7 @@ static int lbs_mesh_open(struct net_device *dev)
442 priv->mesh_open = 1 ; 438 priv->mesh_open = 1 ;
443 netif_wake_queue(priv->mesh_dev); 439 netif_wake_queue(priv->mesh_dev);
444 440
445 priv->adapter->mesh_connect_status = LBS_CONNECTED; 441 priv->mesh_connect_status = LBS_CONNECTED;
446 442
447 netif_carrier_on(priv->mesh_dev); 443 netif_carrier_on(priv->mesh_dev);
448 netif_wake_queue(priv->mesh_dev); 444 netif_wake_queue(priv->mesh_dev);
@@ -534,7 +530,7 @@ static int lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
534 priv->stats.tx_dropped++; 530 priv->stats.tx_dropped++;
535 goto done; 531 goto done;
536 } 532 }
537 if (priv->adapter->currenttxskb) { 533 if (priv->currenttxskb) {
538 lbs_pr_err("%s while TX skb pending\n", __func__); 534 lbs_pr_err("%s while TX skb pending\n", __func__);
539 priv->stats.tx_dropped++; 535 priv->stats.tx_dropped++;
540 goto done; 536 goto done;
@@ -562,7 +558,7 @@ static int lbs_mesh_pre_start_xmit(struct sk_buff *skb,
562 int ret; 558 int ret;
563 559
564 lbs_deb_enter(LBS_DEB_MESH); 560 lbs_deb_enter(LBS_DEB_MESH);
565 if (priv->adapter->monitormode != LBS_MONITOR_OFF) { 561 if (priv->monitormode != LBS_MONITOR_OFF) {
566 netif_stop_queue(dev); 562 netif_stop_queue(dev);
567 return -EOPNOTSUPP; 563 return -EOPNOTSUPP;
568 } 564 }
@@ -585,7 +581,7 @@ static int lbs_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
585 581
586 lbs_deb_enter(LBS_DEB_TX); 582 lbs_deb_enter(LBS_DEB_TX);
587 583
588 if (priv->adapter->monitormode != LBS_MONITOR_OFF) { 584 if (priv->monitormode != LBS_MONITOR_OFF) {
589 netif_stop_queue(dev); 585 netif_stop_queue(dev);
590 return -EOPNOTSUPP; 586 return -EOPNOTSUPP;
591 } 587 }
@@ -608,20 +604,20 @@ static void lbs_tx_timeout(struct net_device *dev)
608 priv->dnld_sent = DNLD_RES_RECEIVED; 604 priv->dnld_sent = DNLD_RES_RECEIVED;
609 dev->trans_start = jiffies; 605 dev->trans_start = jiffies;
610 606
611 if (priv->adapter->currenttxskb) { 607 if (priv->currenttxskb) {
612 if (priv->adapter->monitormode != LBS_MONITOR_OFF) { 608 if (priv->monitormode != LBS_MONITOR_OFF) {
613 /* If we are here, we have not received feedback from 609 /* If we are here, we have not received feedback from
614 the previous packet. Assume TX_FAIL and move on. */ 610 the previous packet. Assume TX_FAIL and move on. */
615 priv->adapter->eventcause = 0x01000000; 611 priv->eventcause = 0x01000000;
616 lbs_send_tx_feedback(priv); 612 lbs_send_tx_feedback(priv);
617 } else 613 } else
618 wake_up_interruptible(&priv->waitq); 614 wake_up_interruptible(&priv->waitq);
619 } else if (dev == priv->dev) { 615 } else if (dev == priv->dev) {
620 if (priv->adapter->connect_status == LBS_CONNECTED) 616 if (priv->connect_status == LBS_CONNECTED)
621 netif_wake_queue(priv->dev); 617 netif_wake_queue(priv->dev);
622 618
623 } else if (dev == priv->mesh_dev) { 619 } else if (dev == priv->mesh_dev) {
624 if (priv->adapter->mesh_connect_status == LBS_CONNECTED) 620 if (priv->mesh_connect_status == LBS_CONNECTED)
625 netif_wake_queue(priv->mesh_dev); 621 netif_wake_queue(priv->mesh_dev);
626 } 622 }
627 623
@@ -630,23 +626,22 @@ static void lbs_tx_timeout(struct net_device *dev)
630 626
631void lbs_host_to_card_done(struct lbs_private *priv) 627void lbs_host_to_card_done(struct lbs_private *priv)
632{ 628{
633 struct lbs_adapter *adapter = priv->adapter;
634 629
635 priv->dnld_sent = DNLD_RES_RECEIVED; 630 priv->dnld_sent = DNLD_RES_RECEIVED;
636 631
637 /* Wake main thread if commands are pending */ 632 /* Wake main thread if commands are pending */
638 if (!adapter->cur_cmd) 633 if (!priv->cur_cmd)
639 wake_up_interruptible(&priv->waitq); 634 wake_up_interruptible(&priv->waitq);
640 635
641 /* Don't wake netif queues if we're in monitor mode and 636 /* Don't wake netif queues if we're in monitor mode and
642 a TX packet is already pending. */ 637 a TX packet is already pending. */
643 if (priv->adapter->currenttxskb) 638 if (priv->currenttxskb)
644 return; 639 return;
645 640
646 if (priv->dev && adapter->connect_status == LBS_CONNECTED) 641 if (priv->dev && priv->connect_status == LBS_CONNECTED)
647 netif_wake_queue(priv->dev); 642 netif_wake_queue(priv->dev);
648 643
649 if (priv->mesh_dev && adapter->mesh_connect_status == LBS_CONNECTED) 644 if (priv->mesh_dev && priv->mesh_connect_status == LBS_CONNECTED)
650 netif_wake_queue(priv->mesh_dev); 645 netif_wake_queue(priv->mesh_dev);
651} 646}
652EXPORT_SYMBOL_GPL(lbs_host_to_card_done); 647EXPORT_SYMBOL_GPL(lbs_host_to_card_done);
@@ -668,7 +663,6 @@ static int lbs_set_mac_address(struct net_device *dev, void *addr)
668{ 663{
669 int ret = 0; 664 int ret = 0;
670 struct lbs_private *priv = (struct lbs_private *) dev->priv; 665 struct lbs_private *priv = (struct lbs_private *) dev->priv;
671 struct lbs_adapter *adapter = priv->adapter;
672 struct sockaddr *phwaddr = addr; 666 struct sockaddr *phwaddr = addr;
673 667
674 lbs_deb_enter(LBS_DEB_NET); 668 lbs_deb_enter(LBS_DEB_NET);
@@ -676,13 +670,13 @@ static int lbs_set_mac_address(struct net_device *dev, void *addr)
676 /* In case it was called from the mesh device */ 670 /* In case it was called from the mesh device */
677 dev = priv->dev ; 671 dev = priv->dev ;
678 672
679 memset(adapter->current_addr, 0, ETH_ALEN); 673 memset(priv->current_addr, 0, ETH_ALEN);
680 674
681 /* dev->dev_addr is 8 bytes */ 675 /* dev->dev_addr is 8 bytes */
682 lbs_deb_hex(LBS_DEB_NET, "dev->dev_addr", dev->dev_addr, ETH_ALEN); 676 lbs_deb_hex(LBS_DEB_NET, "dev->dev_addr", dev->dev_addr, ETH_ALEN);
683 677
684 lbs_deb_hex(LBS_DEB_NET, "addr", phwaddr->sa_data, ETH_ALEN); 678 lbs_deb_hex(LBS_DEB_NET, "addr", phwaddr->sa_data, ETH_ALEN);
685 memcpy(adapter->current_addr, phwaddr->sa_data, ETH_ALEN); 679 memcpy(priv->current_addr, phwaddr->sa_data, ETH_ALEN);
686 680
687 ret = lbs_prepare_and_send_command(priv, CMD_802_11_MAC_ADDRESS, 681 ret = lbs_prepare_and_send_command(priv, CMD_802_11_MAC_ADDRESS,
688 CMD_ACT_SET, 682 CMD_ACT_SET,
@@ -694,24 +688,24 @@ static int lbs_set_mac_address(struct net_device *dev, void *addr)
694 goto done; 688 goto done;
695 } 689 }
696 690
697 lbs_deb_hex(LBS_DEB_NET, "adapter->macaddr", adapter->current_addr, ETH_ALEN); 691 lbs_deb_hex(LBS_DEB_NET, "priv->macaddr", priv->current_addr, ETH_ALEN);
698 memcpy(dev->dev_addr, adapter->current_addr, ETH_ALEN); 692 memcpy(dev->dev_addr, priv->current_addr, ETH_ALEN);
699 if (priv->mesh_dev) 693 if (priv->mesh_dev)
700 memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); 694 memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN);
701 695
702done: 696done:
703 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret); 697 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
704 return ret; 698 return ret;
705} 699}
706 700
707static int lbs_copy_multicast_address(struct lbs_adapter *adapter, 701static int lbs_copy_multicast_address(struct lbs_private *priv,
708 struct net_device *dev) 702 struct net_device *dev)
709{ 703{
710 int i = 0; 704 int i = 0;
711 struct dev_mc_list *mcptr = dev->mc_list; 705 struct dev_mc_list *mcptr = dev->mc_list;
712 706
713 for (i = 0; i < dev->mc_count; i++) { 707 for (i = 0; i < dev->mc_count; i++) {
714 memcpy(&adapter->multicastlist[i], mcptr->dmi_addr, ETH_ALEN); 708 memcpy(&priv->multicastlist[i], mcptr->dmi_addr, ETH_ALEN);
715 mcptr = mcptr->next; 709 mcptr = mcptr->next;
716 } 710 }
717 711
@@ -722,50 +716,49 @@ static int lbs_copy_multicast_address(struct lbs_adapter *adapter,
722static void lbs_set_multicast_list(struct net_device *dev) 716static void lbs_set_multicast_list(struct net_device *dev)
723{ 717{
724 struct lbs_private *priv = dev->priv; 718 struct lbs_private *priv = dev->priv;
725 struct lbs_adapter *adapter = priv->adapter;
726 int oldpacketfilter; 719 int oldpacketfilter;
727 DECLARE_MAC_BUF(mac); 720 DECLARE_MAC_BUF(mac);
728 721
729 lbs_deb_enter(LBS_DEB_NET); 722 lbs_deb_enter(LBS_DEB_NET);
730 723
731 oldpacketfilter = adapter->currentpacketfilter; 724 oldpacketfilter = priv->currentpacketfilter;
732 725
733 if (dev->flags & IFF_PROMISC) { 726 if (dev->flags & IFF_PROMISC) {
734 lbs_deb_net("enable promiscuous mode\n"); 727 lbs_deb_net("enable promiscuous mode\n");
735 adapter->currentpacketfilter |= 728 priv->currentpacketfilter |=
736 CMD_ACT_MAC_PROMISCUOUS_ENABLE; 729 CMD_ACT_MAC_PROMISCUOUS_ENABLE;
737 adapter->currentpacketfilter &= 730 priv->currentpacketfilter &=
738 ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE | 731 ~(CMD_ACT_MAC_ALL_MULTICAST_ENABLE |
739 CMD_ACT_MAC_MULTICAST_ENABLE); 732 CMD_ACT_MAC_MULTICAST_ENABLE);
740 } else { 733 } else {
741 /* Multicast */ 734 /* Multicast */
742 adapter->currentpacketfilter &= 735 priv->currentpacketfilter &=
743 ~CMD_ACT_MAC_PROMISCUOUS_ENABLE; 736 ~CMD_ACT_MAC_PROMISCUOUS_ENABLE;
744 737
745 if (dev->flags & IFF_ALLMULTI || dev->mc_count > 738 if (dev->flags & IFF_ALLMULTI || dev->mc_count >
746 MRVDRV_MAX_MULTICAST_LIST_SIZE) { 739 MRVDRV_MAX_MULTICAST_LIST_SIZE) {
747 lbs_deb_net( "enabling all multicast\n"); 740 lbs_deb_net( "enabling all multicast\n");
748 adapter->currentpacketfilter |= 741 priv->currentpacketfilter |=
749 CMD_ACT_MAC_ALL_MULTICAST_ENABLE; 742 CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
750 adapter->currentpacketfilter &= 743 priv->currentpacketfilter &=
751 ~CMD_ACT_MAC_MULTICAST_ENABLE; 744 ~CMD_ACT_MAC_MULTICAST_ENABLE;
752 } else { 745 } else {
753 adapter->currentpacketfilter &= 746 priv->currentpacketfilter &=
754 ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE; 747 ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
755 748
756 if (!dev->mc_count) { 749 if (!dev->mc_count) {
757 lbs_deb_net("no multicast addresses, " 750 lbs_deb_net("no multicast addresses, "
758 "disabling multicast\n"); 751 "disabling multicast\n");
759 adapter->currentpacketfilter &= 752 priv->currentpacketfilter &=
760 ~CMD_ACT_MAC_MULTICAST_ENABLE; 753 ~CMD_ACT_MAC_MULTICAST_ENABLE;
761 } else { 754 } else {
762 int i; 755 int i;
763 756
764 adapter->currentpacketfilter |= 757 priv->currentpacketfilter |=
765 CMD_ACT_MAC_MULTICAST_ENABLE; 758 CMD_ACT_MAC_MULTICAST_ENABLE;
766 759
767 adapter->nr_of_multicastmacaddr = 760 priv->nr_of_multicastmacaddr =
768 lbs_copy_multicast_address(adapter, dev); 761 lbs_copy_multicast_address(priv, dev);
769 762
770 lbs_deb_net("multicast addresses: %d\n", 763 lbs_deb_net("multicast addresses: %d\n",
771 dev->mc_count); 764 dev->mc_count);
@@ -773,7 +766,7 @@ static void lbs_set_multicast_list(struct net_device *dev)
773 for (i = 0; i < dev->mc_count; i++) { 766 for (i = 0; i < dev->mc_count; i++) {
774 lbs_deb_net("Multicast address %d:%s\n", 767 lbs_deb_net("Multicast address %d:%s\n",
775 i, print_mac(mac, 768 i, print_mac(mac,
776 adapter->multicastlist[i])); 769 priv->multicastlist[i]));
777 } 770 }
778 /* send multicast addresses to firmware */ 771 /* send multicast addresses to firmware */
779 lbs_prepare_and_send_command(priv, 772 lbs_prepare_and_send_command(priv,
@@ -784,7 +777,7 @@ static void lbs_set_multicast_list(struct net_device *dev)
784 } 777 }
785 } 778 }
786 779
787 if (adapter->currentpacketfilter != oldpacketfilter) { 780 if (priv->currentpacketfilter != oldpacketfilter) {
788 lbs_set_mac_packet_filter(priv); 781 lbs_set_mac_packet_filter(priv);
789 } 782 }
790 783
@@ -803,7 +796,6 @@ static int lbs_thread(void *data)
803{ 796{
804 struct net_device *dev = data; 797 struct net_device *dev = data;
805 struct lbs_private *priv = dev->priv; 798 struct lbs_private *priv = dev->priv;
806 struct lbs_adapter *adapter = priv->adapter;
807 wait_queue_t wait; 799 wait_queue_t wait;
808 u8 ireg = 0; 800 u8 ireg = 0;
809 801
@@ -815,99 +807,99 @@ static int lbs_thread(void *data)
815 807
816 for (;;) { 808 for (;;) {
817 lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n", 809 lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
818 adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); 810 priv->intcounter, priv->currenttxskb, priv->dnld_sent);
819 811
820 add_wait_queue(&priv->waitq, &wait); 812 add_wait_queue(&priv->waitq, &wait);
821 set_current_state(TASK_INTERRUPTIBLE); 813 set_current_state(TASK_INTERRUPTIBLE);
822 spin_lock_irq(&adapter->driver_lock); 814 spin_lock_irq(&priv->driver_lock);
823 815
824 if ((adapter->psstate == PS_STATE_SLEEP) || 816 if ((priv->psstate == PS_STATE_SLEEP) ||
825 (!adapter->intcounter && (priv->dnld_sent || adapter->cur_cmd || list_empty(&adapter->cmdpendingq)))) { 817 (!priv->intcounter && (priv->dnld_sent || priv->cur_cmd || list_empty(&priv->cmdpendingq)))) {
826 lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", 818 lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n",
827 adapter->connect_status, adapter->intcounter, 819 priv->connect_status, priv->intcounter,
828 adapter->psmode, adapter->psstate); 820 priv->psmode, priv->psstate);
829 spin_unlock_irq(&adapter->driver_lock); 821 spin_unlock_irq(&priv->driver_lock);
830 schedule(); 822 schedule();
831 } else 823 } else
832 spin_unlock_irq(&adapter->driver_lock); 824 spin_unlock_irq(&priv->driver_lock);
833 825
834 lbs_deb_thread("main-thread 222 (waking up): intcounter=%d currenttxskb=%p dnld_sent=%d\n", 826 lbs_deb_thread("main-thread 222 (waking up): intcounter=%d currenttxskb=%p dnld_sent=%d\n",
835 adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); 827 priv->intcounter, priv->currenttxskb, priv->dnld_sent);
836 828
837 set_current_state(TASK_RUNNING); 829 set_current_state(TASK_RUNNING);
838 remove_wait_queue(&priv->waitq, &wait); 830 remove_wait_queue(&priv->waitq, &wait);
839 try_to_freeze(); 831 try_to_freeze();
840 832
841 lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n", 833 lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
842 adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); 834 priv->intcounter, priv->currenttxskb, priv->dnld_sent);
843 835
844 if (kthread_should_stop() || adapter->surpriseremoved) { 836 if (kthread_should_stop() || priv->surpriseremoved) {
845 lbs_deb_thread("main-thread: break from main thread: surpriseremoved=0x%x\n", 837 lbs_deb_thread("main-thread: break from main thread: surpriseremoved=0x%x\n",
846 adapter->surpriseremoved); 838 priv->surpriseremoved);
847 break; 839 break;
848 } 840 }
849 841
850 842
851 spin_lock_irq(&adapter->driver_lock); 843 spin_lock_irq(&priv->driver_lock);
852 844
853 if (adapter->intcounter) { 845 if (priv->intcounter) {
854 u8 int_status; 846 u8 int_status;
855 847
856 adapter->intcounter = 0; 848 priv->intcounter = 0;
857 int_status = priv->hw_get_int_status(priv, &ireg); 849 int_status = priv->hw_get_int_status(priv, &ireg);
858 850
859 if (int_status) { 851 if (int_status) {
860 lbs_deb_thread("main-thread: reading HOST_INT_STATUS_REG failed\n"); 852 lbs_deb_thread("main-thread: reading HOST_INT_STATUS_REG failed\n");
861 spin_unlock_irq(&adapter->driver_lock); 853 spin_unlock_irq(&priv->driver_lock);
862 continue; 854 continue;
863 } 855 }
864 adapter->hisregcpy |= ireg; 856 priv->hisregcpy |= ireg;
865 } 857 }
866 858
867 lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p dnld_sent=%d\n", 859 lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
868 adapter->intcounter, adapter->currenttxskb, priv->dnld_sent); 860 priv->intcounter, priv->currenttxskb, priv->dnld_sent);
869 861
870 /* command response? */ 862 /* command response? */
871 if (adapter->hisregcpy & MRVDRV_CMD_UPLD_RDY) { 863 if (priv->hisregcpy & MRVDRV_CMD_UPLD_RDY) {
872 lbs_deb_thread("main-thread: cmd response ready\n"); 864 lbs_deb_thread("main-thread: cmd response ready\n");
873 865
874 adapter->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; 866 priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY;
875 spin_unlock_irq(&adapter->driver_lock); 867 spin_unlock_irq(&priv->driver_lock);
876 lbs_process_rx_command(priv); 868 lbs_process_rx_command(priv);
877 spin_lock_irq(&adapter->driver_lock); 869 spin_lock_irq(&priv->driver_lock);
878 } 870 }
879 871
880 /* Any Card Event */ 872 /* Any Card Event */
881 if (adapter->hisregcpy & MRVDRV_CARDEVENT) { 873 if (priv->hisregcpy & MRVDRV_CARDEVENT) {
882 lbs_deb_thread("main-thread: Card Event Activity\n"); 874 lbs_deb_thread("main-thread: Card Event Activity\n");
883 875
884 adapter->hisregcpy &= ~MRVDRV_CARDEVENT; 876 priv->hisregcpy &= ~MRVDRV_CARDEVENT;
885 877
886 if (priv->hw_read_event_cause(priv)) { 878 if (priv->hw_read_event_cause(priv)) {
887 lbs_pr_alert("main-thread: hw_read_event_cause failed\n"); 879 lbs_pr_alert("main-thread: hw_read_event_cause failed\n");
888 spin_unlock_irq(&adapter->driver_lock); 880 spin_unlock_irq(&priv->driver_lock);
889 continue; 881 continue;
890 } 882 }
891 spin_unlock_irq(&adapter->driver_lock); 883 spin_unlock_irq(&priv->driver_lock);
892 lbs_process_event(priv); 884 lbs_process_event(priv);
893 } else 885 } else
894 spin_unlock_irq(&adapter->driver_lock); 886 spin_unlock_irq(&priv->driver_lock);
895 887
896 /* Check if we need to confirm Sleep Request received previously */ 888 /* Check if we need to confirm Sleep Request received previously */
897 if (adapter->psstate == PS_STATE_PRE_SLEEP && 889 if (priv->psstate == PS_STATE_PRE_SLEEP &&
898 !priv->dnld_sent && !adapter->cur_cmd) { 890 !priv->dnld_sent && !priv->cur_cmd) {
899 if (adapter->connect_status == LBS_CONNECTED) { 891 if (priv->connect_status == LBS_CONNECTED) {
900 lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n", 892 lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n",
901 adapter->intcounter, adapter->currenttxskb, priv->dnld_sent, adapter->cur_cmd); 893 priv->intcounter, priv->currenttxskb, priv->dnld_sent, priv->cur_cmd);
902 894
903 lbs_ps_confirm_sleep(priv, (u16) adapter->psmode); 895 lbs_ps_confirm_sleep(priv, (u16) priv->psmode);
904 } else { 896 } else {
905 /* workaround for firmware sending 897 /* workaround for firmware sending
906 * deauth/linkloss event immediately 898 * deauth/linkloss event immediately
907 * after sleep request; remove this 899 * after sleep request; remove this
908 * after firmware fixes it 900 * after firmware fixes it
909 */ 901 */
910 adapter->psstate = PS_STATE_AWAKE; 902 priv->psstate = PS_STATE_AWAKE;
911 lbs_pr_alert("main-thread: ignore PS_SleepConfirm in non-connected state\n"); 903 lbs_pr_alert("main-thread: ignore PS_SleepConfirm in non-connected state\n");
912 } 904 }
913 } 905 }
@@ -915,25 +907,25 @@ static int lbs_thread(void *data)
915 /* The PS state is changed during processing of Sleep Request 907 /* The PS state is changed during processing of Sleep Request
916 * event above 908 * event above
917 */ 909 */
918 if ((priv->adapter->psstate == PS_STATE_SLEEP) || 910 if ((priv->psstate == PS_STATE_SLEEP) ||
919 (priv->adapter->psstate == PS_STATE_PRE_SLEEP)) 911 (priv->psstate == PS_STATE_PRE_SLEEP))
920 continue; 912 continue;
921 913
922 /* Execute the next command */ 914 /* Execute the next command */
923 if (!priv->dnld_sent && !priv->adapter->cur_cmd) 915 if (!priv->dnld_sent && !priv->cur_cmd)
924 lbs_execute_next_command(priv); 916 lbs_execute_next_command(priv);
925 917
926 /* Wake-up command waiters which can't sleep in 918 /* Wake-up command waiters which can't sleep in
927 * lbs_prepare_and_send_command 919 * lbs_prepare_and_send_command
928 */ 920 */
929 if (!list_empty(&adapter->cmdpendingq)) 921 if (!list_empty(&priv->cmdpendingq))
930 wake_up_all(&adapter->cmd_pending); 922 wake_up_all(&priv->cmd_pending);
931 923
932 lbs_tx_runqueue(priv); 924 lbs_tx_runqueue(priv);
933 } 925 }
934 926
935 del_timer(&adapter->command_timer); 927 del_timer(&priv->command_timer);
936 wake_up_all(&adapter->cmd_pending); 928 wake_up_all(&priv->cmd_pending);
937 929
938 lbs_deb_leave(LBS_DEB_THREAD); 930 lbs_deb_leave(LBS_DEB_THREAD);
939 return 0; 931 return 0;
@@ -950,7 +942,6 @@ static int lbs_thread(void *data)
950static int lbs_setup_firmware(struct lbs_private *priv) 942static int lbs_setup_firmware(struct lbs_private *priv)
951{ 943{
952 int ret = -1; 944 int ret = -1;
953 struct lbs_adapter *adapter = priv->adapter;
954 struct cmd_ds_mesh_access mesh_access; 945 struct cmd_ds_mesh_access mesh_access;
955 946
956 lbs_deb_enter(LBS_DEB_FW); 947 lbs_deb_enter(LBS_DEB_FW);
@@ -958,7 +949,7 @@ static int lbs_setup_firmware(struct lbs_private *priv)
958 /* 949 /*
959 * Read MAC address from HW 950 * Read MAC address from HW
960 */ 951 */
961 memset(adapter->current_addr, 0xff, ETH_ALEN); 952 memset(priv->current_addr, 0xff, ETH_ALEN);
962 953
963 ret = lbs_prepare_and_send_command(priv, CMD_GET_HW_SPEC, 954 ret = lbs_prepare_and_send_command(priv, CMD_GET_HW_SPEC,
964 0, CMD_OPTION_WAITFORRSP, 0, NULL); 955 0, CMD_OPTION_WAITFORRSP, 0, NULL);
@@ -1008,12 +999,11 @@ done:
1008static void command_timer_fn(unsigned long data) 999static void command_timer_fn(unsigned long data)
1009{ 1000{
1010 struct lbs_private *priv = (struct lbs_private *)data; 1001 struct lbs_private *priv = (struct lbs_private *)data;
1011 struct lbs_adapter *adapter = priv->adapter;
1012 struct cmd_ctrl_node *ptempnode; 1002 struct cmd_ctrl_node *ptempnode;
1013 struct cmd_ds_command *cmd; 1003 struct cmd_ds_command *cmd;
1014 unsigned long flags; 1004 unsigned long flags;
1015 1005
1016 ptempnode = adapter->cur_cmd; 1006 ptempnode = priv->cur_cmd;
1017 if (ptempnode == NULL) { 1007 if (ptempnode == NULL) {
1018 lbs_deb_fw("ptempnode empty\n"); 1008 lbs_deb_fw("ptempnode empty\n");
1019 return; 1009 return;
@@ -1027,15 +1017,15 @@ static void command_timer_fn(unsigned long data)
1027 1017
1028 lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command); 1018 lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
1029 1019
1030 if (!adapter->fw_ready) 1020 if (!priv->fw_ready)
1031 return; 1021 return;
1032 1022
1033 spin_lock_irqsave(&adapter->driver_lock, flags); 1023 spin_lock_irqsave(&priv->driver_lock, flags);
1034 adapter->cur_cmd = NULL; 1024 priv->cur_cmd = NULL;
1035 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1025 spin_unlock_irqrestore(&priv->driver_lock, flags);
1036 1026
1037 lbs_deb_fw("re-sending same command because of timeout\n"); 1027 lbs_deb_fw("re-sending same command because of timeout\n");
1038 lbs_queue_cmd(adapter, ptempnode, 0); 1028 lbs_queue_cmd(priv, ptempnode, 0);
1039 1029
1040 wake_up_interruptible(&priv->waitq); 1030 wake_up_interruptible(&priv->waitq);
1041 1031
@@ -1044,63 +1034,62 @@ static void command_timer_fn(unsigned long data)
1044 1034
1045static int lbs_init_adapter(struct lbs_private *priv) 1035static int lbs_init_adapter(struct lbs_private *priv)
1046{ 1036{
1047 struct lbs_adapter *adapter = priv->adapter;
1048 size_t bufsize; 1037 size_t bufsize;
1049 int i, ret = 0; 1038 int i, ret = 0;
1050 1039
1051 /* Allocate buffer to store the BSSID list */ 1040 /* Allocate buffer to store the BSSID list */
1052 bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor); 1041 bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
1053 adapter->networks = kzalloc(bufsize, GFP_KERNEL); 1042 priv->networks = kzalloc(bufsize, GFP_KERNEL);
1054 if (!adapter->networks) { 1043 if (!priv->networks) {
1055 lbs_pr_err("Out of memory allocating beacons\n"); 1044 lbs_pr_err("Out of memory allocating beacons\n");
1056 ret = -1; 1045 ret = -1;
1057 goto out; 1046 goto out;
1058 } 1047 }
1059 1048
1060 /* Initialize scan result lists */ 1049 /* Initialize scan result lists */
1061 INIT_LIST_HEAD(&adapter->network_free_list); 1050 INIT_LIST_HEAD(&priv->network_free_list);
1062 INIT_LIST_HEAD(&adapter->network_list); 1051 INIT_LIST_HEAD(&priv->network_list);
1063 for (i = 0; i < MAX_NETWORK_COUNT; i++) { 1052 for (i = 0; i < MAX_NETWORK_COUNT; i++) {
1064 list_add_tail(&adapter->networks[i].list, 1053 list_add_tail(&priv->networks[i].list,
1065 &adapter->network_free_list); 1054 &priv->network_free_list);
1066 } 1055 }
1067 1056
1068 adapter->lbs_ps_confirm_sleep.seqnum = cpu_to_le16(++adapter->seqnum); 1057 priv->lbs_ps_confirm_sleep.seqnum = cpu_to_le16(++priv->seqnum);
1069 adapter->lbs_ps_confirm_sleep.command = 1058 priv->lbs_ps_confirm_sleep.command =
1070 cpu_to_le16(CMD_802_11_PS_MODE); 1059 cpu_to_le16(CMD_802_11_PS_MODE);
1071 adapter->lbs_ps_confirm_sleep.size = 1060 priv->lbs_ps_confirm_sleep.size =
1072 cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep)); 1061 cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep));
1073 adapter->lbs_ps_confirm_sleep.action = 1062 priv->lbs_ps_confirm_sleep.action =
1074 cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED); 1063 cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED);
1075 1064
1076 memset(adapter->current_addr, 0xff, ETH_ALEN); 1065 memset(priv->current_addr, 0xff, ETH_ALEN);
1077 1066
1078 adapter->connect_status = LBS_DISCONNECTED; 1067 priv->connect_status = LBS_DISCONNECTED;
1079 adapter->mesh_connect_status = LBS_DISCONNECTED; 1068 priv->mesh_connect_status = LBS_DISCONNECTED;
1080 adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM; 1069 priv->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
1081 adapter->mode = IW_MODE_INFRA; 1070 priv->mode = IW_MODE_INFRA;
1082 adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL; 1071 priv->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
1083 adapter->currentpacketfilter = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON; 1072 priv->currentpacketfilter = CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
1084 adapter->radioon = RADIO_ON; 1073 priv->radioon = RADIO_ON;
1085 adapter->auto_rate = 1; 1074 priv->auto_rate = 1;
1086 adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE; 1075 priv->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
1087 adapter->psmode = LBS802_11POWERMODECAM; 1076 priv->psmode = LBS802_11POWERMODECAM;
1088 adapter->psstate = PS_STATE_FULL_POWER; 1077 priv->psstate = PS_STATE_FULL_POWER;
1089 1078
1090 mutex_init(&adapter->lock); 1079 mutex_init(&priv->lock);
1091 1080
1092 memset(&adapter->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*)); 1081 memset(&priv->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*));
1093 adapter->tx_queue_idx = 0; 1082 priv->tx_queue_idx = 0;
1094 spin_lock_init(&adapter->txqueue_lock); 1083 spin_lock_init(&priv->txqueue_lock);
1095 1084
1096 setup_timer(&adapter->command_timer, command_timer_fn, 1085 setup_timer(&priv->command_timer, command_timer_fn,
1097 (unsigned long)priv); 1086 (unsigned long)priv);
1098 1087
1099 INIT_LIST_HEAD(&adapter->cmdfreeq); 1088 INIT_LIST_HEAD(&priv->cmdfreeq);
1100 INIT_LIST_HEAD(&adapter->cmdpendingq); 1089 INIT_LIST_HEAD(&priv->cmdpendingq);
1101 1090
1102 spin_lock_init(&adapter->driver_lock); 1091 spin_lock_init(&priv->driver_lock);
1103 init_waitqueue_head(&adapter->cmd_pending); 1092 init_waitqueue_head(&priv->cmd_pending);
1104 1093
1105 /* Allocate the command buffers */ 1094 /* Allocate the command buffers */
1106 if (lbs_allocate_cmd_buffer(priv)) { 1095 if (lbs_allocate_cmd_buffer(priv)) {
@@ -1114,27 +1103,15 @@ out:
1114 1103
1115static void lbs_free_adapter(struct lbs_private *priv) 1104static void lbs_free_adapter(struct lbs_private *priv)
1116{ 1105{
1117 struct lbs_adapter *adapter = priv->adapter;
1118
1119 if (!adapter) {
1120 lbs_deb_fw("why double free adapter?\n");
1121 return;
1122 }
1123
1124 lbs_deb_fw("free command buffer\n"); 1106 lbs_deb_fw("free command buffer\n");
1125 lbs_free_cmd_buffer(priv); 1107 lbs_free_cmd_buffer(priv);
1126 1108
1127 lbs_deb_fw("free command_timer\n"); 1109 lbs_deb_fw("free command_timer\n");
1128 del_timer(&adapter->command_timer); 1110 del_timer(&priv->command_timer);
1129 1111
1130 lbs_deb_fw("free scan results table\n"); 1112 lbs_deb_fw("free scan results table\n");
1131 kfree(adapter->networks); 1113 kfree(priv->networks);
1132 adapter->networks = NULL; 1114 priv->networks = NULL;
1133
1134 /* Free the adapter object itself */
1135 lbs_deb_fw("free adapter\n");
1136 kfree(adapter);
1137 priv->adapter = NULL;
1138} 1115}
1139 1116
1140/** 1117/**
@@ -1159,13 +1136,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1159 } 1136 }
1160 priv = dev->priv; 1137 priv = dev->priv;
1161 1138
1162 /* allocate buffer for struct lbs_adapter */
1163 priv->adapter = kzalloc(sizeof(struct lbs_adapter), GFP_KERNEL);
1164 if (!priv->adapter) {
1165 lbs_pr_err("allocate buffer for struct lbs_adapter failed\n");
1166 goto err_kzalloc;
1167 }
1168
1169 if (lbs_init_adapter(priv)) { 1139 if (lbs_init_adapter(priv)) {
1170 lbs_pr_err("failed to initialize adapter structure.\n"); 1140 lbs_pr_err("failed to initialize adapter structure.\n");
1171 goto err_init_adapter; 1141 goto err_init_adapter;
@@ -1212,8 +1182,6 @@ struct lbs_private *lbs_add_card(void *card, struct device *dmdev)
1212 1182
1213err_init_adapter: 1183err_init_adapter:
1214 lbs_free_adapter(priv); 1184 lbs_free_adapter(priv);
1215
1216err_kzalloc:
1217 free_netdev(dev); 1185 free_netdev(dev);
1218 priv = NULL; 1186 priv = NULL;
1219 1187
@@ -1226,7 +1194,6 @@ EXPORT_SYMBOL_GPL(lbs_add_card);
1226 1194
1227int lbs_remove_card(struct lbs_private *priv) 1195int lbs_remove_card(struct lbs_private *priv)
1228{ 1196{
1229 struct lbs_adapter *adapter = priv->adapter;
1230 struct net_device *dev = priv->dev; 1197 struct net_device *dev = priv->dev;
1231 union iwreq_data wrqu; 1198 union iwreq_data wrqu;
1232 1199
@@ -1241,8 +1208,8 @@ int lbs_remove_card(struct lbs_private *priv)
1241 cancel_delayed_work(&priv->assoc_work); 1208 cancel_delayed_work(&priv->assoc_work);
1242 destroy_workqueue(priv->work_thread); 1209 destroy_workqueue(priv->work_thread);
1243 1210
1244 if (adapter->psmode == LBS802_11POWERMODEMAX_PSP) { 1211 if (priv->psmode == LBS802_11POWERMODEMAX_PSP) {
1245 adapter->psmode = LBS802_11POWERMODECAM; 1212 priv->psmode = LBS802_11POWERMODECAM;
1246 lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP); 1213 lbs_ps_wakeup(priv, CMD_OPTION_WAITFORRSP);
1247 } 1214 }
1248 1215
@@ -1251,7 +1218,7 @@ int lbs_remove_card(struct lbs_private *priv)
1251 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); 1218 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
1252 1219
1253 /* Stop the thread servicing the interrupts */ 1220 /* Stop the thread servicing the interrupts */
1254 adapter->surpriseremoved = 1; 1221 priv->surpriseremoved = 1;
1255 kthread_stop(priv->main_thread); 1222 kthread_stop(priv->main_thread);
1256 1223
1257 lbs_free_adapter(priv); 1224 lbs_free_adapter(priv);
@@ -1315,12 +1282,12 @@ int lbs_stop_card(struct lbs_private *priv)
1315 lbs_debugfs_remove_one(priv); 1282 lbs_debugfs_remove_one(priv);
1316 1283
1317 /* Flush pending command nodes */ 1284 /* Flush pending command nodes */
1318 spin_lock_irqsave(&priv->adapter->driver_lock, flags); 1285 spin_lock_irqsave(&priv->driver_lock, flags);
1319 list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) { 1286 list_for_each_entry(cmdnode, &priv->cmdpendingq, list) {
1320 cmdnode->cmdwaitqwoken = 1; 1287 cmdnode->cmdwaitqwoken = 1;
1321 wake_up_interruptible(&cmdnode->cmdwait_q); 1288 wake_up_interruptible(&cmdnode->cmdwait_q);
1322 } 1289 }
1323 spin_unlock_irqrestore(&priv->adapter->driver_lock, flags); 1290 spin_unlock_irqrestore(&priv->driver_lock, flags);
1324 1291
1325 unregister_netdev(dev); 1292 unregister_netdev(dev);
1326 1293
@@ -1452,7 +1419,6 @@ struct chan_freq_power *lbs_get_region_cfp_table(u8 region, u8 band, int *cfp_no
1452 1419
1453int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band) 1420int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band)
1454{ 1421{
1455 struct lbs_adapter *adapter = priv->adapter;
1456 int ret = 0; 1422 int ret = 0;
1457 int i = 0; 1423 int i = 0;
1458 1424
@@ -1461,22 +1427,22 @@ int lbs_set_regiontable(struct lbs_private *priv, u8 region, u8 band)
1461 1427
1462 lbs_deb_enter(LBS_DEB_MAIN); 1428 lbs_deb_enter(LBS_DEB_MAIN);
1463 1429
1464 memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); 1430 memset(priv->region_channel, 0, sizeof(priv->region_channel));
1465 1431
1466 { 1432 {
1467 cfp = lbs_get_region_cfp_table(region, band, &cfp_no); 1433 cfp = lbs_get_region_cfp_table(region, band, &cfp_no);
1468 if (cfp != NULL) { 1434 if (cfp != NULL) {
1469 adapter->region_channel[i].nrcfp = cfp_no; 1435 priv->region_channel[i].nrcfp = cfp_no;
1470 adapter->region_channel[i].CFP = cfp; 1436 priv->region_channel[i].CFP = cfp;
1471 } else { 1437 } else {
1472 lbs_deb_main("wrong region code %#x in band B/G\n", 1438 lbs_deb_main("wrong region code %#x in band B/G\n",
1473 region); 1439 region);
1474 ret = -1; 1440 ret = -1;
1475 goto out; 1441 goto out;
1476 } 1442 }
1477 adapter->region_channel[i].valid = 1; 1443 priv->region_channel[i].valid = 1;
1478 adapter->region_channel[i].region = region; 1444 priv->region_channel[i].region = region;
1479 adapter->region_channel[i].band = band; 1445 priv->region_channel[i].band = band;
1480 i++; 1446 i++;
1481 } 1447 }
1482out: 1448out:
@@ -1499,12 +1465,12 @@ void lbs_interrupt(struct net_device *dev)
1499 lbs_deb_enter(LBS_DEB_THREAD); 1465 lbs_deb_enter(LBS_DEB_THREAD);
1500 1466
1501 lbs_deb_thread("lbs_interrupt: intcounter=%d\n", 1467 lbs_deb_thread("lbs_interrupt: intcounter=%d\n",
1502 priv->adapter->intcounter); 1468 priv->intcounter);
1503 1469
1504 priv->adapter->intcounter++; 1470 priv->intcounter++;
1505 1471
1506 if (priv->adapter->psstate == PS_STATE_SLEEP) { 1472 if (priv->psstate == PS_STATE_SLEEP) {
1507 priv->adapter->psstate = PS_STATE_AWAKE; 1473 priv->psstate = PS_STATE_AWAKE;
1508 netif_wake_queue(dev); 1474 netif_wake_queue(dev);
1509 if (priv->mesh_dev) 1475 if (priv->mesh_dev)
1510 netif_wake_queue(priv->mesh_dev); 1476 netif_wake_queue(priv->mesh_dev);