Skip to contentSkip to conversation

usb: typec: ucsi: add support for Cypress CCGx

PATCH Superseded Heikki Krogerus 1 participant 1 message Oct 26, 2018 USB

v13 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

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

Quoted 16 lines · Ajay Gupta

Hi Heikki and Andy
[...]

Quoted 14 lines
Quoted 14 lines
Quoted 1 line

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;
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
                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,