Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1657599imj; Thu, 14 Feb 2019 09:51:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IbnYj7NOAKJRBUMQDVEOPn8RO7pG1XWxFPSdC5VhOWeBGGWtCGk1CmyQkh2v29rUr0sI/sE X-Received: by 2002:a62:2e46:: with SMTP id u67mr5209283pfu.3.1550166719739; Thu, 14 Feb 2019 09:51:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550166719; cv=none; d=google.com; s=arc-20160816; b=j1OR0COoHMhGmq1xKg5lOkgxG9du4kJsoJ02dJQZKkKux16UZxlbODthPr9KVyw1CH c+o/y+w3JXdTll6vwULgDPtaRnYRFYen2BBTMKzCDByNb71V7Fa8F0H6yeBcMZNufDh2 Db4eui4UgMkMqobuLr6W/F/ReAabE8XNHktyjvpqugrG17fvwws0X9FQ8xRkHdUoKs+W A+bVyjTO0eY5mNUuveEFvCocOvXFE9L5Ervm1xNLTYEboD301qysvFGsrMjF/tWJb2A7 Wf4Ztpd3IyHNB8O4s0bWUEI/zLpjqJBY6IknoUK3745MmvUQ3AKsCk1nJK67Qaa3fL4Q IDOw== 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=3qxerFGMWahyMCWOq0ia4/lTLwF5vmBx2M/yvwTR9Wc=; b=ZRbZB1+YsLv0Gwa73T2ysqJa6LXth6idZXbTYLBIEG1dIbG0UipMjvgCa2TGhKCtR0 FLdiIqPepM5d61vfrdEsngoEF2o2FUF7krGHm0VeIUYaTkAS2X4P6lu/LdbRprtOh2p1 ZgZPMhWS9vTiBlHm8wli1PdcO7LTfnoqEuMmhDbXybIRTaDce/I5R3IHZAXrnj+vwUN7 7/ZbhOIm8TEsn8PBS09rVPkle/yZOBidR5QYATD3mgJo9G64IhTyu+OLLORkBYJ2are4 vLmdcz2VIZUALu/mPDb24+6e7kZ0C8ZhXx/H6OyBAbXVVnszcmKQzO2kdz8JnmRv2Y7x Z31w== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d125si2998346pfc.114.2019.02.14.09.51.43; Thu, 14 Feb 2019 09:51:59 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406438AbfBNKMW (ORCPT + 99 others); Thu, 14 Feb 2019 05:12:22 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37901 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726337AbfBNKMW (ORCPT ); Thu, 14 Feb 2019 05:12:22 -0500 Received: by mail-lj1-f195.google.com with SMTP id j19so3927419ljg.5; Thu, 14 Feb 2019 02:12:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3qxerFGMWahyMCWOq0ia4/lTLwF5vmBx2M/yvwTR9Wc=; b=ToUuIXgxpQaYke7WsWiBKxBpKvvqxdOPIZLb4WZBfJnDMzKF0mziMHG703aqI/WBCo 1IR92SL4CO6lKR6rgPPh2y3mRigLwJdo381TSghZ4YCK0L2+39/az87v18g0CFi7KliK eGnND3jTOkcxAvnIeldseHXkEkDek4lKhDk1/Ys7iQYxtzoDDpETg+pRoqidpwDSwsFV 595AQm8/DbbiNgiryyh9uknHBczLX/cV2BjXKIZZHv5++BE/5DiotELkvqGOlQEWwD6R rhM0kv8uHEowSSeaLP78UgCC4PRumT3FJp2n8rPhWx+m5paGg8rBlSHZ6fnmvcdzosxv n6SA== X-Gm-Message-State: AHQUAubQZ2xjB/JKOypj3bZ2BMC0+q2fY4fnJRC/L+DepXGqwSg+jQr7 twSE5ufip5ahk9wpbkeOFxs= X-Received: by 2002:a2e:8719:: with SMTP id m25-v6mr1947042lji.121.1550139140032; Thu, 14 Feb 2019 02:12:20 -0800 (PST) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id p14sm382839lfk.16.2019.02.14.02.12.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 02:12:19 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1guE04-0002MM-OH; Thu, 14 Feb 2019 11:12:12 +0100 Date: Thu, 14 Feb 2019 11:12:12 +0100 From: Johan Hovold To: Corentin Labbe Cc: Loys Ollivier , devicetree@vger.kernel.org, Johan Hovold , 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: <20190214101212.GJ28278@localhost> References: <1550070569-18588-1-git-send-email-lollivier@baylibre.com> <1550070569-18588-5-git-send-email-lollivier@baylibre.com> <20190214100019.GA4197@Red> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190214100019.GA4197@Red> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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). Thanks, Johan