Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5655775ybi; Tue, 4 Jun 2019 09:55:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCDg3eOKMnn006CDO7GY+Ou4HmqQR8SvOgP721ui1XgrE3bk4Wlcdu8C4yhBi6AbjvnAWG X-Received: by 2002:a17:902:7891:: with SMTP id q17mr38652027pll.236.1559667320586; Tue, 04 Jun 2019 09:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559667320; cv=none; d=google.com; s=arc-20160816; b=EKRG0JxGleGx2uiXjQo6+r3QBbpFSXBjWPIgQbG4w9k5h7OZXABRJbYJMLP2sx1vDX O+xFY3rAX9wYCsaDDQUUsGH4WOnU8M3zeoI0EbKLqWP5ZhXXzyXn4h/XqUaeuoN/JItq eG5KbLRcKjTORrhD6AjOBk9khxmH/SsVQfDXxziRA+hgJZcEgBPcWfuCsRpBUMDcqyer IQwyuqS5X7FThL27xiIzKX9k9z/k5jjRW+k5VWnQ+68gSDsxmWi9becIlooIV7gNJc7P ZCaATKrDVV+nRdn04RNYNDt8cicTS92R8c8old7M21Qv9FG/2MMwKmMYFOKNMQW+GeCg DONA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=HgeAoD//xv0Q3yYYMnF1hmaRORmRQlBfA/G3SwWbJLM=; b=GNpb+jNWan4WJ/dgGTTz+kRXlsnMl+Zx5AvYQZ8OQkcr7JLvrnpFP0QWi18WhzHHsp 09K88aJkQ1g7Ms6ObV+vV/J3anZ7BoKQPzqsRNLYLwettnOcDA0JJqHcLcO9wBrFIlJq L03pIj0eopXM8CNwTnNZxQrvbpXUQsl4SM3HSp+m2YZFv4IAtSlF6U6vXFT+jHGsspQ2 R0baLdZEIoOkdFDUMHXmtZXaLv5p3nKeaiLw6rBkva2sLmN59gP0P7oIf5+daKCvWCL8 bCbRLGeYluybhhgksNWtNwb5Zg1ZH5zF2U7cW7FP2xywEysSWfd3HV9J0doQVwsTDGhb H58A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si16858793plt.306.2019.06.04.09.55.04; Tue, 04 Jun 2019 09:55:20 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728011AbfFDQw2 (ORCPT + 99 others); Tue, 4 Jun 2019 12:52:28 -0400 Received: from mga01.intel.com ([192.55.52.88]:28822 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727860AbfFDQw2 (ORCPT ); Tue, 4 Jun 2019 12:52:28 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 09:52:27 -0700 X-ExtLoop1: 1 Received: from smile.fi.intel.com (HELO smile) ([10.237.68.145]) by orsmga005.jf.intel.com with ESMTP; 04 Jun 2019 09:52:24 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1hYCfg-00018B-7E; Tue, 04 Jun 2019 19:52:24 +0300 Date: Tue, 4 Jun 2019 19:52:24 +0300 From: Andy Shevchenko To: Stefan Roese Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Yegor Yefremov , Mika Westerberg , Giulio Benetti , Greg Kroah-Hartman , Johan Hovold Subject: Re: [PATCH 2/2 v4] tty/serial/8250: use mctrl_gpio helpers Message-ID: <20190604165224.GP9224@smile.fi.intel.com> References: <20190603083332.12480-1-sr@denx.de> <20190603083332.12480-2-sr@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190603083332.12480-2-sr@denx.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 03, 2019 at 10:33:32AM +0200, Stefan Roese wrote: > From: Yegor Yefremov > > This patch permits the usage for GPIOs to control > the CTS/RTS/DTR/DSR/DCD/RI signals. > + if (up->gpios) { > + mctrl_gpio_set(up->gpios, mctrl_gpio); > + } ... > + if (up->gpios) { > + mctrl_gpio = mctrl_gpio_get_outputs(up->gpios, &mctrl_gpio); > + } ... > + gpios = mctrl_gpio_init(&uart->port, 0); > + if (IS_ERR(gpios)) { > + if (PTR_ERR(gpios) != -ENOSYS) > + return PTR_ERR(gpios); > + } ... > + if (IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(up->gpios, > + UART_GPIO_RTS))) { > + } ... > - if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW) { > + if (termios->c_cflag & CRTSCTS && up->port.flags & UPF_HARD_FLOW > + && IS_ERR_OR_NULL(mctrl_gpio_to_gpiod(up->gpios, > + UART_GPIO_RTS))) { > } ... > + if (up->gpios) > + mctrl_gpio_disable_ms(up->gpios); ... > + if (up->gpios) > + mctrl_gpio_enable_ms(up->gpios); ... > + if (up->gpios) > + return mctrl_gpio_get(up->gpios, &ret); Can we rather make this mimic the gpiod_get_optional() API? So, if we get an error, it's an error, otherwise with NULL pointer the operations goes to be no-op. [IS_ERR_OR_NULL() -> IS_ERR(), if (up->gpios) -> /dev/null, etc] -- With Best Regards, Andy Shevchenko