staging: rt2860: change plain format of mac address to %pM in *printf()
authorAndy Shevchenko <andy.shevchenko@gmail.com>
Sat, 11 Sep 2010 14:17:04 +0000 (17:17 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 16 Sep 2010 19:26:10 +0000 (12:26 -0700)
There are many locations where MAC or BSSID is printed. The plain format
is used in such places. *printf() in kernel recognizes
%pM, %pMF and %pm format parameters to print out 6-byte array as MAC
address. This patch changes plain format to custom %pM which is widely
used in kernel.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 files changed:
drivers/staging/rt2860/common/ba_action.c
drivers/staging/rt2860/common/cmm_mac_usb.c
drivers/staging/rt2860/common/cmm_wpa.c
drivers/staging/rt2860/common/mlme.c
drivers/staging/rt2860/common/rtmp_init.c
drivers/staging/rt2860/rt_linux.c
drivers/staging/rt2860/rt_linux.h
drivers/staging/rt2860/sta/assoc.c
drivers/staging/rt2860/sta/connect.c
drivers/staging/rt2860/sta/rtmp_data.c
drivers/staging/rt2860/sta/sync.c
drivers/staging/rt2860/sta_ioctl.c

index 174f2a73a1bb646c753ff2e9c0faf176cec0dbf0..3f71c5028556c5b2c711372cf5eac5e85b4b7133 100644 (file)
@@ -654,8 +654,8 @@ BOOLEAN BARecSessionAdd(struct rt_rtmp_adapter *pAd,
        } else {
                Status = FALSE;
                DBGPRINT(RT_DEBUG_TRACE,
-                        ("Can't Accept ADDBA for %02x:%02x:%02x:%02x:%02x:%02x TID = %d\n",
-                         PRINT_MAC(pEntry->Addr), TID));
+                       ("Can't Accept ADDBA for %pM TID = %d\n",
+                               &pEntry->Addr[0], TID));
        }
        return (Status);
 }
index 8aec70fc20d6ca0ae6159d08d5e11b4aad832e13..d08abf794c89c7ee30454391df0c5f804fb4ad62 100644 (file)
@@ -663,10 +663,7 @@ int RTUSBWriteHWMACAddress(struct rt_rtmp_adapter *pAd)
        StaMacReg1.field.Byte5 = pAd->CurrentAddress[5];
        StaMacReg1.field.U2MeMask = 0xff;
        DBGPRINT_RAW(RT_DEBUG_TRACE,
-                    ("Local MAC = %02x:%02x:%02x:%02x:%02x:%02x\n",
-                     pAd->CurrentAddress[0], pAd->CurrentAddress[1],
-                     pAd->CurrentAddress[2], pAd->CurrentAddress[3],
-                     pAd->CurrentAddress[4], pAd->CurrentAddress[5]));
+               ("Local MAC = %pM\n", &pAd->CurrentAddress[0]));
 
        RTUSBWriteMACRegister(pAd, MAC_ADDR_DW0, StaMacReg0.word);
        RTUSBWriteMACRegister(pAd, MAC_ADDR_DW1, StaMacReg1.word);
