From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B7D320E0 for ; Wed, 20 Sep 2023 03:44:09 +0000 (UTC) Received: from mg.richtek.com (mg.richtek.com [220.130.44.152]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E6A4EAB; Tue, 19 Sep 2023 20:44:06 -0700 (PDT) X-MailGates: (SIP:2,PASS,NONE)(compute_score:DELIVER,40,3) Received: from 192.168.10.47 by mg.richtek.com with MailGates ESMTPS Server V6.0(1978089:0:AUTH_RELAY) (envelope-from ) (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256/256); Wed, 20 Sep 2023 11:43:19 +0800 (CST) Received: from ex4.rt.l (192.168.10.47) by ex4.rt.l (192.168.10.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 20 Sep 2023 11:43:19 +0800 Received: from linuxcarl2.richtek.com (192.168.10.154) by ex4.rt.l (192.168.10.45) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Wed, 20 Sep 2023 11:43:19 +0800 Date: Wed, 20 Sep 2023 11:43:19 +0800 From: ChiYuan Huang To: Pierre-Louis Bossart CC: Mark Brown , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Rob Herring , Jaroslav Kysela , Takashi Iwai , Allen Lin , , , Subject: Re: [PATCH v2 2/2] ASoC: codecs: Add Richtek rtq9128audio amplifier support Message-ID: <20230920034319.GA4446@linuxcarl2.richtek.com> References: <1695086301-10376-1-git-send-email-cy_huang@richtek.com> <1695086301-10376-3-git-send-email-cy_huang@richtek.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On Tue, Sep 19, 2023 at 08:42:29AM -0400, Pierre-Louis Bossart wrote: > > > +static int rtq9128_i2c_write(void *context, const void *data, size_t count) > > +{ > > + struct device *dev = context; > > + struct i2c_client *i2c = to_i2c_client(dev); > > + u8 reg = *(u8 *)data; > > + int rg_size; > > + > > + BUG_ON(count != 5); > > is this really necessary? Just log and error and return? > same comments for other functions > Yap, it can be removed. Originally, just use it to check regmap core really follow the declared regmap config. I think this check may still needed. I'll change the BUG_ON to if/err/return following by your suggestion in v3. > > + rg_size = rtq9128_get_reg_size(reg); > > + return i2c_smbus_write_i2c_block_data(i2c, reg, rg_size, data + count - rg_size); > > +} >