aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-ich.c4
-rw-r--r--drivers/gpio/gpio-mcp23s08.c12
-rw-r--r--drivers/gpio/gpio-spear-spics.c4
-rw-r--r--drivers/gpio/gpiolib-acpi.c12
-rw-r--r--drivers/gpio/gpiolib.c2
5 files changed, 23 insertions, 11 deletions
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c
index e73c6755a5eb..70304220a479 100644
--- a/drivers/gpio/gpio-ich.c
+++ b/drivers/gpio/gpio-ich.c
@@ -305,6 +305,8 @@ static struct ichx_desc ich6_desc = {
305 305
306 .ngpio = 50, 306 .ngpio = 50,
307 .have_blink = true, 307 .have_blink = true,
308 .regs = ichx_regs,
309 .reglen = ichx_reglen,
308}; 310};
309 311
310/* Intel 3100 */ 312/* Intel 3100 */
@@ -324,6 +326,8 @@ static struct ichx_desc i3100_desc = {
324 .uses_gpe0 = true, 326 .uses_gpe0 = true,
325 327
326 .ngpio = 50, 328 .ngpio = 50,
329 .regs = ichx_regs,
330 .reglen = ichx_reglen,
327}; 331};
328 332
329/* ICH7 and ICH8-based */ 333/* ICH7 and ICH8-based */
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 99a68310e7c0..3d53fd6880d1 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -894,9 +894,11 @@ static int mcp23s08_probe(struct spi_device *spi)
894 dev_err(&spi->dev, "invalid spi-present-mask\n"); 894 dev_err(&spi->dev, "invalid spi-present-mask\n");
895 return -ENODEV; 895 return -ENODEV;
896 } 896 }
897 897 for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) {
898 for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) 898 if ((spi_present_mask & (1 << addr)))
899 chips++;
899 pullups[addr] = 0; 900 pullups[addr] = 0;
901 }
900 } else { 902 } else {
901 type = spi_get_device_id(spi)->driver_data; 903 type = spi_get_device_id(spi)->driver_data;
902 pdata = dev_get_platdata(&spi->dev); 904 pdata = dev_get_platdata(&spi->dev);
@@ -919,12 +921,12 @@ static int mcp23s08_probe(struct spi_device *spi)
919 pullups[addr] = pdata->chip[addr].pullups; 921 pullups[addr] = pdata->chip[addr].pullups;
920 } 922 }
921 923
922 if (!chips)
923 return -ENODEV;
924
925 base = pdata->base; 924 base = pdata->base;
926 } 925 }
927 926
927 if (!chips)
928 return -ENODEV;
929
928 data = kzalloc(sizeof(*data) + chips * sizeof(struct mcp23s08), 930 data = kzalloc(sizeof(*data) + chips * sizeof(struct mcp23s08),
929 GFP_KERNEL); 931 GFP_KERNEL);
930 if (!data) 932 if (!data)
diff --git a/drivers/gpio/gpio-spear-spics.c b/drivers/gpio/gpio-spear-spics.c
index e9a0415834ea..30bcc539425d 100644
--- a/drivers/gpio/gpio-spear-spics.c
+++ b/drivers/gpio/gpio-spear-spics.c
@@ -2,7 +2,7 @@
2 * SPEAr platform SPI chipselect abstraction over gpiolib 2 * SPEAr platform SPI chipselect abstraction over gpiolib
3 * 3 *
4 * Copyright (C) 2012 ST Microelectronics 4 * Copyright (C) 2012 ST Microelectronics
5 * Shiraz Hashim <shiraz.hashim@st.com> 5 * Shiraz Hashim <shiraz.linux.kernel@gmail.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any 8 * License version 2. This program is licensed "as is" without any
@@ -205,6 +205,6 @@ static int __init spics_gpio_init(void)
205} 205}
206subsys_initcall(spics_gpio_init); 206subsys_initcall(spics_gpio_init);
207 207
208MODULE_AUTHOR("Shiraz Hashim <shiraz.hashim@st.com>"); 208MODULE_AUTHOR("Shiraz Hashim <shiraz.linux.kernel@gmail.com>");
209MODULE_DESCRIPTION("ST Microlectronics SPEAr SPI Chip Select Abstraction"); 209MODULE_DESCRIPTION("ST Microlectronics SPEAr SPI Chip Select Abstraction");
210MODULE_LICENSE("GPL"); 210MODULE_LICENSE("GPL");
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index bf0f8b476696..401add28933f 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -233,7 +233,7 @@ static void acpi_gpiochip_request_interrupts(struct acpi_gpio_chip *acpi_gpio)
233{ 233{
234 struct gpio_chip *chip = acpi_gpio->chip; 234 struct gpio_chip *chip = acpi_gpio->chip;
235 235
236 if (!chip->dev || !chip->to_irq) 236 if (!chip->to_irq)
237 return; 237 return;
238 238
239 INIT_LIST_HEAD(&acpi_gpio->events); 239 INIT_LIST_HEAD(&acpi_gpio->events);
@@ -253,7 +253,7 @@ static void acpi_gpiochip_free_interrupts(struct acpi_gpio_chip *acpi_gpio)
253 struct acpi_gpio_event *event, *ep; 253 struct acpi_gpio_event *event, *ep;
254 struct gpio_chip *chip = acpi_gpio->chip; 254 struct gpio_chip *chip = acpi_gpio->chip;
255 255
256 if (!chip->dev || !chip->to_irq) 256 if (!chip->to_irq)
257 return; 257 return;
258 258
259 list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { 259 list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) {
@@ -451,7 +451,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
451 if (function == ACPI_WRITE) 451 if (function == ACPI_WRITE)
452 gpiod_set_raw_value(desc, !!((1 << i) & *value)); 452 gpiod_set_raw_value(desc, !!((1 << i) & *value));
453 else 453 else
454 *value |= gpiod_get_raw_value(desc) << i; 454 *value |= (u64)gpiod_get_raw_value(desc) << i;
455 } 455 }
456 456
457out: 457out:
@@ -501,6 +501,9 @@ void acpi_gpiochip_add(struct gpio_chip *chip)
501 acpi_handle handle; 501 acpi_handle handle;
502 acpi_status status; 502 acpi_status status;
503 503
504 if (!chip || !chip->dev)
505 return;
506
504 handle = ACPI_HANDLE(chip->dev); 507 handle = ACPI_HANDLE(chip->dev);
505 if (!handle) 508 if (!handle)
506 return; 509 return;
@@ -531,6 +534,9 @@ void acpi_gpiochip_remove(struct gpio_chip *chip)
531 acpi_handle handle; 534 acpi_handle handle;
532 acpi_status status; 535 acpi_status status;
533 536
537 if (!chip || !chip->dev)
538 return;
539
534 handle = ACPI_HANDLE(chip->dev); 540 handle = ACPI_HANDLE(chip->dev);
535 if (!handle) 541 if (!handle)
536 return; 542 return;
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 761013f8b82f..f48817d97480 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1387,8 +1387,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq,
1387{ 1387{
1388 struct gpio_chip *chip = d->host_data; 1388 struct gpio_chip *chip = d->host_data;
1389 1389
1390 irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler);
1391 irq_set_chip_data(irq, chip); 1390 irq_set_chip_data(irq, chip);
1391 irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler);
1392#ifdef CONFIG_ARM 1392#ifdef CONFIG_ARM
1393 set_irq_flags(irq, IRQF_VALID); 1393 set_irq_flags(irq, IRQF_VALID);
1394#else 1394#else