Re: [U-Boot] [PATCH v4 06/12] SPEAr : usbd driver support for SPEAr SoCs

14 Jan
2010
14 Jan
'10
4:34 p.m.
Vipin Kumar wrote:
Hello Tom,
+static void udc_state_transition(usb_device_state_t initial,
usb_device_state_t final)
+{
if (initial < final) {
switch (initial) {
case STATE_ATTACHED:
usbd_device_event_irq(udc_device,
DEVICE_HUB_CONFIGURED, 0);
if (final == STATE_POWERED)
break;
case STATE_POWERED:
usbd_device_event_irq(udc_device, DEVICE_RESET, 0);
if (final == STATE_DEFAULT)
break;
case STATE_DEFAULT:
usbd_device_event_irq(udc_device,
DEVICE_ADDRESS_ASSIGNED, 0);
if (final == STATE_ADDRESSED)
break;
case STATE_ADDRESSED:
usbd_device_event_irq(udc_device, DEVICE_CONFIGURED, 0);
case STATE_CONFIGURED:
break;
default:
break;
}
} else if (initial > final) {
switch (initial) {
case STATE_CONFIGURED:
usbd_device_event_irq(udc_device,
DEVICE_DE_CONFIGURED, 0);
if (final == STATE_ADDRESSED)
break;
case STATE_ADDRESSED:
usbd_device_event_irq(udc_device, DEVICE_RESET, 0);
if (final == STATE_DEFAULT)
break;
case STATE_DEFAULT:
usbd_device_event_irq(udc_device,
DEVICE_POWER_INTERRUPTION, 0);
if (final == STATE_POWERED)
break;
case STATE_POWERED:
usbd_device_event_irq(udc_device, DEVICE_HUB_RESET, 0);
case STATE_ATTACHED:
break;
default:
break;
}
}
No panicing if the state transition is the default ?
default here is not an error case. The device state may be other than what are written as switch cases
Ok
Tom
All other review feedbacks are accepted. Patch set v5 would contain the changes
Regards Vipin
5598
Age (days ago)
5598
Last active (days ago)
0 comments
1 participants
participants (1)
-
Tom