[PATCH 2/6] staging: et131x: Remove alignment offset padding on DMA buffer allocation/free

Dan Carpenter dan.carpenter at oracle.com
Thu Nov 15 13:53:21 UTC 2012


On Thu, Nov 15, 2012 at 01:27:17PM +0000, Mark Einon wrote:
> This padding was used to align buffers to a 4k boundary when returned
> from dma_alloc_coherent(). As the buffers are already 4k aligned, and
> the alignment no longer performed, the padding is not needed.
> 
> Signed-off-by: Mark Einon <mark.einon at gmail.com>
> ---
>  drivers/staging/et131x/et131x.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
> index d7cdb673..153ab15 100644
> --- a/drivers/staging/et131x/et131x.c
> +++ b/drivers/staging/et131x/et131x.c
> @@ -2291,8 +2291,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter)
>  
>  	for (id = 0; id < NUM_FBRS; id++) {
>  		/* Allocate an area of memory for Free Buffer Ring */
> -		bufsize = (sizeof(struct fbr_desc) *
> -				rx_ring->fbr[id]->num_entries) + 0xfff;
> +		bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries);

The parenthesis are not needed and don't make it more readable.

>  		rx_ring->fbr[id]->ring_virtaddr =
>  				dma_alloc_coherent(&adapter->pdev->dev,
>  					bufsize,
> @@ -2462,9 +2461,8 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter)
>  				}
>  			}
>  
> -			bufsize =
> -			    (sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries) +
> -										0xfff;
> +		bufsize =
> +		    (sizeof(struct fbr_desc) * rx_ring->fbr[id]->num_entries);

This should be indented one more tab.

regards,
dan carpenter




More information about the devel mailing list