Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp831594imu; Wed, 16 Jan 2019 08:16:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN7CHuZOZakAioTUX7kzMyOx0Yhi+JZQN5rjZ4RNFaC/9d/t/RzI9XWrZ5zwY6ZZpjNmnU7Q X-Received: by 2002:aa7:83c6:: with SMTP id j6mr10580979pfn.91.1547655406529; Wed, 16 Jan 2019 08:16:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547655406; cv=none; d=google.com; s=arc-20160816; b=VALXNlOymILB67ZStawjCb7cgNFssYvKHugKVlf3+MAjbUz3/HCnI3jgYoovCwAjLx yyh1ugP94gc0HaQd2Xy+q25r90VPOHZhGOIQ4o3V6JlW64AJnMHGRf6HcHOq43fja0x3 Gp2vPiSbsfR6H4J+jHGeLnMRkuPmqGCHZPR77obXqoYjJeVzysAA0sMrieqTJXPpwVFA 9nuV7AL9C0kBCBBd7qB9G2CaqmJwugQ0g/lLxTSGT/dElw8fRq1KsynxWaCyJdf2gIfw 3cGmRkxqRY6r9Pixo29bZSm3OJDpBcfD8g/P38qs4vtwdL+zVYAMwvppya/h9TE9t3TO yWMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=aZ35HvpoiXvObk0/0Kx3dM0ANCKp4uRFAms0FUG28Uk=; b=arT0yAt50Ij61U91YLQv02qqBYxdJY1sRv8ubhXm+fGX1uCbeQe8r4ssBOPyeDdb2G DKIPNvaJAo7m/YOytxHbPoNTRVgPqrDItYGUWATEgPXci0GDQyKOJN7tjaUx3GT5DAsI ufHNzlwtqndA6xvIyLOBY/A6Pj0Wxhnr+oERod/2D/aVD0Jbq+fFowHrvaMn9ha8sJ3u TvJx0vGQbgXA5k5tkTRVb2rEvikIdqr9bl0eEPF+lzHVd4lgI+4FdiUAWgd36gzZyKOU lGuJeq6X3h+P5NhvmP+56ppS2/DGlHaSfQLb7bMqz57lNG4Fd8aMd82qM8eXHnupN2Om M85w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bd12si6311031plb.193.2019.01.16.08.16.17; Wed, 16 Jan 2019 08:16:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729219AbfAPCoB (ORCPT + 99 others); Tue, 15 Jan 2019 21:44:01 -0500 Received: from Mailgw01.mediatek.com ([1.203.163.78]:56118 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728394AbfAPCoB (ORCPT ); Tue, 15 Jan 2019 21:44:01 -0500 X-UUID: 8c7863f068fe41ce83799bc6bb1f0c7d-20190116 X-UUID: 8c7863f068fe41ce83799bc6bb1f0c7d-20190116 Received: from mtkcas36.mediatek.inc [(172.27.4.250)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 81010068; Wed, 16 Jan 2019 10:43:56 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 16 Jan 2019 10:43:55 +0800 Received: from [10.17.3.153] (10.17.3.153) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 16 Jan 2019 10:43:54 +0800 Message-ID: <1547606634.4433.179.camel@mhfsdcap03> Subject: Re: [PATCH v2 3/4] usb: musb: Extract set toggle as a separate interface From: Min Guo To: Bin Liu CC: Matthias Brugger , Rob Herring , Greg Kroah-Hartman , Mark Rutland , Alan Stern , , , , , , Date: Wed, 16 Jan 2019 10:43:54 +0800 In-Reply-To: <20190115204049.GE18026@uda0271908> References: <1547516626-5084-1-git-send-email-min.guo@mediatek.com> <1547516626-5084-4-git-send-email-min.guo@mediatek.com> <20190115204049.GE18026@uda0271908> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bin, On Tue, 2019-01-15 at 14:40 -0600, Bin Liu wrote: > Hi Min, > > On Tue, Jan 15, 2019 at 04:19:42PM +0100, Matthias Brugger wrote: > > > > > > On 15/01/2019 02:43, min.guo@mediatek.com wrote: > > > From: Min Guo > > > > > > Add a common interface for set data toggle > > > > > > Signed-off-by: Min Guo > > > --- > > > drivers/usb/musb/musb_host.c | 37 +++++++++++++++++++++++-------------- > > > 1 file changed, 23 insertions(+), 14 deletions(-) > > > > > > diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c > > > index b59ce9a..16d0ba4 100644 > > > --- a/drivers/usb/musb/musb_host.c > > > +++ b/drivers/usb/musb/musb_host.c > > > @@ -306,6 +306,25 @@ static inline void musb_save_toggle(struct musb_qh *qh, int is_in, > > > usb_settoggle(urb->dev, qh->epnum, !is_in, csr ? 1 : 0); > > > } > > > > > > +static inline u16 musb_set_toggle(struct musb_qh *qh, int is_in, > > > + struct urb *urb) > > > +{ > > > + u16 csr = 0; > > > + u16 toggle = 0; > > > + > > > + toggle = usb_gettoggle(urb->dev, qh->epnum, !is_in); > > > + > > > + if (is_in) > > > + csr = toggle ? (MUSB_RXCSR_H_WR_DATATOGGLE > > > + | MUSB_RXCSR_H_DATATOGGLE) : 0; > > > + else > > > + csr = toggle ? (MUSB_TXCSR_H_WR_DATATOGGLE > > > + | MUSB_TXCSR_H_DATATOGGLE) > > > + : MUSB_TXCSR_CLRDATATOG; > > > > Can we switch the if and use is_out logic as function parameter. This would make > > the code easier to understand. > > based on the current implementation in patch 4/4, I don't think we need > this separate patch any more, but Matthias' comments still apply. Okay. > Regards, > -Bin.