diff options
Diffstat (limited to 'drivers/gpio/gpio-mvebu.c')
| -rw-r--r-- | drivers/gpio/gpio-mvebu.c | 26 | 
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 3c3321f9405..418e3865036 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -44,6 +44,7 @@  #include <linux/of_device.h>  #include <linux/clk.h>  #include <linux/pinctrl/consumer.h> +#include <linux/irqchip/chained_irq.h>  /*   * GPIO unit register offsets. @@ -79,7 +80,7 @@ struct mvebu_gpio_chip {  	spinlock_t	   lock;  	void __iomem	  *membase;  	void __iomem	  *percpu_membase; -	unsigned int       irqbase; +	int		   irqbase;  	struct irq_domain *domain;  	int                soc_variant;  }; @@ -438,12 +439,15 @@ static int mvebu_gpio_irq_set_type(struct irq_data *d, unsigned int type)  static void mvebu_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)  {  	struct mvebu_gpio_chip *mvchip = irq_get_handler_data(irq); +	struct irq_chip *chip = irq_desc_get_chip(desc);  	u32 cause, type;  	int i;  	if (mvchip == NULL)  		return; +	chained_irq_enter(chip, desc); +  	cause = readl_relaxed(mvebu_gpioreg_data_in(mvchip)) &  		readl_relaxed(mvebu_gpioreg_level_mask(mvchip));  	cause |= readl_relaxed(mvebu_gpioreg_edge_cause(mvchip)) & @@ -466,8 +470,11 @@ static void mvebu_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)  			polarity ^= 1 << i;  			writel_relaxed(polarity, mvebu_gpioreg_in_pol(mvchip));  		} +  		generic_handle_irq(irq);  	} + +	chained_irq_exit(chip, desc);  }  #ifdef CONFIG_DEBUG_FS @@ -528,7 +535,7 @@ static void mvebu_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)  #define mvebu_gpio_dbg_show NULL  #endif -static struct of_device_id mvebu_gpio_of_match[] = { +static const struct of_device_id mvebu_gpio_of_match[] = {  	{  		.compatible = "marvell,orion-gpio",  		.data       = (void *) MVEBU_GPIO_SOC_VARIANT_ORION, @@ -567,10 +574,8 @@ static int mvebu_gpio_probe(struct platform_device *pdev)  		soc_variant = MVEBU_GPIO_SOC_VARIANT_ORION;  	mvchip = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_gpio_chip), GFP_KERNEL); -	if (!mvchip) { -		dev_err(&pdev->dev, "Cannot allocate memory\n"); +	if (!mvchip)  		return -ENOMEM; -	}  	if (of_property_read_u32(pdev->dev.of_node, "ngpios", &ngpios)) {  		dev_err(&pdev->dev, "Missing ngpios OF property\n"); @@ -600,7 +605,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)  	mvchip->chip.to_irq = mvebu_gpio_to_irq;  	mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK;  	mvchip->chip.ngpio = ngpios; -	mvchip->chip.can_sleep = 0; +	mvchip->chip.can_sleep = false;  	mvchip->chip.of_node = np;  	mvchip->chip.dbg_show = mvebu_gpio_dbg_show; @@ -676,7 +681,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)  	mvchip->irqbase = irq_alloc_descs(-1, 0, ngpios, -1);  	if (mvchip->irqbase < 0) {  		dev_err(&pdev->dev, "no irqs\n"); -		return -ENOMEM; +		return mvchip->irqbase;  	}  	gc = irq_alloc_generic_chip("mvebu_gpio_irq", 2, mvchip->irqbase, @@ -731,9 +736,4 @@ static struct platform_driver mvebu_gpio_driver = {  	},  	.probe		= mvebu_gpio_probe,  }; - -static int __init mvebu_gpio_init(void) -{ -	return platform_driver_register(&mvebu_gpio_driver); -} -postcore_initcall(mvebu_gpio_init); +module_platform_driver(mvebu_gpio_driver);  | 
