From patchwork Thu Mar 16 15:18:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 739881 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vkXFW0SXsz9rxm for ; Fri, 17 Mar 2017 02:19:27 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QTQaqckJ"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SzQawyjt"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qCYHZvfrWrI9DttrtbRks+mEhcz3ik3xoxlkc/5dDeg=; b=QTQaqckJp1D/2d dY4r7bvVMSBxx+KfIgjffJ56wTVsVF3k6iaJ5GyQ9NFZq06A3uz3or3LL6ASSvo2VIqePU53k/LOx y2yrfOV/Qk/tmoCxZT058+XUgZJgMCjwnEe6q7hU7fNYRD70UNQhnX0QqCB0zeLN3qmm2C6txp09w Q+th93ls4IVypBP9lS2K3sYS5nnYkS5tTf8EcdquFnejTEtvPiMId6/BEFq2JQNNynXitEUzsub09 Thz7rnhIfug0JTLRwagTnigSfLs+j/U6Ch5K9xIze5IDcBrR/8HAb2JXWiS92OUZQAQ0XfVLgbYY9 5ZDfiuQ/J+GCAiQc3vMg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1coXBQ-0006Q9-TW; Thu, 16 Mar 2017 15:19:20 +0000 Received: from mail-yw0-x232.google.com ([2607:f8b0:4002:c05::232]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1coXBL-0006N4-CC for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2017 15:19:17 +0000 Received: by mail-yw0-x232.google.com with SMTP id o4so34502017ywd.3 for ; Thu, 16 Mar 2017 08:18:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3XZlYvXhiT7/9f4+8Egn8X+AYEqo+bar4i6N9SDRG/Q=; b=SzQawyjt/hCg7vxJXNzeeXshqRO4NmuAEP7yOfIF0e+E0tfktHIcMto3n3Xr70tyTr k/NTA+Hvgu966D1p8TKUFcASxUwyY76/bqQ0+6NndkGV9uDnFmrBFHTx0P30AiaGkvxF +K5ECrAGJ/dvE8sHYaTuROs4IHuBPO5R9xnBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3XZlYvXhiT7/9f4+8Egn8X+AYEqo+bar4i6N9SDRG/Q=; b=tlBmvTCf1TjJ3IMO7XtOCYZKPWj6vbercMqq6XgKa/wMxpP135dQ94zZ9RlNDgn2MY ye7vwVu/qQrQ3EjgkKSCEz3lyJS2Q7iBPVnP5wCPmkCgUoaehsxkiZlvYBzsLXO1UY26 YoC+8//RW+n80Vi+8uAzM2PkPmzWllpHdRiuQTlD7SgkysvXyUr1naL5QCvB7apEhtep eJFJA+3ZnQdnxcJKyjF3Y2loKNLR6+5N9FHHA5YUeWHktmr4avS+Ozl0naZrtF61JtFx eFqTBufRTvUZrmQAtOV1npZcSNiviCK8iw1qpNQINvEeH4talJg7vcbsOsMGKrAPJMg7 MUmw== X-Gm-Message-State: AFeK/H3aMYfbmzt/A/6AQzYgakr+291ps3dXLKKLloJHb/uj3iSIuq9Dzq7vPbpYheKSMh+hs36caHfWq4rOc0p7 X-Received: by 10.107.146.198 with SMTP id u189mr11410790iod.173.1489677533903; Thu, 16 Mar 2017 08:18:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.134.193 with HTTP; Thu, 16 Mar 2017 08:18:52 -0700 (PDT) In-Reply-To: <20170306100220.droey65uq2ew3mzu@pengutronix.de> References: <20170303191248.wlwjri55ip2x5pgg@pengutronix.de> <20170303194414.n76tr3oa2mlrzjre@pengutronix.de> <20170304174819.esxhwwbsxzuq3vyc@pengutronix.de> <20170306085842.yijkfpqi3adcedmm@pengutronix.de> <20170306093043.ay4dz3ehp3aakwxh@pengutronix.de> <20170306100220.droey65uq2ew3mzu@pengutronix.de> From: Linus Walleij Date: Thu, 16 Mar 2017 16:18:52 +0100 Message-ID: Subject: Re: [PATCH 4/4] tty/serial: sh-sci: remove uneeded IS_ERR_OR_NULL calls To: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170316_081915_626415_302274CC X-CRM114-Status: GOOD ( 20.19 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4002:c05:0:0:0:232 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Geert Uytterhoeven , Richard Genoud , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , Janusz Uzycki , Geert Uytterhoeven , "linux-serial@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org On Mon, Mar 6, 2017 at 11:02 AM, Uwe Kleine-König wrote: > On Mon, Mar 06, 2017 at 10:53:27AM +0100, Geert Uytterhoeven wrote: >> On Mon, Mar 6, 2017 at 10:30 AM, Uwe Kleine-König >> > I wouldn't want to code this in each driver (something like: >> > >> > if (IS_ENABLED(GPIOLIB) || device_is_instantiated_by_dt(dev) || device_is_instantiated_by_acpi(dev)) >> > gpios = mctrl_gpio_init(...); >> > else >> > gpios = NULL; >> > >> > ). Putting this into GPIOLIB is the right approach, and so this is >> > another argument for HALFGPIOLIB. This would fix mctrl_gpio_init en >> > passant. >> >> Do we have platforms where DT=y || ACPI=y, but GPIOLIB=n? >> Ah, x86 ;-) > > Yeah, and I think rm -r arch/x86 won't be acceptable :-) I assume you > can also configure some arm or powerpc systems without GPIOLIB. > >> Anyway, for sh-sci.c, platforms either have DT and GPIOLIB, or they do not >> need mctrl-gpio. > > So we're in agreement now that HALFGPIOLIB is the way to go? > Linus, what do you think? OK modem lines over GPIO. So the problem is that GPIOLIB is needed (obviously) for mctrl_gpio_init() to work properly, and then there are some stubs in drivers/tty/serial/serial_mctrl_gpio.h for !GPIOLIB. And this whole discussion is all about that !GPIOLIB case really, whether DT, ACPI, SFI or board files machine data is used doesn't really matter. We're talking about: > git grep mctrl_gpio_init drivers/tty/serial/atmel_serial.c: atmel_port->gpios = mctrl_gpio_init(&atmel_port->uart, 0); drivers/tty/serial/clps711x.c: s->gpios = mctrl_gpio_init_noauto(&pdev->dev, 0); drivers/tty/serial/etraxfs-uart.c: up->gpios = mctrl_gpio_init_noauto(&pdev->dev, 0); drivers/tty/serial/imx.c: sport->gpios = mctrl_gpio_init(&sport->port, 0); drivers/tty/serial/mxs-auart.c: s->gpios = mctrl_gpio_init_noauto(dev, 0); drivers/tty/serial/sh-sci.c: sciport->gpios = mctrl_gpio_init(&sciport->port, 0); Atmel, ARM, ETRAX, ARM, ARM, Super-H, all have GPIOLIB. Right now no x86, correct? They actually all even do things like this in Kconfig: config SERIAL_ATMEL (...) select SERIAL_MCTRL_GPIO if GPIOLIB What stops us from removing all the stubs in drivers/tty/serial/serial_mctrl_gpio.h and just make SERIAL_MCTRL_GPIO depends on GPIOLIB? From 2ecc70acc510784d953add707f2a5acfebe484c2 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 16 Mar 2017 16:18:21 +0100 Subject: [PATCH] stab at mctrl Signed-off-by: Linus Walleij --- drivers/tty/serial/Kconfig | 1 + drivers/tty/serial/serial_mctrl_gpio.h | 55 ---------------------------------- 2 files changed, 1 insertion(+), 55 deletions(-) #endif diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 6117ac8da48f..39833d009c18 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1681,5 +1681,6 @@ endmenu config SERIAL_MCTRL_GPIO tristate + depends on GPIOLIB endif # TTY diff --git a/drivers/tty/serial/serial_mctrl_gpio.h b/drivers/tty/serial/serial_mctrl_gpio.h index fa000bcff217..ba8f8e531d56 100644 --- a/drivers/tty/serial/serial_mctrl_gpio.h +++ b/drivers/tty/serial/serial_mctrl_gpio.h @@ -40,8 +40,6 @@ enum mctrl_gpio_idx { */ struct mctrl_gpios; -#ifdef CONFIG_GPIOLIB - /* * Set state of the modem control output lines via GPIOs. */ @@ -101,57 +99,4 @@ void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios); */ void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios); -#else /* GPIOLIB */ - -static inline -void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl) -{ -} - -static inline -unsigned int mctrl_gpio_get(struct mctrl_gpios *gpios, unsigned int *mctrl) -{ - return *mctrl; -} - -static inline unsigned int -mctrl_gpio_get_outputs(struct mctrl_gpios *gpios, unsigned int *mctrl) -{ - return *mctrl; -} - -static inline -struct gpio_desc *mctrl_gpio_to_gpiod(struct mctrl_gpios *gpios, - enum mctrl_gpio_idx gidx) -{ - return ERR_PTR(-ENOSYS); -} - -static inline -struct mctrl_gpios *mctrl_gpio_init(struct uart_port *port, unsigned int idx) -{ - return ERR_PTR(-ENOSYS); -} - -static inline -struct mctrl_gpios *mctrl_gpio_init_noauto(struct device *dev, unsigned int idx) -{ - return ERR_PTR(-ENOSYS); -} - -static inline -void mctrl_gpio_free(struct device *dev, struct mctrl_gpios *gpios) -{ -} - -static inline void mctrl_gpio_enable_ms(struct mctrl_gpios *gpios) -{ -} - -static inline void mctrl_gpio_disable_ms(struct mctrl_gpios *gpios) -{ -} - -#endif /* GPIOLIB */ -