staging: r8188eu: replace N_BYTE_ALIGMENT macro with PTR_ALIGN
authorIvan Safonov <insafonov@gmail.com>
Sun, 18 Sep 2016 17:25:40 +0000 (00:25 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Sep 2016 11:33:49 +0000 (13:33 +0200)
PTR_ALIGN is a bit shorter than N_BYTE_ALIGMENT.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_recv.c
drivers/staging/rtl8188eu/core/rtw_xmit.c
drivers/staging/rtl8188eu/include/basic_types.h
drivers/staging/rtl8188eu/os_dep/xmit_linux.c

index 1063617b0ce40cb13f8815bf8a8f99108056f1bd..b87cbbbee0549284ad36c120b4bbdc07ec52ab5c 100644 (file)
@@ -73,7 +73,7 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
        if (!precvpriv->pallocated_frame_buf)
                return _FAIL;
 
-       precvpriv->precv_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ);
+       precvpriv->precv_frame_buf = PTR_ALIGN(precvpriv->pallocated_frame_buf, RXFRAME_ALIGN_SZ);
 
        precvframe = (struct recv_frame *)precvpriv->precv_frame_buf;
 
index e028ff4a52ef31eedc5b7bc931268517c4464acd..56c6604401d4bf372d5bd89d60713dcaf7677b48 100644 (file)
@@ -86,7 +86,7 @@ s32   _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
                res = _FAIL;
                goto exit;
        }
-       pxmitpriv->pxmit_frame_buf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_frame_buf), 4);
+       pxmitpriv->pxmit_frame_buf = PTR_ALIGN(pxmitpriv->pallocated_frame_buf, 4);
        /* pxmitpriv->pxmit_frame_buf = pxmitpriv->pallocated_frame_buf + 4 - */
        /*                                              ((size_t) (pxmitpriv->pallocated_frame_buf) &3); */
 
@@ -124,7 +124,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
                goto exit;
        }
 
-       pxmitpriv->pxmitbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_xmitbuf), 4);
+       pxmitpriv->pxmitbuf = PTR_ALIGN(pxmitpriv->pallocated_xmitbuf, 4);
        /* pxmitpriv->pxmitbuf = pxmitpriv->pallocated_xmitbuf + 4 - */
        /*                                              ((size_t) (pxmitpriv->pallocated_xmitbuf) &3); */
 
@@ -166,7 +166,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
                goto exit;
        }
 
-       pxmitpriv->pxmit_extbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitpriv->pallocated_xmit_extbuf), 4);
+       pxmitpriv->pxmit_extbuf = PTR_ALIGN(pxmitpriv->pallocated_xmit_extbuf, 4);
 
        pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
 
index 2c1676d2ac6e1e0a39963dcee01519d26a6cac3d..69c4d49f43ab8ac597df22b7edf0dd0b352cf452 100644 (file)
@@ -137,8 +137,4 @@ value to host byte ordering.*/
                ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
                )
 
-/*  Get the N-bytes aligment offset from the current length */
-#define        N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \
-       (__value) : (((__value + __aligment - 1) / __aligment) * __aligment))
-
 #endif /* __BASIC_TYPES_H__ */
index 221e2750652e5ffe15d7fed678c473b424a91245..4b1b04e007151aa260b1f3c36f11e40f0f7e4e2f 100644 (file)
@@ -72,7 +72,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitb
        if (pxmitbuf->pallocated_buf == NULL)
                return _FAIL;
 
-       pxmitbuf->pbuf = (u8 *)N_BYTE_ALIGMENT((size_t)(pxmitbuf->pallocated_buf), XMITBUF_ALIGN_SZ);
+       pxmitbuf->pbuf = PTR_ALIGN(pxmitbuf->pallocated_buf, XMITBUF_ALIGN_SZ);
        pxmitbuf->dma_transfer_addr = 0;
 
        for (i = 0; i < 8; i++) {