RE: [PATCH 2/4] usb: chipidea: add otg id switch and vbus connect/disconnect detect

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

 



 
> 
> Just a nitpick really, but what about parametrizing this code so we won't
> have
> two copies of the same loop?
> 
> Say:
> 
> uint32_t bit = low ? OTGSC_BSV : OTGSC_AWW;
> const char *name = low ? "B_SESS_VALID" : "A_VBUS_VALID";
> 
> while (!(otgsc & bit)) {
> 	if (time_after(jiffies, timeout)) {
> 		dev_err(ci->dev, "wait vbus higher than\
> 				%s timeout!\n", name);
> 		return;
> 	}
> 	msleep(20);
> 	otgsc = hw_read(ci, OP_OTGSC, ~0);
> }
> 
Good idea, I will change

> And shall we not be more careful about endless loops?
Yes, we should be careful of buggy hardware with vbus lower
very slow, so if timeout, return is needed.

> 
> [...]


--
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