Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2510798pxb; Tue, 9 Mar 2021 04:32:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcWXFk8SPR+C97ubJef2YvwQFusEPreVhs+Dx2eC19exrVYX41RdvEh+kwT9MUh4eKkN63 X-Received: by 2002:aa7:d9c8:: with SMTP id v8mr3739449eds.9.1615293162019; Tue, 09 Mar 2021 04:32:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615293162; cv=none; d=google.com; s=arc-20160816; b=1CDgNAiJONrUCZu70zkwTvyV/Vq5Jye4i8uw9d4p9VB6GXvq475qfei3o0NvlOgL+e +KL0q4Z7KnKnzLQiGS0/4rbl8d1zAYrn9xbvZI98Abis7f9sQjrNAUOfUO1glEz/cwl8 5v4MNyqmYf+mZMOO/dW5iEwAFRvlpSctzwbphzYt+w5LI7c0gMk/WRucZhNq8EWrM+dI yqWcBAd5/QKqrHAaQrGmvTkbRkIe9icP2O1aEAu6T4/5rKMmSBx2LrafDdRs8c9wH3s3 4y0XCA/xOL6Jhzc4VYx0g1aXEyw1I09e81NQSLoU3w7CZCs830tOU63V4WYeCxjFELNJ ZhPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=WmPaimo8FSgAJJUb77se5w7R+n2rD0q+tZk51JW1paE=; b=PD5pcS2ao/PnVyc1fV4RChs64Ps/rvkCvo9SrKEe9PEfjhj+IolwuntPkN3Z0ROGhZ zaMx8iyjnnrVtc2zZUKeKI7WTqR8AFkN5Ncq4KTd5o2u5aGhsGORd99EhPMkhZ14QXig gmxuziQCrjKwzRIPJcuAp31taMaEOEexTpAfktk7IeQX+A1hM4SFlkbvYlhPb18uvJx/ kJeW4IAvopSpwTTF1bU9ScQqg92oe5AnvcKOwk5T9CfM7K2ZLfKvmYe0mm87XOsACNB/ 5z4j2ckYD8aa1urp5RJ7Jb+MvSKucQUmXm4Klcld2Es/IioJEL2eWrq5h63r8JO90vS0 lzIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aruba.it header.s=a1 header.b=GBBgnyRc; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si8767691ejt.544.2021.03.09.04.32.19; Tue, 09 Mar 2021 04:32:42 -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; dkim=pass header.i=@aruba.it header.s=a1 header.b=GBBgnyRc; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230386AbhCIMbL (ORCPT + 99 others); Tue, 9 Mar 2021 07:31:11 -0500 Received: from smtpweb146.aruba.it ([62.149.158.146]:54070 "EHLO smtpweb146.aruba.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbhCIMaq (ORCPT ); Tue, 9 Mar 2021 07:30:46 -0500 Received: from [192.168.1.56] ([79.0.204.227]) by Aruba Outgoing Smtp with ESMTPSA id JbVdl6yxB1jmzJbVdl3PWd; Tue, 09 Mar 2021 13:30:46 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aruba.it; s=a1; t=1615293046; bh=objXhWxM57lDd2uquN5CiYVQC8nDmaqM0hyQiEWgXjY=; h=Subject:To:From:Date:MIME-Version:Content-Type; b=GBBgnyRccx26RgpPTOx7C6mRmLH7wOdFdIF5+31eoltK1iRYQcV/qt35UXAsHqeMD KfuRjRQWSJr568yivUC0nOyRt/8pfq3nqPkEJW/FBJHsq1TAjo0zjil2rUHiYz671I MHw5LSiQ4Q+rNcSN71FMddTXiYOLEb8tbyT2lWNnsg0WBESmUJE8kHyo3cFoaxf1tN eksO7K1QgvmHguFgOgwkK8hwuvF4CHtAu5fduxqbNv8A+w6kVdni44RZHHTczvo0Qt VT16jZ8m43yxXlHfqPDKjCLva3EudfF9FdiZRylEE9mF03Yt0yNg+Q0Texf6zlWiei WPFauw4edwdWg== Subject: Re: [PATCH resend v1 7/7] pps: clients: gpio: Rearrange optional stuff in pps_gpio_setup() To: Andy Shevchenko , linux-kernel@vger.kernel.org Cc: Ryan Govostes , Greg Kroah-Hartman References: <20210309112403.36633-1-andriy.shevchenko@linux.intel.com> <20210309112403.36633-7-andriy.shevchenko@linux.intel.com> From: Rodolfo Giometti Message-ID: <958cff66-2396-79c6-13f0-bf375afb286b@enneenne.com> Date: Tue, 9 Mar 2021 13:30:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210309112403.36633-7-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfJY40D2rUH+t3uqfY5XGrkAVk+u2f+mL2rIFlwUQJzYDWRVzj/1raE0HzkM14VzEHVRVz8uFT680qhVnYxhhLvUFPuJ+/Ph9H5Tu+XckJhExxaLqrHdJ mAFmESee8/4HEx1oAXlkhx8BPe7X9GO4SInED/CG+rhPiWB+5KAlN2g+xNqIeKackecMh17Lja765lLTiseVxvXOxWzz+M1Uebs2U+mMZgC5HdcWxZEtlARo hVXf6SdQ9O34ae8TAfRqxcO57AlDxp5BFr7/CYgbc34FzU59pQFdJ6Teasaf7X8r Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/03/21 12:24, Andy Shevchenko wrote: > 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; > } > > Acked-by: Rodolfo Giometti -- GNU/Linux Solutions e-mail: giometti@enneenne.com Linux Device Driver giometti@linux.it Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti