Remove some duplicate logic

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1054 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-10-17 23:07:39 +00:00
parent 430198df4c
commit 0c8c5d247d

View File

@ -1339,7 +1339,7 @@ static int usbclass_bind(FAR struct usbdev_s *dev, FAR struct usbdevclass_driver
#ifdef CONFIG_USBSER_BULKREQLEN #ifdef CONFIG_USBSER_BULKREQLEN
reqlen = max(CONFIG_USBSER_BULKREQLEN, priv->epbulkout->maxpacket); reqlen = max(CONFIG_USBSER_BULKREQLEN, priv->epbulkout->maxpacket);
#else #else
reqlen =priv->epbulkout->maxpacket; reqlen = priv->epbulkout->maxpacket;
#endif #endif
for (i = 0; i < CONFIG_USBSER_NRDREQS; i++) for (i = 0; i < CONFIG_USBSER_NRDREQS; i++)
@ -1436,23 +1436,17 @@ static void usbclass_unbind(FAR struct usbdev_s *dev)
if (priv != NULL) if (priv != NULL)
{ {
/* Make sure that the endpoints have been unconfigured. If /* Make sure that the endpoints have been unconfigured. If
* we were terminated gracefully, then the configuration should * we were terminated gracefully, then the configuration should
* already have been reset. If not, then calling usbclass_resetconfig * already have been reset. If not, then calling usbclass_resetconfig
* should cause the endpoints to immediately terminate all * should cause the endpoints to immediately terminate all
* transfers and return the requests to us (with result == -ESHUTDOWN) * transfers and return the requests to us (with result == -ESHUTDOWN)
*/ */
usbclass_resetconfig(priv); usbclass_resetconfig(priv);
up_mdelay(50); up_mdelay(50);
if (priv->ctrlreq != NULL) /* Free the interrupt IN endpoint */
{
usbclass_freereq(dev->ep0, priv->ctrlreq);
}
dev->ep0->private = priv;
/* Free int interrupt IN endpoint */
if (priv->epintin) if (priv->epintin)
{ {
@ -1460,6 +1454,8 @@ static void usbclass_unbind(FAR struct usbdev_s *dev)
priv->epintin = NULL; priv->epintin = NULL;
} }
/* Free the bulk IN endpoint */
if (priv->epbulkin) if (priv->epbulkin)
{ {
DEV_FREEEP(dev, priv->epbulkin); DEV_FREEEP(dev, priv->epbulkin);
@ -1471,6 +1467,7 @@ static void usbclass_unbind(FAR struct usbdev_s *dev)
if (priv->ctrlreq != NULL) if (priv->ctrlreq != NULL)
{ {
usbclass_freereq(dev->ep0, priv->ctrlreq); usbclass_freereq(dev->ep0, priv->ctrlreq);
priv->ctrlreg = NULL;
} }
/* Free pre-allocated read requests (which should all have /* Free pre-allocated read requests (which should all have