From 805f864ebefc39065b6b0cf2548f13c2fbf888d9 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 6 Dec 2012 01:10:28 -0800 Subject: gpio: pcf857x: use client->irq for gpio_to_irq() 6e20a0a429bd4dc07d6de16d9c247270e04e4aa0 (gpio: pcf857x: enable gpio_to_irq() support) added gpio_to_irq() support on pcf857x driver, but it used pdata->irq. This patch modifies driver to use client->irq instead of it. It modifies kzm9g board platform settings, and device probe information too. This patch is tested on kzm9g board Reported-by: Christian Engelmayer Acked-by: Simon Horman Signed-off-by: Kuninori Morimoto Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pcf857x.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'drivers/gpio/gpio-pcf857x.c') diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index 16af35cd2b10..a19b7457a726 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c @@ -223,11 +223,11 @@ static void pcf857x_irq_domain_cleanup(struct pcf857x *gpio) static int pcf857x_irq_domain_init(struct pcf857x *gpio, struct pcf857x_platform_data *pdata, - struct device *dev) + struct i2c_client *client) { int status; - gpio->irq_domain = irq_domain_add_linear(dev->of_node, + gpio->irq_domain = irq_domain_add_linear(client->dev.of_node, gpio->chip.ngpio, &pcf857x_irq_domain_ops, NULL); @@ -235,15 +235,15 @@ static int pcf857x_irq_domain_init(struct pcf857x *gpio, goto fail; /* enable real irq */ - status = request_irq(pdata->irq, pcf857x_irq_demux, 0, - dev_name(dev), gpio); + status = request_irq(client->irq, pcf857x_irq_demux, 0, + dev_name(&client->dev), gpio); if (status) goto fail; /* enable gpio_to_irq() */ INIT_WORK(&gpio->work, pcf857x_irq_demux_work); gpio->chip.to_irq = pcf857x_to_irq; - gpio->irq = pdata->irq; + gpio->irq = client->irq; return 0; @@ -285,8 +285,8 @@ static int pcf857x_probe(struct i2c_client *client, gpio->chip.ngpio = id->driver_data; /* enable gpio_to_irq() if platform has settings */ - if (pdata && pdata->irq) { - status = pcf857x_irq_domain_init(gpio, pdata, &client->dev); + if (pdata && client->irq) { + status = pcf857x_irq_domain_init(gpio, pdata, client); if (status < 0) { dev_err(&client->dev, "irq_domain init failed\n"); goto fail; @@ -368,15 +368,6 @@ static int pcf857x_probe(struct i2c_client *client, if (status < 0) goto fail; - /* NOTE: these chips can issue "some pin-changed" IRQs, which we - * don't yet even try to use. Among other issues, the relevant - * genirq state isn't available to modular drivers; and most irq - * methods can't be called from sleeping contexts. - */ - - dev_info(&client->dev, "%s\n", - client->irq ? " (irq ignored)" : ""); - /* Let platform code set up the GPIOs and their users. * Now is the first time anyone could use them. */ @@ -388,13 +379,15 @@ static int pcf857x_probe(struct i2c_client *client, dev_warn(&client->dev, "setup --> %d\n", status); } + dev_info(&client->dev, "probed\n"); + return 0; fail: dev_dbg(&client->dev, "probe error %d for '%s'\n", status, client->name); - if (pdata && pdata->irq) + if (pdata && client->irq) pcf857x_irq_domain_cleanup(gpio); kfree(gpio); @@ -418,7 +411,7 @@ static int pcf857x_remove(struct i2c_client *client) } } - if (pdata && pdata->irq) + if (pdata && client->irq) pcf857x_irq_domain_cleanup(gpio); status = gpiochip_remove(&gpio->chip); -- cgit