gpio: pcf857x: Simpify wake-up handling

Unlike gpio_rcar_irq_set_wake(), which this solution was based on,
pcf857x_irq_set_wake() does not need to do anything else than calling
irq_set_irq_wake() for the upstream interrupt controller.  Hence there
is no reason for making this call conditional, and no longer a need for
keeping a copy of the interrupt number that also serves as a flag.

Just propagate irq_set_irq_wake() to the upstream interrupt controller,
using the original interrupt number.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Geert Uytterhoeven 2019-02-13 14:14:09 +01:00 committed by Linus Walleij
parent 92de6bc3a8
commit 7f2f787c10

View File

@ -88,7 +88,6 @@ struct pcf857x {
struct mutex lock; /* protect 'out' */ struct mutex lock; /* protect 'out' */
unsigned out; /* software latch */ unsigned out; /* software latch */
unsigned status; /* current status */ unsigned status; /* current status */
unsigned int irq_parent;
unsigned irq_enabled; /* enabled irqs */ unsigned irq_enabled; /* enabled irqs */
int (*write)(struct i2c_client *client, unsigned data); int (*write)(struct i2c_client *client, unsigned data);
@ -210,18 +209,7 @@ static int pcf857x_irq_set_wake(struct irq_data *data, unsigned int on)
{ {
struct pcf857x *gpio = irq_data_get_irq_chip_data(data); struct pcf857x *gpio = irq_data_get_irq_chip_data(data);
int error = 0; return irq_set_irq_wake(gpio->client->irq, on);
if (gpio->irq_parent) {
error = irq_set_irq_wake(gpio->irq_parent, on);
if (error) {
dev_dbg(&gpio->client->dev,
"irq %u doesn't support irq_set_wake\n",
gpio->irq_parent);
gpio->irq_parent = 0;
}
}
return error;
} }
static void pcf857x_irq_enable(struct irq_data *data) static void pcf857x_irq_enable(struct irq_data *data)
@ -394,7 +382,6 @@ static int pcf857x_probe(struct i2c_client *client,
gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip, gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip,
client->irq); client->irq);
gpio->irq_parent = client->irq;
} }
/* Let platform code set up the GPIOs and their users. /* Let platform code set up the GPIOs and their users.