diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-fsl-spi.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi-oc-tiny.c | 8 | ||||
-rw-r--r-- | drivers/spi/spi-ppc4xx.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi.c | 5 |
4 files changed, 10 insertions, 11 deletions
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 1a7f6359d998..086a9eef2e05 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -947,12 +947,12 @@ static int of_fsl_spi_get_chipselects(struct device *dev) struct device_node *np = dev->of_node; struct fsl_spi_platform_data *pdata = dev->platform_data; struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata); - unsigned int ngpios; + int ngpios; int i = 0; int ret; ngpios = of_gpio_count(np); - if (!ngpios) { + if (ngpios <= 0) { /* * SPI w/o chip-select line. One SPI device is still permitted * though. diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c index 432e66ec3088..cb2e284bd814 100644 --- a/drivers/spi/spi-oc-tiny.c +++ b/drivers/spi/spi-oc-tiny.c @@ -54,7 +54,7 @@ struct tiny_spi { unsigned int txc, rxc; const u8 *txp; u8 *rxp; - unsigned int gpio_cs_count; + int gpio_cs_count; int *gpio_cs; }; @@ -74,7 +74,7 @@ static void tiny_spi_chipselect(struct spi_device *spi, int is_active) { struct tiny_spi *hw = tiny_spi_to_hw(spi); - if (hw->gpio_cs_count) { + if (hw->gpio_cs_count > 0) { gpio_set_value(hw->gpio_cs[spi->chip_select], (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); } @@ -254,7 +254,7 @@ static int tiny_spi_of_probe(struct platform_device *pdev) if (!np) return 0; hw->gpio_cs_count = of_gpio_count(np); - if (hw->gpio_cs_count) { + if (hw->gpio_cs_count > 0) { hw->gpio_cs = devm_kzalloc(&pdev->dev, hw->gpio_cs_count * sizeof(unsigned int), GFP_KERNEL); @@ -352,7 +352,7 @@ static int tiny_spi_probe(struct platform_device *pdev) goto exit_gpio; gpio_direction_output(hw->gpio_cs[i], 1); } - hw->bitbang.master->num_chipselect = max(1U, hw->gpio_cs_count); + hw->bitbang.master->num_chipselect = max(1, hw->gpio_cs_count); /* register our spi controller */ err = spi_bitbang_start(&hw->bitbang); diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c index 7a85f22b6474..af3e6e756dc9 100644 --- a/drivers/spi/spi-ppc4xx.c +++ b/drivers/spi/spi-ppc4xx.c @@ -419,7 +419,7 @@ static int __init spi_ppc4xx_of_probe(struct platform_device *op) * This includes both "null" gpio's and real ones. */ num_gpios = of_gpio_count(np); - if (num_gpios) { + if (num_gpios > 0) { int i; hw->gpios = kzalloc(sizeof(int) * num_gpios, GFP_KERNEL); @@ -471,7 +471,7 @@ static int __init spi_ppc4xx_of_probe(struct platform_device *op) SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | SPI_LSB_FIRST; /* this many pins in all GPIO controllers */ - bbp->master->num_chipselect = num_gpios; + bbp->master->num_chipselect = num_gpios > 0 ? num_gpios : 0; /* Get the clock for the OPB */ opbnp = of_find_compatible_node(NULL, NULL, "ibm,opb"); diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 19ee901577da..21c47482d9fd 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1059,15 +1059,14 @@ EXPORT_SYMBOL_GPL(spi_alloc_master); #ifdef CONFIG_OF static int of_spi_register_master(struct spi_master *master) { - u16 nb; - int i, *cs; + int nb, i, *cs; struct device_node *np = master->dev.of_node; if (!np) return 0; nb = of_gpio_named_count(np, "cs-gpios"); - master->num_chipselect = max(nb, master->num_chipselect); + master->num_chipselect = max(nb, (int)master->num_chipselect); if (nb < 1) return 0; |