NuttX: Fix nxtyle errors

Fix errors reported by nxstyle

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2021-04-02 14:56:34 +02:00 committed by David Sidrane
parent 08e5378b11
commit 26fef3f6a1
13 changed files with 144 additions and 111 deletions

View File

@ -68,7 +68,8 @@
*
* Kernel .data region. Size determined at link time.
* Kernel .bss region Size determined at link time.
* Kernel IDLE thread stack. Size determined by CONFIG_IDLETHREAD_STACKSIZE.
* Kernel IDLE thread stack. Size determined by
* CONFIG_IDLETHREAD_STACKSIZE.
* Padding for alignment
* User .data region. Size determined at link time.
* User .bss region Size determined at link time.
@ -85,7 +86,8 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
*/
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend +
CONFIG_MM_KERNEL_HEAPSIZE;
size_t usize = CONFIG_RAM_END - ubase;
int log2;
@ -110,7 +112,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
/* Allow user-mode access to the user heap memory */
xmc4_mpu_uheap((uintptr_t)ubase, usize);
xmc4_mpu_uheap((uintptr_t)ubase, usize);
#else
/* Return the heap settings */
@ -139,7 +141,8 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
*/
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend +
CONFIG_MM_KERNEL_HEAPSIZE;
size_t usize = CONFIG_RAM_END - ubase;
int log2;

View File

@ -17,6 +17,7 @@
* under the License.
*
****************************************************************************/
/* The Freedom K66F has a single RGB LED driven by the K66F as follows:
*
* LED K66

View File

@ -85,10 +85,11 @@ void kinetis_boardinitialize(void)
* Description:
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
* initialization call will be performed in the boot-up sequence to a
* function called board_late_initialize(). board_late_initialize() will be
* called immediately after up_intitialize() is called and just before the
* initial application is started. This additional initialization phase
* may be used, for example, to initialize board-specific device drivers.
* function called board_late_initialize(). board_late_initialize() will
* be called immediately after up_intitialize() is called and just before
* the initial application is started. This additional initialization
* phase may be used, for example, to initialize board-specific device
* drivers.
*
****************************************************************************/

View File

