Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2841904imm; Thu, 24 May 2018 17:19:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpnMZdiBIpRtKN4j21Ps5scodE4DsDFPQuVDFZp80iASuxQxNMEZBKUXdSiGJmQXuobs/rc X-Received: by 2002:a62:ec18:: with SMTP id k24-v6mr183670pfh.204.1527207599811; Thu, 24 May 2018 17:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527207599; cv=none; d=google.com; s=arc-20160816; b=bfMfsx34RTWygpFTH7uORn5IFRvisWKPFKBUpdrWs9QHuWUp1ib5EoxDPql+kW9ky1 wK9I6ap4GOLOp9RSsslW8TywzJBxzbpF7dRCZWIZJ/O/lfhFLYulMkqplT8CsdbmboRQ nqiPX4rYMRy4B3qfuqh4kpPMf12BW8qOwg1PiKo+Uj5c7wAM4/F0b94UDgjV2JNDuTf3 yQtQ3fikGf79BhRB0j/7htu8Rwqd2K5eXA2IbsdJA5ai5/IkJRZaSQy0S3v59BWEZN3C oiiEqvCju1ior8lI4mTV7BM6o9Vn/sOYYdI38Q1AKosCJt/KGP0fUMybVL6aBtVpAFfC 67pg== 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:dkim-signature:arc-authentication-results; bh=jEHVBuQVYN7HioBg9gixfpf2eZncnG+17VvlAPccgvQ=; b=ZHR8Ocp61VeoU/QntR2AMAxhNhLkvk5YzwbE/HFKtyGyr/MLroPKrrs4ZAnax5qoyR y70CSfhWtYKgo/fWqIS2Trt2FDpFXibHCUIMEtrBgtSvSrSIzTQlCLbdFzUyJzyQPEKw tZaR96UJRkE0O4NKpSOfG00Pv5Yeq4CcDSwlvMfHtVipGWqm+9biEnXPZCZobjpP+Jro k2qMDS3r0tjohH/axLszJL7f2ua+iwvNUc8MEPLTkQ9R/kiWbuP26QeVmyagCjp85may 5YDXkesW7Md7ikaKAE1e6GDb6wlu34VGKJr1baic1iYaFZAZb8O+ozDC4wJ5SAkYW0P8 MnkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=lg6/rn74; 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 h70-v6si6721851pgc.170.2018.05.24.17.19.45; Thu, 24 May 2018 17:19:59 -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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=lg6/rn74; 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 S1031325AbeEXOOe (ORCPT + 99 others); Thu, 24 May 2018 10:14:34 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:33168 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966100AbeEXOOc (ORCPT ); Thu, 24 May 2018 10:14:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jEHVBuQVYN7HioBg9gixfpf2eZncnG+17VvlAPccgvQ=; b=lg6/rn74otsgL+ptB5hVDNP18 iYhMifK6xeObcxwOY9X+IAiE9gMLQVI9lqW2vf7NGAilifw/nuXGinPRzoCYejv4OyI0oUjOQMLvM FViMrRey5BytY61EZeEFJWoUJcSBDluDZfFVmaqIM3rPDouTUsGz1q18UCtgulhSbSM2M=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fLr0e-00068f-Nw; Thu, 24 May 2018 14:14:28 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fLr0d-0006cf-Cf; Thu, 24 May 2018 15:14:27 +0100 Date: Thu, 24 May 2018 15:14:27 +0100 From: Mark Brown To: Matti Vaittinen Cc: mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, lee.jones@linaro.org, lgirdwood@gmail.com, mazziesaccount@gmail.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mikko.mutanen@fi.rohmeurope.com, heikki.haikola@fi.rohmeurope.com Subject: Re: [PATCH 8/9] regulator: bd71837: BD71837 PMIC regulator driver Message-ID: <20180524141427.GU4828@sirena.org.uk> References: <20180524060036.GI4249@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LtN0I0gXzHUftVCi" Content-Disposition: inline In-Reply-To: <20180524060036.GI4249@localhost.localdomain> X-Cookie: Excellent day to have a rotten day. User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --LtN0I0gXzHUftVCi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, May 24, 2018 at 09:00:36AM +0300, Matti Vaittinen wrote: > @@ -0,0 +1,683 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* Copyright (C) 2018 ROHM Semiconductors */ > +/* > + * bd71837-regulator.c ROHM BD71837MWV regulator driver > + */ > +#include Make the entire comment block a C++ comment so it looks more intentional and add a blank line before the headers for legibility. > +static int bd71837_regulator_set_regmap(struct regulator_dev *rdev, int set) > +{ > + int ret = -EINVAL; > + struct bd71837_pmic *pmic = rdev->reg_data; > + > + if (pmic) { > + mutex_lock(&pmic->mtx); > + if (!set) > + ret = regulator_disable_regmap(rdev); > + else > + ret = regulator_enable_regmap(rdev); > + mutex_unlock(&pmic->mtx); > + } This looks very weird - why might we not have a parent PMIC, what is the lock doing and what is this wrapper function intended to do? Similar issues apply to the voltage functions, if there's any need for this it needs to be better documented but it really doesn't look like a good idea. > + err = > + regmap_update_bits(pmic->mfd->regmap, BD71837_REG_REGLOCK, > + (REGLOCK_PWRSEQ | REGLOCK_VREG), 0); > + if (err) { > + dev_err(&pmic->pdev->dev, "Failed to unlock PMIC (%d)\n", err); > + goto err; > + } else > + dev_dbg(&pmic->pdev->dev, "%s: Unlocked lock register 0x%x\n", > + __func__, BD71837_REG_REGLOCK); There's loads of coding style problems with this code, please refer to the coding style - indentation is weird and if there's { } on one side of an else it should be on both. > + rdev = regulator_register(desc, &config); > + if (IS_ERR(rdev)) { devm_regulator_regster() --LtN0I0gXzHUftVCi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlsGyMIACgkQJNaLcl1U h9BVuQf/cxnvFEfK8b/tJjG1FFbjWQlAQDE04Ti6c9LSrNP5jc7u1pzkBpmbqYH7 lk+4NUzecWbgrqSNvKBQbERCeE1U+CXC/jAP+9kRiAOZBz2tHptA5wfUZT0nhhFn YU2J/99hDSDYfpt7rTfjXBG5ljXUrymJ/eWrzRGnrbRVSvnav3ViST7TJBdG23mt 6nnhcAo9CrEjYgKCfOJPFXXmiukU0+aWSpwQA2+ygOBXZKk5dG+FSLpbgTHpEzWt ucQTwHEFPkQaEr/NubKHEeIetZ8nOoow7bd22gCswE+Thrtu2H9WLLYDldGmWXvc DxS/F8D740F4NXZfRhv3HN0YEKHPIQ== =upsr -----END PGP SIGNATURE----- --LtN0I0gXzHUftVCi--