aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r--drivers/net/wireless/airo.c191
1 files changed, 105 insertions, 86 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 864937a409e5..8a0abb668ed4 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -1216,6 +1216,22 @@ static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime);
1216static int flashputbuf(struct airo_info *ai); 1216static int flashputbuf(struct airo_info *ai);
1217static int flashrestart(struct airo_info *ai,struct net_device *dev); 1217static int flashrestart(struct airo_info *ai,struct net_device *dev);
1218 1218
1219#define airo_print(type, name, fmt, args...) \
1220 { printk(type "airo(%s): " fmt "\n", name, ##args); }
1221
1222#define airo_print_info(name, fmt, args...) \
1223 airo_print(KERN_INFO, name, fmt, ##args)
1224
1225#define airo_print_dbg(name, fmt, args...) \
1226 airo_print(KERN_DEBUG, name, fmt, ##args)
1227
1228#define airo_print_warn(name, fmt, args...) \
1229 airo_print(KERN_WARNING, name, fmt, ##args)
1230
1231#define airo_print_err(name, fmt, args...) \
1232 airo_print(KERN_ERR, name, fmt, ##args)
1233
1234
1219/*********************************************************************** 1235/***********************************************************************
1220 * MIC ROUTINES * 1236 * MIC ROUTINES *
1221 *********************************************************************** 1237 ***********************************************************************
@@ -1294,7 +1310,7 @@ static int micsetup(struct airo_info *ai) {
1294 ai->tfm = crypto_alloc_tfm("aes", CRYPTO_TFM_REQ_MAY_SLEEP); 1310 ai->tfm = crypto_alloc_tfm("aes", CRYPTO_TFM_REQ_MAY_SLEEP);
1295 1311
1296 if (ai->tfm == NULL) { 1312 if (ai->tfm == NULL) {
1297 printk(KERN_ERR "airo: failed to load transform for AES\n"); 1313 airo_print_err(ai->dev->name, "failed to load transform for AES");
1298 return ERROR; 1314 return ERROR;
1299 } 1315 }
1300 1316
@@ -1726,11 +1742,11 @@ static int writeWepKeyRid(struct airo_info*ai, WepKeyRid *pwkr, int perm, int lo
1726 wkr.kindex = cpu_to_le16(wkr.kindex); 1742 wkr.kindex = cpu_to_le16(wkr.kindex);
1727 wkr.klen = cpu_to_le16(wkr.klen); 1743 wkr.klen = cpu_to_le16(wkr.klen);
1728 rc = PC4500_writerid(ai, RID_WEP_TEMP, &wkr, sizeof(wkr), lock); 1744 rc = PC4500_writerid(ai, RID_WEP_TEMP, &wkr, sizeof(wkr), lock);
1729 if (rc!=SUCCESS) printk(KERN_ERR "airo: WEP_TEMP set %x\n", rc); 1745 if (rc!=SUCCESS) airo_print_err(ai->dev->name, "WEP_TEMP set %x", rc);
1730 if (perm) { 1746 if (perm) {
1731 rc = PC4500_writerid(ai, RID_WEP_PERM, &wkr, sizeof(wkr), lock); 1747 rc = PC4500_writerid(ai, RID_WEP_PERM, &wkr, sizeof(wkr), lock);
1732 if (rc!=SUCCESS) { 1748 if (rc!=SUCCESS) {
1733 printk(KERN_ERR "airo: WEP_PERM set %x\n", rc); 1749 airo_print_err(ai->dev->name, "WEP_PERM set %x", rc);
1734 } 1750 }
1735 } 1751 }
1736 return rc; 1752 return rc;
@@ -1909,7 +1925,7 @@ static int mpi_start_xmit(struct sk_buff *skb, struct net_device *dev) {
1909 struct airo_info *ai = dev->priv; 1925 struct airo_info *ai = dev->priv;
1910 1926
1911 if (!skb) { 1927 if (!skb) {
1912 printk(KERN_ERR "airo: %s: skb==NULL\n",__FUNCTION__); 1928 airo_print_err(dev->name, "%s: skb == NULL!",__FUNCTION__);
1913 return 0; 1929 return 0;
1914 } 1930 }
1915 npacks = skb_queue_len (&ai->txq); 1931 npacks = skb_queue_len (&ai->txq);
@@ -1955,8 +1971,8 @@ static int mpi_send_packet (struct net_device *dev)
1955 /* get a packet to send */ 1971 /* get a packet to send */
1956 1972
1957 if ((skb = skb_dequeue(&ai->txq)) == 0) { 1973 if ((skb = skb_dequeue(&ai->txq)) == 0) {
1958 printk (KERN_ERR 1974 airo_print_err(dev->name,
1959 "airo: %s: Dequeue'd zero in send_packet()\n", 1975 "%s: Dequeue'd zero in send_packet()",
1960 __FUNCTION__); 1976 __FUNCTION__);
1961 return 0; 1977 return 0;
1962 } 1978 }
@@ -2108,7 +2124,7 @@ static int airo_start_xmit(struct sk_buff *skb, struct net_device *dev) {
2108 u32 *fids = priv->fids; 2124 u32 *fids = priv->fids;
2109 2125
2110 if ( skb == NULL ) { 2126 if ( skb == NULL ) {
2111 printk( KERN_ERR "airo: skb == NULL!!!\n" ); 2127 airo_print_err(dev->name, "%s: skb == NULL!", __FUNCTION__);
2112 return 0; 2128 return 0;
2113 } 2129 }
2114 2130
@@ -2179,7 +2195,7 @@ static int airo_start_xmit11(struct sk_buff *skb, struct net_device *dev) {
2179 } 2195 }
2180 2196
2181 if ( skb == NULL ) { 2197 if ( skb == NULL ) {
2182 printk( KERN_ERR "airo: skb == NULL!!!\n" ); 2198 airo_print_err(dev->name, "%s: skb == NULL!", __FUNCTION__);
2183 return 0; 2199 return 0;
2184 } 2200 }
2185 2201
@@ -2434,7 +2450,7 @@ static int mpi_init_descriptors (struct airo_info *ai)
2434 cmd.parm2 = MPI_MAX_FIDS; 2450 cmd.parm2 = MPI_MAX_FIDS;
2435 rc=issuecommand(ai, &cmd, &rsp); 2451 rc=issuecommand(ai, &cmd, &rsp);
2436 if (rc != SUCCESS) { 2452 if (rc != SUCCESS) {
2437 printk(KERN_ERR "airo: Couldn't allocate RX FID\n"); 2453 airo_print_err(ai->dev->name, "Couldn't allocate RX FID");
2438 return rc; 2454 return rc;
2439 } 2455 }
2440 2456
@@ -2462,7 +2478,7 @@ static int mpi_init_descriptors (struct airo_info *ai)
2462 2478
2463 rc=issuecommand(ai, &cmd, &rsp); 2479 rc=issuecommand(ai, &cmd, &rsp);
2464 if (rc != SUCCESS) { 2480 if (rc != SUCCESS) {
2465 printk(KERN_ERR "airo: Couldn't allocate TX FID\n"); 2481 airo_print_err(ai->dev->name, "Couldn't allocate TX FID");
2466 return rc; 2482 return rc;
2467 } 2483 }
2468 2484
@@ -2476,7 +2492,7 @@ static int mpi_init_descriptors (struct airo_info *ai)
2476 cmd.parm2 = 1; /* Magic number... */ 2492 cmd.parm2 = 1; /* Magic number... */
2477 rc=issuecommand(ai, &cmd, &rsp); 2493 rc=issuecommand(ai, &cmd, &rsp);
2478 if (rc != SUCCESS) { 2494 if (rc != SUCCESS) {
2479 printk(KERN_ERR "airo: Couldn't allocate RID\n"); 2495 airo_print_err(ai->dev->name, "Couldn't allocate RID");
2480 return rc; 2496 return rc;
2481 } 2497 }
2482 2498
@@ -2508,25 +2524,25 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci,
2508 aux_len = AUXMEMSIZE; 2524 aux_len = AUXMEMSIZE;
2509 2525
2510 if (!request_mem_region(mem_start, mem_len, name)) { 2526 if (!request_mem_region(mem_start, mem_len, name)) {
2511 printk(KERN_ERR "airo: Couldn't get region %x[%x] for %s\n", 2527 airo_print_err(ai->dev->name, "Couldn't get region %x[%x] for %s",
2512 (int)mem_start, (int)mem_len, name); 2528 (int)mem_start, (int)mem_len, name);
2513 goto out; 2529 goto out;
2514 } 2530 }
2515 if (!request_mem_region(aux_start, aux_len, name)) { 2531 if (!request_mem_region(aux_start, aux_len, name)) {
2516 printk(KERN_ERR "airo: Couldn't get region %x[%x] for %s\n", 2532 airo_print_err(ai->dev->name, "Couldn't get region %x[%x] for %s",
2517 (int)aux_start, (int)aux_len, name); 2533 (int)aux_start, (int)aux_len, name);
2518 goto free_region1; 2534 goto free_region1;
2519 } 2535 }
2520 2536
2521 ai->pcimem = ioremap(mem_start, mem_len); 2537 ai->pcimem = ioremap(mem_start, mem_len);
2522 if (!ai->pcimem) { 2538 if (!ai->pcimem) {
2523 printk(KERN_ERR "airo: Couldn't map region %x[%x] for %s\n", 2539 airo_print_err(ai->dev->name, "Couldn't map region %x[%x] for %s",
2524 (int)mem_start, (int)mem_len, name); 2540 (int)mem_start, (int)mem_len, name);
2525 goto free_region2; 2541 goto free_region2;
2526 } 2542 }
2527 ai->pciaux = ioremap(aux_start, aux_len); 2543 ai->pciaux = ioremap(aux_start, aux_len);
2528 if (!ai->pciaux) { 2544 if (!ai->pciaux) {
2529 printk(KERN_ERR "airo: Couldn't map region %x[%x] for %s\n", 2545 airo_print_err(ai->dev->name, "Couldn't map region %x[%x] for %s",
2530 (int)aux_start, (int)aux_len, name); 2546 (int)aux_start, (int)aux_len, name);
2531 goto free_memmap; 2547 goto free_memmap;
2532 } 2548 }
@@ -2534,7 +2550,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci,
2534 /* Reserve PKTSIZE for each fid and 2K for the Rids */ 2550 /* Reserve PKTSIZE for each fid and 2K for the Rids */
2535 ai->shared = pci_alloc_consistent(pci, PCI_SHARED_LEN, &ai->shared_dma); 2551 ai->shared = pci_alloc_consistent(pci, PCI_SHARED_LEN, &ai->shared_dma);
2536 if (!ai->shared) { 2552 if (!ai->shared) {
2537 printk(KERN_ERR "airo: Couldn't alloc_consistent %d\n", 2553 airo_print_err(ai->dev->name, "Couldn't alloc_consistent %d",
2538 PCI_SHARED_LEN); 2554 PCI_SHARED_LEN);
2539 goto free_auxmap; 2555 goto free_auxmap;
2540 } 2556 }
@@ -2681,22 +2697,22 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2681 /* Create the network device object. */ 2697 /* Create the network device object. */
2682 dev = alloc_etherdev(sizeof(*ai)); 2698 dev = alloc_etherdev(sizeof(*ai));
2683 if (!dev) { 2699 if (!dev) {
2684 printk(KERN_ERR "airo: Couldn't alloc_etherdev\n"); 2700 airo_print_err("", "Couldn't alloc_etherdev");
2685 return NULL; 2701 return NULL;
2686 } 2702 }
2687 if (dev_alloc_name(dev, dev->name) < 0) { 2703 if (dev_alloc_name(dev, dev->name) < 0) {
2688 printk(KERN_ERR "airo: Couldn't get name!\n"); 2704 airo_print_err("", "Couldn't get name!");
2689 goto err_out_free; 2705 goto err_out_free;
2690 } 2706 }
2691 2707
2692 ai = dev->priv; 2708 ai = dev->priv;
2693 ai->wifidev = NULL; 2709 ai->wifidev = NULL;
2694 ai->flags = 0; 2710 ai->flags = 0;
2711 ai->dev = dev;
2695 if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) { 2712 if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) {
2696 printk(KERN_DEBUG "airo: Found an MPI350 card\n"); 2713 airo_print_dbg(dev->name, "Found an MPI350 card");
2697 set_bit(FLAG_MPI, &ai->flags); 2714 set_bit(FLAG_MPI, &ai->flags);
2698 } 2715 }
2699 ai->dev = dev;
2700 spin_lock_init(&ai->aux_lock); 2716 spin_lock_init(&ai->aux_lock);
2701 sema_init(&ai->sem, 1); 2717 sema_init(&ai->sem, 1);
2702 ai->config.len = 0; 2718 ai->config.len = 0;
@@ -2738,27 +2754,28 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2738 2754
2739 rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev ); 2755 rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev );
2740 if (rc) { 2756 if (rc) {
2741 printk(KERN_ERR "airo: register interrupt %d failed, rc %d\n", irq, rc ); 2757 airo_print_err(dev->name, "register interrupt %d failed, rc %d",
2758 irq, rc);
2742 goto err_out_unlink; 2759 goto err_out_unlink;
2743 } 2760 }
2744 if (!is_pcmcia) { 2761 if (!is_pcmcia) {
2745 if (!request_region( dev->base_addr, 64, dev->name )) { 2762 if (!request_region( dev->base_addr, 64, dev->name )) {
2746 rc = -EBUSY; 2763 rc = -EBUSY;
2747 printk(KERN_ERR "airo: Couldn't request region\n"); 2764 airo_print_err(dev->name, "Couldn't request region");
2748 goto err_out_irq; 2765 goto err_out_irq;
2749 } 2766 }
2750 } 2767 }
2751 2768
2752 if (test_bit(FLAG_MPI,&ai->flags)) { 2769 if (test_bit(FLAG_MPI,&ai->flags)) {
2753 if (mpi_map_card(ai, pci, dev->name)) { 2770 if (mpi_map_card(ai, pci, dev->name)) {
2754 printk(KERN_ERR "airo: Could not map memory\n"); 2771 airo_print_err(dev->name, "Could not map memory");
2755 goto err_out_res; 2772 goto err_out_res;
2756 } 2773 }
2757 } 2774 }
2758 2775
2759 if (probe) { 2776 if (probe) {
2760 if ( setup_card( ai, dev->dev_addr, 1 ) != SUCCESS ) { 2777 if ( setup_card( ai, dev->dev_addr, 1 ) != SUCCESS ) {
2761 printk( KERN_ERR "airo: MAC could not be enabled\n" ); 2778 airo_print_err(dev->name, "MAC could not be enabled" );
2762 rc = -EIO; 2779 rc = -EIO;
2763 goto err_out_map; 2780 goto err_out_map;
2764 } 2781 }
@@ -2769,14 +2786,13 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
2769 2786
2770 rc = register_netdev(dev); 2787 rc = register_netdev(dev);
2771 if (rc) { 2788 if (rc) {
2772 printk(KERN_ERR "airo: Couldn't register_netdev\n"); 2789 airo_print_err(dev->name, "Couldn't register_netdev");
2773 goto err_out_map; 2790 goto err_out_map;
2774 } 2791 }
2775 ai->wifidev = init_wifidev(ai, dev); 2792 ai->wifidev = init_wifidev(ai, dev);
2776 2793
2777 set_bit(FLAG_REGISTERED,&ai->flags); 2794 set_bit(FLAG_REGISTERED,&ai->flags);
2778 printk( KERN_INFO "airo: MAC enabled %s %x:%x:%x:%x:%x:%x\n", 2795 airo_print_info(dev->name, "MAC enabled %x:%x:%x:%x:%x:%x",
2779 dev->name,
2780 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], 2796 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
2781 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] ); 2797 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5] );
2782 2798
@@ -2840,10 +2856,10 @@ int reset_airo_card( struct net_device *dev )
2840 return -1; 2856 return -1;
2841 2857
2842 if ( setup_card(ai, dev->dev_addr, 1 ) != SUCCESS ) { 2858 if ( setup_card(ai, dev->dev_addr, 1 ) != SUCCESS ) {
2843 printk( KERN_ERR "airo: MAC could not be enabled\n" ); 2859 airo_print_err(dev->name, "MAC could not be enabled");
2844 return -1; 2860 return -1;
2845 } 2861 }
2846 printk( KERN_INFO "airo: MAC enabled %s %x:%x:%x:%x:%x:%x\n", dev->name, 2862 airo_print_info(dev->name, "MAC enabled %x:%x:%x:%x:%x:%x",
2847 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], 2863 dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
2848 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); 2864 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
2849 /* Allocate the transmit buffers if needed */ 2865 /* Allocate the transmit buffers if needed */
@@ -3118,7 +3134,7 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3118 len = le16_to_cpu(hdr.len); 3134 len = le16_to_cpu(hdr.len);
3119 3135
3120 if (len > 2312) { 3136 if (len > 2312) {
3121 printk( KERN_ERR "airo: Bad size %d\n", len ); 3137 airo_print_err(apriv->dev->name, "Bad size %d", len);
3122 goto badrx; 3138 goto badrx;
3123 } 3139 }
3124 if (len == 0) 3140 if (len == 0)
@@ -3161,10 +3177,12 @@ static irqreturn_t airo_interrupt ( int irq, void* dev_id, struct pt_regs *regs)
3161 bap_read (apriv, &gap, sizeof(gap), BAP0); 3177 bap_read (apriv, &gap, sizeof(gap), BAP0);
3162 gap = le16_to_cpu(gap); 3178 gap = le16_to_cpu(gap);
3163 if (gap) { 3179 if (gap) {
3164 if (gap <= 8) 3180 if (gap <= 8) {
3165 bap_read (apriv, tmpbuf, gap, BAP0); 3181 bap_read (apriv, tmpbuf, gap, BAP0);
3166 else 3182 } else {
3167 printk(KERN_ERR "airo: gaplen too big. Problems will follow...\n"); 3183 airo_print_err(apriv->dev->name, "gaplen too "
3184 "big. Problems will follow...");
3185 }
3168 } 3186 }
3169 bap_read (apriv, buffer + hdrlen/2, len, BAP0); 3187 bap_read (apriv, buffer + hdrlen/2, len, BAP0);
3170 } else { 3188 } else {
@@ -3281,12 +3299,13 @@ exitrx:
3281 } 3299 }
3282 } else { 3300 } else {
3283 OUT4500( apriv, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC)); 3301 OUT4500( apriv, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC));
3284 printk( KERN_ERR "airo: Unallocated FID was used to xmit\n" ); 3302 airo_print_err(apriv->dev->name, "Unallocated FID was "
3303 "used to xmit" );
3285 } 3304 }
3286 } 3305 }
3287exittx: 3306exittx:
3288 if ( status & ~STATUS_INTS & ~IGNORE_INTS ) 3307 if ( status & ~STATUS_INTS & ~IGNORE_INTS )
3289 printk( KERN_WARNING "airo: Got weird status %x\n", 3308 airo_print_warn(apriv->dev->name, "Got weird status %x",
3290 status & ~STATUS_INTS & ~IGNORE_INTS ); 3309 status & ~STATUS_INTS & ~IGNORE_INTS );
3291 } 3310 }
3292 3311
@@ -3359,8 +3378,8 @@ static int enable_MAC( struct airo_info *ai, Resp *rsp, int lock ) {
3359 up(&ai->sem); 3378 up(&ai->sem);
3360 3379
3361 if (rc) 3380 if (rc)
3362 printk(KERN_ERR "%s: Cannot enable MAC, err=%d\n", 3381 airo_print_err(ai->dev->name, "%s: Cannot enable MAC, err=%d",
3363 __FUNCTION__,rc); 3382 __FUNCTION__, rc);
3364 return rc; 3383 return rc;
3365} 3384}
3366 3385
@@ -3490,7 +3509,7 @@ void mpi_receive_802_11 (struct airo_info *ai)
3490 hdr.len = 0; 3509 hdr.len = 0;
3491 len = le16_to_cpu(hdr.len); 3510 len = le16_to_cpu(hdr.len);
3492 if (len > 2312) { 3511 if (len > 2312) {
3493 printk( KERN_ERR "airo: Bad size %d\n", len ); 3512 airo_print_err(ai->dev->name, "Bad size %d", len);
3494 goto badrx; 3513 goto badrx;
3495 } 3514 }
3496 if (len == 0) 3515 if (len == 0)
@@ -3531,8 +3550,8 @@ void mpi_receive_802_11 (struct airo_info *ai)
3531 if (gap <= 8) 3550 if (gap <= 8)
3532 ptr += gap; 3551 ptr += gap;
3533 else 3552 else
3534 printk(KERN_ERR 3553 airo_print_err(ai->dev->name,
3535 "airo: gaplen too big. Problems will follow...\n"); 3554 "gaplen too big. Problems will follow...");
3536 } 3555 }
3537 memcpy ((char *)buffer + hdrlen, ptr, len); 3556 memcpy ((char *)buffer + hdrlen, ptr, len);
3538 ptr += len; 3557 ptr += len;
@@ -3604,15 +3623,15 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
3604 if (issuecommand(ai, &cmd, &rsp) != SUCCESS) { 3623 if (issuecommand(ai, &cmd, &rsp) != SUCCESS) {
3605 if (lock) 3624 if (lock)
3606 up(&ai->sem); 3625 up(&ai->sem);
3607 printk(KERN_ERR "airo: Error checking for AUX port\n"); 3626 airo_print_err(ai->dev->name, "Error checking for AUX port");
3608 return ERROR; 3627 return ERROR;
3609 } 3628 }
3610 if (!aux_bap || rsp.status & 0xff00) { 3629 if (!aux_bap || rsp.status & 0xff00) {
3611 ai->bap_read = fast_bap_read; 3630 ai->bap_read = fast_bap_read;
3612 printk(KERN_DEBUG "airo: Doing fast bap_reads\n"); 3631 airo_print_dbg(ai->dev->name, "Doing fast bap_reads");
3613 } else { 3632 } else {
3614 ai->bap_read = aux_bap_read; 3633 ai->bap_read = aux_bap_read;
3615 printk(KERN_DEBUG "airo: Doing AUX bap_reads\n"); 3634 airo_print_dbg(ai->dev->name, "Doing AUX bap_reads");
3616 } 3635 }
3617 } 3636 }
3618 if (lock) 3637 if (lock)
@@ -3643,7 +3662,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
3643 if (cap_rid.softCap & 8) 3662 if (cap_rid.softCap & 8)
3644 ai->config.rmode |= RXMODE_NORMALIZED_RSSI; 3663 ai->config.rmode |= RXMODE_NORMALIZED_RSSI;
3645 else 3664 else
3646 printk(KERN_WARNING "airo: unknown received signal level scale\n"); 3665 airo_print_warn(ai->dev->name, "unknown received signal "
3666 "level scale");
3647 } 3667 }
3648 ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS; 3668 ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS;
3649 ai->config.authType = AUTH_OPEN; 3669 ai->config.authType = AUTH_OPEN;
@@ -3706,7 +3726,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
3706 3726
3707 status = enable_MAC(ai, &rsp, lock); 3727 status = enable_MAC(ai, &rsp, lock);
3708 if ( status != SUCCESS || (rsp.status & 0xFF00) != 0) { 3728 if ( status != SUCCESS || (rsp.status & 0xFF00) != 0) {
3709 printk( KERN_ERR "airo: Bad MAC enable reason = %x, rid = %x, offset = %d\n", rsp.rsp0, rsp.rsp1, rsp.rsp2 ); 3729 airo_print_err(ai->dev->name, "Bad MAC enable reason = %x, rid = %x,"
3730 " offset = %d", rsp.rsp0, rsp.rsp1, rsp.rsp2 );
3710 return ERROR; 3731 return ERROR;
3711 } 3732 }
3712 3733
@@ -3749,8 +3770,8 @@ static u16 issuecommand(struct airo_info *ai, Cmd *pCmd, Resp *pRsp) {
3749 } 3770 }
3750 3771
3751 if ( max_tries == -1 ) { 3772 if ( max_tries == -1 ) {
3752 printk( KERN_ERR 3773 airo_print_err(ai->dev->name,
3753 "airo: Max tries exceeded when issueing command\n" ); 3774 "Max tries exceeded when issueing command");
3754 if (IN4500(ai, COMMAND) & COMMAND_BUSY) 3775 if (IN4500(ai, COMMAND) & COMMAND_BUSY)
3755 OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY); 3776 OUT4500(ai, EVACK, EV_CLEARCOMMANDBUSY);
3756 return ERROR; 3777 return ERROR;
@@ -3762,11 +3783,11 @@ static u16 issuecommand(struct airo_info *ai, Cmd *pCmd, Resp *pRsp) {
3762 pRsp->rsp1 = IN4500(ai, RESP1); 3783 pRsp->rsp1 = IN4500(ai, RESP1);
3763 pRsp->rsp2 = IN4500(ai, RESP2); 3784 pRsp->rsp2 = IN4500(ai, RESP2);
3764 if ((pRsp->status & 0xff00)!=0 && pCmd->cmd != CMD_SOFTRESET) { 3785 if ((pRsp->status & 0xff00)!=0 && pCmd->cmd != CMD_SOFTRESET) {
3765 printk (KERN_ERR "airo: cmd= %x\n", pCmd->cmd); 3786 airo_print_err(ai->dev->name, "cmd= %x\n", pCmd->cmd);
3766 printk (KERN_ERR "airo: status= %x\n", pRsp->status); 3787 airo_print_err(ai->dev->name, "status= %x\n", pRsp->status);
3767 printk (KERN_ERR "airo: Rsp0= %x\n", pRsp->rsp0); 3788 airo_print_err(ai->dev->name, "Rsp0= %x\n", pRsp->rsp0);
3768 printk (KERN_ERR "airo: Rsp1= %x\n", pRsp->rsp1); 3789 airo_print_err(ai->dev->name, "Rsp1= %x\n", pRsp->rsp1);
3769 printk (KERN_ERR "airo: Rsp2= %x\n", pRsp->rsp2); 3790 airo_print_err(ai->dev->name, "Rsp2= %x\n", pRsp->rsp2);
3770 } 3791 }
3771 3792
3772 // clear stuck command busy if necessary 3793 // clear stuck command busy if necessary
@@ -3799,15 +3820,15 @@ static int bap_setup(struct airo_info *ai, u16 rid, u16 offset, int whichbap )
3799 } 3820 }
3800 } else if ( status & BAP_ERR ) { 3821 } else if ( status & BAP_ERR ) {
3801 /* invalid rid or offset */ 3822 /* invalid rid or offset */
3802 printk( KERN_ERR "airo: BAP error %x %d\n", 3823 airo_print_err(ai->dev->name, "BAP error %x %d",
3803 status, whichbap ); 3824 status, whichbap );
3804 return ERROR; 3825 return ERROR;
3805 } else if (status & BAP_DONE) { // success 3826 } else if (status & BAP_DONE) { // success
3806 return SUCCESS; 3827 return SUCCESS;
3807 } 3828 }
3808 if ( !(max_tries--) ) { 3829 if ( !(max_tries--) ) {
3809 printk( KERN_ERR 3830 airo_print_err(ai->dev->name,
3810 "airo: BAP setup error too many retries\n" ); 3831 "airo: BAP setup error too many retries\n");
3811 return ERROR; 3832 return ERROR;
3812 } 3833 }
3813 // -- PC4500 missed it, try again 3834 // -- PC4500 missed it, try again
@@ -3962,8 +3983,8 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, in
3962 len = min(len, (int)le16_to_cpu(*(u16*)pBuf)) - 2; 3983 len = min(len, (int)le16_to_cpu(*(u16*)pBuf)) - 2;
3963 3984
3964 if ( len <= 2 ) { 3985 if ( len <= 2 ) {
3965 printk( KERN_ERR 3986 airo_print_err(ai->dev->name,
3966 "airo: Rid %x has a length of %d which is too short\n", 3987 "Rid %x has a length of %d which is too short",
3967 (int)rid, (int)len ); 3988 (int)rid, (int)len );
3968 rc = ERROR; 3989 rc = ERROR;
3969 goto done; 3990 goto done;
@@ -3996,8 +4017,8 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
3996 Resp rsp; 4017 Resp rsp;
3997 4018
3998 if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid)) 4019 if (test_bit(FLAG_ENABLED, &ai->flags) && (RID_WEP_TEMP != rid))
3999 printk(KERN_ERR 4020 airo_print_err(ai->dev->name,
4000 "%s: MAC should be disabled (rid=%04x)\n", 4021 "%s: MAC should be disabled (rid=%04x)",
4001 __FUNCTION__, rid); 4022 __FUNCTION__, rid);
4002 memset(&cmd, 0, sizeof(cmd)); 4023 memset(&cmd, 0, sizeof(cmd));
4003 memset(&rsp, 0, sizeof(rsp)); 4024 memset(&rsp, 0, sizeof(rsp));
@@ -4013,7 +4034,7 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
4013 &ai->config_desc.rid_desc, sizeof(Rid)); 4034 &ai->config_desc.rid_desc, sizeof(Rid));
4014 4035
4015 if (len < 4 || len > 2047) { 4036 if (len < 4 || len > 2047) {
4016 printk(KERN_ERR "%s: len=%d\n",__FUNCTION__,len); 4037 airo_print_err(ai->dev->name, "%s: len=%d", __FUNCTION__, len);
4017 rc = -1; 4038 rc = -1;
4018 } else { 4039 } else {
4019 memcpy((char *)ai->config_desc.virtual_host_addr, 4040 memcpy((char *)ai->config_desc.virtual_host_addr,
@@ -4021,10 +4042,10 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
4021 4042
4022 rc = issuecommand(ai, &cmd, &rsp); 4043 rc = issuecommand(ai, &cmd, &rsp);
4023 if ((rc & 0xff00) != 0) { 4044 if ((rc & 0xff00) != 0) {
4024 printk(KERN_ERR "%s: Write rid Error %d\n", 4045 airo_print_err(ai->dev->name, "%s: Write rid Error %d",
4025 __FUNCTION__,rc); 4046 __FUNCTION__, rc);
4026 printk(KERN_ERR "%s: Cmd=%04x\n", 4047 airo_print_err(ai->dev->name, "%s: Cmd=%04x",
4027 __FUNCTION__,cmd.cmd); 4048 __FUNCTION__, cmd.cmd);
4028 } 4049 }
4029 4050
4030 if ((rsp.status & 0x7f00)) 4051 if ((rsp.status & 0x7f00))
@@ -4123,7 +4144,7 @@ static int transmit_802_3_packet(struct airo_info *ai, int len, char *pPacket)
4123 len >>= 16; 4144 len >>= 16;
4124 4145
4125 if (len <= ETH_ALEN * 2) { 4146 if (len <= ETH_ALEN * 2) {
4126 printk( KERN_WARNING "Short packet %d\n", len ); 4147 airo_print_warn(ai->dev->name, "Short packet %d", len);
4127 return ERROR; 4148 return ERROR;
4128 } 4149 }
4129 len -= ETH_ALEN * 2; 4150 len -= ETH_ALEN * 2;
@@ -4187,7 +4208,7 @@ static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket)
4187 } 4208 }
4188 4209
4189 if (len < hdrlen) { 4210 if (len < hdrlen) {
4190 printk( KERN_WARNING "Short packet %d\n", len ); 4211 airo_print_warn(ai->dev->name, "Short packet %d", len);
4191 return ERROR; 4212 return ERROR;
4192 } 4213 }
4193 4214
@@ -4584,15 +4605,14 @@ static int proc_stats_rid_open( struct inode *inode,
4584 i*4<stats.len; i++){ 4605 i*4<stats.len; i++){
4585 if (!statsLabels[i]) continue; 4606 if (!statsLabels[i]) continue;
4586 if (j+strlen(statsLabels[i])+16>4096) { 4607 if (j+strlen(statsLabels[i])+16>4096) {
4587 printk(KERN_WARNING 4608 airo_print_warn(apriv->dev->name,
4588 "airo: Potentially disasterous buffer overflow averted!\n"); 4609 "Potentially disasterous buffer overflow averted!");
4589 break; 4610 break;
4590 } 4611 }
4591 j+=sprintf(data->rbuffer+j, "%s: %u\n", statsLabels[i], vals[i]); 4612 j+=sprintf(data->rbuffer+j, "%s: %u\n", statsLabels[i], vals[i]);
4592 } 4613 }
4593 if (i*4>=stats.len){ 4614 if (i*4>=stats.len){
4594 printk(KERN_WARNING 4615 airo_print_warn(apriv->dev->name, "Got a short rid");
4595 "airo: Got a short rid\n");
4596 } 4616 }
4597 data->readlen = j; 4617 data->readlen = j;
4598 return 0; 4618 return 0;
@@ -4798,8 +4818,7 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
4798 case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break; 4818 case 'd': ai->config.modulation=MOD_DEFAULT; set_bit(FLAG_COMMIT, &ai->flags); break;
4799 case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break; 4819 case 'c': ai->config.modulation=MOD_CCK; set_bit(FLAG_COMMIT, &ai->flags); break;
4800 case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break; 4820 case 'm': ai->config.modulation=MOD_MOK; set_bit(FLAG_COMMIT, &ai->flags); break;
4801 default: 4821 default: airo_print_warn(ai->dev->name, "Unknown modulation");
4802 printk( KERN_WARNING "airo: Unknown modulation\n" );
4803 } 4822 }
4804 } else if (!strncmp(line, "Preamble: ", 10)) { 4823 } else if (!strncmp(line, "Preamble: ", 10)) {
4805 line += 10; 4824 line += 10;
@@ -4807,10 +4826,10 @@ static void proc_config_on_close( struct inode *inode, struct file *file ) {
4807 case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break; 4826 case 'a': ai->config.preamble=PREAMBLE_AUTO; set_bit(FLAG_COMMIT, &ai->flags); break;
4808 case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break; 4827 case 'l': ai->config.preamble=PREAMBLE_LONG; set_bit(FLAG_COMMIT, &ai->flags); break;
4809 case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break; 4828 case 's': ai->config.preamble=PREAMBLE_SHORT; set_bit(FLAG_COMMIT, &ai->flags); break;
4810 default: printk(KERN_WARNING "airo: Unknown preamble\n"); 4829 default: airo_print_warn(ai->dev->name, "Unknown preamble");
4811 } 4830 }
4812 } else { 4831 } else {
4813 printk( KERN_WARNING "Couldn't figure out %s\n", line ); 4832 airo_print_warn(ai->dev->name, "Couldn't figure out %s", line);
4814 } 4833 }
4815 while( line[0] && line[0] != '\n' ) line++; 4834 while( line[0] && line[0] != '\n' ) line++;
4816 if ( line[0] ) line++; 4835 if ( line[0] ) line++;
@@ -5076,7 +5095,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
5076 } 5095 }
5077 j = 2; 5096 j = 2;
5078 } else { 5097 } else {
5079 printk(KERN_ERR "airo: WepKey passed invalid key index\n"); 5098 airo_print_err(ai->dev->name, "WepKey passed invalid key index");
5080 return; 5099 return;
5081 } 5100 }
5082 5101
@@ -5489,17 +5508,16 @@ static int __init airo_init_module( void )
5489 airo_entry->gid = proc_gid; 5508 airo_entry->gid = proc_gid;
5490 5509
5491 for( i = 0; i < 4 && io[i] && irq[i]; i++ ) { 5510 for( i = 0; i < 4 && io[i] && irq[i]; i++ ) {
5492 printk( KERN_INFO 5511 airo_print_info("", "Trying to configure ISA adapter at irq=%d "
5493 "airo: Trying to configure ISA adapter at irq=%d io=0x%x\n", 5512 "io=0x%x", irq[i], io[i] );
5494 irq[i], io[i] );
5495 if (init_airo_card( irq[i], io[i], 0, NULL )) 5513 if (init_airo_card( irq[i], io[i], 0, NULL ))
5496 have_isa_dev = 1; 5514 have_isa_dev = 1;
5497 } 5515 }
5498 5516
5499#ifdef CONFIG_PCI 5517#ifdef CONFIG_PCI
5500 printk( KERN_INFO "airo: Probing for PCI adapters\n" ); 5518 airo_print_info("", "Probing for PCI adapters");
5501 pci_register_driver(&airo_driver); 5519 pci_register_driver(&airo_driver);
5502 printk( KERN_INFO "airo: Finished probing for PCI adapters\n" ); 5520 airo_print_info("", "Finished probing for PCI adapters");
5503#endif 5521#endif
5504 5522
5505 /* Always exit with success, as we are a library module 5523 /* Always exit with success, as we are a library module
@@ -5511,7 +5529,7 @@ static int __init airo_init_module( void )
5511static void __exit airo_cleanup_module( void ) 5529static void __exit airo_cleanup_module( void )
5512{ 5530{
5513 while( airo_devices ) { 5531 while( airo_devices ) {
5514 printk( KERN_INFO "airo: Unregistering %s\n", airo_devices->dev->name ); 5532 airo_print_info(airo_devices->dev->name, "Unregistering...\n");
5515 stop_airo_card( airo_devices->dev, 1 ); 5533 stop_airo_card( airo_devices->dev, 1 );
5516 } 5534 }
5517#ifdef CONFIG_PCI 5535#ifdef CONFIG_PCI
@@ -5622,7 +5640,8 @@ static int airo_set_freq(struct net_device *dev,
5622 /* We should do a better check than that, 5640 /* We should do a better check than that,
5623 * based on the card capability !!! */ 5641 * based on the card capability !!! */
5624 if((channel < 1) || (channel > 14)) { 5642 if((channel < 1) || (channel > 14)) {
5625 printk(KERN_DEBUG "%s: New channel value of %d is invalid!\n", dev->name, fwrq->m); 5643 airo_print_dbg(dev->name, "New channel value of %d is invalid!",
5644 fwrq->m);
5626 rc = -EINVAL; 5645 rc = -EINVAL;
5627 } else { 5646 } else {
5628 readConfigRid(local, 1); 5647 readConfigRid(local, 1);
@@ -7711,7 +7730,7 @@ static int cmdreset(struct airo_info *ai) {
7711 disable_MAC(ai, 1); 7730 disable_MAC(ai, 1);
7712 7731
7713 if(!waitbusy (ai)){ 7732 if(!waitbusy (ai)){
7714 printk(KERN_INFO "Waitbusy hang before RESET\n"); 7733 airo_print_info(ai->dev->name, "Waitbusy hang before RESET");
7715 return -EBUSY; 7734 return -EBUSY;
7716 } 7735 }
7717 7736
@@ -7720,7 +7739,7 @@ static int cmdreset(struct airo_info *ai) {
7720 ssleep(1); /* WAS 600 12/7/00 */ 7739 ssleep(1); /* WAS 600 12/7/00 */
7721 7740
7722 if(!waitbusy (ai)){ 7741 if(!waitbusy (ai)){
7723 printk(KERN_INFO "Waitbusy hang AFTER RESET\n"); 7742 airo_print_info(ai->dev->name, "Waitbusy hang AFTER RESET");
7724 return -EBUSY; 7743 return -EBUSY;
7725 } 7744 }
7726 return 0; 7745 return 0;
@@ -7748,7 +7767,7 @@ static int setflashmode (struct airo_info *ai) {
7748 7767
7749 if(!waitbusy(ai)) { 7768 if(!waitbusy(ai)) {
7750 clear_bit (FLAG_FLASHING, &ai->flags); 7769 clear_bit (FLAG_FLASHING, &ai->flags);
7751 printk(KERN_INFO "Waitbusy hang after setflash mode\n"); 7770 airo_print_info(ai->dev->name, "Waitbusy hang after setflash mode");
7752 return -EIO; 7771 return -EIO;
7753 } 7772 }
7754 return 0; 7773 return 0;
@@ -7777,7 +7796,7 @@ static int flashpchar(struct airo_info *ai,int byte,int dwelltime) {
7777 7796
7778 /* timeout for busy clear wait */ 7797 /* timeout for busy clear wait */
7779 if(waittime <= 0 ){ 7798 if(waittime <= 0 ){
7780 printk(KERN_INFO "flash putchar busywait timeout! \n"); 7799 airo_print_info(ai->dev->name, "flash putchar busywait timeout!");
7781 return -EBUSY; 7800 return -EBUSY;
7782 } 7801 }
7783 7802