USB host composite: Several syntactic errors fixed

This commit is contained in:
Alpo Leinonen
2016-08-29 07:53:57 -06:00
committed by Gregory Nutt
parent 173b996983
commit 7d5173ca09
3 changed files with 35 additions and 25 deletions
+2
View File
@@ -562,6 +562,7 @@ static int memlcd_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t * buffer,
* Get information about the LCD video controller configuration. * Get information about the LCD video controller configuration.
* *
****************************************************************************/ ****************************************************************************/
static int memlcd_getvideoinfo(FAR struct lcd_dev_s *dev, static int memlcd_getvideoinfo(FAR struct lcd_dev_s *dev,
FAR struct fb_videoinfo_s *vinfo) FAR struct fb_videoinfo_s *vinfo)
{ {
@@ -708,6 +709,7 @@ static int memlcd_setcontrast(struct lcd_dev_s *dev, unsigned int contrast)
* the specified LCD. NULL is returned on any failure. * the specified LCD. NULL is returned on any failure.
* *
****************************************************************************/ ****************************************************************************/
FAR struct lcd_dev_s *memlcd_initialize(FAR struct spi_dev_s *spi, FAR struct lcd_dev_s *memlcd_initialize(FAR struct spi_dev_s *spi,
FAR struct memlcd_priv_s *priv, FAR struct memlcd_priv_s *priv,
unsigned int devno) unsigned int devno)
+31 -25
View File
@@ -40,8 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
#include "usbhost_composite.h" #include "usbhost_composite.h"
@@ -58,24 +60,24 @@ struct usbhost_component_s
{ {
/* This the the classobject returned by each contained class */ /* This the the classobject returned by each contained class */
FAR struct usbhost_class_s **usbclass FAR struct usbhost_class_s *usbclass;
/* This is the information that we need to do the registry lookup for this /* This is the information that we need to do the registry lookup for this
* class member. * class member.
*/ */
struct usbhost_id_s id, struct usbhost_id_s id;
}; };
/* This structure contains the internal, private state of the USB host /* This structure contains the internal, private state of the USB host
* CDC/ACM class. * CDC/ACM class.
*/ */
struct usbhsot_composite_s struct usbhost_composite_s
{ {
/* This is the externally visible portion of the state. The usbclass must /* This is the externally visible portion of the state. The usbclass must
* the first element of the structure. It is then cast compatible with * the first element of the structure. It is then cast compatible with
* struct usbhsot_composite_s. * struct usbhost_composite_s.
*/ */
struct usbhost_class_s usbclass; struct usbhost_class_s usbclass;
@@ -120,13 +122,14 @@ static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass);
* *
****************************************************************************/ ****************************************************************************/
static void usbhost_disconnect_all(FAR struct usbhsot_composite_s *priv) static void usbhost_disconnect_all(FAR struct usbhost_composite_s *priv)
{ {
FAR struct usbhost_component_s *member; FAR struct usbhost_component_s *member;
int i;
/* Loop, processing each class that has been included into the composite */ /* Loop, processing each class that has been included into the composite */
for (i = 0; i < nclasses; i++) for (i = 0; i < priv->nclasses; i++)
{ {
member = &priv->members[i]; member = &priv->members[i];
@@ -218,7 +221,7 @@ static int usbhost_connect(FAR struct usbhost_class_s *usbclass,
static int usbhost_disconnected(struct usbhost_class_s *usbclass) static int usbhost_disconnected(struct usbhost_class_s *usbclass)
{ {
FAR struct usbhsot_composite_s *priv = (FAR struct usbhsot_composite_s *)usbclass; FAR struct usbhost_composite_s *priv = (FAR struct usbhost_composite_s *)usbclass;
DEBUGASSERT(priv != NULL); DEBUGASSERT(priv != NULL);
@@ -279,7 +282,7 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
FAR struct usbhost_id_s *id, FAR struct usbhost_id_s *id,
FAR struct usbhost_class_s **usbclass) FAR struct usbhost_class_s **usbclass)
{ {
FAR struct usbhsot_composite_s *priv; FAR struct usbhost_composite_s *priv;
FAR struct usbhost_component_s *member; FAR struct usbhost_component_s *member;
FAR const struct usbhost_registry_s *reg; FAR const struct usbhost_registry_s *reg;
FAR struct usb_desc_s *desc; FAR struct usb_desc_s *desc;
@@ -288,6 +291,7 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
uint16_t nmerged; uint16_t nmerged;
uint16_t nclasses; uint16_t nclasses;
int offset; int offset;
int ret;
int i; int i;
/* Determine if this a composite device has been connected to the /* Determine if this a composite device has been connected to the
@@ -323,7 +327,7 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
* descriptor (nmerged). * descriptor (nmerged).
*/ */
mergeset = 0 mergeset = 0;
nintfs = 0; nintfs = 0;
nmerged = 0; nmerged = 0;
@@ -362,8 +366,8 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
/* Keep track of which interfaces have been merged */ /* Keep track of which interfaces have been merged */
DEBUGASSERT(iad->firstif + iad->nifs < 32); DEBUGASSERT(iad->firstif + iad->nifs < 32);
mask = (1 << iad->nifs) - 1; mask = (1 << iad->nifs) - 1;
mergset |= mask << iad->firstif; mergeset |= mask << iad->firstif;
} }
} }
@@ -404,8 +408,8 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
/* Allocate the composite class container */ /* Allocate the composite class container */
priv = (FAR struct usbhsot_composite_s *) priv = (FAR struct usbhost_composite_s *)
kmm_zalloc(sizeof(struct usbhsot_composite_s)); kmm_zalloc(sizeof(struct usbhost_composite_s));
if (priv == NULL) if (priv == NULL)
{ {
@@ -453,7 +457,7 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
/* Was the interface merged via an IAD descriptor? */ /* Was the interface merged via an IAD descriptor? */
DEBUGASSERT(ifdesc->iif < 32); DEBUGASSERT(ifdesc->iif < 32);
if ((mergset & (1 << ifdesc->iif)) == 0) if ((mergeset & (1 << ifdesc->iif)) == 0)
{ {
FAR struct usbhost_id_s *member = FAR struct usbhost_id_s *member =
(FAR struct usbhost_id_s *)&priv->members[i]; (FAR struct usbhost_id_s *)&priv->members[i];
@@ -482,18 +486,20 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
else if (desc->type == USB_DESC_TYPE_INTERFACEASSOCIATION) else if (desc->type == USB_DESC_TYPE_INTERFACEASSOCIATION)
{ {
FAR struct usb_iaddesc_s *iad = (FAR struct usb_iaddesc_s *)desc; FAR struct usb_iaddesc_s *iad = (FAR struct usb_iaddesc_s *)desc;
FAR struct usbhost_id_s *member =
(FAR struct usbhost_id_s *)&priv->members[i];
/* Yes.. Save the registry lookup information from the IAD. */ /* Yes.. Save the registry lookup information from the IAD. */
member->base = iad->classid; member->base = iad->classid;
member->subclass = iad->subclass; member->subclass = iad->subclass;
member->proto = iad->protocol; member->proto = iad->protocol;
member->vid = id->vid; member->vid = id->vid;
member->pid = id->pid; member->pid = id->pid;
/* Increment the member index */ /* Increment the member index */
i++; i++;
} }
} }
@@ -518,12 +524,12 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
* device. * device.
*/ */
reg = usbhost_findclass(&priv->id); reg = usbhost_findclass(&member->id);
if (reg == NULL) if (reg == NULL)
{ {
uinfo("usbhost_findclass failed\n"); uinfo("usbhost_findclass failed\n");
ret = -EINVAL; ret = -EINVAL;
goto errour_with_members; goto errout_with_members;
} }
/* Yes.. there is a class for this device. Get an instance of its /* Yes.. there is a class for this device. Get an instance of its
@@ -535,7 +541,7 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
{ {
uinfo("CLASS_CREATE failed\n"); uinfo("CLASS_CREATE failed\n");
ret = -ENOMEM; ret = -ENOMEM;
goto errour_with_members; goto errout_with_members;
} }
/* Call the newly instantiated classes connect() method provide it /* Call the newly instantiated classes connect() method provide it
+2
View File
@@ -42,6 +42,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/usb/usb.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
#ifdef CONFIG_USBHOST_COMPOSITE #ifdef CONFIG_USBHOST_COMPOSITE
@@ -80,6 +81,7 @@
int usbhost_composite(FAR struct usbhost_hubport_s *hport, int usbhost_composite(FAR struct usbhost_hubport_s *hport,
FAR const uint8_t *configdesc, int desclen, FAR const uint8_t *configdesc, int desclen,
FAR struct usbhost_id_s *id,
FAR struct usbhost_class_s **usbclass); FAR struct usbhost_class_s **usbclass);
#undef EXTERN #undef EXTERN