From patchwork Wed May 4 08:21:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 618319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3r09xl2JcZz9t66 for ; Wed, 4 May 2016 18:22:01 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757571AbcEDIWB (ORCPT ); Wed, 4 May 2016 04:22:01 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:58862 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756941AbcEDIWA (ORCPT ); Wed, 4 May 2016 04:22:00 -0400 Received: from ayla.of.borg ([84.195.107.21]) by andre.telenet-ops.be with bizsmtp id q8Mv1s0100TjorY018Mwpw; Wed, 04 May 2016 10:21:56 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1axs4B-0007VX-Su; Wed, 04 May 2016 10:21:55 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1axs4C-0005Gf-6s; Wed, 04 May 2016 10:21:56 +0200 From: Geert Uytterhoeven To: Linus Walleij , Alexandre Courbot Cc: Laurent Pinchart , linux-gpio@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error Date: Wed, 4 May 2016 10:21:53 +0200 Message-Id: <1462350113-20216-1-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Currrently the gpio_chip.to_irq() callback returns -ENOSYS on error, which causes bad interactions with the serial_mctrl_gpio helpers. mctrl_gpio_init() returns -ENOSYS if GPIOLIB is not enabled, which is intended to be ignored by its callers. However, ignoring -ENOSYS when it was caused by a gpiod_to_irq() failure will lead to a crash later: Unable to handle kernel paging request at virtual address ffffffde ... PC is at mctrl_gpio_set+0x14/0x78 Fix this by returning zero instead, like gpiochip_to_irq() does. Signed-off-by: Geert Uytterhoeven --- This depends on "gpio: make gpiod_to_irq() return negative for NO_IRQ" for proper handling by callers of mctrl_gpio_init(). Hence I think it's best to take this through the GPIO tree, after the above has been applied. v2: - Return zero instead of -ENXIO. --- drivers/pinctrl/sh-pfc/gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c index a6681b8b17c3b30c..97dff6a09ff08115 100644 --- a/drivers/pinctrl/sh-pfc/gpio.c +++ b/drivers/pinctrl/sh-pfc/gpio.c @@ -212,7 +212,7 @@ static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset) } } - return -ENOSYS; + return 0; found: return pfc->irqs[i];