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

index aa8f1e185bd457533700e5979ba5d867c7c49f83..21a40276f7b62abdc1ecda00201ee664322a29dc 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
@@ -771,11 +766,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 8870e4e8f2e9279a39ba4f72e506caea92af6e7a..1ddd835882a6cd8d1832e33b8f7465a59c7a7d04 100644 (file)
@@ -96,9 +96,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                     "1.4.0.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 6af952159144dd527fad57210c10e57211e196b7..6192ebfcdd11e93d0283a1c7922d0783ac5d1e4e 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                                              */
 /*---------------------------------------------------------------------*/
@@ -860,11 +853,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);
@@ -882,11 +870,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;
        }
@@ -895,373 +878,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:
@@ -1353,21 +969,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 14d2ee2991b4ccddb64c74137c8b56aa5c0fd29c..9e0746e941a3efc68062daa77200586e94860133 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 5bc83d0453d350964f42d279c0bf4e68757042c4..65d766c7307d552aec9ab7a01fa87417c58a9f73 100644 (file)
@@ -2911,11 +2911,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 35cbc61482a1f7b8e7a6b4f129a55efc84a9a3ff..70f8f2fd6a400145d709da1f963257b57f05d7ed 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 1a074dd898123a15c7c19f29c48a15f889df14f1..30217531d6581e9bc5fb00ebeaa3a64a14784bc4 100644 (file)
@@ -5090,9 +5090,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;