staging: r8188eu: remove unused members of struct xmit_buf
PATCH 1/1 staging: r8188eu: remove unused members of struct xmit_buf
Remove unused members of struct xmit_buf: alloc_sz, ff_hwaddr, dma_transfer_addr, bpending and last.
--- drivers/staging/rtl8188eu/include/rtw_xmit.h | 5 ----- drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 1 - 2 files changed, 6 deletions(-)
drivers/staging/rtl8188eu/include/rtw_xmit.h +0 -5
@@ -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 {
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0 -1
@@ -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 ); - pxmitbuf->dma_transfer_addr =0 ;for (i =0 ; i <8 ; i++) { pxmitbuf->pxmit_urb[i] =usb_alloc_urb (0 ,GFP_KERNEL );
Signature · 1 line
2.26.2
Quoted 5 lines · Ivan Safonov
Remove unused members of struct
xmit_buf:alloc_sz,ff_hwaddr,dma_transfer_addr, bpending and last.Signed-off-by Ivan Safonov <[email protected]>---
Have you tested this change? Previously with this driver, an unused quantity was removed from one of the structs and the driver failed. Apparently, the alignment of some other quantity was affected. I do not think that this change would have that affect; however, you should be testing whenever the changes are more than cosmetic.
Larry
Quoted 11 lines · Larry Finger
Quoted 5 lines · Ivan Safonov
Remove unused members of struct
xmit_buf:alloc_sz,ff_hwaddr,dma_transfer_addr, bpending and last.Signed-off-by Ivan Safonov <[email protected]>---
Have you tested this change? Previously with this driver, an unused quantity was removed from one of the structs and the driver failed. Apparently, the alignment of some other quantity was affected. I do not think that this change would have that affect; however, you should be testing whenever the changes are more than cosmetic.
Larry
I have not tested this patch.
Ivan.
Quoted 33 lines · Ivan Safonov
Remove unused members of struct
xmit_buf:alloc_sz,ff_hwaddr,dma_transfer_addr, bpending and last.Signed-off-by Ivan Safonov <[email protected]>--- drivers/staging/rtl8188eu/include/rtw_xmit.h | 5 ----- drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 1 - 2 files changed, 6 deletions(-)drivers/staging/rtl8188eu/include/rtw_xmit.h +0
-5@@ -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 {drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-0
drivers/staging/rtl8188eu/os_dep/xmit_linux.c int rtw_os_xmit_resource_alloc(struct adapter *padapter, · line 26
Quoted 3 lines
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-0@@ -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.
drivers/staging/rtl8188eu/os_dep/xmit_linux.c int rtw_os_xmit_resource_alloc(struct adapter *padapter, · line 27
Quoted 1 line
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-1- pxmitbuf->dma_transfer_addr =0 ;
regards,
dan carpenter
Quoted 36 lines · Dan Carpenter
Quoted 35 lines · Ivan Safonov
Remove unused members of struct
xmit_buf:alloc_sz,ff_hwaddr,dma_transfer_addr, bpending and last.Signed-off-by Ivan Safonov <[email protected]>--- drivers/staging/rtl8188eu/include/rtw_xmit.h | 5 ----- drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 1 - 2 files changed, 6 deletions(-)drivers/staging/rtl8188eu/include/rtw_xmit.h +0
-5@@ -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 {drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-0@@ -24,7 +24,6 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter,return _FAIL;
Quoted 5 lines
drivers/staging/rtl8188eu/os_dep/xmit_linux.c int rtw_os_xmit_resource_alloc(struct adapter *padapter, · line 26
Quoted 1 line
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-0pxmitbuf->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_MINALIGNaligned which is never less thanXMITBUF_ALIGN_SZ(4) so this is a no-op.
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
Quoted 37 lines · Dan Carpenter
Quoted 36 lines · Dan Carpenter
Quoted 35 lines · Ivan Safonov
Remove unused members of struct
xmit_buf:alloc_sz,ff_hwaddr,dma_transfer_addr, bpending and last.Signed-off-by Ivan Safonov <[email protected]>--- drivers/staging/rtl8188eu/include/rtw_xmit.h | 5 ----- drivers/staging/rtl8188eu/os_dep/xmit_linux.c | 1 - 2 files changed, 6 deletions(-)drivers/staging/rtl8188eu/include/rtw_xmit.h +0
-5@@ -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 {drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-0@@ -24,7 +24,6 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter,return _FAIL;
Quoted 5 lines
Quoted 5 lines
drivers/staging/rtl8188eu/os_dep/xmit_linux.c int rtw_os_xmit_resource_alloc(struct adapter *padapter, · line 26
Quoted 1 line
drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-0pxmitbuf->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_MINALIGNaligned which is never less thanXMITBUF_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.
Quoted 5 lines
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.
Quoted 9 lines
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.
Ivan.
Larry Finger
Acked-byQuoted 52 lines · Ivan Safonov
Quoted 32 lines · Dan Carpenter
Quoted 31 lines · Dan Carpenter
Quoted 30 lines · Ivan Safonov
Remove unused members of struct
xmit_buf:alloc_sz,ff_hwaddr,dma_transfer_addr, bpending and last.Signed-off-by Ivan Safonov <[email protected]>---
drivers/staging/rtl8188eu/include/rtw_xmit.h | 5 -----drivers/staging/rtl8188eu/os_dep/xmit_linux.c| 1 -2 files changed, 6 deletions(-)drivers/staging/rtl8188eu/include/rtw_xmit.h +0
-0@@ -193,14 +193,9 @@ struct xmit_buf { void *priv_data;u16
ext_tag; /* 0: Normal xmitbuf, 1: extension xmitbuf. */ u16 flags;
- u32alloc_sz;
u32 len;
structsubmit_ctx*sctx;
- u32ff_hwaddr;
struct urb *pxmit_urb[8];
-dma_addr_tdma_transfer_addr; /* (in) dma addr fortransfer_buffer*/ - u8 bpending[8];
- int last[8];
};
structxmit_frame{drivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-1--- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.cQuoted 8 lines
Quoted 8 lines
drivers/staging/rtl8188eu/os_dep/xmit_linux.c int rtw_os_xmit_resource_alloc(struct adapter *padapter, · line 25
Quoted 4 lines
+++
b/drivers/staging/rtl8188eu/os_dep/xmit_linux.cdrivers/staging/rtl8188eu/os_dep/xmit_linux.c +0
-0@@ -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_MINALIGNaligned which is never less thanXMITBUF_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.Quoted 8 lines
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.
Quoted 8 lines
Quoted 6 lines
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 carpenterI 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.
Larry