Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27422809rwd; Tue, 4 Jul 2023 02:45:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlEZhaNyepx5QkJIWcwsJMe9XcnuyLGMJMoRIMIQPloSVXMawn6Lh9fPhxNqKQoyZ9FGHoSt X-Received: by 2002:a17:90a:c58b:b0:262:c2fa:b077 with SMTP id l11-20020a17090ac58b00b00262c2fab077mr12257395pjt.18.1688463925562; Tue, 04 Jul 2023 02:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688463925; cv=none; d=google.com; s=arc-20160816; b=iVywcAy7YD4p+xjoqPeja3Ot0aUDYC9cI3QTYCtRoVP+14UV83OJMozAKTLNuiVDwm gYlrWtZXIYkTEVx39rhUISXoaOravH/sNBtkk0pPJXIh50EEMoBnuLhJpb8iNzzYwU5o cTSK4XPwaID5MUT7UFYG6SYKWGegy3pA4Hxhawbm1U1efov0ggFXw/EDAtBtq8wdCsbA Gsx4pyfc9qMz7m5dwpDI9pohwC8dwxP2UcMhW87wlhb+3G+JYd/u7hyl95bXPKFk0uAQ jU0uq/xJzGvWK6cZ1lut7TmduhLESqS+tcHP8DBkzHRPgFGtimuK7yfx84o52VTBX7N8 gFnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=xxBYV5PGHxOojZ6/Vf69b83Mv4nKQ6Ix2pTjW52Xd2E=; fh=CsqkfoH9KD7nVtGe1Q/jTnlfyMzaUmi5F/oCcxk9qUU=; b=gPmIkieVFVhoBU0ItXXohRl4eSjveYul4o+kr353pQxg8OIoXf6u8X8IBqvHe5Vpcm dR3uZO0DSKFJo6CNyMUMSO+RDLeejMfog9beqVcRIuXBB89A2GZuPy14bIpZnk07bqRf SB5fBc/BH/fUyeCum5fovmtHB0DkAY9RzW+GO8ly2f5T6WydMUE5SEs+XweZWJmYCpNl sM6qOuvZxQDBWlIol2j4oeHwD0d0L/KfWaNSpM18M/eiECbqfTzR4Dn2jKMwdvQpdgvS BO6yyxO9YwVphBClURN3ALbiN0CHKJmsKwo4x+ZpArz2sY5jXbOmfIPv+9tJtn8/uqaL jKYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=EuwuNreG; dkim=neutral (no key) header.i=@suse.de header.b=WfvgNuET; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kk17-20020a17090b4a1100b00263dee6d04dsi1972343pjb.126.2023.07.04.02.45.12; Tue, 04 Jul 2023 02:45:25 -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=@suse.de header.s=susede2_rsa header.b=EuwuNreG; dkim=neutral (no key) header.i=@suse.de header.b=WfvgNuET; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbjGDJbs (ORCPT + 99 others); Tue, 4 Jul 2023 05:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230492AbjGDJbq (ORCPT ); Tue, 4 Jul 2023 05:31:46 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91EF111F for ; Tue, 4 Jul 2023 02:31:45 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 01C5120479; Tue, 4 Jul 2023 09:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1688463104; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xxBYV5PGHxOojZ6/Vf69b83Mv4nKQ6Ix2pTjW52Xd2E=; b=EuwuNreGaHdJ2Fk7s6PHEKDg3FCcmHiYWvxdvsRjKJ659EHvDlnsb29GcvMehTo7D90fmB 4Fy59JubTOvNYsfCg/v5r5DrM5/ZNd/sVvI/TsQ8MDZSe7s0di/J/Sum2ltkndej2oiEds 3vxCEky8CB0OdLeF+1zdo4ytSXTmIss= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1688463104; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xxBYV5PGHxOojZ6/Vf69b83Mv4nKQ6Ix2pTjW52Xd2E=; b=WfvgNuETT3yz/dlBpoOeyoscnNgZy6sBLamLeW2qaPjeGep/pRBX8qyVvoCYZEGSXCp18k pZlYXheAWgigQyCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CB38D133F7; Tue, 4 Jul 2023 09:31:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ByrNMP/mo2TeTwAAMHmgww (envelope-from ); Tue, 04 Jul 2023 09:31:43 +0000 Date: Tue, 04 Jul 2023 11:31:43 +0200 Message-ID: <878rbw2fb4.wl-tiwai@suse.de> From: Takashi Iwai To: Minjie Du Cc: Jaroslav Kysela , Takashi Iwai , Stephen Rothwell , alsa-devel@alsa-project.org (moderated list:SOUND), linux-kernel@vger.kernel.org (open list), opensource.kernel@vivo.com Subject: Re: [PATCH v1] sound: riptide: Remove duplicate judgments code In-Reply-To: <20230704091131.6662-1-duminjie@vivo.com> References: <20230704091131.6662-1-duminjie@vivo.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Tue, 04 Jul 2023 11:11:31 +0200, Minjie Du wrote: > > Fix: delate duplicate judgments > Could you help check it out? Thank you! I'm afraid that it's no right fix. The duplicated calls actually send two commands sequentially, and if you drop one, it'll change the behavior completely. Honestly speaking, I have no idea whether sending twice is mandatory for this chip. It's an ugly driver by reverse engineering, so who knows. We can get rid of it in future. But it's a different topic. thanks, Takashi > > Signed-off-by: Minjie Du > --- > sound/pci/riptide/riptide.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c > index b37c877c2..9bf4b2e86 100644 > --- a/sound/pci/riptide/riptide.c > +++ b/sound/pci/riptide/riptide.c > @@ -958,8 +958,7 @@ getsourcesink(struct cmdif *cif, unsigned char source, unsigned char sink, > { > union cmdret rptr = CMDRET_ZERO; > > - if (SEND_RSSV(cif, source, sink, &rptr) && > - SEND_RSSV(cif, source, sink, &rptr)) > + if (SEND_RSSV(cif, source, sink, &rptr)) > return -EIO; > *a = rptr.retbytes[0]; > *b = rptr.retbytes[1]; > @@ -978,8 +977,7 @@ getsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int *rate) > s = intdec; > for (i = 0; i < 2; i++) { > if (*s != 0xff) { > - if (SEND_RSRC(cif, *s, &rptr) && > - SEND_RSRC(cif, *s, &rptr)) > + if (SEND_RSRC(cif, *s, &rptr)) > return -EIO; > p[i] += rptr.retwords[1]; > p[i] *= rptr.retwords[2]; > @@ -1013,8 +1011,7 @@ setsampleformat(struct cmdif *cif, > sig = snd_pcm_format_unsigned(format) != 0; > order = snd_pcm_format_big_endian(format) != 0; > > - if (SEND_SETF(cif, mixer, w, ch, order, sig, id) && > - SEND_SETF(cif, mixer, w, ch, order, sig, id)) { > + if (SEND_SETF(cif, mixer, w, ch, order, sig, id)) { > snd_printdd("setsampleformat failed\n"); > return -EIO; > } > @@ -1060,7 +1057,7 @@ getmixer(struct cmdif *cif, short num, unsigned short *rval, > { > union cmdret rptr = CMDRET_ZERO; > > - if (SEND_RDGV(cif, num, num, &rptr) && SEND_RDGV(cif, num, num, &rptr)) > + if (SEND_RDGV(cif, num, num, &rptr)) > return -EIO; > *rval = rptr.retwords[0]; > *lval = rptr.retwords[1]; > -- > 2.39.0 >