Staging: rt2860: remove dead MULTIPLE_CARD_SUPPORT code
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sun, 26 Apr 2009 14:05:03 +0000 (16:05 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 19 Jun 2009 18:00:43 +0000 (11:00 -0700)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rt2860/2860_main_dev.c
drivers/staging/rt2860/rt_linux.h
drivers/staging/rt2860/rt_main_dev.c
drivers/staging/rt2860/rt_profile.c
drivers/staging/rt2860/rtmp.h
drivers/staging/rt2860/rtmp_def.h
drivers/staging/rt2860/sta_ioctl.c

index ff7f833..4f39fcb 100644 (file)
 
 #include "rt_config.h"
 
-
-#ifdef MULTIPLE_CARD_SUPPORT
-// record whether the card in the card list is used in the card file
-extern UINT8  MC_CardUsed[];
-#endif // MULTIPLE_CARD_SUPPORT //
-
-
 extern INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p,
                                                                        IN UINT argc, OUT PRTMP_ADAPTER *ppAd);
 
@@ -328,14 +321,6 @@ static VOID __devexit rt2860_remove_one(
 
        if (pAd != NULL)
        {
-#ifdef MULTIPLE_CARD_SUPPORT
-               if ((pAd->MC_RowID >= 0) && (pAd->MC_RowID <= MAX_NUM_OF_MULTIPLE_CARD))
-                       MC_CardUsed[pAd->MC_RowID] = 0; // not clear MAC address
-#endif // MULTIPLE_CARD_SUPPORT //
-
-
-
-
                // Unregister network device
                unregister_netdev(net_dev);
 
index 4756479..9d2153e 100644 (file)
@@ -92,11 +92,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
 #define STA_RTMP_FIRMWARE_FILE_NAME "/etc/Wireless/RT2860STA/RT2860STA.bin"
 #define STA_NIC_DEVICE_NAME                    "RT2860STA"
 #define STA_DRIVER_VERSION                     "1.8.1.1"
-#ifdef MULTIPLE_CARD_SUPPORT
-#define CARD_INFO_PATH                 "/etc/Wireless/RT2860STA/RT2860STACard.dat"
-#endif // MULTIPLE_CARD_SUPPORT //
-
-
 #endif // CONFIG_STA_SUPPORT //
 
 #ifndef PCI_DEVICE
index e3b7c4e..95965a2 100644 (file)
 
 #define FORTY_MHZ_INTOLERANT_INTERVAL  (60*1000) // 1 min
 
-#ifdef MULTIPLE_CARD_SUPPORT
-// record whether the card in the card list is used in the card file
-UINT8  MC_CardUsed[MAX_NUM_OF_MULTIPLE_CARD];
-// record used card mac address in the card list
-static UINT8  MC_CardMac[MAX_NUM_OF_MULTIPLE_CARD][6];
-#endif // MULTIPLE_CARD_SUPPORT //
-
 /*---------------------------------------------------------------------*/
 /* Private Variables Used                                              */
 /*---------------------------------------------------------------------*/
@@ -726,11 +719,6 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p
        // find available device name
        for (i = 0; i < 8; i++)
        {
-#ifdef MULTIPLE_CARD_SUPPORT
-               if (pAd->MC_RowID >= 0)
-                       sprintf(slot_name, "ra%02d_%d", pAd->MC_RowID, i);
-               else
-#endif // MULTIPLE_CARD_SUPPORT //
                sprintf(slot_name, "ra%d", i);
 
                device = dev_get_by_name(dev_net(dev), slot_name);
@@ -748,11 +736,6 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p
        }
        else
        {
-#ifdef MULTIPLE_CARD_SUPPORT
-               if (pAd->MC_RowID >= 0)
-               sprintf(dev->name, "ra%02d_%d", pAd->MC_RowID, i);
-               else
-#endif // MULTIPLE_CARD_SUPPORT //
                sprintf(dev->name, "ra%d", i);
                Status = NDIS_STATUS_SUCCESS;
        }
@@ -761,369 +744,6 @@ static NDIS_STATUS rt_ieee80211_if_setup(struct net_device *dev, PRTMP_ADAPTER p
 
 }
 
-
-#ifdef MULTIPLE_CARD_SUPPORT
-/*
-========================================================================
-Routine Description:
-    Get card profile path.
-
-Arguments:
-    pAd
-
-Return Value:
-    TRUE               - Find a card profile
-       FALSE           - use default profile
-
-Note:
-========================================================================
-*/
-extern INT RTMPGetKeyParameter(
-    IN  PCHAR   key,
-    OUT PCHAR   dest,
-    IN  INT     destsize,
-    IN  PCHAR   buffer);
-
-BOOLEAN RTMP_CardInfoRead(
-       IN      PRTMP_ADAPTER pAd)
-{
-#define MC_SELECT_CARDID               0       /* use CARD ID (0 ~ 31) to identify different cards */
-#define MC_SELECT_MAC                  1       /* use CARD MAC to identify different cards */
-#define MC_SELECT_CARDTYPE             2       /* use CARD type (abgn or bgn) to identify different cards */
-
-#define LETTER_CASE_TRANSLATE(txt_p, card_id)                  \
-       {       UINT32 _len; char _char;                                                \
-               for(_len=0; _len<strlen(card_id); _len++) {             \
-                       _char = *(txt_p + _len);                                        \
-                       if (('A' <= _char) && (_char <= 'Z'))           \
-                               *(txt_p+_len) = 'a'+(_char-'A');                \
-               } }
-
-       struct file *srcf;
-       INT retval, orgfsuid, orgfsgid;
-       mm_segment_t orgfs;
-       CHAR *buffer, *tmpbuf, card_id_buf[30], RFIC_word[30];
-       BOOLEAN flg_match_ok = FALSE;
-       INT32 card_select_method;
-       INT32 card_free_id, card_nouse_id, card_same_mac_id, card_match_id;
-       EEPROM_ANTENNA_STRUC antenna;
-       USHORT addr01, addr23, addr45;
-       UINT8 mac[6];
-       UINT32 data, card_index;
-       UCHAR *start_ptr;
-
-
-       // init
-       buffer = kmalloc(MAX_INI_BUFFER_SIZE, MEM_ALLOC_FLAG);
-       if (buffer == NULL)
-        return FALSE;
-
-       tmpbuf = kmalloc(MAX_PARAM_BUFFER_SIZE, MEM_ALLOC_FLAG);
-       if(tmpbuf == NULL)
-       {
-               kfree(buffer);
-        return NDIS_STATUS_FAILURE;
-       }
-
-       orgfsuid = current->fsuid;
-       orgfsgid = current->fsgid;
-       current->fsuid = current->fsgid = 0;
-    orgfs = get_fs();
-    set_fs(KERNEL_DS);
-
-       // get RF IC type
-       RTMP_IO_READ32(pAd, E2PROM_CSR, &data);
-
-       if ((data & 0x30) == 0)
-               pAd->EEPROMAddressNum = 6;      // 93C46
-       else if ((data & 0x30) == 0x10)
-               pAd->EEPROMAddressNum = 8;      // 93C66
-       else
-               pAd->EEPROMAddressNum = 8;      // 93C86
-
-       RT28xx_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET, antenna.word);
-
-       if ((antenna.field.RfIcType == RFIC_2850) ||
-               (antenna.field.RfIcType == RFIC_2750))
-       {
-               /* ABGN card */
-               strcpy(RFIC_word, "abgn");
-       }
-       else
-       {
-               /* BGN card */
-               strcpy(RFIC_word, "bgn");
-       }
-
-       // get MAC address
-       RT28xx_EEPROM_READ16(pAd, 0x04, addr01);
-       RT28xx_EEPROM_READ16(pAd, 0x06, addr23);
-       RT28xx_EEPROM_READ16(pAd, 0x08, addr45);
-
-       mac[0] = (UCHAR)(addr01 & 0xff);
-       mac[1] = (UCHAR)(addr01 >> 8);
-       mac[2] = (UCHAR)(addr23 & 0xff);
-       mac[3] = (UCHAR)(addr23 >> 8);
-       mac[4] = (UCHAR)(addr45 & 0xff);
-       mac[5] = (UCHAR)(addr45 >> 8);
-
-       // open card information file
-       srcf = filp_open(CARD_INFO_PATH, O_RDONLY, 0);
-       if (IS_ERR(srcf))
-       {
-               /* card information file does not exist */
-                       DBGPRINT(RT_DEBUG_TRACE,
-                               ("--> Error %ld opening %s\n", -PTR_ERR(srcf), CARD_INFO_PATH));
-               return FALSE;
-       }
-
-       if (srcf->f_op && srcf->f_op->read)
-       {
-               /* card information file exists so reading the card information */
-               memset(buffer, 0x00, MAX_INI_BUFFER_SIZE);
-               retval = srcf->f_op->read(srcf, buffer, MAX_INI_BUFFER_SIZE, &srcf->f_pos);
-               if (retval < 0)
-               {
-                       /* read fail */
-                               DBGPRINT(RT_DEBUG_TRACE,
-                                       ("--> Read %s error %d\n", CARD_INFO_PATH, -retval));
-               }
-               else
-               {
-                       /* get card selection method */
-                       memset(tmpbuf, 0x00, MAX_PARAM_BUFFER_SIZE);
-                       card_select_method = MC_SELECT_CARDTYPE; // default
-
-                       if (RTMPGetKeyParameter("SELECT", tmpbuf, 256, buffer))
-                       {
-                               if (strcmp(tmpbuf, "CARDID") == 0)
-                                       card_select_method = MC_SELECT_CARDID;
-                               else if (strcmp(tmpbuf, "MAC") == 0)
-                                       card_select_method = MC_SELECT_MAC;
-                               else if (strcmp(tmpbuf, "CARDTYPE") == 0)
-                                       card_select_method = MC_SELECT_CARDTYPE;
-                       }
-
-                       DBGPRINT(RT_DEBUG_TRACE,
-                                       ("MC> Card Selection = %d\n", card_select_method));
-
-                       // init
-                       card_free_id = -1;
-                       card_nouse_id = -1;
-                       card_same_mac_id = -1;
-                       card_match_id = -1;
-
-                       // search current card information records
-                       for(card_index=0;
-                               card_index<MAX_NUM_OF_MULTIPLE_CARD;
-                               card_index++)
-                       {
-                               if ((*(UINT32 *)&MC_CardMac[card_index][0] == 0) &&
-                                       (*(UINT16 *)&MC_CardMac[card_index][4] == 0))
-                               {
-                                       // MAC is all-0 so the entry is available
-                                       MC_CardUsed[card_index] = 0;
-
-                                       if (card_free_id < 0)
-                                               card_free_id = card_index; // 1st free entry
-                               }
-                               else
-                               {
-                                       if (memcmp(MC_CardMac[card_index], mac, 6) == 0)
-                                       {
-                                               // we find the entry with same MAC
-                                               if (card_same_mac_id < 0)
-                                                       card_same_mac_id = card_index; // 1st same entry
-                                       }
-                                       else
-                                       {
-                                               // MAC is not all-0 but used flag == 0
-                                               if ((MC_CardUsed[card_index] == 0) &&
-                                                       (card_nouse_id < 0))
-                                               {
-                                                       card_nouse_id = card_index; // 1st available entry
-                                               }
-                                       }
-                               }
-                       }
-
-                       DBGPRINT(RT_DEBUG_TRACE,
-                                       ("MC> Free = %d, Same = %d, NOUSE = %d\n",
-                                       card_free_id, card_same_mac_id, card_nouse_id));
-
-                       if ((card_same_mac_id >= 0) &&
-                               ((card_select_method == MC_SELECT_CARDID) ||
-                               (card_select_method == MC_SELECT_CARDTYPE)))
-                       {
-                               // same MAC entry is found
-                               card_match_id = card_same_mac_id;
-
-                               if (card_select_method == MC_SELECT_CARDTYPE)
-                               {
-                                       // for CARDTYPE
-                                       sprintf(card_id_buf, "%02dCARDTYPE%s",
-                                                       card_match_id, RFIC_word);
-
-                                       if ((start_ptr=rtstrstruncasecmp(buffer, card_id_buf)) != NULL)
-                                       {
-                                               // we found the card ID
-                                               LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               // the card is 1st plug-in, try to find the match card profile
-                               switch(card_select_method)
-                               {
-                                       case MC_SELECT_CARDID: // CARDID
-                                       default:
-                                               if (card_free_id >= 0)
-                                                       card_match_id = card_free_id;
-                                               else
-                                                       card_match_id = card_nouse_id;
-                                               break;
-
-                                       case MC_SELECT_MAC: // MAC
-                                               sprintf(card_id_buf, "MAC%02x:%02x:%02x:%02x:%02x:%02x",
-                                                               mac[0], mac[1], mac[2],
-                                                               mac[3], mac[4], mac[5]);
-
-                                               /* try to find the key word in the card file */
-                                               if ((start_ptr=rtstrstruncasecmp(buffer, card_id_buf)) != NULL)
-                                               {
-                                                       LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
-
-                                                       /* get the row ID (2 ASCII characters) */
-                                                       start_ptr -= 2;
-                                                       card_id_buf[0] = *(start_ptr);
-                                                       card_id_buf[1] = *(start_ptr+1);
-                                                       card_id_buf[2] = 0x00;
-
-                                                       card_match_id = simple_strtol(card_id_buf, 0, 10);
-                                               }
-                                               break;
-
-                                       case MC_SELECT_CARDTYPE: // CARDTYPE
-                                               card_nouse_id = -1;
-
-                                               for(card_index=0;
-                                                       card_index<MAX_NUM_OF_MULTIPLE_CARD;
-                                                       card_index++)
-                                               {
-                                                       sprintf(card_id_buf, "%02dCARDTYPE%s",
-                                                                       card_index, RFIC_word);
-
-                                                       if ((start_ptr=rtstrstruncasecmp(buffer,
-                                                                                                               card_id_buf)) != NULL)
-                                                       {
-                                                               LETTER_CASE_TRANSLATE(start_ptr, card_id_buf);
-
-                                                               if (MC_CardUsed[card_index] == 0)
-                                                               {
-                                                                       /* current the card profile is not used */
-                                                                       if ((*(UINT32 *)&MC_CardMac[card_index][0] == 0) &&
-                                                                               (*(UINT16 *)&MC_CardMac[card_index][4] == 0))
-                                                                       {
-                                                                               // find it and no previous card use it
-                                                                               card_match_id = card_index;
-                                                                               break;
-                                                                       }
-                                                                       else
-                                                                       {
-                                                                               // ever a card use it
-                                                                               if (card_nouse_id < 0)
-                                                                                       card_nouse_id = card_index;
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-
-                                               // if not find a free one, use the available one
-                                               if (card_match_id < 0)
-                                                       card_match_id = card_nouse_id;
-                                               break;
-                               }
-                       }
-
-                       if (card_match_id >= 0)
-                       {
-                               // make up search keyword
-                               switch(card_select_method)
-                               {
-                                       case MC_SELECT_CARDID: // CARDID
-                                               sprintf(card_id_buf, "%02dCARDID", card_match_id);
-                                               break;
-
-                                       case MC_SELECT_MAC: // MAC
-                                               sprintf(card_id_buf,
-                                                               "%02dmac%02x:%02x:%02x:%02x:%02x:%02x",
-                                                               card_match_id,
-                                                               mac[0], mac[1], mac[2],
-                                                               mac[3], mac[4], mac[5]);
-                                               break;
-
-                                       case MC_SELECT_CARDTYPE: // CARDTYPE
-                                       default:
-                                               sprintf(card_id_buf, "%02dcardtype%s",
-                                                               card_match_id, RFIC_word);
-                                               break;
-                               }
-
-                               DBGPRINT(RT_DEBUG_TRACE, ("Search Keyword = %s\n", card_id_buf));
-
-                               // read card file path
-                               if (RTMPGetKeyParameter(card_id_buf, tmpbuf, 256, buffer))
-                               {
-                                       if (strlen(tmpbuf) < sizeof(pAd->MC_FileName))
-                                       {
-                                               // backup card information
-                                               pAd->MC_RowID = card_match_id; /* base 0 */
-                                               MC_CardUsed[card_match_id] = 1;
-                                               memcpy(MC_CardMac[card_match_id], mac, sizeof(mac));
-
-                                               // backup card file path
-                                               NdisMoveMemory(pAd->MC_FileName, tmpbuf , strlen(tmpbuf));
-                                               pAd->MC_FileName[strlen(tmpbuf)] = '\0';
-                                               flg_match_ok = TRUE;
-
-                                               DBGPRINT(RT_DEBUG_TRACE,
-                                                               ("Card Profile Name = %s\n", pAd->MC_FileName));
-                                       }
-                                       else
-                                       {
-                                               DBGPRINT(RT_DEBUG_ERROR,
-                                                               ("Card Profile Name length too large!\n"));
-                                       }
-                               }
-                               else
-                               {
-                                       DBGPRINT(RT_DEBUG_ERROR,
-                                                       ("Can not find search key word in card.dat!\n"));
-                               }
-
-                               if ((flg_match_ok != TRUE) &&
-                                       (card_match_id < MAX_NUM_OF_MULTIPLE_CARD))
-                               {
-                                       MC_CardUsed[card_match_id] = 0;
-                                       memset(MC_CardMac[card_match_id], 0, sizeof(mac));
-                               }
-                       } // if (card_match_id >= 0)
-               }
-       }
-
-       // close file
-       retval = filp_close(srcf, NULL);
-       set_fs(orgfs);
-       current->fsuid = orgfsuid;
-       current->fsgid = orgfsgid;
-       kfree(buffer);
-       kfree(tmpbuf);
-       return flg_match_ok;
-}
-#endif // MULTIPLE_CARD_SUPPORT //
-
-
 /*
 ========================================================================
 Routine Description:
@@ -1199,21 +819,6 @@ INT __devinit   rt28xx_probe(
        pAd->OpMode = OPMODE_STA;
 #endif // CONFIG_STA_SUPPORT //
 
-
-#ifdef MULTIPLE_CARD_SUPPORT
-       // find its profile path
-       pAd->MC_RowID = -1; // use default profile path
-       RTMP_CardInfoRead(pAd);
-
-       if (pAd->MC_RowID == -1)
-#ifdef CONFIG_STA_SUPPORT
-               strcpy(pAd->MC_FileName, STA_PROFILE_PATH);
-#endif // CONFIG_STA_SUPPORT //
-
-       DBGPRINT(RT_DEBUG_TRACE,
-                       ("MC> ROW = %d, PATH = %s\n", pAd->MC_RowID, pAd->MC_FileName));
-#endif // MULTIPLE_CARD_SUPPORT //
-
        // sample move
        if (rt_ieee80211_if_setup(net_dev, pAd) != NDIS_STATUS_SUCCESS)
                goto err_out_unmap;
index cf48923..27f69a5 100644 (file)
@@ -919,9 +919,6 @@ NDIS_STATUS RTMPReadParametersHook(
        IF_DEV_CONFIG_OPMODE_ON_STA(pAd)
                src = STA_PROFILE_PATH;
 #endif // CONFIG_STA_SUPPORT //
-#ifdef MULTIPLE_CARD_SUPPORT
-       src = pAd->MC_FileName;
-#endif // MULTIPLE_CARD_SUPPORT //
 
        // Save uid and gid used for filesystem access.
        // Set user and group to 0 (root)
index 16a0e2e..aa06070 100644 (file)
@@ -2836,11 +2836,6 @@ typedef struct _RTMP_ADAPTER
 
        struct net_device_stats stats;
 
-#ifdef MULTIPLE_CARD_SUPPORT
-       INT32                                   MC_RowID;
-       UCHAR                                   MC_FileName[256];
-#endif // MULTIPLE_CARD_SUPPORT //
-
        ULONG                                   TbttTickCount;
 #ifdef PCI_MSI_SUPPORT
        BOOLEAN                                 HaveMsi;
index e9bc055..aa975ac 100644 (file)
 #define MAX_TX_DONE_PROCESS     TX_RING_SIZE //8
 #define LOCAL_TXBUF_SIZE        2
 
-
-#ifdef MULTIPLE_CARD_SUPPORT
-// MC: Multple Cards
-#define MAX_NUM_OF_MULTIPLE_CARD               32
-#endif // MULTIPLE_CARD_SUPPORT //
-
 #define MAX_RX_PROCESS          128 //64 //32
 #define NUM_OF_LOCAL_TXBUF      2
 #define TXD_SIZE                16
index d95b325..304e49c 100644 (file)
@@ -5073,9 +5073,6 @@ INT RTMPQueryInformation(
         case RT_OID_QUERY_MULTIPLE_CARD_SUPPORT:
                        wrq->u.data.length = sizeof(UCHAR);
             i = 0;
-#ifdef MULTIPLE_CARD_SUPPORT
-            i = 1;
-#endif // MULTIPLE_CARD_SUPPORT //
                        if (copy_to_user(wrq->u.data.pointer, &i, wrq->u.data.length))
             {
                                Status = -EFAULT;