From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44D03C43334 for ; Mon, 13 Jun 2022 12:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O+6ZkTtdxc08x0Rn5Pl3CA3mhNG7F8W7psFTmbtOfa0=; b=P/9qMSJMFUHIX6V0ET8C+vODNn yGKD66i0zlF0sVaWo064ntV3DLk0/GenpPIS8Cb//eeNSQz9Apre0nzz+7VM82SCoMEjWnkXb2XhC BxS26dZuw88degtHgZQ7eQf37tq4/i6yUs6Q+wI475V+7UEIBqk3yw67JYh+Sxk0B9gIoTSJynLbg Nde9AL/CYOiVtdA8neEBjbTe094KEz1yzBJEqTn39khrge0hH99fAWCnNIa5yNeEFM+FAy1k9zCdd GARXwyfyIUmJZPNub9yXLiKOkIHzOXAKKhP6Z+GH00iuoVxcngRMLGKXC3dXCcF6354iN0ZoAeHRt OEayMNaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o0jdX-003h8k-A5; Mon, 13 Jun 2022 12:57:43 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o0jdT-003h6R-L9 for linux-arm-kernel@lists.infradead.org; Mon, 13 Jun 2022 12:57:41 +0000 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 sin.source.kernel.org (Postfix) with ESMTPS id 4641DCE128C; Mon, 13 Jun 2022 12:57:33 +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 In-Reply-To: <20220613090604.9975-3-jneanne@baylibre.com> X-Cookie: innovate, v.: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220613_055740_113142_18712005 X-CRM114-Status: GOOD ( 19.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============5794484773124047842==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============5794484773124047842== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="U2vy66mGJShhsnPN" Content-Disposition: inline --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-- --===============5794484773124047842== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============5794484773124047842==--