[PATCH] spi: remove check for bits_per_word on transfer
When spi client does the spi transfer and does not sets the bits_per_word for each transfer then set it as default of spi device in spi core before calling low level transfer. Removing the similar code from different low level drivers as it its duplicate checks and it is no more require. Signed-off-by: Laxman Dewangan ldewan...@nvidia.com --- This is the continuation of feedback got from Jonas on change spi: make sure all transfer has bits_per_word set where I made the change in only tegra slink driver. This patch remove the similar code form all drivers. drivers/spi/spi-altera.c|2 +- drivers/spi/spi-bfin-sport.c|3 +-- drivers/spi/spi-bfin5xx.c |3 +-- drivers/spi/spi-bitbang.c |6 +++--- drivers/spi/spi-clps711x.c |2 +- drivers/spi/spi-coldfire-qspi.c |3 +-- drivers/spi/spi-ep93xx.c|2 +- drivers/spi/spi-s3c64xx.c |2 +- drivers/spi/spi-sirf.c |3 +-- drivers/spi/spi-tegra20-slink.c |9 +++-- drivers/spi/spi-txx9.c |6 ++ 11 files changed, 16 insertions(+), 25 deletions(-) diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c index 5e7314a..a537f8d 100644 --- a/drivers/spi/spi-altera.c +++ b/drivers/spi/spi-altera.c @@ -134,7 +134,7 @@ static int altera_spi_txrx(struct spi_device *spi, struct spi_transfer *t) hw-tx = t-tx_buf; hw-rx = t-rx_buf; hw-count = 0; - hw-bytes_per_word = (t-bits_per_word ? : spi-bits_per_word) / 8; + hw-bytes_per_word = t-bits_per_word / 8; hw-len = t-len / hw-bytes_per_word; if (hw-irq = 0) { diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c index ac7ffca..39b0d17 100644 --- a/drivers/spi/spi-bfin-sport.c +++ b/drivers/spi/spi-bfin-sport.c @@ -416,8 +416,7 @@ bfin_sport_spi_pump_transfers(unsigned long data) drv_data-cs_change = transfer-cs_change; /* Bits per word setup */ - bits_per_word = transfer-bits_per_word ? : - message-spi-bits_per_word ? : 8; + bits_per_word = transfer-bits_per_word; if (bits_per_word % 16 == 0) drv_data-ops = bfin_sport_transfer_ops_u16; else diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index 0429d83..7d7c991 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c @@ -642,8 +642,7 @@ static void bfin_spi_pump_transfers(unsigned long data) drv_data-cs_change = transfer-cs_change; /* Bits per word setup */ - bits_per_word = transfer-bits_per_word ? : - message-spi-bits_per_word ? : 8; + bits_per_word = transfer-bits_per_word; if (bits_per_word % 16 == 0) { drv_data-n_bytes = bits_per_word/8; drv_data-len = (transfer-len) 1; diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index 8b3d8ef..61beaec 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -69,7 +69,7 @@ static unsigned bitbang_txrx_8( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u8*tx = t-tx_buf; u8 *rx = t-rx_buf; @@ -95,7 +95,7 @@ static unsigned bitbang_txrx_16( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u16 *tx = t-tx_buf; u16 *rx = t-rx_buf; @@ -121,7 +121,7 @@ static unsigned bitbang_txrx_32( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u32 *tx = t-tx_buf; u32 *rx = t-rx_buf; diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index 1366c46..a11cbf0 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c @@ -68,7 +68,7 @@ static int spi_clps711x_setup_xfer(struct spi_device *spi, struct spi_transfer *xfer) { u32 speed = xfer-speed_hz ? : spi-max_speed_hz; - u8 bpw = xfer-bits_per_word ? : spi-bits_per_word; + u8 bpw = xfer-bits_per_word; struct spi_clps711x_data *hw = spi_master_get_devdata(spi-master); if (bpw != 8) { diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c index 58466b8..7b5cc9e 100644 --- a/drivers/spi/spi-coldfire-qspi.c +++ b/drivers/spi/spi-coldfire-qspi.c @@ -329,8 +329,7 @@ static int
[PATCH] spi: remove check for bits_per_word on transfer
When spi client does the spi transfer and does not sets the bits_per_word for each transfer then set it as default of spi device in spi core before calling low level transfer. Removing the similar code from different low level drivers as it its duplicate checks and it is no more require. Signed-off-by: Laxman Dewangan ldewan...@nvidia.com --- This is the continuation of feedback got from Jonas on change spi: make sure all transfer has bits_per_word set where I made the change in only tegra slink driver. This patch remove the similar code form all drivers. drivers/spi/spi-altera.c|2 +- drivers/spi/spi-bfin-sport.c|3 +-- drivers/spi/spi-bfin5xx.c |3 +-- drivers/spi/spi-bitbang.c |6 +++--- drivers/spi/spi-clps711x.c |2 +- drivers/spi/spi-coldfire-qspi.c |3 +-- drivers/spi/spi-ep93xx.c|2 +- drivers/spi/spi-s3c64xx.c |2 +- drivers/spi/spi-sirf.c |3 +-- drivers/spi/spi-tegra20-slink.c |9 +++-- drivers/spi/spi-txx9.c |6 ++ 11 files changed, 16 insertions(+), 25 deletions(-) diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c index 5e7314a..a537f8d 100644 --- a/drivers/spi/spi-altera.c +++ b/drivers/spi/spi-altera.c @@ -134,7 +134,7 @@ static int altera_spi_txrx(struct spi_device *spi, struct spi_transfer *t) hw-tx = t-tx_buf; hw-rx = t-rx_buf; hw-count = 0; - hw-bytes_per_word = (t-bits_per_word ? : spi-bits_per_word) / 8; + hw-bytes_per_word = t-bits_per_word / 8; hw-len = t-len / hw-bytes_per_word; if (hw-irq = 0) { diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c index ac7ffca..39b0d17 100644 --- a/drivers/spi/spi-bfin-sport.c +++ b/drivers/spi/spi-bfin-sport.c @@ -416,8 +416,7 @@ bfin_sport_spi_pump_transfers(unsigned long data) drv_data-cs_change = transfer-cs_change; /* Bits per word setup */ - bits_per_word = transfer-bits_per_word ? : - message-spi-bits_per_word ? : 8; + bits_per_word = transfer-bits_per_word; if (bits_per_word % 16 == 0) drv_data-ops = bfin_sport_transfer_ops_u16; else diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index 0429d83..7d7c991 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c @@ -642,8 +642,7 @@ static void bfin_spi_pump_transfers(unsigned long data) drv_data-cs_change = transfer-cs_change; /* Bits per word setup */ - bits_per_word = transfer-bits_per_word ? : - message-spi-bits_per_word ? : 8; + bits_per_word = transfer-bits_per_word; if (bits_per_word % 16 == 0) { drv_data-n_bytes = bits_per_word/8; drv_data-len = (transfer-len) 1; diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index 8b3d8ef..61beaec 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -69,7 +69,7 @@ static unsigned bitbang_txrx_8( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u8*tx = t-tx_buf; u8 *rx = t-rx_buf; @@ -95,7 +95,7 @@ static unsigned bitbang_txrx_16( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u16 *tx = t-tx_buf; u16 *rx = t-rx_buf; @@ -121,7 +121,7 @@ static unsigned bitbang_txrx_32( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u32 *tx = t-tx_buf; u32 *rx = t-rx_buf; diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index 1366c46..a11cbf0 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c @@ -68,7 +68,7 @@ static int spi_clps711x_setup_xfer(struct spi_device *spi, struct spi_transfer *xfer) { u32 speed = xfer-speed_hz ? : spi-max_speed_hz; - u8 bpw = xfer-bits_per_word ? : spi-bits_per_word; + u8 bpw = xfer-bits_per_word; struct spi_clps711x_data *hw = spi_master_get_devdata(spi-master); if (bpw != 8) { diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c index 58466b8..7b5cc9e 100644 --- a/drivers/spi/spi-coldfire-qspi.c +++ b/drivers/spi/spi-coldfire-qspi.c @@ -329,8 +329,7 @@ static int
Re: [PATCH] spi: remove check for bits_per_word on transfer
On Mon, Dec 17, 2012 at 11:21:57PM +0530, Laxman Dewangan wrote: When spi client does the spi transfer and does not sets the bits_per_word for each transfer then set it as default of spi device in spi core before calling low level transfer. Err, sorry? To me, the above doesn't make too much sense when considering what's in the patch. Please can you improve the description? Thanks. Removing the similar code from different low level drivers as it its duplicate checks and it is no more require. Signed-off-by: Laxman Dewangan ldewan...@nvidia.com --- This is the continuation of feedback got from Jonas on change spi: make sure all transfer has bits_per_word set where I made the change in only tegra slink driver. This patch remove the similar code form all drivers. drivers/spi/spi-altera.c|2 +- drivers/spi/spi-bfin-sport.c|3 +-- drivers/spi/spi-bfin5xx.c |3 +-- drivers/spi/spi-bitbang.c |6 +++--- drivers/spi/spi-clps711x.c |2 +- drivers/spi/spi-coldfire-qspi.c |3 +-- drivers/spi/spi-ep93xx.c|2 +- drivers/spi/spi-s3c64xx.c |2 +- drivers/spi/spi-sirf.c |3 +-- drivers/spi/spi-tegra20-slink.c |9 +++-- drivers/spi/spi-txx9.c |6 ++ 11 files changed, 16 insertions(+), 25 deletions(-) diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c index 5e7314a..a537f8d 100644 --- a/drivers/spi/spi-altera.c +++ b/drivers/spi/spi-altera.c @@ -134,7 +134,7 @@ static int altera_spi_txrx(struct spi_device *spi, struct spi_transfer *t) hw-tx = t-tx_buf; hw-rx = t-rx_buf; hw-count = 0; - hw-bytes_per_word = (t-bits_per_word ? : spi-bits_per_word) / 8; + hw-bytes_per_word = t-bits_per_word / 8; hw-len = t-len / hw-bytes_per_word; if (hw-irq = 0) { diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c index ac7ffca..39b0d17 100644 --- a/drivers/spi/spi-bfin-sport.c +++ b/drivers/spi/spi-bfin-sport.c @@ -416,8 +416,7 @@ bfin_sport_spi_pump_transfers(unsigned long data) drv_data-cs_change = transfer-cs_change; /* Bits per word setup */ - bits_per_word = transfer-bits_per_word ? : - message-spi-bits_per_word ? : 8; + bits_per_word = transfer-bits_per_word; if (bits_per_word % 16 == 0) drv_data-ops = bfin_sport_transfer_ops_u16; else diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index 0429d83..7d7c991 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c @@ -642,8 +642,7 @@ static void bfin_spi_pump_transfers(unsigned long data) drv_data-cs_change = transfer-cs_change; /* Bits per word setup */ - bits_per_word = transfer-bits_per_word ? : - message-spi-bits_per_word ? : 8; + bits_per_word = transfer-bits_per_word; if (bits_per_word % 16 == 0) { drv_data-n_bytes = bits_per_word/8; drv_data-len = (transfer-len) 1; diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index 8b3d8ef..61beaec 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -69,7 +69,7 @@ static unsigned bitbang_txrx_8( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u8*tx = t-tx_buf; u8 *rx = t-rx_buf; @@ -95,7 +95,7 @@ static unsigned bitbang_txrx_16( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u16 *tx = t-tx_buf; u16 *rx = t-rx_buf; @@ -121,7 +121,7 @@ static unsigned bitbang_txrx_32( unsignedns, struct spi_transfer *t ) { - unsignedbits = t-bits_per_word ? : spi-bits_per_word; + unsignedbits = t-bits_per_word; unsignedcount = t-len; const u32 *tx = t-tx_buf; u32 *rx = t-rx_buf; diff --git a/drivers/spi/spi-clps711x.c b/drivers/spi/spi-clps711x.c index 1366c46..a11cbf0 100644 --- a/drivers/spi/spi-clps711x.c +++ b/drivers/spi/spi-clps711x.c @@ -68,7 +68,7 @@ static int spi_clps711x_setup_xfer(struct spi_device *spi, struct spi_transfer *xfer) { u32 speed = xfer-speed_hz ? : spi-max_speed_hz; - u8 bpw = xfer-bits_per_word ? : spi-bits_per_word; + u8 bpw = xfer-bits_per_word; struct spi_clps711x_data *hw = spi_master_get_devdata(spi-master); if (bpw != 8) { diff