* [PATCH] spi: Remove duplicate code to set default bits_per_word setting
@ 2014-01-17 10:53 Axel Lin
2014-01-17 12:55 ` Marek Vasut
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Axel Lin @ 2014-01-17 10:53 UTC (permalink / raw)
To: Mark Brown
Cc: Matt Porter, Alison Wang, Chao Fu, Marek Vasut, Yoshihiro Shimoda,
Guenter Roeck, Barry Song, Tomoya MORINAGA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
The implementation in spi_setup() already set spi->bits_per_word = 8 when
spi->bits_per_word is 0 before calling spi->master->setup.
So we don't need to do it again in setup() callback.
Cc: Matt Porter <mporter-l0cyMroinI0@public.gmane.org>
Cc: Alison Wang <b18965-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: Chao Fu <b44548-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
Cc: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
Cc: Barry Song <Baohua.Song-kQvG35nSl+M@public.gmane.org>
Cc: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-davinci.c | 4 ----
drivers/spi/spi-fsl-dspi.c | 3 ---
drivers/spi/spi-mxs.c | 9 ---------
drivers/spi/spi-rspi.c | 2 --
drivers/spi/spi-sc18is602.c | 3 ---
drivers/spi/spi-sh.c | 3 ---
drivers/spi/spi-sirf.c | 7 -------
drivers/spi/spi-topcliff-pch.c | 6 ------
8 files changed, 37 deletions(-)
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 79d40c8..5e7389f 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -396,10 +396,6 @@ static int davinci_spi_setup(struct spi_device *spi)
dspi = spi_master_get_devdata(spi->master);
pdata = &dspi->pdata;
- /* if bits per word length is zero then set it default 8 */
- if (!spi->bits_per_word)
- spi->bits_per_word = 8;
-
if (!(spi->mode & SPI_NO_CS)) {
if ((pdata->chip_sel == NULL) ||
(pdata->chip_sel[spi->chip_select] == SPI_INTERN_CS))
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index a37f156..ec79f72 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -375,9 +375,6 @@ static int dspi_setup(struct spi_device *spi)
if (!spi->max_speed_hz)
return -EINVAL;
- if (!spi->bits_per_word)
- spi->bits_per_word = 8;
-
return dspi_setup_transfer(spi, NULL);
}
diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c
index 3adebfa..79e5aa2 100644
--- a/drivers/spi/spi-mxs.c
+++ b/drivers/spi/spi-mxs.c
@@ -111,14 +111,6 @@ static int mxs_spi_setup_transfer(struct spi_device *dev,
return 0;
}
-static int mxs_spi_setup(struct spi_device *dev)
-{
- if (!dev->bits_per_word)
- dev->bits_per_word = 8;
-
- return 0;
-}
-
static u32 mxs_spi_cs_to_reg(unsigned cs)
{
u32 select = 0;
@@ -502,7 +494,6 @@ static int mxs_spi_probe(struct platform_device *pdev)
return -ENOMEM;
master->transfer_one_message = mxs_spi_transfer_one;
- master->setup = mxs_spi_setup;
master->bits_per_word_mask = SPI_BPW_MASK(8);
master->mode_bits = SPI_CPOL | SPI_CPHA;
master->num_chipselect = 3;
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index c26840c..28987d9 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -802,8 +802,6 @@ static int rspi_setup(struct spi_device *spi)
{
struct rspi_data *rspi = spi_master_get_devdata(spi->master);
- if (!spi->bits_per_word)
- spi->bits_per_word = 8;
rspi->max_speed_hz = spi->max_speed_hz;
rspi->spcmd = SPCMD_SSLKP;
diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
index c981d21..121c2e1 100644
--- a/drivers/spi/spi-sc18is602.c
+++ b/drivers/spi/spi-sc18is602.c
@@ -247,9 +247,6 @@ error:
static int sc18is602_setup(struct spi_device *spi)
{
- if (!spi->bits_per_word)
- spi->bits_per_word = 8;
-
if (spi->mode & ~(SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST))
return -EINVAL;
diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c
index 9fea8cc..f6f2c70 100644
--- a/drivers/spi/spi-sh.c
+++ b/drivers/spi/spi-sh.c
@@ -352,9 +352,6 @@ static int spi_sh_setup(struct spi_device *spi)
{
struct spi_sh_data *ss = spi_master_get_devdata(spi->master);
- if (!spi->bits_per_word)
- spi->bits_per_word = 8;
-
pr_debug("%s: enter\n", __func__);
spi_sh_write(ss, 0xfe, SPI_SH_CR1); /* SPI sycle stop */
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index ed5e501..e430689 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -536,16 +536,9 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
static int spi_sirfsoc_setup(struct spi_device *spi)
{
- struct sirfsoc_spi *sspi;
-
if (!spi->max_speed_hz)
return -EINVAL;
- sspi = spi_master_get_devdata(spi->master);
-
- if (!spi->bits_per_word)
- spi->bits_per_word = 8;
-
return spi_sirfsoc_setup_transfer(spi, NULL);
}
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index 338fc11..2e7f38c 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -466,12 +466,6 @@ static void pch_spi_reset(struct spi_master *master)
static int pch_spi_setup(struct spi_device *pspi)
{
- /* check bits per word */
- if (pspi->bits_per_word == 0) {
- pspi->bits_per_word = 8;
- dev_dbg(&pspi->dev, "%s 8 bits per word\n", __func__);
- }
-
/* Check baud rate setting */
/* if baud rate of chip is greater than
max we can support,return error */
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] spi: Remove duplicate code to set default bits_per_word setting
2014-01-17 10:53 [PATCH] spi: Remove duplicate code to set default bits_per_word setting Axel Lin
@ 2014-01-17 12:55 ` Marek Vasut
[not found] ` <201401171355.27291.marex-ynQEQJNshbs@public.gmane.org>
2014-01-17 14:25 ` Guenter Roeck
2014-01-17 15:58 ` Mark Brown
2 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2014-01-17 12:55 UTC (permalink / raw)
To: Axel Lin
Cc: Mark Brown, Matt Porter, Alison Wang, Chao Fu, Yoshihiro Shimoda,
Guenter Roeck, Barry Song, Tomoya MORINAGA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
On Friday, January 17, 2014 at 11:53:40 AM, Axel Lin wrote:
> The implementation in spi_setup() already set spi->bits_per_word = 8 when
> spi->bits_per_word is 0 before calling spi->master->setup.
> So we don't need to do it again in setup() callback.
>
> Cc: Matt Porter <mporter-l0cyMroinI0@public.gmane.org>
> Cc: Alison Wang <b18965-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Cc: Chao Fu <b44548-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Cc: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> Cc: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
> Cc: Barry Song <Baohua.Song-kQvG35nSl+M@public.gmane.org>
> Cc: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Good catch,
for spi-mxs:
Acked-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] spi: Remove duplicate code to set default bits_per_word setting
2014-01-17 10:53 [PATCH] spi: Remove duplicate code to set default bits_per_word setting Axel Lin
2014-01-17 12:55 ` Marek Vasut
@ 2014-01-17 14:25 ` Guenter Roeck
2014-01-17 15:58 ` Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2014-01-17 14:25 UTC (permalink / raw)
To: Axel Lin, Mark Brown
Cc: Matt Porter, Alison Wang, Chao Fu, Marek Vasut, Yoshihiro Shimoda,
Barry Song, Tomoya MORINAGA, linux-spi-u79uwXL29TY76Z2rM5mHXA
On 01/17/2014 02:53 AM, Axel Lin wrote:
> The implementation in spi_setup() already set spi->bits_per_word = 8 when
> spi->bits_per_word is 0 before calling spi->master->setup.
> So we don't need to do it again in setup() callback.
>
> Cc: Matt Porter <mporter-l0cyMroinI0@public.gmane.org>
> Cc: Alison Wang <b18965-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Cc: Chao Fu <b44548-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> Cc: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> Cc: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
For spi-sc18is602.c:
Acked-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] spi: Remove duplicate code to set default bits_per_word setting
2014-01-17 10:53 [PATCH] spi: Remove duplicate code to set default bits_per_word setting Axel Lin
2014-01-17 12:55 ` Marek Vasut
2014-01-17 14:25 ` Guenter Roeck
@ 2014-01-17 15:58 ` Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-01-17 15:58 UTC (permalink / raw)
To: Axel Lin
Cc: Matt Porter, Alison Wang, Chao Fu, Marek Vasut, Yoshihiro Shimoda,
Guenter Roeck, Barry Song, Tomoya MORINAGA,
linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 268 bytes --]
On Fri, Jan 17, 2014 at 06:53:40PM +0800, Axel Lin wrote:
> The implementation in spi_setup() already set spi->bits_per_word = 8 when
> spi->bits_per_word is 0 before calling spi->master->setup.
> So we don't need to do it again in setup() callback.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-01-17 15:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-17 10:53 [PATCH] spi: Remove duplicate code to set default bits_per_word setting Axel Lin
2014-01-17 12:55 ` Marek Vasut
[not found] ` <201401171355.27291.marex-ynQEQJNshbs@public.gmane.org>
2014-01-17 13:05 ` Barry Song
2014-01-17 14:25 ` Guenter Roeck
2014-01-17 15:58 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.