Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1065784rdb; Tue, 19 Sep 2023 20:45:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoTaE+32nOePx9KxO8EYfD6MJBe8zD/tk7kOyXQlFdW9bVyoJmIEH6xlUHnwIR/v6fYs5G X-Received: by 2002:a05:6a20:144a:b0:10f:be0:4dce with SMTP id a10-20020a056a20144a00b0010f0be04dcemr1749876pzi.8.1695181516768; Tue, 19 Sep 2023 20:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695181516; cv=none; d=google.com; s=arc-20160816; b=xaXE1o4DZ2nUNcZ5erfj623D2kKtSPeoyBNCZxKtx0HIcoVuMZ2TglaxTeuxF9YOoB anpFpWugii/4tEqyH2DCFUahID0BgufzWspW94OzZz7anGyo7V6ogHoUAb3bD6k3nHIn HV4GFK/kTM1qYogj3Bt5jhC/HhtJjQsxqVYRF0ya2nV104STQukeUWgFEM61N5/SXYhQ r0SiqWsDALCWNnU231IgHC5W6Hmh/3F9qXqkQ1qHH9c1zmjAMa1GokMFZBvKpLHCtd3B noqk8cZizMbHo6HVrZGJ9v6zY89lGIiNGpKdWxmhML6kAo8X/fuTPr6IvJyrBwx5lMsv rE/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=o7unLlo/T8WdvawnB0i2Fxu/G/BbTVNW+SvSMoiiPNQ=; fh=X2llCM03GS3xSr4kBKPPKdPl7W3IET5tQNx5Umx743U=; b=eA+FSUsYzArAKtkAQsj+pP/+CHWncaXABTuxggqSka+BdxTuLyUOBU1E+hy3bw8CUA Dw+CL+8Nb++oqyFcf9f3EwHvV+XTduX1kzFhMTfU/P+bjeFli71mxx/dppoOAMVTTJOg cUOETmOi564IQ9/1bHU7mNiXQoc8Oqo1IaXlYUGaBQo5Dk4bIWopJoMWVJS4b7MsrlQI MFCUHWkj5d+eDru5eit6pXZbRe/kRCpTgaSNoqI4YOngcWJriCV2siY4DyRk1jlaqfxg JzyzrH/gtOugKlSFhDw52So0jOXgI8UkKDX6O3NNVR21XihcQJ033cEa39WKa/87v3VH muSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z185-20020a6333c2000000b00578bf534637si1881727pgz.201.2023.09.19.20.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 20:45:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6D7C38213F06; Tue, 19 Sep 2023 20:44:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232465AbjITDoQ (ORCPT + 99 others); Tue, 19 Sep 2023 23:44:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232190AbjITDoP (ORCPT ); Tue, 19 Sep 2023 23:44:15 -0400 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> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 19 Sep 2023 20:44:14 -0700 (PDT) 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); > > +} >