From 0c8c5d247dafea3ce56731827364ed940f230f65 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 17 Oct 2008 23:07:39 +0000 Subject: [PATCH] Remove some duplicate logic git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1054 42af7a65-404d-4744-a932-0658087f49c3 --- drivers/usbdev/usbdev_serial.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/usbdev/usbdev_serial.c b/drivers/usbdev/usbdev_serial.c index e7307bd00b..96cb973e02 100644 --- a/drivers/usbdev/usbdev_serial.c +++ b/drivers/usbdev/usbdev_serial.c @@ -1339,7 +1339,7 @@ static int usbclass_bind(FAR struct usbdev_s *dev, FAR struct usbdevclass_driver #ifdef CONFIG_USBSER_BULKREQLEN reqlen = max(CONFIG_USBSER_BULKREQLEN, priv->epbulkout->maxpacket); #else - reqlen =priv->epbulkout->maxpacket; + reqlen = priv->epbulkout->maxpacket; #endif for (i = 0; i < CONFIG_USBSER_NRDREQS; i++) @@ -1436,23 +1436,17 @@ static void usbclass_unbind(FAR struct usbdev_s *dev) if (priv != NULL) { - /* Make sure that the endpoints have been unconfigured. If - * we were terminated gracefully, then the configuration should - * already have been reset. If not, then calling usbclass_resetconfig - * should cause the endpoints to immediately terminate all - * transfers and return the requests to us (with result == -ESHUTDOWN) - */ + /* Make sure that the endpoints have been unconfigured. If + * we were terminated gracefully, then the configuration should + * already have been reset. If not, then calling usbclass_resetconfig + * should cause the endpoints to immediately terminate all + * transfers and return the requests to us (with result == -ESHUTDOWN) + */ - usbclass_resetconfig(priv); - up_mdelay(50); + usbclass_resetconfig(priv); + up_mdelay(50); - if (priv->ctrlreq != NULL) - { - usbclass_freereq(dev->ep0, priv->ctrlreq); - } - dev->ep0->private = priv; - - /* Free int interrupt IN endpoint */ + /* Free the interrupt IN endpoint */ if (priv->epintin) { @@ -1460,6 +1454,8 @@ static void usbclass_unbind(FAR struct usbdev_s *dev) priv->epintin = NULL; } + /* Free the bulk IN endpoint */ + if (priv->epbulkin) { DEV_FREEEP(dev, priv->epbulkin); @@ -1471,6 +1467,7 @@ static void usbclass_unbind(FAR struct usbdev_s *dev) if (priv->ctrlreq != NULL) { usbclass_freereq(dev->ep0, priv->ctrlreq); + priv->ctrlreg = NULL; } /* Free pre-allocated read requests (which should all have