Re: [PATCH v13 2/2] usb: typec: ucsi: add support for Cypress CCGx

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

 



On Thu, Oct 25, 2018 at 09:55:47PM +0000, Ajay Gupta wrote:
> Hi Heikki and Andy
> [...]
> > > > Shouldn't you return -ETIMEDOUT if count == 0?
> > > Yes. Good catch. Does the below fix looks ok?
> > >
> > >         do {
> > >                 status = ccg_write(uc, CCGX_RAB_INTR_REG, &data, sizeof(data));
> > >                 if (status < 0)
> > >                         return status;
> > >
> > >                 usleep_range(10000, 11000);
> > >
> > >                 status = ccg_read(uc, CCGX_RAB_INTR_REG, &data, sizeof(data));
> > >                 if (status < 0)
> > >                         return status;
> > >
> > >                 if (!data)
> > >                         return 0;
> > >         } while (data && count--);
> > 
> > Doesn't that condition break out of the loop immediately?
> How? I didn't get your point? We want to break out when data is
> zero (interrupt status cleared).

Sorry Ajay. My brain interpreted that "while" as an "if" statement :-)


thanks,

-- 
heikki



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

  Powered by Linux