Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp166278ybi; Thu, 1 Aug 2019 16:46:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXUWRBXaVtp2eYETNzGnl3bsGS6xddzzUILa9lb3a7LXxXS+w50U+0WiPs+07xcWuPH77e X-Received: by 2002:a17:902:934a:: with SMTP id g10mr130806582plp.18.1564703183970; Thu, 01 Aug 2019 16:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564703183; cv=none; d=google.com; s=arc-20160816; b=I4OFzPsH+fEjVemRPZ7kHN0Kh8OLEaoZ6D7PRla8zirshcNS/v66FboDgUCdVsJhfN HJG0jX4cXGeVLHaeKIjRRShfZ/vKce9b1tg17OlPlWwRKTCPV+DgnpqlkAoTf8TqtMjR wvYWLz++5Na8MZERu5T8TbZ+opDCV1ZVSZE8HOc8hBadXWfjtcK4iFSzygbmRNwC3m9K lt2ge6yveSWzSQcGEgmjFZgL0t/xA+oaNtKt+jLAnvW73QB58AYl3BpJLT6Uu2jGSYC1 SoV+0pmC6I7PN238nIB+a5NuY80skH5l+MC69LIZoNdqNxqlcsgs3tM8EZW1+iS77HUF sGVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=gWYvf2SmJiMO8pgVZkaHszFrzL40tOBghAVE87BwJtM=; b=znYX2mzqEOAE3jrU+BRATx7+FtT7OAE3fPw5fdEVBnaeSID43Go8Io0C/IYOCp7Fws IaVqJ1cxKCrBRCCnEfZC3OBAYXHfPXaZxG1xDOQKnRQu6fk7xOgbtniDe1gwFLidDZiL eNGquQKWRP3z/XpM4L/By8tPIlQa97Y+gDpc4IvwVbHMscbKMyy0My3HoSvMA1XKBNjT gakSnD/6GSkj1jlGgCnRE7FXDVjC41SfhmzudZEx0OUFXkE5oXTQJhdIMRuyyYrvyete 74WA6siP8df8704z9iltpVqFrR8q55cMndVcf9GOgripxNl4uNxCclOYH6DeHanMw5O8 h30A== 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 bg2si32258835plb.263.2019.08.01.16.45.41; Thu, 01 Aug 2019 16:46:23 -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 S1729449AbfHASpZ convert rfc822-to-8bit (ORCPT + 99 others); Thu, 1 Aug 2019 14:45:25 -0400 Received: from skedge04.snt-world.com ([91.208.41.69]:44556 "EHLO skedge04.snt-world.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726017AbfHASpY (ORCPT ); Thu, 1 Aug 2019 14:45:24 -0400 Received: from sntmail14r.snt-is.com (unknown [10.203.32.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by skedge04.snt-world.com (Postfix) with ESMTPS id ED90367A7B0; Thu, 1 Aug 2019 20:45:21 +0200 (CEST) Received: from sntmail12r.snt-is.com (10.203.32.182) by sntmail14r.snt-is.com (10.203.32.184) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 1 Aug 2019 20:45:21 +0200 Received: from sntmail12r.snt-is.com ([fe80::e551:8750:7bba:3305]) by sntmail12r.snt-is.com ([fe80::e551:8750:7bba:3305%3]) with mapi id 15.01.1713.004; Thu, 1 Aug 2019 20:45:21 +0200 From: Schrempf Frieder To: "u.kleine-koenig@pengutronix.de" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux-imx@nxp.com" , Greg Kroah-Hartman CC: "linux-arm-kernel@lists.infradead.org" , "geert+renesas@glider.be" , Schrempf Frieder , Jiri Slaby , "linux-serial@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v2 1/3] serial: mctrl_gpio: Avoid probe failures in case of missing gpiolib Thread-Topic: [PATCH v2 1/3] serial: mctrl_gpio: Avoid probe failures in case of missing gpiolib Thread-Index: AQHVSJlF+cJCIhOOZEmFG6rcowK4DA== Date: Thu, 1 Aug 2019 18:45:21 +0000 Message-ID: <20190801184505.17239-1-frieder.schrempf@kontron.de> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-originating-ip: [172.25.9.193] x-c2processedorg: 51b406b7-48a2-4d03-b652-521f56ac89f3 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-SnT-MailScanner-Information: Please contact the ISP for more information X-SnT-MailScanner-ID: ED90367A7B0.AF516 X-SnT-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-SnT-MailScanner-SpamCheck: X-SnT-MailScanner-From: frieder.schrempf@kontron.de X-SnT-MailScanner-To: festevam@gmail.com, geert+renesas@glider.be, gregkh@linuxfoundation.org, jslaby@suse.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org, u.kleine-koenig@pengutronix.de X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; + return gpios->gpio[gidx]; } EXPORT_SYMBOL_GPL(mctrl_gpio_to_gpiod); diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h index b7d3cca48ede..1b2ff503b2c2 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.h +++ b/drivers/tty/serial/serial_mctrl_gpio.h @@ -114,19 +114,19 @@ static inline struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, enum mctrl_gpio_idx gidx) { - return ERR_PTR(-ENOSYS); + return NULL; } static inline struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx) { - return ERR_PTR(-ENOSYS); + return NULL; } static inline struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx) { - return ERR_PTR(-ENOSYS); + return NULL; } static inline -- 2.17.1