aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-02-05 17:33:28 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-05 17:33:28 -0500
commit6e03f896b52cd2ca88942170c5c9c407ec0ede69 (patch)
tree48ca9a6efa5f99819667538838bab3679416f92c /drivers/gpio
parentdb79a621835ee91d3e10177abd97f48e0a4dcf9b (diff)
parent9d82f5eb3376cbae96ad36a063a9390de1694546 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/vxlan.c drivers/vhost/net.c include/linux/if_vlan.h net/core/dev.c The net/core/dev.c conflict was the overlap of one commit marking an existing function static whilst another was adding a new function. In the include/linux/if_vlan.h case, the type used for a local variable was changed in 'net', whereas the function got rewritten to fix a stacked vlan bug in 'net-next'. In drivers/vhost/net.c, Al Viro's iov_iter conversions in 'net-next' overlapped with an endainness fix for VHOST 1.0 in 'net'. In drivers/net/vxlan.c, vxlan_find_vni() added a 'flags' parameter in 'net-next' whereas in 'net' there was a bug fix to pass in the correct network namespace pointer in calls to this function. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-mcp23s08.c17
-rw-r--r--drivers/gpio/gpio-omap.c39
-rw-r--r--drivers/gpio/gpiolib-sysfs.c3
3 files changed, 45 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index da9c316059bc..eea5d7e578c9 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -801,9 +801,11 @@ static int mcp230xx_probe(struct i2c_client *client,
801 client->irq = irq_of_parse_and_map(client->dev.of_node, 0); 801 client->irq = irq_of_parse_and_map(client->dev.of_node, 0);
802 } else { 802 } else {
803 pdata = dev_get_platdata(&client->dev); 803 pdata = dev_get_platdata(&client->dev);
804 if (!pdata || !gpio_is_valid(pdata->base)) { 804 if (!pdata) {
805 dev_dbg(&client->dev, "invalid platform data\n"); 805 pdata = devm_kzalloc(&client->dev,
806 return -EINVAL; 806 sizeof(struct mcp23s08_platform_data),
807 GFP_KERNEL);
808 pdata->base = -1;
807 } 809 }
808 } 810 }
809 811
@@ -924,10 +926,11 @@ static int mcp23s08_probe(struct spi_device *spi)
924 } else { 926 } else {
925 type = spi_get_device_id(spi)->driver_data; 927 type = spi_get_device_id(spi)->driver_data;
926 pdata = dev_get_platdata(&spi->dev); 928 pdata = dev_get_platdata(&spi->dev);
927 if (!pdata || !gpio_is_valid(pdata->base)) { 929 if (!pdata) {
928 dev_dbg(&spi->dev, 930 pdata = devm_kzalloc(&spi->dev,
929 "invalid or missing platform data\n"); 931 sizeof(struct mcp23s08_platform_data),
930 return -EINVAL; 932 GFP_KERNEL);
933 pdata->base = -1;
931 } 934 }
932 935
933 for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) { 936 for (addr = 0; addr < ARRAY_SIZE(pdata->chip); addr++) {
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 30646cfe0efa..f476ae2eb0b3 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -88,6 +88,8 @@ struct gpio_bank {
88#define BANK_USED(bank) (bank->mod_usage || bank->irq_usage) 88#define BANK_USED(bank) (bank->mod_usage || bank->irq_usage)
89#define LINE_USED(line, offset) (line & (BIT(offset))) 89#define LINE_USED(line, offset) (line & (BIT(offset)))
90 90
91static void omap_gpio_unmask_irq(struct irq_data *d);
92
91static int omap_irq_to_gpio(struct gpio_bank *bank, unsigned int gpio_irq) 93static int omap_irq_to_gpio(struct gpio_bank *bank, unsigned int gpio_irq)
92{ 94{
93 return bank->chip.base + gpio_irq; 95 return bank->chip.base + gpio_irq;
@@ -477,6 +479,16 @@ static int omap_gpio_is_input(struct gpio_bank *bank, int mask)
477 return readl_relaxed(reg) & mask; 479 return readl_relaxed(reg) & mask;
478} 480}
479 481
482static void omap_gpio_init_irq(struct gpio_bank *bank, unsigned gpio,
483 unsigned offset)
484{
485 if (!LINE_USED(bank->mod_usage, offset)) {
486 omap_enable_gpio_module(bank, offset);
487 omap_set_gpio_direction(bank, offset, 1);
488 }
489 bank->irq_usage |= BIT(GPIO_INDEX(bank, gpio));
490}
491
480static int omap_gpio_irq_type(struct irq_data *d, unsigned type) 492static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
481{ 493{
482 struct gpio_bank *bank = omap_irq_data_get_bank(d); 494 struct gpio_bank *bank = omap_irq_data_get_bank(d);
@@ -506,15 +518,11 @@ static int omap_gpio_irq_type(struct irq_data *d, unsigned type)
506 spin_lock_irqsave(&bank->lock, flags); 518 spin_lock_irqsave(&bank->lock, flags);
507 offset = GPIO_INDEX(bank, gpio); 519 offset = GPIO_INDEX(bank, gpio);
508 retval = omap_set_gpio_triggering(bank, offset, type); 520 retval = omap_set_gpio_triggering(bank, offset, type);
509 if (!LINE_USED(bank->mod_usage, offset)) { 521 omap_gpio_init_irq(bank, gpio, offset);
510 omap_enable_gpio_module(bank, offset); 522 if (!omap_gpio_is_input(bank, BIT(offset))) {
511 omap_set_gpio_direction(bank, offset, 1);
512 } else if (!omap_gpio_is_input(bank, BIT(offset))) {
513 spin_unlock_irqrestore(&bank->lock, flags); 523 spin_unlock_irqrestore(&bank->lock, flags);
514 return -EINVAL; 524 return -EINVAL;
515 } 525 }
516
517 bank->irq_usage |= BIT(GPIO_INDEX(bank, gpio));
518 spin_unlock_irqrestore(&bank->lock, flags); 526 spin_unlock_irqrestore(&bank->lock, flags);
519 527
520 if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) 528 if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
@@ -792,6 +800,24 @@ exit:
792 pm_runtime_put(bank->dev); 800 pm_runtime_put(bank->dev);
793} 801}
794 802
803static unsigned int omap_gpio_irq_startup(struct irq_data *d)
804{
805 struct gpio_bank *bank = omap_irq_data_get_bank(d);
806 unsigned int gpio = omap_irq_to_gpio(bank, d->hwirq);
807 unsigned long flags;
808 unsigned offset = GPIO_INDEX(bank, gpio);
809
810 if (!BANK_USED(bank))
811 pm_runtime_get_sync(bank->dev);
812
813 spin_lock_irqsave(&bank->lock, flags);
814 omap_gpio_init_irq(bank, gpio, offset);
815 spin_unlock_irqrestore(&bank->lock, flags);
816 omap_gpio_unmask_irq(d);
817
818 return 0;
819}
820
795static void omap_gpio_irq_shutdown(struct irq_data *d) 821static void omap_gpio_irq_shutdown(struct irq_data *d)
796{ 822{
797 struct gpio_bank *bank = omap_irq_data_get_bank(d); 823 struct gpio_bank *bank = omap_irq_data_get_bank(d);
@@ -1181,6 +1207,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
1181 if (!irqc) 1207 if (!irqc)
1182 return -ENOMEM; 1208 return -ENOMEM;
1183 1209
1210 irqc->irq_startup = omap_gpio_irq_startup,
1184 irqc->irq_shutdown = omap_gpio_irq_shutdown, 1211 irqc->irq_shutdown = omap_gpio_irq_shutdown,
1185 irqc->irq_ack = omap_gpio_ack_irq, 1212 irqc->irq_ack = omap_gpio_ack_irq,
1186 irqc->irq_mask = omap_gpio_mask_irq, 1213 irqc->irq_mask = omap_gpio_mask_irq,
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index f62aa115d79a..7722ed53bd65 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -648,6 +648,7 @@ int gpiod_export_link(struct device *dev, const char *name,
648 if (tdev != NULL) { 648 if (tdev != NULL) {
649 status = sysfs_create_link(&dev->kobj, &tdev->kobj, 649 status = sysfs_create_link(&dev->kobj, &tdev->kobj,
650 name); 650 name);
651 put_device(tdev);
651 } else { 652 } else {
652 status = -ENODEV; 653 status = -ENODEV;
653 } 654 }
@@ -695,7 +696,7 @@ int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value)
695 } 696 }
696 697
697 status = sysfs_set_active_low(desc, dev, value); 698 status = sysfs_set_active_low(desc, dev, value);
698 699 put_device(dev);
699unlock: 700unlock:
700 mutex_unlock(&sysfs_lock); 701 mutex_unlock(&sysfs_lock);
701 702