Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp527379imu; Wed, 16 Jan 2019 03:14:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN4lHXDi9MDt8VpHPgH8qMY8VIRR7B0Bu1GiOIEhacXFCXsulXWCAuYaXZs1aEeHMzVQ/RP7 X-Received: by 2002:a17:902:765:: with SMTP id 92mr9329237pli.242.1547637277666; Wed, 16 Jan 2019 03:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547637277; cv=none; d=google.com; s=arc-20160816; b=SBVSBUUEqFbkJy+oQPf0fZWzSZTLwF/STHXjF7ppOQTH1VsTyoY9U/qj/ac2OfipQL 9N4ClNrbO6CdqbY6nNP/rZmHzoLXBvhuTU1lmLJcFlal72D5itvQFt1m45v19owhIzL3 7l3HTcHNeIkP35elnRA9h3kdHoNX6x+ksLVk5FWOsbHgPNet6LOquQgBsqu9PNoIpTCA cRyzMS041AtCzdZQuPupU3nJpqDzMEkQ49dpEw3eL2LKf5IY3qYNofXjyzqYEJnHUeWK iZECslIw1G5GlhjvYiq6l3+b6BWaZG/FQb0tE9Wp84jWqTb5k7Pa4eLLnz3foNTefhHz 7IgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=X4grtUrF6wqcq5kqJD3bJfYhoCsb92MFlX7qUAKo160=; b=Fiv0DIc87hCeIx0fz76daCCVdRJ8oZBjp1X8NOVfGqShuxfGfxOChF3hLwKDsSOl2U IHCQBvnBTA0Cvkl/b2y8jkzxeGSlGSCwFjnLBYoK5CUSv3HUXXOLFAEkBnbe11rMSlYH GfJdjrZw26IFN8g+prGcMkWdpKWXRKI3e+XpBUsHQQWUYOWeuLBbTID33KF+MG+gq0dJ mSH6pQ+rIRL1y1SVrkUx5A7FRvOKwfpzEgSZccAgnvNn4BVgNUuXPWTUPSvNDT0i4Pl2 G1KNz2dZzFDFoGik7o2uc4584Wgk5d1HRS5lsAnYThW+kAFy0dfJltx8Y5stPWqi57+8 shdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TTui+AhO; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si5471525pli.50.2019.01.16.03.14.22; Wed, 16 Jan 2019 03:14:37 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TTui+AhO; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389937AbfAOUlC (ORCPT + 99 others); Tue, 15 Jan 2019 15:41:02 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:42714 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730179AbfAOUlB (ORCPT ); Tue, 15 Jan 2019 15:41:01 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0FKenc1052494; Tue, 15 Jan 2019 14:40:49 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547584849; bh=X4grtUrF6wqcq5kqJD3bJfYhoCsb92MFlX7qUAKo160=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=TTui+AhOHOV2EB5QSHzf4ji9t9TQ2eGDPSs8ud/Dunz2iADa3MR2oqBJwXuA/HaLF mXa+IFRSKbBUU0f8G/6THc/VfniLnyXy+I+cKvQVzuYngPTEDBAhISvvJpk3H8kRQf voQwBFddkxxiyc8MIup2bd8FeX/LsgZwpWYu0yIg= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0FKenHS103063 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 15 Jan 2019 14:40:49 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 15 Jan 2019 14:40:49 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Tue, 15 Jan 2019 14:40:49 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0FKenXn006500; Tue, 15 Jan 2019 14:40:49 -0600 Date: Tue, 15 Jan 2019 14:40:49 -0600 From: Bin Liu To: Matthias Brugger CC: , Rob Herring , Greg Kroah-Hartman , Mark Rutland , Alan Stern , , , , , , Subject: Re: [PATCH v2 3/4] usb: musb: Extract set toggle as a separate interface Message-ID: <20190115204049.GE18026@uda0271908> Mail-Followup-To: Bin Liu , Matthias Brugger , min.guo@mediatek.com, Rob Herring , Greg Kroah-Hartman , Mark Rutland , Alan Stern , chunfeng.yun@mediatek.com, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <1547516626-5084-1-git-send-email-min.guo@mediatek.com> <1547516626-5084-4-git-send-email-min.guo@mediatek.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-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Regards, -Bin.