diff options
Diffstat (limited to 'drivers/staging/rt2870/rt_main_dev.c')
-rw-r--r-- | drivers/staging/rt2870/rt_main_dev.c | 112 |
1 files changed, 7 insertions, 105 deletions
diff --git a/drivers/staging/rt2870/rt_main_dev.c b/drivers/staging/rt2870/rt_main_dev.c index 48ad41136d0..1abd46d53df 100644 --- a/drivers/staging/rt2870/rt_main_dev.c +++ b/drivers/staging/rt2870/rt_main_dev.c | |||
@@ -54,11 +54,7 @@ static UINT8 MC_CardMac[MAX_NUM_OF_MULTIPLE_CARD][6]; | |||
54 | 54 | ||
55 | char *mac = ""; // default 00:00:00:00:00:00 | 55 | char *mac = ""; // default 00:00:00:00:00:00 |
56 | char *hostname = ""; | 56 | char *hostname = ""; |
57 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12) | ||
58 | MODULE_PARM (mac, "s"); | ||
59 | #else | ||
60 | module_param (mac, charp, 0); | 57 | module_param (mac, charp, 0); |
61 | #endif | ||
62 | MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr"); | 58 | MODULE_PARM_DESC (mac, "rt28xx: wireless mac addr"); |
63 | 59 | ||
64 | 60 | ||
@@ -80,13 +76,6 @@ INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p, | |||
80 | static int rt28xx_init(IN struct net_device *net_dev); | 76 | static int rt28xx_init(IN struct net_device *net_dev); |
81 | INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); | 77 | INT rt28xx_send_packets(IN struct sk_buff *skb_p, IN struct net_device *net_dev); |
82 | 78 | ||
83 | #if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1 | ||
84 | struct net_device *alloc_netdev( | ||
85 | int sizeof_priv, | ||
86 | const char *mask, | ||
87 | void (*setup)(struct net_device *)); | ||
88 | #endif // LINUX_VERSION_CODE // | ||
89 | |||
90 | static void CfgInitHook(PRTMP_ADAPTER pAd); | 79 | static void CfgInitHook(PRTMP_ADAPTER pAd); |
91 | //static BOOLEAN RT28XXAvailRANameAssign(IN CHAR *name_p); | 80 | //static BOOLEAN RT28XXAvailRANameAssign(IN CHAR *name_p); |
92 | 81 | ||
@@ -350,11 +339,7 @@ int rt28xx_close(IN PNET_DEV dev) | |||
350 | } | 339 | } |
351 | RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); | 340 | RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags); |
352 | 341 | ||
353 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) | ||
354 | msleep(UNLINK_TIMEOUT_MS); //Time in millisecond | 342 | msleep(UNLINK_TIMEOUT_MS); //Time in millisecond |
355 | #else | ||
356 | RTMPusecDelay(UNLINK_TIMEOUT_MS*1000); //Time in microsecond | ||
357 | #endif | ||
358 | i++; | 343 | i++; |
359 | } | 344 | } |
360 | pAd->wait = NULL; | 345 | pAd->wait = NULL; |
@@ -917,25 +902,11 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p | |||
917 | #endif // MULTIPLE_CARD_SUPPORT // | 902 | #endif // MULTIPLE_CARD_SUPPORT // |
918 | sprintf(slot_name, "ra%d", i); | 903 | sprintf(slot_name, "ra%d", i); |
919 | 904 | ||
920 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | 905 | device = dev_get_by_name(dev_net(dev), slot_name); |
921 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) | 906 | if (device != NULL) |
922 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26) | 907 | dev_put(device); |
923 | device = dev_get_by_name(dev_net(dev), slot_name); | 908 | |
924 | #else | 909 | if (device == NULL) |
925 | device = dev_get_by_name(dev->nd_net, slot_name); | ||
926 | #endif | ||
927 | #else | ||
928 | device = dev_get_by_name(slot_name); | ||
929 | #endif | ||
930 | if (device != NULL) dev_put(device); | ||
931 | #else | ||
932 | for (device = dev_base; device != NULL; device = device->next) | ||
933 | { | ||
934 | if (strncmp(device->name, slot_name, 4) == 0) | ||
935 | break; | ||
936 | } | ||
937 | #endif | ||
938 | if(device == NULL) | ||
939 | break; | 910 | break; |
940 | } | 911 | } |
941 | 912 | ||
@@ -1353,14 +1324,10 @@ INT __devinit rt28xx_probe( | |||
1353 | INT status; | 1324 | INT status; |
1354 | PVOID handle; | 1325 | PVOID handle; |
1355 | #ifdef RT2870 | 1326 | #ifdef RT2870 |
1356 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* kernel 2.4 series */ | ||
1357 | struct usb_device *dev_p = (struct usb_device *)_dev_p; | ||
1358 | #else | ||
1359 | struct usb_interface *intf = (struct usb_interface *)_dev_p; | 1327 | struct usb_interface *intf = (struct usb_interface *)_dev_p; |
1360 | struct usb_device *dev_p = interface_to_usbdev(intf); | 1328 | struct usb_device *dev_p = interface_to_usbdev(intf); |
1361 | 1329 | ||
1362 | dev_p = usb_get_dev(dev_p); | 1330 | dev_p = usb_get_dev(dev_p); |
1363 | #endif // LINUX_VERSION_CODE // | ||
1364 | #endif // RT2870 // | 1331 | #endif // RT2870 // |
1365 | 1332 | ||
1366 | 1333 | ||
@@ -1372,22 +1339,11 @@ INT __devinit rt28xx_probe( | |||
1372 | // if (RT28XXChipsetCheck(_dev_p) == FALSE) | 1339 | // if (RT28XXChipsetCheck(_dev_p) == FALSE) |
1373 | // goto err_out; | 1340 | // goto err_out; |
1374 | 1341 | ||
1375 | #if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1 | ||
1376 | net_dev = alloc_netdev(sizeof(PRTMP_ADAPTER), "eth%d", ether_setup); | ||
1377 | #else | ||
1378 | net_dev = alloc_etherdev(sizeof(PRTMP_ADAPTER)); | 1342 | net_dev = alloc_etherdev(sizeof(PRTMP_ADAPTER)); |
1379 | #endif | ||
1380 | if (net_dev == NULL) | 1343 | if (net_dev == NULL) |
1381 | { | 1344 | { |
1382 | printk("alloc_netdev failed\n"); | 1345 | printk("alloc_netdev failed\n"); |
1383 | 1346 | ||
1384 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
1385 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) | ||
1386 | module_put(THIS_MODULE); | ||
1387 | #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) | ||
1388 | #else | ||
1389 | MOD_DEC_USE_COUNT; | ||
1390 | #endif | ||
1391 | goto err_out; | 1347 | goto err_out; |
1392 | } | 1348 | } |
1393 | 1349 | ||
@@ -1395,19 +1351,13 @@ INT __devinit rt28xx_probe( | |||
1395 | // if (rt_ieee80211_if_setup(net_dev) != NDIS_STATUS_SUCCESS) | 1351 | // if (rt_ieee80211_if_setup(net_dev) != NDIS_STATUS_SUCCESS) |
1396 | // goto err_out; | 1352 | // goto err_out; |
1397 | 1353 | ||
1398 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) | ||
1399 | SET_MODULE_OWNER(net_dev); | ||
1400 | #endif | ||
1401 | |||
1402 | netif_stop_queue(net_dev); | 1354 | netif_stop_queue(net_dev); |
1403 | #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT | 1355 | #ifdef NATIVE_WPA_SUPPLICANT_SUPPORT |
1404 | /* for supporting Network Manager */ | 1356 | /* for supporting Network Manager */ |
1405 | /* Set the sysfs physical device reference for the network logical device | 1357 | /* Set the sysfs physical device reference for the network logical device |
1406 | * if set prior to registration will cause a symlink during initialization. | 1358 | * if set prior to registration will cause a symlink during initialization. |
1407 | */ | 1359 | */ |
1408 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) | ||
1409 | SET_NETDEV_DEV(net_dev, &(dev_p->dev)); | 1360 | SET_NETDEV_DEV(net_dev, &(dev_p->dev)); |
1410 | #endif | ||
1411 | #endif // NATIVE_WPA_SUPPLICANT_SUPPORT // | 1361 | #endif // NATIVE_WPA_SUPPLICANT_SUPPORT // |
1412 | 1362 | ||
1413 | // Allocate RTMP_ADAPTER miniport adapter structure | 1363 | // Allocate RTMP_ADAPTER miniport adapter structure |
@@ -1431,13 +1381,8 @@ INT __devinit rt28xx_probe( | |||
1431 | // RT28XXAvailRANameAssign(net_dev->name); | 1381 | // RT28XXAvailRANameAssign(net_dev->name); |
1432 | 1382 | ||
1433 | // Post config | 1383 | // Post config |
1434 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
1435 | if (RT28XXProbePostConfig(_dev_p, pAd, argc) == FALSE) | ||
1436 | goto err_out_unmap; | ||
1437 | #else | ||
1438 | if (RT28XXProbePostConfig(_dev_p, pAd, 0) == FALSE) | 1384 | if (RT28XXProbePostConfig(_dev_p, pAd, 0) == FALSE) |
1439 | goto err_out_unmap; | 1385 | goto err_out_unmap; |
1440 | #endif // LINUX_VERSION_CODE // | ||
1441 | 1386 | ||
1442 | #ifdef CONFIG_STA_SUPPORT | 1387 | #ifdef CONFIG_STA_SUPPORT |
1443 | pAd->OpMode = OPMODE_STA; | 1388 | pAd->OpMode = OPMODE_STA; |
@@ -1482,20 +1427,12 @@ err_out_unmap: | |||
1482 | RT28XX_UNMAP(); | 1427 | RT28XX_UNMAP(); |
1483 | 1428 | ||
1484 | err_out_free_netdev: | 1429 | err_out_free_netdev: |
1485 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | 1430 | free_netdev(net_dev); |
1486 | free_netdev(net_dev); | ||
1487 | #else | ||
1488 | kfree(net_dev); | ||
1489 | #endif | ||
1490 | 1431 | ||
1491 | err_out: | 1432 | err_out: |
1492 | RT28XX_PUT_DEVICE(dev_p); | 1433 | RT28XX_PUT_DEVICE(dev_p); |
1493 | 1434 | ||
1494 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | 1435 | return -ENODEV; /* probe fail */ |
1495 | return (LONG)NULL; | ||
1496 | #else | ||
1497 | return -ENODEV; /* probe fail */ | ||
1498 | #endif // LINUX_VERSION_CODE // | ||
1499 | } /* End of rt28xx_probe */ | 1436 | } /* End of rt28xx_probe */ |
1500 | 1437 | ||
1501 | 1438 | ||
@@ -1624,41 +1561,6 @@ INT rt28xx_send_packets( | |||
1624 | 1561 | ||
1625 | 1562 | ||
1626 | 1563 | ||
1627 | #if LINUX_VERSION_CODE <= 0x20402 // Red Hat 7.1 | ||
1628 | //static struct net_device *alloc_netdev(int sizeof_priv, const char *mask, void (*setup)(struct net_device *)) //sample | ||
1629 | struct net_device *alloc_netdev( | ||
1630 | int sizeof_priv, | ||
1631 | const char *mask, | ||
1632 | void (*setup)(struct net_device *)) | ||
1633 | { | ||
1634 | struct net_device *dev; | ||
1635 | INT alloc_size; | ||
1636 | |||
1637 | |||
1638 | /* ensure 32-byte alignment of the private area */ | ||
1639 | alloc_size = sizeof (*dev) + sizeof_priv + 31; | ||
1640 | |||
1641 | dev = (struct net_device *) kmalloc(alloc_size, GFP_KERNEL); | ||
1642 | if (dev == NULL) | ||
1643 | { | ||
1644 | DBGPRINT(RT_DEBUG_ERROR, | ||
1645 | ("alloc_netdev: Unable to allocate device memory.\n")); | ||
1646 | return NULL; | ||
1647 | } | ||
1648 | |||
1649 | memset(dev, 0, alloc_size); | ||
1650 | |||
1651 | if (sizeof_priv) | ||
1652 | dev->priv = (void *) (((long)(dev + 1) + 31) & ~31); | ||
1653 | |||
1654 | setup(dev); | ||
1655 | strcpy(dev->name, mask); | ||
1656 | |||
1657 | return dev; | ||
1658 | } | ||
1659 | #endif // LINUX_VERSION_CODE // | ||
1660 | |||
1661 | |||
1662 | void CfgInitHook(PRTMP_ADAPTER pAd) | 1564 | void CfgInitHook(PRTMP_ADAPTER pAd) |
1663 | { | 1565 | { |
1664 | pAd->bBroadComHT = TRUE; | 1566 | pAd->bBroadComHT = TRUE; |