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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4D0AEB64D9 for ; Tue, 4 Jul 2023 09:31:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231546AbjGDJbu (ORCPT ); Tue, 4 Jul 2023 05:31:50 -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 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 >