index 9414aa344375e1a9c570b3fd8f71ff39cf9dfce6..78ca4ed46d97bb604aecd1298023db7cb9d8e05b 100644 (file)
@@ -221,8 +221,8 @@ void WpaEAPOLKeyAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *E
                        break;
 
                DBGPRINT(RT_DEBUG_TRACE,
-                        ("Receive EAPoL-Key frame from STA %02X-%02X-%02X-%02X-%02X-%02X\n",
-                         PRINT_MAC(pEntry->Addr)));
+                       ("Receive EAPoL-Key frame from STA %pMF\n",
+                               &pEntry->Addr[0]));
 
                if (((pEapol_packet->ProVer != EAPOL_VER)
                     && (pEapol_packet->ProVer != EAPOL_VER2))
index 9fc34a8f218022dc651a984d1c323bc1836e484c..e51403315fea243cdcd8e137958410d8e22c5ab6 100644 (file)
@@ -1536,10 +1536,9 @@ void MlmeAutoReconnectLastSSID(struct rt_rtmp_adapter *pAd)
 {
        if (pAd->StaCfg.bAutoConnectByBssid) {
                DBGPRINT(RT_DEBUG_TRACE,
-                        ("Driver auto reconnect to last OID_802_11_BSSID setting - %02X:%02X:%02X:%02X:%02X:%02X\n",
-                         pAd->MlmeAux.Bssid[0], pAd->MlmeAux.Bssid[1],
-                         pAd->MlmeAux.Bssid[2], pAd->MlmeAux.Bssid[3],
-                         pAd->MlmeAux.Bssid[4], pAd->MlmeAux.Bssid[5]));
+                       ("Driver auto reconnect to last OID_802_11_BSSID "
+                               "setting - %pM\n",
+                               &pAd->MlmeAux.Bssid[0]));
 
                pAd->MlmeAux.Channel = pAd->CommonCfg.Channel;
                MlmeEnqueue(pAd,
index ff9f87c6be747c54739a36b8c4f3266c83914767..afeb528207424ba811c9f0a81896d275594347c2 100644 (file)
@@ -749,13 +749,7 @@ void NICReadEEPROMParameters(struct rt_rtmp_adapter *pAd, u8 *mac_addr)
                /*      pAd->PermanentAddress[5] = RandomByte(pAd)&0xf8; */
 
                DBGPRINT_RAW(RT_DEBUG_TRACE,
-                            ("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n",
-                             pAd->PermanentAddress[0],
-                             pAd->PermanentAddress[1],
-                             pAd->PermanentAddress[2],
-                             pAd->PermanentAddress[3],
-                             pAd->PermanentAddress[4],
-                             pAd->PermanentAddress[5]));
+                       ("E2PROM MAC: =%pM\n", &pAd->PermanentAddress[0]));
                if (pAd->bLocalAdminMAC == FALSE) {
                        MAC_DW0_STRUC csr2;
                        MAC_DW1_STRUC csr3;
@@ -772,8 +766,8 @@ void NICReadEEPROMParameters(struct rt_rtmp_adapter *pAd, u8 *mac_addr)
                        csr3.field.U2MeMask = 0xff;
                        RTMP_IO_WRITE32(pAd, MAC_ADDR_DW1, csr3.word);
                        DBGPRINT_RAW(RT_DEBUG_TRACE,
-                                    ("E2PROM MAC: =%02x:%02x:%02x:%02x:%02x:%02x\n",
-                                     PRINT_MAC(pAd->PermanentAddress)));
+                               ("E2PROM MAC: =%pM\n",
+                                       &pAd->PermanentAddress[0]));
                }
        }
 
index 5b79f655bb0b222edf7147c10f0ab1d7f293c3ba..abfeea11721d7bb4c95ee8d23961ffc4e8e57bac 100644 (file)
@@ -682,9 +682,7 @@ void RTMPSendWirelessEvent(struct rt_rtmp_adapter *pAd,
 
                if (pAddr)
                        pBufPtr +=
-                           sprintf(pBufPtr,
-                                   "(RT2860) STA(%02x:%02x:%02x:%02x:%02x:%02x) ",
-                                   PRINT_MAC(pAddr));
+                           sprintf(pBufPtr, "(RT2860) STA(%pM) ", pAddr);
                else if (BssIdx < MAX_MBSSID_NUM)
                        pBufPtr +=
                            sprintf(pBufPtr, "(RT2860) BSS(wlan%d) ", BssIdx);
index b370fb21e423cc21e53a98f6d22ded6ffb014445..5acedf18b1ab9d5ce382645a11e61f2c7a2f824e 100644 (file)
@@ -409,9 +409,6 @@ struct os_cookie {
 /***********************************************************************************
  *     OS debugging and printing related definitions and data structure
  ***********************************************************************************/
-#define PRINT_MAC(addr)        \
-       addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
-
 #ifdef DBG
 extern unsigned long RTDebugLevel;
 
index 6e85d5e6554b1ee6c7bd2999edf984bf80c07cfb..1efd75b88fa99822a32e607c7db065b20e2a0f25 100644 (file)
@@ -794,11 +794,8 @@ void MlmeDisassocReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_ele
        RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &TimerCancelled);
 
        DBGPRINT(RT_DEBUG_TRACE,
-                ("ASSOC - Send DISASSOC request[BSSID::%02x:%02x:%02x:%02x:%02x:%02x (Reason=%d)\n",
-                 pDisassocReq->Addr[0], pDisassocReq->Addr[1],
-                 pDisassocReq->Addr[2], pDisassocReq->Addr[3],
-                 pDisassocReq->Addr[4], pDisassocReq->Addr[5],
-                 pDisassocReq->Reason));
+               ("ASSOC - Send DISASSOC request[BSSID::%pM (Reason=%d)\n",
+                       &pDisassocReq->Addr[0], pDisassocReq->Reason));
        MgtMacHeaderInit(pAd, &DisassocHdr, SUBTYPE_DISASSOC, 0, pDisassocReq->Addr, pDisassocReq->Addr);       /* patch peap ttls switching issue */
        MakeOutgoingFrame(pOutBuffer, &FrameLen,
                          sizeof(struct rt_header_802_11), &DisassocHdr,
index 55732b10062db638ebcf793fb6cd4f0648e13f22..05b4af6c3e8a8df929bb4b84a52fd18313136153 100644 (file)
@@ -653,10 +653,8 @@ void CntlOidRTBssidProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *
                           RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, 0);
                           } */
                        /* No active association, join the BSS immediately */
