From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Walleij Subject: Re: [PATCH] pinctrl: sh-pfc: Let gpio_chip.to_irq() return -ENXIO on error Date: Mon, 2 May 2016 11:06:29 +0200 Message-ID: References: <1461914677-24899-1-git-send-email-geert+renesas@glider.be> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: Sender: linux-renesas-soc-owner@vger.kernel.org To: Geert Uytterhoeven Cc: Geert Uytterhoeven , Laurent Pinchart , "linux-gpio@vger.kernel.org" , linux-renesas-soc@vger.kernel.org List-Id: linux-gpio@vger.kernel.org On Mon, May 2, 2016 at 11:04 AM, Geert Uytterhoeven wrote: > [silly response deleted] > > Scrap it. :D > The only annoying thing is that 0 cannot easily be propagated upstream as > an error code, so it has to be tested for explicitly. Well with the Big Penguin's clear opinion on the matter there is not much we can do. What about this? diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c index 02147361eaa9..2297ec781681 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.c +++ b/drivers/tty/serial/serial_mctrl_gpio.c @@ -172,6 +172,13 @@ struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx) dev_err(port->dev, "failed to find corresponding irq for %s (idx=%d, err=%d)\n", mctrl_gpios_desc[i].name, idx, ret); + /* + * Satisfy the error code semantics for a missing IRQ, + * 0 means NO_IRQ, but the framework needs to return + * a negative to deal with the error. + */ + if (!ret) + ret = -ENOSYS; return ERR_PTR(ret); } gpios->irq[i] = ret; Yours, Linus Walleij