Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754544AbbGJJPv (ORCPT ); Fri, 10 Jul 2015 05:15:51 -0400 Received: from mail-bn1bon0116.outbound.protection.outlook.com ([157.56.111.116]:63233 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753334AbbGJJPk (ORCPT ); Fri, 10 Jul 2015 05:15:40 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Date: Fri, 10 Jul 2015 16:06:43 +0800 From: Li Jun To: Roger Quadros CC: , , , , , , , , , , , Subject: Re: [PATCH v3 02/11] usb: otg-fsm: support multiple instances Message-ID: <20150710080642.GB14729@shlinux2> References: <1436350777-28056-1-git-send-email-rogerq@ti.com> <1436350777-28056-3-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1436350777-28056-3-git-send-email-rogerq@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD034;1:cDYEq3he0I48iVbZoCv56bBhz6DXDHC8lydJ8nKucEl4Cz81brW/Rtj576ehdaTfqKW/NCeWJ9AcayS1IdDMYAKxrpwIgXQUkEDud7f/XojWlfNVYPeR1j2PtM6H2d4LliC5GipaJN6FsIC5qGuRd12f5duFuQ12K48SeotTsWZVeQ0yhiC0JyIawIxrdGzQ/hbrSjXA0YiCbS/TcsmoX9YQ33Y4iQCyLJFgAmwayF1S8qV6lylU0y4/r9mEdQx62mJMO4uoB8H+gOKNN0zWKYIa56++VbzkyiYKifrHD0SnDWdbgHIbrXtVP7SIhaIaQJhlrUZNLNN5Ckd6RJw8+SkcIN8pL16GwlHaobedHMGAAg7PjdzCXU8FO8+Baksy0J0VPWtzby4EYRy07lIvT8WZsRv5Wg23zicEA85u9IgNV4itBSddlaL6yXmxaqs0 X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(339900001)(51704005)(189002)(24454002)(199003)(92566002)(33716001)(83506001)(106466001)(104016003)(4001350100001)(2950100001)(47776003)(46102003)(110136002)(50986999)(5001960100002)(50466002)(46406003)(33656002)(77096005)(23726002)(85426001)(76176999)(105606002)(54356999)(77156002)(189998001)(6806004)(19580395003)(62966003)(97756001)(19580405001)(87936001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR0301MB0862;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB0862;2:UjRU47cWYyRPRSKQ2cpwUdH08lqOI5R9h79wkpiYRJrTQEU9e53XyY3DloDeQ49T;3:L818yrTg9PwnuPw+NRrsuQZ6GTD3D9wsJ2267V88bR0xC5GJ/dI61L/QB+4xCcHJbM3FkC4B0YKJ7w8X4OnHQzO9fOsCettxUOUxFCeMVLCY/21cp+wTpKfknyM6rQqR+Naj6zrA2UrP2GWQdPcrpCyx/tbtXekBwU0kpVEukBlODt2nntmK1/r5ptcHM0TbPcnUUcC89cJK3SYNErXM1nktao1Vx4cctjldVZe8YMQ=;25:OzNWwwTnaOEXftxFrVk5lJUJONsqZEJOTD2WAJo6NIIbn0KoErAdRJg5NZ8f8gSwzX8NZc0iovw9XqM9jyZrOaZ5tLnsS7bYOP9C3MCm1n1m+JtgbLtbCVLrJERlRbp0ZhvLcTMH8Sj2e844jBwaesW2mRZbOzYq8vd/4psMwcTD57pgprHVL8Du3f6r34bnR7BM/KggYrY32GSZ3tKLCuwNUdjur8JsabFHdmjhMYMAe7YD2qEVJfTCb7CSzJE7ni6+5ddNZzjHSqnUPG1Mag==;20:XWxCHsuC+rbhriFIEkR/64wDwdCPZS9KmDe7ysyql2lAaVnj7b2SrYTmwQSbXjGEEd4q8wgzs8k9OBKwFs52GQYUVSf9QIQVPD1PrVI4Vcg/x6+etALBzFKxSXnrYR0wNEmCnboGcdVl4P3dPe2xUrCd/3ENuGaVqkL4d6BeA8sagRrkSrAln52lnMpcVt5DYP6jHZ4eUig3TSRwfU7YCq2x0QD9CIX15Qi1j98/4jRXmtttt83QtUsMwZe7DcgvrRye5iwhg/SUkgCs1PWGzqPqpekMXx0sZuDZSi0hnpzi7h/tpTxRtW7Rf5TRnLajwL1JXDY1X6RBXslqu1y3/vINhuGvEAlcSZO0Zp8Wo20= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0862; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:DM2PR0301MB0862;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0862; X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB0862;4:CMCj5yipYiRLN5LKLqe6X4w8UpyolhMKOiETICKSPX2vZ/Wa+eUNXO5zUuQHSKbPBylB83Y6sRlDqhwFXLxIHeoG0ohjj+nkSCqx83Ca/yhRcrvPPA2wOktAF8vWq4EWAmwgnMLN8GKvfXDz+gvxv5CpM/u0oQccRl4xPOhokQOs1bJGJ8XxIjralC7p5LvQ2o6V36lfAcjddeCs8UDhx7rVXbAkx81NQJF3dv+5wleLWKW1vTi5WZeRFyvf3RSdkcLCyGA/vM/71lzF3a6aUWkN36ECc+EhwGsRMyAsd5E= X-Forefront-PRVS: 06339BAE63 X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB0862;23:N6BAvmDXifhfRUlX2mW+ytyXgHl5RRtkVaXt6UliIMq7JKS+R6Eb4zv9CGpIiXvZODg0PNCA9AwC3d5eX9z/8GouwaucYc/GTYxoL1scFBPjvJIlkyUeGYMOAfQ7Ls9HbrptcIqFbIisFdaKgb9RPvPM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ZNE/n+f5wDD4pxh/+9XfoFp2Gs=;20:ETGXk9T3CXzFltqYyoNgnPUgDS+l7pVlKsFyc8pGSe4r9Nx++UNrrskdjGwOyNtWxeeslkp10lSaC630JCUxPQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2015 09:15:37.9716 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0862 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2672 Lines: 81 On Wed, Jul 08, 2015 at 01:19:28PM +0300, Roger Quadros wrote: > Move the state_changed variable into struct otg_fsm > so that we can support multiple instances. > I am not sure if multiple instances may happen since OTG protocol requires only one OTG port can be equipped on OTG device. Li Jun > Signed-off-by: Roger Quadros > --- > drivers/usb/common/usb-otg-fsm.c | 10 ++++------ > include/linux/usb/otg-fsm.h | 1 + > 2 files changed, 5 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c > index 61d538a..42c6376 100644 > --- a/drivers/usb/common/usb-otg-fsm.c > +++ b/drivers/usb/common/usb-otg-fsm.c > @@ -61,8 +61,6 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol) > return 0; > } > > -static int state_changed; > - > /* Called when leaving a state. Do state clean up jobs here */ > static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) > { > @@ -123,7 +121,7 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) > /* Called when entering a state */ > static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) > { > - state_changed = 1; > + fsm->state_changed = 1; > if (fsm->otg->state == new_state) > return 0; "fsm->state_changed = 1;" should be put here, I think. Li Jun > VDBG("Set state: %s\n", usb_otg_state_string(new_state)); > @@ -248,7 +246,7 @@ int otg_statemachine(struct otg_fsm *fsm) > mutex_lock(&fsm->lock); > > state = fsm->otg->state; > - state_changed = 0; > + fsm->state_changed = 0; > /* State machine state change judgement */ > > switch (state) { > @@ -361,7 +359,7 @@ int otg_statemachine(struct otg_fsm *fsm) > } > mutex_unlock(&fsm->lock); > > - VDBG("quit statemachine, changed = %d\n", state_changed); > - return state_changed; > + VDBG("quit statemachine, changed = %d\n", fsm->state_changed); > + return fsm->state_changed; > } > EXPORT_SYMBOL_GPL(otg_statemachine); > diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h > index ca508c2..243274f 100644 > --- a/include/linux/usb/otg-fsm.h > +++ b/include/linux/usb/otg-fsm.h > @@ -194,6 +194,7 @@ struct otg_fsm { > /* Current usb protocol used: 0:undefine; 1:host; 2:client */ > int protocol; > struct mutex lock; > + bool state_changed; > }; > > struct otg_fsm_ops { > -- > 2.1.4 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/