-                       DBGPRINT(RT_DEBUG_TRACE,
-                                ("CNTL - joining %02x:%02x:%02x:%02x:%02x:%02x ...\n",
-                                 pOidBssid[0], pOidBssid[1], pOidBssid[2],
-                                 pOidBssid[3], pOidBssid[4], pOidBssid[5]));
+                       DBGPRINT(RT_DEBUG_TRACE, ("CNTL - joining %pM ...\n",
+                                       &pOidBssid[0]));
 
                        JoinParmFill(pAd, &JoinReq, pAd->MlmeAux.BssIdx);
                        MlmeEnqueue(pAd, SYNC_STATE_MACHINE, MT2_MLME_JOIN_REQ,
@@ -778,13 +776,8 @@ void CntlWaitJoinProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *El
                                LinkUp(pAd, BSS_ADHOC);
                                pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE;
                                DBGPRINT(RT_DEBUG_TRACE,
-                                        ("CNTL - join the IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n",
-                                         pAd->CommonCfg.Bssid[0],
-                                         pAd->CommonCfg.Bssid[1],
-                                         pAd->CommonCfg.Bssid[2],
-                                         pAd->CommonCfg.Bssid[3],
-                                         pAd->CommonCfg.Bssid[4],
-                                         pAd->CommonCfg.Bssid[5]));
+                                       ("CNTL - join the IBSS = %pM ...\n",
+                                               &pAd->CommonCfg.Bssid[0]));
 
                                pAd->IndicateMediaState =
                                    NdisMediaStateConnected;
@@ -902,13 +895,8 @@ void CntlWaitStartProc(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *E
                        }
 
                        DBGPRINT(RT_DEBUG_TRACE,
-                                ("CNTL - start a new IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n",
-                                 pAd->CommonCfg.Bssid[0],
-                                 pAd->CommonCfg.Bssid[1],
-                                 pAd->CommonCfg.Bssid[2],
-                                 pAd->CommonCfg.Bssid[3],
-                                 pAd->CommonCfg.Bssid[4],
-                                 pAd->CommonCfg.Bssid[5]));
+                               ("CNTL - start a new IBSS = %pM ...\n",
+                                       &pAd->CommonCfg.Bssid[0]));
                } else {
                        DBGPRINT(RT_DEBUG_TRACE,
                                 ("CNTL - Start IBSS fail. BUG!\n"));
index 5d348e9d9b797c1a09528290664e896307a9dbb7..fbe903c530bec1d60c86746d2c2ae909389a4944 100644 (file)
@@ -976,8 +976,8 @@ int STASendPacket(struct rt_rtmp_adapter *pAd, void *pPacket)
 
        if (!pEntry) {
                DBGPRINT(RT_DEBUG_ERROR,
-                        ("STASendPacket->Cannot find pEntry(%2x:%2x:%2x:%2x:%2x:%2x) in MacTab!\n",
-                         PRINT_MAC(pSrcBufVA)));
+                       ("STASendPacket->Cannot find pEntry(%pM) in MacTab!\n",
+                               pSrcBufVA));
                /* Resourece is low, system did not allocate virtual address */
                /* return NDIS_STATUS_FAILURE directly to upper layer */
                RELEASE_NDIS_PACKET(pAd, pPacket, NDIS_STATUS_FAILURE);
index cbe90a6496d2c9f5c38db06aafa3edc9d706ee6e..3abc36291116101eeddd65c0fd8cfc34e2f7da00 100644 (file)
@@ -424,9 +424,8 @@ void MlmeJoinReqAction(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *E
        } while (FALSE);
 
        DBGPRINT(RT_DEBUG_TRACE,
-                ("SYNC - Switch to ch %d, Wait BEACON from %02x:%02x:%02x:%02x:%02x:%02x\n",
-                 pBss->Channel, pBss->Bssid[0], pBss->Bssid[1], pBss->Bssid[2],
-                 pBss->Bssid[3], pBss->Bssid[4], pBss->Bssid[5]));
+               ("SYNC - Switch to ch %d, Wait BEACON from %pM\n",
+                       pBss->Channel, &pBss->Bssid[0]));
 
        pAd->Mlme.SyncMachine.CurrState = JOIN_WAIT_BEACON;
 }
