RE: [PATCH 3/3] usb: phy-fsm: change "|" to "||" for condition OTG_STATE_A_WAIT_BCON at statemachine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
> 
> From: Peter Chen
> > It is should be condition "or" not bit "or".
> >
> > Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>
> > ---
> >  drivers/usb/phy/phy-fsm-usb.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/usb/phy/phy-fsm-usb.c
> > b/drivers/usb/phy/phy-fsm-usb.c index 0021839..bf5c32f 100644
> > --- a/drivers/usb/phy/phy-fsm-usb.c
> > +++ b/drivers/usb/phy/phy-fsm-usb.c
> > @@ -315,7 +315,7 @@ int otg_statemachine(struct otg_fsm *fsm)
> >  			otg_set_state(fsm, OTG_STATE_A_VBUS_ERR);
> >  		else if (fsm->b_conn)
> >  			otg_set_state(fsm, OTG_STATE_A_HOST);
> > -		else if (fsm->id | fsm->a_bus_drop | fsm->a_wait_bcon_tmout)
> > +		else if (fsm->id || fsm->a_bus_drop || fsm->a_wait_bcon_tmout)
> >  			otg_set_state(fsm, OTG_STATE_A_WAIT_VFALL);
> >  		break;
> >  	case OTG_STATE_A_HOST:
> 
> That rather depends.
> It might be an optimisation (avoiding branch instructions) if it is
> normal that all three values will be zero.
> 

Then, why other state machine transfer uses "||" for their condition judgment?

Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux