Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2471656pxb; Tue, 9 Mar 2021 03:28:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXt5X7Zjh39tt/8f8XwbFz9psyZR1/LPOsY4iyZVBfkMGQQdI+h96Nrht3wYAPgcsC1Lqu X-Received: by 2002:a17:906:2612:: with SMTP id h18mr19534526ejc.309.1615289284891; Tue, 09 Mar 2021 03:28:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615289284; cv=none; d=google.com; s=arc-20160816; b=WLk2Dx5RG+PVz5KeJqpShxCQUbOLpyP2FLTBgQ4K3+COcCGWD2CX+0I3O4UKFPHJjt MTbK+kUBuzKd8jzzZTpjIBDxsWi95wEPADXMrg0CC9htz385y84yvqalRF01XUBuTJ66 ITTr/YMpX5YPQiotv8E+EpUU+iI5G9MnAHx3g8MMK3Y8hnWmyJr59wkBSW9yj+4yusrp bT7w1idQyhsfjhhfH8iHGhh/zuohLW3uXvkdkyyvTRU/fMW5VbEvcn3zemx/kXyflFrH anrlOC10kAMinBHNJehV/uAM9ZHHj3JqF25D0mWEIyuCpYRlIvB96PqQf6R1lLUMPuSR sSbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=ETQrdhOn7wQljSRJz6wMV2gpTVWPTZzI4kAki/aZAtQ=; b=jbaVk32Oj4QONX3XlLblvUuMxNMZYbPclWQszKL0dqjPoviOaOyWXRlEeO7fTgFq/s t14oVRNAK+P9SKTSuaKYWeoGBQnZMfVrg0NEH2DrDIFmoAjfAHsuv9zrJvmNUgt627IB IojSEe5MFE2Qk26aEEm4DGL1I3SGJnAT959ORfhRTAP0myQBMtuKh7aiCR9O5EqmtSI0 pgtuo+FNLvByJf1K1/pwft5bZF2wdob5ImsKvpYvlWOYa7AMUhj8wZzo9XaqAnm07xIu 5ZGUwYlMN2iAaY3WfvQhRW3x5xVoxohppp1QfF/JZm4K57DDN7FzF2+Dhev9w+9it7kI NSqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id b26si8588719edx.214.2021.03.09.03.27.42; Tue, 09 Mar 2021 03:28:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230425AbhCILYt (ORCPT + 99 others); Tue, 9 Mar 2021 06:24:49 -0500 Received: from mga12.intel.com ([192.55.52.136]:30691 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbhCILYX (ORCPT ); Tue, 9 Mar 2021 06:24:23 -0500 IronPort-SDR: b6I3i+jtEJaxJV6zEmGq+oJnh1EsT9KlXPLm+U8XiYdQbHbDtM9RhnonWXlaYid0NiRZMVD7P9 ziwSSIgDzKMQ== X-IronPort-AV: E=McAfee;i="6000,8403,9917"; a="167480619" X-IronPort-AV: E=Sophos;i="5.81,234,1610438400"; d="scan'208";a="167480619" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2021 03:24:21 -0800 IronPort-SDR: OovhzC5WG77IUj6Rwq0bBB3f+gmvUnykv0uVqHOBR+DNuXL26ng/DBVJVbrIcG7QndGAWhk//P PeJxg4J+wMqQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,234,1610438400"; d="scan'208";a="403189257" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 09 Mar 2021 03:24:20 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A27175D2; Tue, 9 Mar 2021 13:24:18 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Rodolfo Giometti , Ryan Govostes , Greg Kroah-Hartman Subject: [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup() Date: Tue, 9 Mar 2021 13:24:03 +0200 Message-Id: <20210309112403.36633-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210309112403.36633-1-andriy.shevchenko@linux.intel.com> References: <20210309112403.36633-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rearrange optional stuff in pps_gpio_setup() so it will go after mandatory one and with reduced indentation. This will increase readability of the sources. Signed-off-by: Andy Shevchenko --- drivers/pps/clients/pps-gpio.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c index b097da5a659a..35799e6401c9 100644 --- a/drivers/pps/clients/pps-gpio.c +++ b/drivers/pps/clients/pps-gpio.c @@ -110,28 +110,31 @@ static int pps_gpio_setup(struct device *dev) return dev_err_probe(dev, PTR_ERR(data->gpio_pin), "failed to request PPS GPIO\n"); + data->assert_falling_edge = + device_property_read_bool(dev, "assert-falling-edge"); + data->echo_pin = devm_gpiod_get_optional(dev, "echo", GPIOD_OUT_LOW); if (IS_ERR(data->echo_pin)) return dev_err_probe(dev, PTR_ERR(data->echo_pin), "failed to request ECHO GPIO\n"); - if (data->echo_pin) { - ret = device_property_read_u32(dev, "echo-active-ms", &value); - if (ret) { - dev_err(dev, "failed to get echo-active-ms from FW\n"); - return ret; - } - data->echo_active_ms = value; - /* sanity check on echo_active_ms */ - if (!data->echo_active_ms || data->echo_active_ms > 999) { - dev_err(dev, "echo-active-ms: %u - bad value from FW\n", - data->echo_active_ms); - return -EINVAL; - } + if (!data->echo_pin) + return 0; + + ret = device_property_read_u32(dev, "echo-active-ms", &value); + if (ret) { + dev_err(dev, "failed to get echo-active-ms from FW\n"); + return ret; } - data->assert_falling_edge = - device_property_read_bool(dev, "assert-falling-edge"); + /* sanity check on echo_active_ms */ + if (!value || value > 999) { + dev_err(dev, "echo-active-ms: %u - bad value from FW\n", value); + return -EINVAL; + } + + data->echo_active_ms = value; + return 0; } -- 2.30.1