gpio: Make of_count_named_gpios() use new of_count_phandle_with_args()
[linux-2.6-microblaze.git] / drivers / spi / spi-oc-tiny.c
index 432e66e..cb2e284 100644 (file)
@@ -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);