Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp999421imc; Mon, 11 Mar 2019 04:22:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1hWa5OS1q5E6MZm2OYtO1cStnj5Y3jvTvFkzW3xhiRgV/8M/9QioqvtcuhN4MriTs730p X-Received: by 2002:a17:902:205:: with SMTP id 5mr29473188plc.336.1552303323039; Mon, 11 Mar 2019 04:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552303323; cv=none; d=google.com; s=arc-20160816; b=jiTzfgnJ1mnrH9IhfSohXQD/dxXeVQFJmfyCMB5DGSUHrOFrPZQt7jvJuAMwLu7jL+ DKxjiKqnM5hqrQozMj6gOWID1ct82/00XzDl42kU3G+SvjXE8lgwpFOikGO5bzudZsOA F4CgaAfRxen3CzvJ8dcR2qG6jNWhYY0eGryT8y++x6o9kcYnX3fzu2/EbjYeiGRDOojj 2tumeqcKFBxe/1eJ2w97g2ToYGmn427FWuiGhxWE7senBchgdl8tys1NZ0RqvKOzw8v8 EqH7OkfIyFJaGOnhDauUf0QLY3mya7Q5HC5SAIswnHFRA4hE3Yu285/7+w8fmRcJ38fS avfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=033d31x1IGOuPJo6bsWQNJ2m+lPhXncZ9chZNywMK08=; b=CtJpDdhq3SyhSVP1rwzz/YcddAQCzEE89PwS+v+zisdmaFNN/kqUcUSNMhEZNDSvtt dsSLYmAQ+v4cNj+zpKwThpkfo/jhF4ofgzRc8+0yQVlFuMe2tyo7JlQMjubdzvx9ynEN hNv5hkARLmIzwRJLWSSOY0wrRLvjkY479ZgKA4vNfcwC7JW43AWAb8x42zIwNprvawJv k/g7CbQlDva0EqcVpxvgQzamSWrG+PWFcn9cQEB4QgWdjbC2HkdYzgOB2NMfbrGFAGTA ci6C6cLbDFQA0wHjPBH4/MXQZEecOykfitg6YZ15jN+wRF6mfNEcwbW/HjqT6WiyJ+vW WV5w== 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 d2si471224pgc.146.2019.03.11.04.21.47; Mon, 11 Mar 2019 04:22:03 -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 S1727367AbfCKLVS (ORCPT + 99 others); Mon, 11 Mar 2019 07:21:18 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:58878 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727290AbfCKLVR (ORCPT ); Mon, 11 Mar 2019 07:21:17 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 619318024A; Mon, 11 Mar 2019 12:21:08 +0100 (CET) Date: Mon, 11 Mar 2019 12:21:14 +0100 From: Pavel Machek To: Johan Hovold Cc: Corentin Labbe , Loys Ollivier , devicetree@vger.kernel.org, Mark Rutland , Martin Blumenstingl , Kevin Hilman , linux-kernel@vger.kernel.org, Rob Herring , linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 4/4] gnss: add driver for mediatek receivers Message-ID: <20190311112114.GD14118@amd> References: <1550070569-18588-1-git-send-email-lollivier@baylibre.com> <1550070569-18588-5-git-send-email-lollivier@baylibre.com> <20190214100019.GA4197@Red> <20190214101212.GJ28278@localhost> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/unnNtmY43mpUSKx" Content-Disposition: inline In-Reply-To: <20190214101212.GJ28278@localhost> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --/unnNtmY43mpUSKx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu 2019-02-14 11:12:12, Johan Hovold wrote: > On Thu, Feb 14, 2019 at 11:00:19AM +0100, Corentin Labbe wrote: > > On Wed, Feb 13, 2019 at 04:09:29PM +0100, Loys Ollivier wrote: > > > Add driver for serial-connected Mediatek-based GNSS receivers. > > >=20 > > > These devices typically boot transmitting vendor specific NMEA output > > > sequences. The serial port bit rate is read from the device tree > > > "current-speed". > > >=20 > > > Note that the driver uses the generic GNSS serial implementation and > > > therefore essentially only manages power abstracted into three power > > > states: ACTIVE, STANDBY, and OFF. > > >=20 > > > For mediatek receivers with a main supply and no enable-gpios, this s= imply > > > means that the main supply is disabled in STANDBY and OFF (the option= al > > > backup supply is kept enabled while the driver is bound). > > >=20 > > > Note that the timepulse-support is left unimplemented. > > >=20 > > > Signed-off-by: Loys Ollivier >=20 > > > +static int mtk_set_active(struct gnss_serial *gserial) > > > +{ > > > + struct mtk_data *data =3D gnss_serial_get_drvdata(gserial); > > > + int ret; > > > + > > > + ret =3D regulator_enable(data->vcc); > > > + if (ret) > > > + return ret; > > > + > > > + return 0; > > > +} > >=20 > > Hello > >=20 > > This could be simplified to return regulator_enable(data->vcc); >=20 > Indeed, but I prefer this style which clearly separates the error path > from the success path while making the success return value explicit. What is clear about useless code? That function can be two lines, this only leads people to wonder "what is going on here?". Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --/unnNtmY43mpUSKx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlyGRKoACgkQMOfwapXb+vJqAwCfScGhWTgpO+dfu2CFL1ZJgSkD N6AAoIRtpiQeraSW32y0NcjTq66hwSeP =o1Tv -----END PGP SIGNATURE----- --/unnNtmY43mpUSKx--