Staging: rt3070: remove dead MULTIPLE_CARD_SUPPORT code
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sun, 26 Apr 2009 14:05:06 +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/rt3070/2870_main_dev.c
drivers/staging/rt3070/rt_linux.h
drivers/staging/rt3070/rt_main_dev.c
drivers/staging/rt3070/rt_profile.c
drivers/staging/rt3070/rtmp.h
drivers/staging/rt3070/rtmp_def.h
drivers/staging/rt3070/sta_ioctl.c

index 2acda3e07d1302b0de8802b2f847ac6aef9c415e..7150373ff52121125f29fb02830ad91b6ac77520 100644 (file)
@@ -53,11 +53,6 @@ MODULE_VERSION(STA_DRIVER_VERSION);
 #endif
 #endif // CONFIG_STA_SUPPORT //
 
-#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 //
-
 /* Kernel thread and vars, which handles packets that are completed. Only
  * packets that have a "complete" function are sent here. This way, the
  * completion is run out of kernel context, and doesn't block the rest of
@@ -782,11 +777,6 @@ static void _rtusb_disconnect(struct usb_device *dev, PRTMP_ADAPTER pAd)
                                dev->bus->bus_name, dev->devpath));
        if (!pAd)
        {
-#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 //
-
                usb_put_dev(dev);
 
                printk("rtusb_disconnect: pAd == NULL!\n");
index d1a2da1fe35aa984054c77360340d6ba445eac17..e8638920469d4faa57edc401c6761af007b51ac1 100644 (file)
@@ -95,9 +95,6 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
 #define STA_RT2870_IMAGE_FILE_NAME  "/etc/Wireless/RT2870STA/rt2870.bin"
 #define STA_NIC_DEVICE_NAME                    "RT2870STA"
 #define STA_DRIVER_VERSION                     "2.0.1.0"
-#ifdef MULTIPLE_CARD_SUPPORT
-#define CARD_INFO_PATH                 "/etc/Wireless/RT2870STA/RT2870STACard.dat"
-#endif // MULTIPLE_CARD_SUPPORT //
 #endif // RT2870 //
 
 #endif // CONFIG_STA_SUPPORT //
index 097a301c74388de793f2f2a75d6dae6f8cf35bb8..b73b1ffcda5bb5eaa826149dc62a294eb1bf7d47 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                                              */
 /*---------------------------------------------------------------------*/
@@ -840,11 +833,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);
@@ -862,11 +850,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;
        }
@@ -875,373 +858,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
-
-       //antenna.word = RTMP_EEPROM_READ16(pAd, EEPROM_NIC1_OFFSET);
-       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
-       //addr01 = RTMP_EEPROM_READ16(pAd, 0x04);
-       //addr23 = RTMP_EEPROM_READ16(pAd, 0x06);
-       //addr45 = RTMP_EEPROM_READ16(pAd, 0x08);
-       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:
@@ -1333,21 +949,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 cea6b436ed4f4bd47ca521a9cadaefa4134207b2..46865c146aff8bb9726a285bcc4047cb26568d3b 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 fcd46d26b439052e7755205635384de83771f5d2..7e83079f411b5ecd816eb4e11538d0c02813cac0 100644 (file)
@@ -2965,11 +2965,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 694090039b24d00e54fafab9df3fb144208f3023..06f1d3ff5048268ae957ef54920959733e5e84bd 100644 (file)
 #define LOCAL_TXBUF_SIZE        2048
 #endif // RT2870 //
 
-#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 ff085d7f7703dbe05090805ef94d5d70032bdcdc..1495ff386e53b0c9f34c3e9416b989b0212033d8 100644 (file)
@@ -5013,9 +5013,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;