lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200811201232.16712.david-b@pacbell.net>
Date:	Thu, 20 Nov 2008 12:32:16 -0800
From:	David Brownell <david-b@...bell.net>
To:	Bryan Wu <cooloney@...nel.org>
Cc:	spi-devel-general@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org, Mike Frysinger <vapier.adi@...il.com>
Subject: Re: [PATCH 06/16] Blackfin SPI Driver: unify duplicated code in dma read/write paths

On Monday 17 November 2008, Bryan Wu wrote:
> From: Mike Frysinger <vapier.adi@...il.com>
> 
> Signed-off-by: Mike Frysinger <vapier.adi@...il.com>
> Signed-off-by: Bryan Wu <cooloney@...nel.org>

Acked-by: David Brownell <dbrownell@...rs.sourceforge.net>

assuming:  this patch grows a real patch comment
instead of only having the long $SUBJECT ...


> ---
>  drivers/spi/spi_bfin5xx.c |   47 ++++++++++++++++++++------------------------
>  1 files changed, 21 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
> index 642c402..df424a2 100644
> --- a/drivers/spi/spi_bfin5xx.c
> +++ b/drivers/spi/spi_bfin5xx.c
> @@ -755,18 +755,19 @@ static void pump_transfers(unsigned long data)
>  	if (!full_duplex && drv_data->cur_chip->enable_dma
>  				&& drv_data->len > 6) {
>  
> +		unsigned long dma_start_addr;
> +
>  		disable_dma(drv_data->dma_channel);
>  		clear_dma_irqstat(drv_data->dma_channel);
>  		bfin_spi_disable(drv_data);
>  
>  		/* config dma channel */
>  		dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n");
> +		set_dma_x_count(drv_data->dma_channel, drv_data->len);
>  		if (width == CFG_SPI_WORDSIZE16) {
> -			set_dma_x_count(drv_data->dma_channel, drv_data->len);
>  			set_dma_x_modify(drv_data->dma_channel, 2);
>  			dma_width = WDSIZE_16;
>  		} else {
> -			set_dma_x_count(drv_data->dma_channel, drv_data->len);
>  			set_dma_x_modify(drv_data->dma_channel, 1);
>  			dma_width = WDSIZE_8;
>  		}
> @@ -801,6 +802,7 @@ static void pump_transfers(unsigned long data)
>  		}
>  
>  		/* In dma mode, rx or tx must be NULL in one transfer */
> +		dma_config = (RESTART | dma_width | DI_EN);
>  		if (drv_data->rx != NULL) {
>  			/* set transfer mode, and enable SPI */
>  			dev_dbg(&drv_data->pdev->dev, "doing DMA in.\n");
> @@ -814,19 +816,9 @@ static void pump_transfers(unsigned long data)
>  			/* clear tx reg soformer data is not shifted out */
>  			write_TDBR(drv_data, 0xFFFF);
>  
> -			set_dma_x_count(drv_data->dma_channel, drv_data->len);
> -
> -			/* start dma */
> -			dma_enable_irq(drv_data->dma_channel);
> -			dma_config = (WNR | RESTART | dma_width | DI_EN);
> -			set_dma_config(drv_data->dma_channel, dma_config);
> -			set_dma_start_addr(drv_data->dma_channel,
> -					(unsigned long)drv_data->rx);
> -			enable_dma(drv_data->dma_channel);
> -
> -			/* start SPI transfer */
> -			write_CTRL(drv_data,
> -				(cr | CFG_SPI_DMAREAD | BIT_CTL_ENABLE));
> +			dma_config |= WNR;
> +			dma_start_addr = (unsigned long)drv_data->rx;
> +			cr |= CFG_SPI_DMAREAD;
>  
>  		} else if (drv_data->tx != NULL) {
>  			dev_dbg(&drv_data->pdev->dev, "doing DMA out.\n");
> @@ -837,18 +829,21 @@ static void pump_transfers(unsigned long data)
>  						(unsigned long) (drv_data->tx +
>  						drv_data->len_in_bytes));
>  
> -			/* start dma */
> -			dma_enable_irq(drv_data->dma_channel);
> -			dma_config = (RESTART | dma_width | DI_EN);
> -			set_dma_config(drv_data->dma_channel, dma_config);
> -			set_dma_start_addr(drv_data->dma_channel,
> -					(unsigned long)drv_data->tx);
> -			enable_dma(drv_data->dma_channel);
> +			dma_start_addr = (unsigned long)drv_data->tx;
> +			cr |= CFG_SPI_DMAWRITE;
> +
> +		} else
> +			BUG();
> +
> +		/* start dma */
> +		dma_enable_irq(drv_data->dma_channel);
> +		set_dma_config(drv_data->dma_channel, dma_config);
> +		set_dma_start_addr(drv_data->dma_channel, dma_start_addr);
> +		enable_dma(drv_data->dma_channel);
> +
> +		/* start SPI transfer */
> +		write_CTRL(drv_data, (cr | BIT_CTL_ENABLE));
>  
> -			/* start SPI transfer */
> -			write_CTRL(drv_data,
> -				(cr | CFG_SPI_DMAWRITE | BIT_CTL_ENABLE));
> -		}
>  	} else {
>  		/* IO mode write then read */
>  		dev_dbg(&drv_data->pdev->dev, "doing IO transfer\n");
> -- 
> 1.5.6.3
> 
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