aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-oc-tiny.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-oc-tiny.c')
-rw-r--r--drivers/spi/spi-oc-tiny.c8
1 files changed, 4 insertions, 4 deletions
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 {
54 unsigned int txc, rxc; 54 unsigned int txc, rxc;
55 const u8 *txp; 55 const u8 *txp;
56 u8 *rxp; 56 u8 *rxp;
57 unsigned int gpio_cs_count; 57 int gpio_cs_count;
58 int *gpio_cs; 58 int *gpio_cs;
59}; 59};
60 60
@@ -74,7 +74,7 @@ static void tiny_spi_chipselect(struct spi_device *spi, int is_active)
74{ 74{
75 struct tiny_spi *hw = tiny_spi_to_hw(spi); 75 struct tiny_spi *hw = tiny_spi_to_hw(spi);
76 76
77 if (hw->gpio_cs_count) { 77 if (hw->gpio_cs_count > 0) {
78 gpio_set_value(hw->gpio_cs[spi->chip_select], 78 gpio_set_value(hw->gpio_cs[spi->chip_select],
79 (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); 79 (spi->mode & SPI_CS_HIGH) ? is_active : !is_active);
80 } 80 }
@@ -254,7 +254,7 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
254 if (!np) 254 if (!np)
255 return 0; 255 return 0;
256 hw->gpio_cs_count = of_gpio_count(np); 256 hw->gpio_cs_count = of_gpio_count(np);
257 if (hw->gpio_cs_count) { 257 if (hw->gpio_cs_count > 0) {
258 hw->gpio_cs = devm_kzalloc(&pdev->dev, 258 hw->gpio_cs = devm_kzalloc(&pdev->dev,
259 hw->gpio_cs_count * sizeof(unsigned int), 259 hw->gpio_cs_count * sizeof(unsigned int),
260 GFP_KERNEL); 260 GFP_KERNEL);
@@ -352,7 +352,7 @@ static int tiny_spi_probe(struct platform_device *pdev)
352 goto exit_gpio; 352 goto exit_gpio;
353 gpio_direction_output(hw->gpio_cs[i], 1); 353 gpio_direction_output(hw->gpio_cs[i], 1);
354 } 354 }
355 hw->bitbang.master->num_chipselect = max(1U, hw->gpio_cs_count); 355 hw->bitbang.master->num_chipselect = max(1, hw->gpio_cs_count);
356 356
357 /* register our spi controller */ 357 /* register our spi controller */
358 err = spi_bitbang_start(&hw->bitbang); 358 err = spi_bitbang_start(&hw->bitbang);