Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp875867imj; Fri, 15 Feb 2019 08:14:11 -0800 (PST) X-Google-Smtp-Source: AHgI3IZynJzRnmjMDnxWTuJUeEnwJq7csQQQqfZcIAsA0GJspXnbdXt91nzNS0zT6gXvI0T0PUaB X-Received: by 2002:a17:902:bcc6:: with SMTP id o6mr10870487pls.39.1550247251779; Fri, 15 Feb 2019 08:14:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550247251; cv=none; d=google.com; s=arc-20160816; b=kViwoUN4ti+ofp4AMkCSU/gMrDR7x34oq5g85Rr8D9v/ZX7IVarT8sqKPt5M3pjXA+ 95AGx7HKaxAOkW9heLvpDDg7rYAgz3WD394yhyfUjDo4rp0yCOUXvSibggwmBa9OPHo9 3/sdJau1RN9NND8QFF1/xZB2TLrmLY9iFZ59x5FyrhFh6IEJF/v3hnBebhcTV3gHAW8e fPEkk/mTeTwyQGyeYSGd880cUfvYryPt3A1GnqMcHeeAqr3UY6zY9KQb9q5DeuSojXtT D9oGXQK9wC2KY2bRh2R1HMB4OqB5FGG9nU1xCywVokwki47JH8oMROKJTtcN0OBmjrJO Zj1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references:dkim-signature; bh=kaYhpM3K1lORUrG4TIL1K2D+s9nWHtiHPzXDKda8A0E=; b=ZV/pRW7OQkcwsumUa0hpC1ID7GzUDENCatULSpXhThBcmW3FntlFLEZHsmyIzrhj5H dpp/pg3MP2ZLgwnwwbu9/3QeAyR0d0YnqVgwyxr/8qWfKJmJqyg7kJTN6oGqSiYs898A NB9rIjph6tD+tGezvSZ1YEMEPiWeGXZqmY6RoHNX/SEggm+28OF2RLLUv9fF6fCgCtFK nlXT3edy2cBTxnssQHMNsH85M7B4+vj6f/DZD2N+l31S0tHJHDPWgLbvByhC6z8R0NbW mNjfMZMcBlpKTeZV/zKZs4KiITMWTR2mtlNzg4JWulIJ/VWWJT/jD3rBjKklS4VTBOtT Otcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=nRrFNkH4; 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 64si5886952pfe.74.2019.02.15.08.13.55; Fri, 15 Feb 2019 08:14:11 -0800 (PST) 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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=nRrFNkH4; 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 S2436996AbfBOMZ0 (ORCPT + 99 others); Fri, 15 Feb 2019 07:25:26 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:46101 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733121AbfBOMZ0 (ORCPT ); Fri, 15 Feb 2019 07:25:26 -0500 Received: by mail-ed1-f67.google.com with SMTP id f2so7761634edy.13 for ; Fri, 15 Feb 2019 04:25:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=kaYhpM3K1lORUrG4TIL1K2D+s9nWHtiHPzXDKda8A0E=; b=nRrFNkH4Rf5YL6oIfpcUZxZDrnILQ/wVBi0OglfDxNwG3jevICe+YCnXBUKUIlWcLd C3A1rh9wOGdBpMs10ko4HdFZtAbREng0aKZp/WG/fW9BP2hsSNLOsVdpIqhyawKYAW+T UqSXXeU+TH+02NhJnZ6YY7WiP5G0uU9rJTO3iAKregSBEHy1F5aI7knhYPU28dR1Xbzc zMZTme+eZH1NwlJ/TkiBSRPyTbaEwahPugkN9FBEdSZmFFTt9Kxp/fz/kW61tNBlsTyV 2UFidFtkZzXvFO/ia6scjaivvj6GpkZeJRtLlXBp4PH/9dZiZFGtp0yrFUzsjp6DtVnJ tezQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=kaYhpM3K1lORUrG4TIL1K2D+s9nWHtiHPzXDKda8A0E=; b=VOpZW4+iHZqUSPE0pJ31DD9xLV6PRHjUtK0jOtn6LzHtOGZhi5uS640/fIwJDSZaSs ZTMtoA2rtGsEzChHqytQOpjG/c+xSueTwBgPl6vsgQwQB4+BmAvWBHsACuuJrXjLMs31 iYMtB9S7HBQ9MVH1Nfz7m1E5XE9P1FpYdGQoyEawx6vArbtcSHFDkrn9p91cME7lnELU FOGXWpt+DgHaG4TqMopyw+AS4qZa/7czcpSWFiw9GNnzEjquguDG5y+UkSEmWqyHOdGP 7ZkX/2R5HRWuKfjU25l53cofmmrS/Q+JyEr34JqHswiCHGu/NdGKWOKnX4fWuJCqhHQ7 zMyA== X-Gm-Message-State: AHQUAuby8JK+B25xUcnwQYb5RbiibzslgowaL8trX5Vb0Sgp2cxTXfZG LbM3RMqJ+cnLwqZVpoGEtQAp9g== X-Received: by 2002:a17:906:32c7:: with SMTP id k7mr6496809ejk.180.1550233524020; Fri, 15 Feb 2019 04:25:24 -0800 (PST) Received: from localhost ([2620:10d:c092:180::1:2b]) by smtp.gmail.com with ESMTPSA id c25sm512455ejx.59.2019.02.15.04.25.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Feb 2019 04:25:23 -0800 (PST) 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> User-agent: mu4e 1.0; emacs 25.3.2 From: Loys Ollivier 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 In-reply-to: <20190214101212.GJ28278@localhost> Date: Fri, 15 Feb 2019 13:25:20 +0100 Message-ID: <86d0ntfdcf.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 14 Feb 2019 at 10: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. >> > >> > These devices typically boot transmitting vendor specific NMEA output >> > sequences. The serial port bit rate is read from the device tree >> > "current-speed". >> > >> > 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. >> > >> > For mediatek receivers with a main supply and no enable-gpios, this simply >> > means that the main supply is disabled in STANDBY and OFF (the optional >> > backup supply is kept enabled while the driver is bound). >> > >> > Note that the timepulse-support is left unimplemented. >> > >> > Signed-off-by: Loys Ollivier > >> > +static int mtk_set_active(struct gnss_serial *gserial) >> > +{ >> > + struct mtk_data *data = gnss_serial_get_drvdata(gserial); >> > + int ret; >> > + >> > + ret = regulator_enable(data->vcc); >> > + if (ret) >> > + return ret; >> > + >> > + return 0; >> > +} >> >> Hello >> >> This could be simplified to return regulator_enable(data->vcc); > > Indeed, but I prefer this style which clearly separates the error path > from the success path while making the success return value explicit. > It respects the coding style/standard and I prefer the original version. It's also easier to debug if you want to add extra code on error. >> Furthermore, after this simplification, the function seems useless. > > Why do you think so? You still need to retrieve the regulator from the > driver data. Sure, this could be folded into mtk_set_power(), but that > would be less ideal if there are more resources that need to be managed > (e.g. an external lna supply). I would be in favor to keep mtk_set_active. It clearly shows when the regulator is enabled. It also seems logic to have an enable/standby function in the driver. Even if those are trivial (for now). > > Thanks, > Johan -- -L