Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8179ybi; Thu, 1 Aug 2019 13:35:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4AflIn00J3ebWvm2ayW6MaOy51dOgTt4bhiRnNe/+r3FStfITHNERFNfdvC1uvOEF9DoB X-Received: by 2002:a63:9e56:: with SMTP id r22mr64140481pgo.221.1564691754430; Thu, 01 Aug 2019 13:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564691754; cv=none; d=google.com; s=arc-20160816; b=yuc3Ql+Ssokm1C24ymUFTQE5aCc5J9ozKRyfzb6eGGAHD9svUcZsQgPREIhONhvnLs ahjVO7PJGt8sXYQX4gJZo+H1/gtUBaag0/darAyQg/VPGChXndOz4mtG8KFMWKOJAAyO +/C98cMUedvZzclw3G5/7E26fq3NkokEhabfIKhEcywkzzlE1btU2TNxiR8E+/2Xr1Dm joNUrv319IAZsbMkWj3e83HFMHzRFcV5XUHnXvFE2TTuaTWDIacDgc4JyKF22ErSZdhv 5+UVtFeP97l2jnYK2Ezz+nQ6F3QKtPyXTCEEqDzoPV2hRx4gmFdjtF44FO987Jt3gC5t P4KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=fmvKzBDFxn+SsrnxiUnXTMl2Kzk/c/f8+DGWE3w82zo=; b=nFsdQZ1R+YMdrtckJho4cPN0VUSo27S1v4wtY8bgj8h3vTGXNE0RMNVkJgFMNbb8EY 3Y7+a3QfrBOOFiyD2F4YtPTDc1Sf9Rx91Ze2iZSF3Hlzh83k4go7DurjtGsYy0YgJgZS MZ2jN+Hh5reZDkiMfiuCdFotsiOpdvPjGLXg9KXifvYAh3KXnP2wfOX4sWTl/m/2mXmQ yELH5N6hNu98gdyARMldsZrINtlgn8zuyERi9ycpJSXxYPO8QbJA9UYI4VjNKKJLi0VO /s6ezJvQYKQfmLiZfKtNpn7/dq0/H9WTE/P19dhyIuv/KN2c3J3Lpe5AdNhtOgwrjb0t ZCGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s23si35757427pgm.345.2019.08.01.13.35.27; Thu, 01 Aug 2019 13:35:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729582AbfHAUda (ORCPT + 99 others); Thu, 1 Aug 2019 16:33:30 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:38015 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725846AbfHAUda (ORCPT ); Thu, 1 Aug 2019 16:33:30 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1htHlI-0003TO-CA; Thu, 01 Aug 2019 22:33:20 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1htHlE-0001p3-TM; Thu, 01 Aug 2019 22:33:16 +0200 Date: Thu, 1 Aug 2019 22:33:16 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Schrempf Frieder Cc: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux-imx@nxp.com" , Greg Kroah-Hartman , "linux-arm-kernel@lists.infradead.org" , "geert+renesas@glider.be" , Jiri Slaby , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 1/3] serial: mctrl_gpio: Avoid probe failures in case of missing gpiolib Message-ID: <20190801203316.7ntlv6hequmddfxu@pengutronix.de> References: <20190801184505.17239-1-frieder.schrempf@kontron.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190801184505.17239-1-frieder.schrempf@kontron.de> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 01, 2019 at 06:45:21PM +0000, Schrempf Frieder wrote: > From: Frieder Schrempf > > If CONFIG_GPIOLIB is not enabled, mctrl_gpio_init() and > mctrl_gpio_init_noauto() will currently return an error pointer with > -ENOSYS. As the mctrl GPIOs are usually optional, drivers need to > check for this condition to allow continue probing. > > To avoid the need for this check in each driver, we return NULL > instead, as all the mctrl_gpio_*() functions are skipped anyway. > We also adapt mctrl_gpio_to_gpiod() to be in line with this change. > > Signed-off-by: Frieder Schrempf > Reviewed-by: Fabio Estevam nitpick: put your S-o-b last. > --- > Changes in v2 > ============= > * Move the sh_sci changes to a separate patch > * Add a patch for the 8250 driver > * Add Fabio's R-b tag > --- > drivers/tty/serial/serial_mctrl_gpio.c | 3 +++ > drivers/tty/serial/serial_mctrl_gpio.h | 6 +++--- > 2 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/tty/serial/serial_mctrl_gpio.c b/drivers/tty/serial/serial_mctrl_gpio.c > index 2b400189be91..54c43e02e375 100644 > --- a/drivers/tty/serial/serial_mctrl_gpio.c > +++ b/drivers/tty/serial/serial_mctrl_gpio.c > @@ -61,6 +61,9 @@ EXPORT_SYMBOL_GPL(mctrl_gpio_set); > struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, > enum mctrl_gpio_idx gidx) > { > + if (gpios == NULL) > + return NULL; > + I wonder why you need this. If GPIOLIB is off this code isn't active and with GPIOLIB calling mctrl_gpio_to_gpiod with a gpios == NULL is a bug that IMHO should not be silently ignored. Am I missing something (again)? > return gpios->gpio[gidx]; > } Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |