spi: Remove duplicate code to check chip_select
authorAxel Lin <axel.lin@ingics.com>
Tue, 11 Feb 2014 14:07:30 +0000 (22:07 +0800)
committerMark Brown <broonie@linaro.org>
Wed, 12 Feb 2014 16:25:32 +0000 (16:25 +0000)
In spi_add_device(), we have the code to validate spi->chip_select.
So remove the duplicate code in various drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-atmel.c
drivers/spi/spi-coldfire-qspi.c
drivers/spi/spi-falcon.c
drivers/spi/spi-mpc52xx.c
drivers/spi/spi-omap-uwire.c
drivers/spi/spi-tegra114.c
drivers/spi/spi-tegra20-slink.c

index b0842f75101647616ada3a3db4f545a57b519be0..5488ab86312fdb74ffa08533f877519dd64e6030 100644 (file)
@@ -993,13 +993,6 @@ static int atmel_spi_setup(struct spi_device *spi)
 
        as = spi_master_get_devdata(spi->master);
 
-       if (spi->chip_select > spi->master->num_chipselect) {
-               dev_dbg(&spi->dev,
-                               "setup: invalid chipselect %u (%u defined)\n",
-                               spi->chip_select, spi->master->num_chipselect);
-               return -EINVAL;
-       }
-
        /* see notes above re chipselect */
        if (!atmel_spi_is_v2(as)
                        && spi->chip_select == 0
index cabed8f9119e1af30d80766420d548b94567c91c..0ab2c55575ddd35bf9cdc90174d3d72b6b7f9a12 100644 (file)
@@ -356,12 +356,6 @@ static int mcfqspi_transfer_one_message(struct spi_master *master,
 
 static int mcfqspi_setup(struct spi_device *spi)
 {
-       if (spi->chip_select >= spi->master->num_chipselect) {
-               dev_dbg(&spi->dev, "%d chip select is out of range\n",
-                       spi->chip_select);
-               return -EINVAL;
-       }
-
        mcfqspi_cs_deselect(spi_master_get_devdata(spi->master),
                            spi->chip_select, spi->mode & SPI_CS_HIGH);
 
index dd5bd468e9621698c7a130418d5a74994c474cbe..0ae7f45e24a5b0034829ed2691f71bebfa8ebd3f 100644 (file)
@@ -312,9 +312,6 @@ static int falcon_sflash_setup(struct spi_device *spi)
        unsigned int i;
        unsigned long flags;
 
-       if (spi->chip_select > 0)
-               return -ENODEV;
-
        spin_lock_irqsave(&ebu_lock, flags);
 
        if (spi->max_speed_hz >= CLOCK_100M) {
index 7c675fe8310105d255f6f10afc7a2f1c5e576b32..e3d29a56d70a703a0e65f7a5694912cdb2858653 100644 (file)
@@ -365,9 +365,6 @@ static int mpc52xx_spi_setup(struct spi_device *spi)
        if (spi->mode & ~(SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST))
                return -EINVAL;
 
-       if (spi->chip_select >= spi->master->num_chipselect)
-               return -EINVAL;
-
        return 0;
 }
 
index 9313fd3b413dfd6eed5e1d8e14dc42a0e32f1e3d..462ddd45821708740a84f0f7cfc7ed6f84e25b1d 100644 (file)
@@ -332,12 +332,6 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
 
        uwire = spi_master_get_devdata(spi->master);
 
-       if (spi->chip_select > 3) {
-               pr_debug("%s: cs%d?\n", dev_name(&spi->dev), spi->chip_select);
-               status = -ENODEV;
-               goto done;
-       }
-
        bits = spi->bits_per_word;
        if (t != NULL && t->bits_per_word)
                bits = t->bits_per_word;
index d8c71b81165afc8925fc616d1fe0eebe121dde9e..22905b5d254681942dbea548a45c77fe96147750 100644 (file)
@@ -760,8 +760,6 @@ static int tegra_spi_setup(struct spi_device *spi)
                spi->mode & SPI_CPHA ? "" : "~",
                spi->max_speed_hz);
 
-       BUG_ON(spi->chip_select >= MAX_CHIP_SELECT);
-
        ret = pm_runtime_get_sync(tspi->dev);
        if (ret < 0) {
                dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
index 9da14f2e281837f686fbdb82f5c9c6b32fe533ec..593e823d6c21ef38c149ab8f17fc7d45dde26816 100644 (file)
@@ -760,8 +760,6 @@ static int tegra_slink_setup(struct spi_device *spi)
                spi->mode & SPI_CPHA ? "" : "~",
                spi->max_speed_hz);
 
-       BUG_ON(spi->chip_select >= MAX_CHIP_SELECT);
-
        ret = pm_runtime_get_sync(tspi->dev);
        if (ret < 0) {
                dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);