Re: [PATCH v4 4/4] gnss: add driver for mediatek receivers

From
Johan Hovold <johan@kernel.org>
Date
2019-02-14 10:12:24
Also in
linux-amlogic, linux-devicetree, linux-mediatek, lkml
Reply to
Corentin Labbe, 2019-02-14
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:
quoted
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 <redacted>
quoted
+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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (12 messages) 12 messages, 5 authors, last reply 2019-03-11
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help