Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp691110iog; Mon, 13 Jun 2022 10:44:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sop8uvAokv1Zhs5QThRy+oIjzNlnGH/WT7hTh14dK7P/NKf1wFZy8GH+1zxf988dG4BEDy X-Received: by 2002:a17:903:2312:b0:163:daf7:83a9 with SMTP id d18-20020a170903231200b00163daf783a9mr172942plh.160.1655142288688; Mon, 13 Jun 2022 10:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655142288; cv=none; d=google.com; s=arc-20160816; b=0cvcYb6fh7JcpZd85tTEBuav1sicXA2yaPk8TINMxp5IgNWaY6tUdtPQE4gc+0t9M7 P5NDPhZNDsTDXuom7fqUwL2HDolMJrbysBDwyXV3oKNoM0XDTvMXLXVgVpwMPe2aw3tL xdFph+7M3sDH8AvVe45zYE+XbOz2YUPgBTb4NK5nGXnUe3GW8DJW0EpXouZjmdi4hSYW lzYiAdWVXuQMznyo1TfMVwDxtdMjCg9UTqsVTjZh8eAxPbyy8Z1diBak8QXUksdix913 6INpR+iYqdp1w8InIZUkTDxifwQm6iKLAi3VLIxfjxbkOJ5eiLaJZooD1nQZDzSyZIs4 6Acg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=b1MOKuHqhxAaXAxBXzN6nR7P19nXgKZYr6P/HdzO3vQ=; b=ihHTEfwq2VudTPYSQutmYGXhxlpRvm0MUH1bGGy0uQo/E4gIK+LRHuR5XDVJJKwF5o 7Mx5U7pPkZKGRttSI0jVP377sNGicUCk1zlaq9TxCd7xBXsArYGhOD1ZckRiwTMtbMJ9 TZzL07tkF2yG3hwyuuok5Nq5ntkqI3xQ5ca45OKl0W8kyNqNCg2qLwic1uXZLj+NRKIO L4vLGAmKkr/5+9+kgTm3apZPmKgelJndQBNUeJ2oxwXJloHPYeAh0yhKia+F3RvORg3x Ug9CBFXO/rXGYccvRewSK4pwX1M4otCNm5zF3BSQ/mx8ABk5kJLxomWnXYNjVzKi0mu9 THBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nMJ5e6gB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a17090322ce00b00164027788e8si8228405plg.254.2022.06.13.10.44.31; Mon, 13 Jun 2022 10:44:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nMJ5e6gB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239855AbiFMRf4 (ORCPT + 99 others); Mon, 13 Jun 2022 13:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244911AbiFMRbN (ORCPT ); Mon, 13 Jun 2022 13:31:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 438B5663D6; Mon, 13 Jun 2022 05:57:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6379B80FCD; Mon, 13 Jun 2022 12:57:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE2BDC3411C; Mon, 13 Jun 2022 12:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655125051; bh=KDhPN0EJSPqVJzBkGZYZ/spitiiOUeilcgOvShhrFB0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nMJ5e6gBSI7FEY6Te1788d11iJlulxXuHGGuL9TFl9R5J/Fi1mTnAbFFEwc9sVdqG /gfYi9COCxRzBF4bqk4wOlkpnMT5E1gkLYpSZBE3RIQHpZjkXxkdhtRBvdTPICAKEp j+onTRZedv5xDqdbcECM32Wc5IWYXJeN4XSW9cHtTj9wm7SaZsazli+NlPcyjRsFzE /rsjvMHBqJuoUyXL/GMHOj9800A6o4X66xFIorh/uzTDrf3UxlJlDdXeHyEfErYSVs heThHqdyy3FhrH/ZHx+EWxGDhEFgoXgPXComQNGT9GReuajxWkZ41ikVfXD2hEXEBM b3dsu2DO2eNoA== Date: Mon, 13 Jun 2022 13:57:25 +0100 From: Mark Brown To: Jerome NEANNE Cc: lgirdwood@gmail.com, robh+dt@kernel.org, nm@ti.com, kristo@kernel.org, will@kernel.org, lee.jones@linaro.org, khilman@baylibre.com, narmstrong@baylibre.com, msp@baylibre.com, j-keerthy@ti.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH 2/5] mfd: drivers: Add TI TPS65219 PMIC support Message-ID: References: <20220613090604.9975-1-jneanne@baylibre.com> <20220613090604.9975-3-jneanne@baylibre.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="U2vy66mGJShhsnPN" Content-Disposition: inline In-Reply-To: <20220613090604.9975-3-jneanne@baylibre.com> X-Cookie: innovate, v.: X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --U2vy66mGJShhsnPN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 13, 2022 at 11:06:01AM +0200, Jerome NEANNE wrote: > +/** > + * tps65219_reg_read: Read a single tps65219 register. > + * > + * @tps: Device to read from. > + * @reg: Register to read. > + * @val: Contians the value > + */ > +int tps65219_reg_read(struct tps65219 *tps, unsigned int reg, > + unsigned int *val) > +{ > + return regmap_read(tps->regmap, reg, val); > +} > +EXPORT_SYMBOL_GPL(tps65219_reg_read); It is better practice to just expose the regmap and let the function drivers use it, that means the function drivers can just use standard helper functions. > +static int tps65219_update_bits(struct tps65219 *tps, unsigned int reg, > + unsigned int mask, unsigned int val) > +{ > + int ret; > + unsigned int data; > + > + ret = regmap_read(tps->regmap, reg, &data); > + if (ret) { > + dev_err(tps->dev, "Read from reg 0x%x failed\n", reg); > + return ret; > + } > + > + data &= ~mask; > + data |= val & mask; > + > + mutex_lock(&tps->tps_lock); > + ret = tps65219_reg_write(tps, reg, data); > + if (ret) > + dev_err(tps->dev, "Write for reg 0x%x failed\n", reg); > + mutex_unlock(&tps->tps_lock); It's not clear what this locking is intended to protect. It looks like this should just be using regmap_update_bits(). > +static const struct regmap_range tps65219_yes_ranges[] = { > + regmap_reg_range(TPS65219_REG_INT_SOURCE, TPS65219_REG_POWER_UP_STATUS), > +}; > + > +static const struct regmap_access_table tps65219_volatile_table = { > + .yes_ranges = tps65219_yes_ranges, > + .n_yes_ranges = ARRAY_SIZE(tps65219_yes_ranges), > +}; tps65219_yes_ranges probably needs a clearer name. --U2vy66mGJShhsnPN Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmKnNDQACgkQJNaLcl1U h9Bqegf/anATfCIwadSoj3K2+Sm8a/mvOi3cqdrwn+9BBtO5fPW8QB0iEMMVyX9W 5+AhfxMMfQ9icgu5/ciWCWFuhQ5s0jI5xCbkCdKI9z9wXrIahFJLd0p7UN8Qszen pGvT/TIF3PTfcQoLt7YNDxLvwNchi9A26stCHUpvZXDInzbeqSvA6JZraL8BE2bw 1uoRmHRfb28iPl8J6v9Jbhb1GOrjpzZKosWB1Awlet0COCWYSGdnRWepEGt0RCfi JB9PmDmt9Hzx+JaDTu1+2pMiLkzCShs3Sd/oOWAiSB9PKHI73tVll1G1tJ26lWFv aPxmboun/NkcNpq7jgX0z3UN/AKG7w== =Q4Fu -----END PGP SIGNATURE----- --U2vy66mGJShhsnPN--