@@ -1225,10 +1224,9 @@ void PeerBeacon(struct rt_rtmp_adapter *pAd, struct rt_mlme_queue_elem *Elem)
                        for (i = 0; i < 6; i++) {
                                if (Bssid[i] > pAd->CommonCfg.Bssid[i]) {
                                        DBGPRINT(RT_DEBUG_TRACE,
-                                                ("SYNC - merge to the IBSS with bigger BSSID=%02x:%02x:%02x:%02x:%02x:%02x\n",
-                                                 Bssid[0], Bssid[1], Bssid[2],
-                                                 Bssid[3], Bssid[4],
-                                                 Bssid[5]));
+                                               ("SYNC - merge to the IBSS "
+                                                       "with bigger BSSID="
+                                                       "%pM\n", &Bssid[0]));
                                        AsicDisableSync(pAd);
                                        COPY_MAC_ADDR(pAd->CommonCfg.Bssid,
                                                      Bssid);
index 6b8268d3dc75a776b190694128fcbb4f43bf342e..bff7b0b639872a69f41c2b603e44b7464f5d1b2e 100644 (file)
@@ -614,9 +614,7 @@ int rt_ioctl_siwap(struct net_device *dev,
                    OID_802_11_BSSID,
                    sizeof(NDIS_802_11_MAC_ADDRESS), (void *) & Bssid);
 
-       DBGPRINT(RT_DEBUG_TRACE,
-                ("IOCTL::SIOCSIWAP %02x:%02x:%02x:%02x:%02x:%02x\n", Bssid[0],
-                 Bssid[1], Bssid[2], Bssid[3], Bssid[4], Bssid[5]));
+       DBGPRINT(RT_DEBUG_TRACE, ("IOCTL::SIOCSIWAP %pM\n", &Bssid[0]));
 
        return 0;
 }
@@ -1513,11 +1511,8 @@ void getBaInfo(struct rt_rtmp_adapter *pAd, char *pOutBuf)
                if (((pEntry->ValidAsCLI || pEntry->ValidAsApCli)
                     && (pEntry->Sst == SST_ASSOC))
                    || (pEntry->ValidAsWDS) || (pEntry->ValidAsMesh)) {
-                       sprintf(pOutBuf + strlen(pOutBuf),
-                               "\n%02X:%02X:%02X:%02X:%02X:%02X (Aid = %d) (AP) -\n",
-                               pEntry->Addr[0], pEntry->Addr[1],
-                               pEntry->Addr[2], pEntry->Addr[3],
-                               pEntry->Addr[4], pEntry->Addr[5], pEntry->Aid);
+                       sprintf(pOutBuf + strlen(pOutBuf), "\n%pM (Aid = %d) "
+                               "(AP) -\n", &pEntry->Addr[0], pEntry->Aid);
 
                        sprintf(pOutBuf, "%s[Recipient]\n", pOutBuf);
                        for (j = 0; j < NUM_OF_TID; j++) {