Re: [PATCH] staging: r8188eu: remove unused members of struct xmit_buf

From: Larry Finger
Date: Mon Jul 13 2020 - 17:15:49 EST


On 7/13/20 1:28 PM, Ivan Safonov wrote:
On 7/13/20 5:23 PM, Dan Carpenter wrote:
On Mon, Jul 13, 2020 at 04:16:07PM +0300, Dan Carpenter wrote:
On Sun, Jul 12, 2020 at 03:38:21PM +0300, Ivan Safonov wrote:
Remove unused members of struct xmit_buf: alloc_sz, ff_hwaddr,
dma_transfer_addr, bpending and last.

Signed-off-by: Ivan Safonov <insafonov@xxxxxxxxx>
---
 drivers/staging/rtl8188eu/include/rtw_xmit.h | 5 -----
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 1 -
 2 files changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h b/drivers/staging/rtl8188eu/include/rtw_xmit.h
index 12d16e98176a..3c03987c81a1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_xmit.h
+++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h
@@ -193,14 +193,9 @@ struct xmit_buf {
ÂÂÂÂÂ void *priv_data;
ÂÂÂÂÂ u16 ext_tag; /*Â 0: Normal xmitbuf, 1: extension xmitbuf. */
ÂÂÂÂÂ u16 flags;
-ÂÂÂ u32 alloc_sz;
ÂÂÂÂÂ u32Â len;
ÂÂÂÂÂ struct submit_ctx *sctx;
-ÂÂÂ u32ÂÂÂ ff_hwaddr;
ÂÂÂÂÂ struct urb *pxmit_urb[8];
-ÂÂÂ dma_addr_t dma_transfer_addr;ÂÂÂ /* (in) dma addr for transfer_buffer */
-ÂÂÂ u8 bpending[8];
-ÂÂÂ int last[8];
 };
 struct xmit_frame {
diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
index 017e1d628461..61ced1160951 100644
--- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
@@ -24,7 +24,6 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter,
ÂÂÂÂÂÂÂÂÂ return _FAIL;
ÂÂÂÂÂ pxmitbuf->pbuf = PTR_ALIGN(pxmitbuf->pallocated_buf, XMITBUF_ALIGN_SZ);

Not related to this patch but kmalloc always returns data which is at
least ARCH_KMALLOC_MINALIGN aligned which is never less than
XMITBUF_ALIGN_SZ (4) so this is a no-op.

4-byte alignment for 8-byte pointer (for example void *priv_data) on 64-bit arch is an _error_. Itâs good that kmalloc (and vmalloc) is already aligned to 8 bytes.


The alignment in the driver is pretty crazy because it's all unnecessary
and so complicated. Every allocation is 4 bytes extra so we can align
it later.

Also every buffer is called "pbuf" which stands for pointer to buffer.
"pallocated_buf" is not really useful either.

I tried to look at this to see if we could change the alignment, and
it's complicated because of the naming and the alignment.

regards,
dan carpenter


I have already fixed 4 places with unnecessary alignment, but, alas, there is no great desire to test them on real hardware.

I have now tested on real hardware and it works fine.

Acked-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx>

Larry