From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Date: Thu, 14 Jan 2010 09:34:31 -0600 Subject: [U-Boot] [PATCH v4 06/12] SPEAr : usbd driver support for SPEAr SoCs In-Reply-To: <83d1d72b1001140300gd0c9f7dq3a50d45948dd9c76@mail.gmail.com> References: <4B4DC836.5050509@windriver.com> <83d1d72b1001140300gd0c9f7dq3a50d45948dd9c76@mail.gmail.com> Message-ID: <4B4F3987.60204@windriver.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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