@ -18,10 +18,10 @@
*
****************************************************************************/
/* A micro Secure Digital (SD) card slot is available on the FRDM-K66F connected to
* the SD Host Controller (SDHC) signals of the MCU. This slot will accept micro
* format SD memory cards. The SD card detect pin (PTD10) is an open switch that
* shorts with VDD when card is inserted.
/* A micro Secure Digital (SD) card slot is available on the FRDM-K66F
* connected to the SD Host Controller (SDHC) signals of the MCU. This slot
* will accept micro format SD memory cards. The SD card detect pin (PTD10)
* is an open switch that shorts with VDD when card is inserted.
*
* ------------ ------------- --------
* SD Card Slot Board Signal K66F Pin
@ -66,6 +66,7 @@
/****************************************************************************
* Private Types
****************************************************************************/
/* This structure holds static information unique to one SDHC peripheral */
struct k66_sdhc_state_s
@ -107,7 +108,9 @@ static void k66_mediachange(void)
{
mcinfo("Media change: %d->%d\n", g_sdhc.inserted, inserted);
/* Yes.. perform the appropriate action (this might need some debounce). */
/* Yes.. perform the appropriate action
* (this might need some debounce).
*/
g_sdhc.inserted = inserted;
sdhc_mediachange(g_sdhc.sdhc, inserted);
@ -159,6 +162,7 @@ int k66_sdhc_initialize(void)
/* Configure the write protect GPIO -- None */
/* Mount the SDHC-based MMC/SD block driver */
/* First, get an instance of the SDHC interface */
mcinfo("Initializing SDHC slot %d\n", MMCSD_SLOTNO);
@ -177,7 +181,8 @@ int k66_sdhc_initialize(void)
ret = mmcsd_slotinitialize(MMSCD_MINOR, g_sdhc.sdhc);
if (ret != OK)
{
syslog(LOG_ERR, "ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", ret);
syslog(LOG_ERR,
"ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", ret);
return ret;
}
@ -205,8 +210,8 @@ bool k66_cardinserted(void)
{
bool inserted;
/* Get the current value of the card detect pin. This pin is pulled to VDD on
* insert. So high means that a card is present.
/* Get the current value of the card detect pin. This pin is pulled to VDD
* on insert. So high means that a card is present.
*/
inserted = kinetis_gpioread(GPIO_SD_CARDDETECT);

View File

@ -81,8 +81,8 @@ void weak_function k66_spidev_initialize(void)
* is configured.
* 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
* kinetis_spi[n]cmddata() functions in your board-specific logic.
* These functions will perform cmd/data selection operations using GPIOs
* in the way your board is configured.
* These functions will perform cmd/data selection operations using
* GPIOs in the way your board is configured.
* 3. Add a call to kinetis_spibus_initialize() in your low level
* application initialization logic
* 4. The handle returned by kinetis_spibus_initialize() may then be used

View File

@ -60,7 +60,8 @@ void k66_usbinitialize(void)
* If USB is supported and the board supports a pullup via GPIO (for USB
* software connect and disconnect), then the board software must provide
* kinetis_usbpullup.
* See include/nuttx/usb/usbdev.h for additional description of this method.
* See include/nuttx/usb/usbdev.h for additional description of this
* method.
* Alternatively, if no pull-up GPIO the following EXTERN can be redefined
* to be NULL.
*

View File

@ -64,7 +64,9 @@ struct zc_upperhalf_s
FAR struct zc_open_s *zu_open;
};
/* This structure describes the state of one open zero cross driver instance */
/* This structure describes the state of one open zero cross driver
* instance
*/
struct zc_open_s
{

View File

@ -324,78 +324,79 @@ int16_t usbmsc_mkcfgdesc(uint8_t *buf,
*/
#ifndef CONFIG_USBMSC_COMPOSITE
{
/* Configuration descriptor If the USB mass storage device is configured as part
* of a composite device, then the configuration descriptor will be provided
* by the composite device logic.
*/
{
/* Configuration descriptor If the USB mass storage device is
* configured as part of a composite device, then the configuration
* descriptor will be provided by the composite device logic.
*/
FAR struct usb_cfgdesc_s *dest = (FAR struct usb_cfgdesc_s *)buf;
FAR struct usb_cfgdesc_s *dest = (FAR struct usb_cfgdesc_s *)buf;
dest->len = USB_SIZEOF_CFGDESC; /* Descriptor length */
dest->len = USB_SIZEOF_CFGDESC; /* Descriptor length */
#ifdef CONFIG_USBDEV_DUALSPEED
dest->type = type; /* Descriptor type */
dest->type = type; /* Descriptor type */
#else
dest->type = USB_DESC_TYPE_CONFIG; /* Descriptor type */
dest->type = USB_DESC_TYPE_CONFIG; /* Descriptor type */
#endif
dest->totallen[0] = LSBYTE(SIZEOF_USBMSC_CFGDESC); /* LS Total length */
dest->totallen[1] = MSBYTE(SIZEOF_USBMSC_CFGDESC); /* MS Total length */
dest->ninterfaces = USBMSC_NINTERFACES; /* Number of interfaces */
dest->cfgvalue = USBMSC_CONFIGID; /* Configuration value */
dest->icfg = USBMSC_CONFIGSTRID; /* Configuration */
dest->attr = USB_CONFIG_ATTR_ONE | /* Attributes */
dest->totallen[0] = LSBYTE(SIZEOF_USBMSC_CFGDESC); /* LS Total length */
dest->totallen[1] = MSBYTE(SIZEOF_USBMSC_CFGDESC); /* MS Total length */
dest->ninterfaces = USBMSC_NINTERFACES; /* Number of interfaces */
dest->cfgvalue = USBMSC_CONFIGID; /* Configuration value */
dest->icfg = USBMSC_CONFIGSTRID; /* Configuration */
dest->attr = USB_CONFIG_ATTR_ONE | /* Attributes */
USBMSC_SELFPOWERED |
USBMSC_REMOTEWAKEUP;
dest->mxpower = (CONFIG_USBDEV_MAXPOWER + 1) / 2; /* Max power (mA/2) */
dest->mxpower = (CONFIG_USBDEV_MAXPOWER + 1) / 2; /* Max power (mA/2) */
buf += sizeof(struct usb_cfgdesc_s);
length += sizeof(struct usb_cfgdesc_s);
}
buf += sizeof(struct usb_cfgdesc_s);
length += sizeof(struct usb_cfgdesc_s);
}
#endif
/* Copy the canned interface descriptor */
{
/* Single interface descriptor */
{
/* Single interface descriptor */
FAR struct usb_ifdesc_s * dest = (struct usb_ifdesc_s *)buf;
FAR struct usb_ifdesc_s * dest = (struct usb_ifdesc_s *)buf;
dest->len = USB_SIZEOF_IFDESC; /* Descriptor length */
dest->type = USB_DESC_TYPE_INTERFACE; /* Descriptor type */
dest->ifno = devinfo->ifnobase; /* Interface number */
dest->alt = USBMSC_ALTINTERFACEID; /* Alternate setting */
dest->neps = USBMSC_NENDPOINTS; /* Number of endpoints */
dest->classid = USB_CLASS_MASS_STORAGE; /* Interface class */
dest->subclass = USBMSC_SUBCLASS_SCSI; /* Interface sub-class */
dest->protocol = USBMSC_PROTO_BULKONLY; /* Interface protocol */
dest->iif = devinfo->strbase + USBMSC_INTERFACESTRID; /* iInterface */
dest->len = USB_SIZEOF_IFDESC; /* Descriptor length */
dest->type = USB_DESC_TYPE_INTERFACE; /* Descriptor type */
dest->ifno = devinfo->ifnobase; /* Interface number */
dest->alt = USBMSC_ALTINTERFACEID; /* Alternate setting */
dest->neps = USBMSC_NENDPOINTS; /* Number of endpoints */
dest->classid = USB_CLASS_MASS_STORAGE; /* Interface class */
dest->subclass = USBMSC_SUBCLASS_SCSI; /* Interface sub-class */
dest->protocol = USBMSC_PROTO_BULKONLY; /* Interface protocol */
dest->iif = devinfo->strbase + USBMSC_INTERFACESTRID; /* iInterface */
buf += sizeof(struct usb_ifdesc_s);
length += sizeof(struct usb_ifdesc_s);
}
buf += sizeof(struct usb_ifdesc_s);
length += sizeof(struct usb_ifdesc_s);
}
/* Make the two endpoint configurations */
/* Bulk IN endpoint descriptor */
{
int len = usbmsc_copy_epdesc(USBMSC_EPBULKIN, (FAR struct usb_epdesc_s *)buf,
devinfo, hispeed);
{
int len = usbmsc_copy_epdesc(USBMSC_EPBULKIN,
(FAR struct usb_epdesc_s *)buf,
devinfo, hispeed);
buf += len;
length += len;
}
buf += len;
length += len;
}
/* Bulk OUT endpoint descriptor */
{
int len = usbmsc_copy_epdesc(USBMSC_EPBULKOUT,
(FAR struct usb_epdesc_s *)buf, devinfo,
hispeed);
{
int len = usbmsc_copy_epdesc(USBMSC_EPBULKOUT,
(FAR struct usb_epdesc_s *)buf, devinfo,
hispeed);
buf += len;
length += len;
}
buf += len;
length += len;
}
return SIZEOF_USBMSC_CFGDESC;
}

View File

@ -53,7 +53,7 @@
****************************************************************************/
/****************************************************************************
* Private Data
* Private Functions
****************************************************************************/
/****************************************************************************

View File

@ -53,7 +53,7 @@
****************************************************************************/
/****************************************************************************
* Private Data
* Private Functions
****************************************************************************/
/****************************************************************************

View File

@ -53,7 +53,7 @@
****************************************************************************/
/****************************************************************************
* Private Data
* Private Functions
****************************************************************************/
/****************************************************************************

View File

@ -106,8 +106,9 @@ void kbd_release(uint8_t ch, FAR struct lib_outstream_s *stream)
void kbd_specpress(enum kbd_keycode_e keycode,
FAR struct lib_outstream_s *stream)
{
DEBUGASSERT(stream && keycode >=
KEYCODE_FWDDEL && keycode <= LAST_KEYCODE);
DEBUGASSERT(stream &&
keycode >= KEYCODE_FWDDEL &&
keycode <= LAST_KEYCODE);
kbd_encode((uint8_t)keycode, stream, ('a' + KBD_SPECPRESS));
}
@ -131,7 +132,8 @@ void kbd_specpress(enum kbd_keycode_e keycode,
void kbd_specrel(enum kbd_keycode_e keycode,
FAR struct lib_outstream_s *stream)
{
DEBUGASSERT(stream && keycode >=
KEYCODE_FWDDEL && keycode <= LAST_KEYCODE);
DEBUGASSERT(stream &&
keycode >= KEYCODE_FWDDEL &&
keycode <= LAST_KEYCODE);
kbd_encode((uint8_t)keycode, stream, ('a' + KBD_SPECREL));
}

View File

@ -177,8 +177,8 @@ struct menu_s
* Private Data
****************************************************************************/
static char g_line[LINE_SIZE+1];
static char g_scratch[SCRATCH_SIZE+1];
static char g_line[LINE_SIZE + 1];
static char g_scratch[SCRATCH_SIZE + 1];
static FILE *g_outfile;
static FILE *g_bodyfile;
static FILE *g_apndxfile;
@ -225,7 +225,7 @@ static struct reserved_s g_reserved[] =
{TOKEN_SOURCE, "source"},
{TOKEN_IF, "if"},
{TOKEN_ENDIF, "endif"},
{TOKEN_NOTRESERVED, NULL} /* Terminates list */
{TOKEN_NOTRESERVED, NULL} /* Terminates list */
};
/****************************************************************************
@ -369,15 +369,20 @@ static void append_file(const char *filename)
static void show_usage(const char *progname, int exitcode)
{
error("USAGE: %s [-d] [-a <apps directory>] {-o <out file>] [<Kconfig root>]\n", progname);
error("USAGE: "
"%s [-d] [-a <apps directory>] {-o <out file>] [<Kconfig root>]\n",
progname);
error(" %s [-h]\n\n", progname);
error("Where:\n\n");
error("\t-a : Select relative path to the apps/ directory. Theis path is relative\n");
error("\t-a : Select relative path to the apps/ directory."
" Theis path is relative\n");
error("\t to the <Kconfig directory>. Default: ../apps\n");
error("\t-o : Send output to <out file>. Default: Output goes to stdout\n");
error("\t-o : Send output to <out file>. "
"Default: Output goes to stdout\n");
error("\t-d : Enable debug output\n");
error("\t-h : Prints this message and exits\n");
error("\t<Kconfig root> is the directory containing the root Kconfig file.\n");
error("\t<Kconfig root> "
"is the directory containing the root Kconfig file.\n");
error("\t Default <Kconfig directory>: .\n");
exit(exitcode);
}
@ -411,11 +416,11 @@ static char *dequote(char *ptr)
/* Check if there is a trailing quote */
len = strlen(ptr);
if (ptr[len-1] == '"')
if (ptr[len - 1] == '"')
{
/* Yes... replace it with a terminator */
ptr[len-1] = '\0';
ptr[len - 1] = '\0';
len--;
}
@ -548,8 +553,8 @@ static char *htmlize_text(const char *src)
static char *htmlize_expression(const char *src)
{
char varname[VAR_SIZE+1];
char htmlvar[HTML_VAR_SIZE+1];
char varname[VAR_SIZE + 1];
char htmlvar[HTML_VAR_SIZE + 1];
char *dest = g_scratch;
char ch = '\0';
char lastc;
@ -629,7 +634,8 @@ static char *htmlize_expression(const char *src)
/* HTML-ize the name into our bigger, local scratch buffer */
snprintf(htmlvar, HTML_VAR_SIZE, "<a href=\"#CONFIG_%s\"><code>CONFIG_%s</code></a>",
snprintf(htmlvar, HTML_VAR_SIZE,
"<a href=\"#CONFIG_%s\"><code>CONFIG_%s</code></a>",
varname, varname);
/* Then transfer the string into the scratch buffer */
@ -679,7 +685,7 @@ static char *read_line(FILE *stream)
/* Loop to handle continuation lines */
for (;;)
for (; ; )
{
/* How long is the line so far? */
@ -687,7 +693,7 @@ static char *read_line(FILE *stream)
/* Remove any newline character at the end of the buffer */
if (g_line[len-1] == '\n')
if (g_line[len - 1] == '\n')
{
len--;
g_line[len] = '\0';
@ -698,7 +704,7 @@ static char *read_line(FILE *stream)
* a line continuation... Don't do that!
*/
if (g_line[len-1] != '\\')
if (g_line[len - 1] != '\\')
{
/* No.. return now */
@ -708,7 +714,7 @@ static char *read_line(FILE *stream)
/* Yes.. Replace the backslash with a space delimiter */
g_line[len-1] = ' ';
g_line[len - 1] = ' ';
/* Read the next line into the scratch buffer */
@ -741,11 +747,12 @@ static char *kconfig_line(FILE *stream)
{
char *ptr;
for (;;)
for (; ; )
{
/* Read the next line from the Kconfig file */
/* Is there already valid data in the line buffer? This can happen while parsing
* help text and we read one line too far.
/* Is there already valid data in the line buffer? This can happen
* while parsing help text and we read one line too far.
*/
if (!g_preread)
@ -1204,8 +1211,8 @@ static inline void process_help(FILE *stream, output_t outfunc)
newpara = true;
preformatted = false;
for (;;)
{
for (; ; )
{
/* Read the next line of comment text */
if (!read_line(stream))
@ -1394,7 +1401,7 @@ static void process_default(FILE *stream, struct default_s *defp)
/* The rest of the line is the dependency */
defp->d_item[ndx].d_dependency = strdup(g_lnptr);
}
}
/* Update the number of defaults we have encountered in this block */
@ -1462,7 +1469,8 @@ static void print_default(struct default_s *defp, output_t outfunc)
{
outfunc(" <p>\n");
outfunc(" <i>Dependency:</i>\n");
outfunc(" %s\n", htmlize_expression(item->d_dependency));
outfunc(" %s\n",
htmlize_expression(item->d_dependency));
outfunc(" </p>\n");
}
}
@ -1615,7 +1623,8 @@ static inline char *process_config(FILE *stream, const char *varname,
{
/* Save the type of the configuration variable */
config.c_type = tokid == TOKEN_BOOL ? VALUE_BOOL : VALUE_TRISTATE;
config.c_type = tokid ==
TOKEN_BOOL ? VALUE_BOOL : VALUE_TRISTATE;
/* Get the description following the type */
@ -1854,7 +1863,9 @@ static inline char *process_config(FILE *stream, const char *varname,
outfunc("</li>\n");
}
/* Print the default value of the configuration variable auto-selected by this setting */
/* Print the default value of the configuration variable auto-selected by
* this setting
*/
if (config.c_select.s_nvar > 0)
{
@ -1864,7 +1875,8 @@ static inline char *process_config(FILE *stream, const char *varname,
for (i = 1; i < config.c_select.s_nvar; i++)
{
outfunc(", <a href=\"#CONFIG_%s\"><code>CONFIG_%s</code></a>",
config.c_select.s_varname[i], config.c_select.s_varname[i]);
config.c_select.s_varname[i],
config.c_select.s_varname[i]);
}
outfunc("</li>\n");
@ -2046,10 +2058,10 @@ static inline char *process_choice(FILE *stream, const char *kconfigdir,
* Kconfig.
*/
body(" <li><i>Kconfig file</i>: <code>%s/%s</code>\n</li>",
kconfigdir, kconfigname);
body(" <li><i>Kconfig file</i>: <code>%s/%s</code>\n</li>",
kconfigdir, kconfigname);
/* Print any help text */
/* Print any help text */
if (help)
{
@ -2057,12 +2069,12 @@ static inline char *process_choice(FILE *stream, const char *kconfigdir,
token = NULL;
}
body("</ul>\n");
body("</ul>\n");
/* Then show the choice options */
/* Then show the choice options */
body("<p><b>Choice Options:</b></p>");
body("<ul>\n");
body("<p><b>Choice Options:</b></p>");
body("<ul>\n");
/* Free allocated memory */
@ -2228,7 +2240,8 @@ static inline char *process_menu(FILE *stream, const char *kconfigdir,
*
****************************************************************************/
static void process_kconfigfile(const char *kconfigdir, const char *kconfigname); /* Forward reference */
static void process_kconfigfile(const char *kconfigdir,
const char *kconfigname); /* Forward reference */
static char *parse_kconfigfile(FILE *stream, const char *kconfigdir,
const char *kconfigname)
{
@ -2304,7 +2317,9 @@ static char *parse_kconfigfile(FILE *stream, const char *kconfigdir,
free(configname);
}
/* Set the token string to NULL to indicate that we need to read the next line */
/* Set the token string to NULL to indicate that we need to read
* the next line
*/
token = NULL;
}
@ -2635,7 +2650,9 @@ int main(int argc, char **argv, char **envp)
g_menu_number++;
/* Increment the paragraph level again: Everything is included within the main menu. */
/* Increment the paragraph level again:
* Everything is included within the main menu.
*/
incr_level();
@ -2708,7 +2725,7 @@ int main(int argc, char **argv, char **envp)
output("</body>\n");
output("</html>\n");
/* Close the output file (if any) and the temporary file*/
/* Close the output file (if any) and the temporary file */
if (outfile)
{