You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/03/22 13:24:16 UTC

[incubator-nuttx] branch master updated (f0267af -> 547a3cb)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from f0267af  tools/testbuild.sh: suppress lots of stdout log from configure.sh
     new f7e11fb  boards/:  Remove references to CONFIG_FS_WRITABLE
     new 7dc4ae4  arch/:  Remove support for CONFIG_FS_WRITABLE
     new 9120c33  Documentation/:  Remove support for CONFIG_FS_WRITABLE
     new 74ce4ab  include/:  Remove support for CONFIG_FS_WRITABLE
     new 382513e  libs/libc:  Remove support for CONFIG_FS_WRITABLE
     new 66ab039  drivers/:  Remove support for CONFIG_FS_WRITABLE
     new 7a871e2  fs/:  Remove support for CONFIG_FS_WRITABLE
     new 4312865  drivers/:  Remove support for CONFIG_FS_READABLE
     new 2b532ae  fs/: Remove support for CONFIG_FS_READABLE
     new d22b22a  syscall/:  Remove support for CONFIG_FS_READABLE
     new 533528a  libs/libc:  Remove support CONFIG_FS_READABLE
     new 547a3cb  Run all .c and .h files in previous commits through nxstyle.

The 12 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Documentation/NuttShell.html                       |  33 +-
 arch/arm/src/cxd56xx/cxd56_emmc.c                  |  94 ++--
 arch/arm/src/lc823450/lc823450_mmcl.c              |  33 +-
 .../lc823450/lc823450-xgevk/configs/elf/defconfig  |   1 -
 .../lc823450/lc823450-xgevk/configs/knsh/defconfig |   1 -
 .../lc823450/lc823450-xgevk/configs/nsh/defconfig  |   1 -
 .../lc823450-xgevk/configs/posix_spawn/defconfig   |   1 -
 .../stm32/clicker2-stm32/configs/knsh/defconfig    |   1 -
 boards/arm/stm32/stm32f103-minimum/README.txt      |   2 -
 .../stm32/stm32f103-minimum/configs/nsh/defconfig  |   1 -
 .../stm32l4/stm32l476vg-disco/src/stm32_appinit.c  |  67 ++-
 boards/boardctl.c                                  | 149 +++---
 .../fe310/hifive1-revb/configs/nsh/defconfig       |   1 -
 boards/risc-v/gap8/gapuino/configs/nsh/defconfig   |   1 -
 boards/risc-v/litex/arty_a7/configs/nsh/defconfig  |   1 -
 .../nr5m100/nr5m100-nexys4/configs/nsh/defconfig   |   1 -
 boards/z80/ez80/z20x/configs/w25boot/defconfig     |   1 -
 drivers/Kconfig                                    |   2 -
 drivers/loop/losetup.c                             |  56 +--
 drivers/mmcsd/mmcsd_sdio.c                         | 529 +++++++++----------
 drivers/mmcsd/mmcsd_spi.c                          | 278 +++++-----
 drivers/mtd/Kconfig                                |   3 +-
 drivers/mtd/filemtd.c                              |  21 +-
 drivers/mtd/ftl.c                                  |  22 +-
 drivers/mtd/smart.c                                | 557 ++++++++++++---------
 drivers/ramdisk.c                                  |  68 +--
 drivers/usbdev/Kconfig                             |   2 -
 drivers/usbhost/usbhost_storage.c                  | 252 +++++-----
 fs/Kconfig                                         |  19 -
 fs/binfs/Kconfig                                   |   1 -
 fs/cromfs/Kconfig                                  |   1 -
 fs/driver/fs_blockpartition.c                      |  35 +-
 fs/fat/Kconfig                                     |   2 -
 fs/hostfs/Kconfig                                  |   2 -
 fs/littlefs/Kconfig                                |   2 -
 fs/mount/fs_mount.c                                |  49 +-
 fs/nfs/Kconfig                                     |   2 -
 fs/nxffs/Kconfig                                   |   2 -
 fs/procfs/Kconfig                                  |   1 -
 fs/romfs/Kconfig                                   |   1 -
 fs/smartfs/Kconfig                                 |   2 -
 fs/spiffs/Kconfig                                  |   2 -
 fs/tmpfs/Kconfig                                   |   2 -
 fs/vfs/fs_mkdir.c                                  |  42 +-
 fs/vfs/fs_rename.c                                 |  46 +-
 fs/vfs/fs_rmdir.c                                  |  48 +-
 fs/vfs/fs_unlink.c                                 |  42 +-
 include/nuttx/drivers/ramdisk.h                    |  44 +-
 include/sys/syscall.h                              |  62 +--
 libs/libc/grp/Kconfig                              |   1 -
 libs/libc/netdb/Kconfig                            |   2 -
 libs/libc/pwd/Kconfig                              |   1 -
 libs/libc/stdio/Make.defs                          |  41 +-
 libs/libc/stdlib/Kconfig                           |   2 -
 libs/libc/stdlib/Make.defs                         |  42 +-
 libs/libc/stdlib/lib_mkstemp.c                     |  58 +--
 libs/libc/stdlib/lib_mktemp.c                      |  42 +-
 syscall/syscall.csv                                |   2 +-
 syscall/syscall_lookup.h                           |  41 +-
 59 files changed, 1294 insertions(+), 1524 deletions(-)


[incubator-nuttx] 11/12: libs/libc: Remove support CONFIG_FS_READABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 533528af0161ec3ac16b418df76281e09e457c05
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 11:05:39 2020 -0600

    libs/libc:  Remove support CONFIG_FS_READABLE
---
 libs/libc/grp/Kconfig   | 1 -
 libs/libc/netdb/Kconfig | 2 --
 libs/libc/pwd/Kconfig   | 1 -
 3 files changed, 4 deletions(-)

diff --git a/libs/libc/grp/Kconfig b/libs/libc/grp/Kconfig
index f375b9e..410282a 100644
--- a/libs/libc/grp/Kconfig
+++ b/libs/libc/grp/Kconfig
@@ -6,7 +6,6 @@
 config LIBC_GROUP_FILE
 	bool "Have group file"
 	default n
-	depends on FS_READABLE
 	---help---
 		Have a group file.  The format of the group file is:
 
diff --git a/libs/libc/netdb/Kconfig b/libs/libc/netdb/Kconfig
index b36c1dd..aeee1e7 100644
--- a/libs/libc/netdb/Kconfig
+++ b/libs/libc/netdb/Kconfig
@@ -21,7 +21,6 @@ config LIBC_GAISTRERROR
 menuconfig NETDB_HOSTFILE
 	bool "Network host file support"
 	default n
-	depends on FS_READABLE
 	select LIBC_NETDB
 	---help---
 		Enable network host table look ups via gethostbyname() and
@@ -126,7 +125,6 @@ config NETDB_DNSCLIENT_RETRIES
 config NETDB_RESOLVCONF
 	bool "DNS resolver file support"
 	default n
-	depends on FS_READABLE
 	---help---
 		Enable DNS server look ups in resolver file like /etc/resolv.conf.
 
diff --git a/libs/libc/pwd/Kconfig b/libs/libc/pwd/Kconfig
index c34d19b..2fc6e0f 100644
--- a/libs/libc/pwd/Kconfig
+++ b/libs/libc/pwd/Kconfig
@@ -6,7 +6,6 @@
 config LIBC_PASSWD_FILE
 	bool "Have passwd file"
 	default n
-	depends on FS_READABLE
 	---help---
 		Have a passwd file.  The format of the password file is:
 


[incubator-nuttx] 07/12: fs/: Remove support for CONFIG_FS_WRITABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 7a871e2f292096928cc8cf6b4156260b1d1b688a
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:48:14 2020 -0600

    fs/:  Remove support for CONFIG_FS_WRITABLE
---
 Documentation/NuttShell.html  | 12 ++++--------
 fs/Kconfig                    | 13 -------------
 fs/driver/fs_blockpartition.c |  8 --------
 fs/fat/Kconfig                |  1 -
 fs/hostfs/Kconfig             |  1 -
 fs/littlefs/Kconfig           |  1 -
 fs/nfs/Kconfig                |  1 -
 fs/nxffs/Kconfig              |  1 -
 fs/smartfs/Kconfig            |  1 -
 fs/spiffs/Kconfig             |  1 -
 fs/tmpfs/Kconfig              |  1 -
 fs/vfs/fs_mkdir.c             | 42 +++++++++++++-----------------------------
 fs/vfs/fs_rename.c            | 42 +++++++++++++-----------------------------
 fs/vfs/fs_rmdir.c             | 42 +++++++++++++-----------------------------
 fs/vfs/fs_unlink.c            | 42 +++++++++++++-----------------------------
 15 files changed, 56 insertions(+), 153 deletions(-)

diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html
index e5dfe63..7a72ce0 100644
--- a/Documentation/NuttShell.html
+++ b/Documentation/NuttShell.html
@@ -3736,7 +3736,7 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>df</code></b></td>
-    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_READABLE</code><sup>3</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code></code></td>
     <td><code>CONFIG_NSH_DISABLE_DF</code></td>
   </tr>
   <tr>
@@ -3785,7 +3785,7 @@ nsh&gt;
     <td><code>CONFIG_NSH_DISABLE_GET</code></td>
   </tr>
   <tr>
-    <td><b><code>help</code></b><sup>4</sup></td>
+    <td><b><code>help</code></b><sup>3</sup></td>
     <td><br></td>
     <td><code>CONFIG_NSH_DISABLE_HELP</code></td>
   </tr>
@@ -3880,7 +3880,7 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>mount</code></b></td>
-    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_READABLE</code><sup>3</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code></code></td>
     <td><code>CONFIG_NSH_DISABLE_MOUNT</code></td>
   </tr>
   <tr>
@@ -4006,7 +4006,7 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>umount</code></b></td>
-    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_READABLE</code><sup>3</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code></code></td>
     <td><code>CONFIG_NSH_DISABLE_UMOUNT</code></td>
   </tr>
   <tr>
@@ -4062,10 +4062,6 @@ nsh&gt;
   Special TFTP server start-up options will probably be required to permit
   creation of files for the correct operation of the <code>put</code> command.</small><br>
   <sup>3</sup><small>
-  <code>CONFIG_FS_READABLE</code> is not a user configuration but is set automatically
-  if any readable file system is selected.  At present, this is either <code>CONFIG_FS_FAT</code>
-  or <code>CONFIG_FS_ROMFS</code>.</small><br>
-  <sup>4</sup><small>
   Verbose help output can be suppressed by defining <code>CONFIG_NSH_HELP_TERSE</code>.
   In that case, the help command is still available but will be slightly smaller.
   </small>
diff --git a/fs/Kconfig b/fs/Kconfig
index 8715d2f..c5a516d 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -59,19 +59,6 @@ config FS_READABLE
 	---help---
 		Automatically selected if any readable file system is selected
 
-config FS_WRITABLE
-	bool "Writable file system"
-	default n
-	---help---
-		Automatically selected if any writable file system is selected.  If
-		not selected, support for writing will be disabled in all block
-		drivers and also the block-to-character (BCH) layer and the MTD FTL
-		layer.
-
-		This selection can also be manually selected.  You might want to do
-		this if there are no writable file systems enabled, but you still
-		want support for write access in block drivers and/or FTL.
-
 source fs/aio/Kconfig
 source fs/semaphore/Kconfig
 source fs/mqueue/Kconfig
diff --git a/fs/driver/fs_blockpartition.c b/fs/driver/fs_blockpartition.c
index 898282a..3e662af 100644
--- a/fs/driver/fs_blockpartition.c
+++ b/fs/driver/fs_blockpartition.c
@@ -70,10 +70,8 @@ static int     part_open(FAR struct inode *inode);
 static int     part_close(FAR struct inode *inode);
 static ssize_t part_read(FAR struct inode *inode, unsigned char *buffer,
                          size_t start_sector, unsigned int nsectors);
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t part_write(FAR struct inode *inode, const unsigned char *buffer,
                           size_t start_sector, unsigned int nsectors);
-#endif
 static int     part_geometry(FAR struct inode *inode, struct geometry *geometry);
 static int     part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg);
 
@@ -90,11 +88,7 @@ static const struct block_operations g_part_bops =
   part_open,     /* open     */
   part_close,    /* close    */
   part_read,     /* read     */
-#ifdef CONFIG_FS_WRITABLE
   part_write,    /* write    */
-#else
-  NULL,         /* write    */
-#endif
   part_geometry, /* geometry */
   part_ioctl     /* ioctl    */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
@@ -180,7 +174,6 @@ static ssize_t part_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t part_write(FAR struct inode *inode, const unsigned char *buffer,
                         size_t start_sector, unsigned int nsectors)
 {
@@ -196,7 +189,6 @@ static ssize_t part_write(FAR struct inode *inode, const unsigned char *buffer,
 
   return parent->u.i_bops->write(parent, buffer, start_sector, nsectors);
 }
-#endif
 
 /****************************************************************************
  * Name: part_geometry
diff --git a/fs/fat/Kconfig b/fs/fat/Kconfig
index 51610e2..ebbaa97 100644
--- a/fs/fat/Kconfig
+++ b/fs/fat/Kconfig
@@ -8,7 +8,6 @@ config FS_FAT
 	default n
 	depends on !DISABLE_MOUNTPOINT
 	select FS_READABLE
-	select FS_WRITABLE
 	---help---
 		Enable FAT filesystem support
 
diff --git a/fs/hostfs/Kconfig b/fs/hostfs/Kconfig
index 736692b..e514007 100644
--- a/fs/hostfs/Kconfig
+++ b/fs/hostfs/Kconfig
@@ -8,7 +8,6 @@ config FS_HOSTFS
 	default n
 	depends on !DISABLE_MOUNTPOINT
 	select FS_READABLE
-	select FS_WRITABLE
 	---help---
 		The Host file system provides a mechanism to mount directories
 		from the host OS during simulation mode.  The host directory
diff --git a/fs/littlefs/Kconfig b/fs/littlefs/Kconfig
index 8627b7b..df403ed 100644
--- a/fs/littlefs/Kconfig
+++ b/fs/littlefs/Kconfig
@@ -2,7 +2,6 @@ config FS_LITTLEFS
 	bool "LITTLEFS File System"
 	default n
 	select FS_READABLE
-	select FS_WRITABLE
 	depends on !DISABLE_MOUNTPOINT
 	---help---
 		Build the LITTLEFS file system. https://github.com/ARMmbed/littlefs.
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index a25b3b5..580ba64 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -8,7 +8,6 @@ config NFS
 	default n
 	depends on !DISABLE_MOUNTPOINT
 	select FS_READABLE
-	select FS_WRITABLE
 	---help---
 		Enable network file system (NFS) client file system
 
diff --git a/fs/nxffs/Kconfig b/fs/nxffs/Kconfig
index 1a22844..9232c52 100644
--- a/fs/nxffs/Kconfig
+++ b/fs/nxffs/Kconfig
@@ -8,7 +8,6 @@ config FS_NXFFS
 	default n
 	depends on !DISABLE_MOUNTPOINT
 	select FS_READABLE
-	select FS_WRITABLE
 	---help---
 		Enable NuttX FLASH file system (NXFF) support.
 
diff --git a/fs/smartfs/Kconfig b/fs/smartfs/Kconfig
index 877a5be..53ece00 100644
--- a/fs/smartfs/Kconfig
+++ b/fs/smartfs/Kconfig
@@ -8,7 +8,6 @@ config FS_SMARTFS
 	default n
 	depends on !DISABLE_MOUNTPOINT
 	select FS_READABLE
-	select FS_WRITABLE
 	---help---
 		Enable NuttX SMART Flash file system (SMARTFS) support.
 
diff --git a/fs/spiffs/Kconfig b/fs/spiffs/Kconfig
index 32cc60e..030a572 100644
--- a/fs/spiffs/Kconfig
+++ b/fs/spiffs/Kconfig
@@ -7,7 +7,6 @@ config FS_SPIFFS
 	bool "SPIFFS File System"
 	default n
 	select FS_READABLE
-	select FS_WRITABLE
 	depends on !DISABLE_MOUNTPOINT
 	---help---
 		Build the SPIFFS file system.  This is a port of version 0.3.7 of
diff --git a/fs/tmpfs/Kconfig b/fs/tmpfs/Kconfig
index 04ac741..d1a473b 100644
--- a/fs/tmpfs/Kconfig
+++ b/fs/tmpfs/Kconfig
@@ -8,7 +8,6 @@ config FS_TMPFS
 	default n
 	depends on !DISABLE_MOUNTPOINT
 	select FS_READABLE
-	select FS_WRITABLE
 	---help---
 		Enable TMPFS filesystem support
 
diff --git a/fs/vfs/fs_mkdir.c b/fs/vfs/fs_mkdir.c
index e310b35..8b31581 100644
--- a/fs/vfs/fs_mkdir.c
+++ b/fs/vfs/fs_mkdir.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * fs/vfs/fs_mkdir.c
  *
- *   Copyright (C) 2007, 2008, 2014, 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -54,8 +39,7 @@
  ****************************************************************************/
 
 #undef FS_HAVE_WRITABLE_MOUNTPOINT
-#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \
-    CONFIG_NFILE_STREAMS > 0
+#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_STREAMS > 0
 #  define FS_HAVE_WRITABLE_MOUNTPOINT 1
 #endif
 
diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c
index e610f32..e6983b5 100644
--- a/fs/vfs/fs_rename.c
+++ b/fs/vfs/fs_rename.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * fs/vfs/fs_rename.c
  *
- *   Copyright (C) 2007-2009, 2014, 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -55,8 +40,7 @@
  ****************************************************************************/
 
 #undef FS_HAVE_WRITABLE_MOUNTPOINT
-#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \
-    CONFIG_NFILE_STREAMS > 0
+#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_STREAMS > 0
 #  define FS_HAVE_WRITABLE_MOUNTPOINT 1
 #endif
 
diff --git a/fs/vfs/fs_rmdir.c b/fs/vfs/fs_rmdir.c
index 3370675..3c90b82 100644
--- a/fs/vfs/fs_rmdir.c
+++ b/fs/vfs/fs_rmdir.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * fs/vfs/fs_rmdir.c
  *
- *   Copyright (C) 2007-2009, 2014, 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -53,8 +38,7 @@
  ****************************************************************************/
 
 #undef FS_HAVE_WRITABLE_MOUNTPOINT
-#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \
-    CONFIG_NFILE_STREAMS > 0
+#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_STREAMS > 0
 #  define FS_HAVE_WRITABLE_MOUNTPOINT 1
 #endif
 
diff --git a/fs/vfs/fs_unlink.c b/fs/vfs/fs_unlink.c
index 0cbd078..a84a83b 100644
--- a/fs/vfs/fs_unlink.c
+++ b/fs/vfs/fs_unlink.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * fs/vfs/fs_unlink.c
  *
- *   Copyright (C) 2007-2009, 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -53,8 +38,7 @@
  ****************************************************************************/
 
 #undef FS_HAVE_WRITABLE_MOUNTPOINT
-#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_WRITABLE) && \
-    CONFIG_NFILE_STREAMS > 0
+#if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_STREAMS > 0
 #  define FS_HAVE_WRITABLE_MOUNTPOINT 1
 #endif
 


[incubator-nuttx] 05/12: libs/libc: Remove support for CONFIG_FS_WRITABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 382513e9978db7d0987b38aa94d026ced84b3db1
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:20:03 2020 -0600

    libs/libc:  Remove support for CONFIG_FS_WRITABLE
    
    The mktemp family of functions are built unconditionally now (but not necessarily included in any  build).
---
 libs/libc/stdio/Make.defs      | 41 ++++++++++++-----------------------------
 libs/libc/stdlib/Kconfig       |  2 --
 libs/libc/stdlib/Make.defs     | 42 ++++++++++++------------------------------
 libs/libc/stdlib/lib_mkstemp.c | 42 ++++++++++++------------------------------
 libs/libc/stdlib/lib_mktemp.c  | 42 ++++++++++++------------------------------
 5 files changed, 48 insertions(+), 121 deletions(-)

diff --git a/libs/libc/stdio/Make.defs b/libs/libc/stdio/Make.defs
index 2dd90f6..4ce1a21 100644
--- a/libs/libc/stdio/Make.defs
+++ b/libs/libc/stdio/Make.defs
@@ -1,35 +1,20 @@
 ############################################################################
 # libs/libc/stdio/Make.defs
 #
-#   Copyright (C) 2011-2014, 2019 Gregory Nutt. All rights reserved.
-#   Author: Gregory Nutt <gn...@nuttx.org>
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in
-#    the documentation and/or other materials provided with the
-#    distribution.
-# 3. Neither the name NuttX nor the names of its contributors may be
-#    used to endorse or promote products derived from this software
-#    without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
 #
 ############################################################################
 
@@ -79,9 +64,7 @@ CSRCS += lib_fscanf.c lib_vfscanf.c
 
 endif
 
-ifeq ($(CONFIG_FS_WRITABLE),y)
 CSRCS += lib_tempnam.c lib_tmpnam.c
-endif
 
 ifneq ($(CONFIG_STDIO_DISABLE_BUFFERING),y)
 CSRCS += lib_setbuf.c lib_setvbuf.c
diff --git a/libs/libc/stdlib/Kconfig b/libs/libc/stdlib/Kconfig
index 2df878e..50e2317 100644
--- a/libs/libc/stdlib/Kconfig
+++ b/libs/libc/stdlib/Kconfig
@@ -23,7 +23,6 @@ config LIB_HOMEDIR
 config LIBC_TMPDIR
 	string "Temporary file directory"
 	default "/tmp"
-	depends on FS_WRITABLE
 		---help---
 		If a write-able file system is selected, this string will be
 		provided to specify the full path to a directory where temporary
@@ -33,7 +32,6 @@ config LIBC_TMPDIR
 config LIBC_MAX_TMPFILE
 	int "Maximum size of a temporary file path"
 	default 32
-	depends on FS_WRITABLE
 		---help---
 		If a write-able file system is selected, then temporary file may be
 		supported at the path provided by LIBC_TMPDIR.  The tmpnam() interface
diff --git a/libs/libc/stdlib/Make.defs b/libs/libc/stdlib/Make.defs
index 8f059a8..e724bff 100644
--- a/libs/libc/stdlib/Make.defs
+++ b/libs/libc/stdlib/Make.defs
@@ -1,35 +1,20 @@
 ############################################################################
 # libs/libc/stdlib/Make.defs
 #
-#   Copyright (C) 2012, 2015-2016 Gregory Nutt. All rights reserved.
-#   Author: Gregory Nutt <gn...@nuttx.org>
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
 #
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
+#   http://www.apache.org/licenses/LICENSE-2.0
 #
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in
-#    the documentation and/or other materials provided with the
-#    distribution.
-# 3. Neither the name NuttX nor the names of its contributors may be
-#    used to endorse or promote products derived from this software
-#    without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
 #
 ############################################################################
 
@@ -40,10 +25,7 @@ CSRCS += lib_itoa.c lib_labs.c lib_llabs.c
 CSRCS += lib_bsearch.c lib_rand.c lib_qsort.c lib_srand.c
 CSRCS += lib_strtol.c lib_strtoll.c lib_strtoul.c lib_strtoull.c
 CSRCS += lib_strtod.c lib_strtof.c lib_strtold.c lib_checkbase.c
-
-ifeq ($(CONFIG_FS_WRITABLE),y)
 CSRCS += lib_mktemp.c lib_mkstemp.c
-endif
 
 ifeq ($(CONFIG_LIBC_WCHAR),y)
 CSRCS += lib_mbtowc.c lib_wctomb.c
diff --git a/libs/libc/stdlib/lib_mkstemp.c b/libs/libc/stdlib/lib_mkstemp.c
index 83696e9..ee996e5 100644
--- a/libs/libc/stdlib/lib_mkstemp.c
+++ b/libs/libc/stdlib/lib_mkstemp.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * libs/libc/stdlib/lib_mkstemp.c
  *
- *   Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -49,8 +34,6 @@
 
 #include <nuttx/semaphore.h>
 
-#ifdef CONFIG_FS_WRITABLE
-
 /****************************************************************************
  * Pre-processor definitions
  ****************************************************************************/
@@ -292,4 +275,3 @@ int mkstemp(FAR char *path_template)
   return ERROR;
 }
 
-#endif /* CONFIG_FS_WRITABLE */
diff --git a/libs/libc/stdlib/lib_mktemp.c b/libs/libc/stdlib/lib_mktemp.c
index b6bb6ed..1c4f15d 100644
--- a/libs/libc/stdlib/lib_mktemp.c
+++ b/libs/libc/stdlib/lib_mktemp.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * libs/libc/stdlib/lib_mktemp.c
  *
- *   Copyright (C) 2014 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -43,8 +28,6 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-#ifdef CONFIG_FS_WRITABLE
-
 /****************************************************************************
  * Pre-processor definitions
  ****************************************************************************/
@@ -77,4 +60,3 @@ int mktemp(FAR char *path_template)
   return OK;
 }
 
-#endif /* CONFIG_FS_WRITABLE */


[incubator-nuttx] 01/12: boards/: Remove references to CONFIG_FS_WRITABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit f7e11fb2a60f1fe3949c6f394d073a9c66519b93
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:02:20 2020 -0600

    boards/:  Remove references to CONFIG_FS_WRITABLE
    
    Remove references from defconfig files, README.txt files and a couple of uses in .c files
---
 boards/arm/lc823450/lc823450-xgevk/configs/elf/defconfig         | 1 -
 boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig        | 1 -
 boards/arm/lc823450/lc823450-xgevk/configs/nsh/defconfig         | 1 -
 boards/arm/lc823450/lc823450-xgevk/configs/posix_spawn/defconfig | 1 -
 boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig           | 1 -
 boards/arm/stm32/stm32f103-minimum/README.txt                    | 2 --
 boards/arm/stm32/stm32f103-minimum/configs/nsh/defconfig         | 1 -
 boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c         | 8 --------
 boards/boardctl.c                                                | 5 +----
 boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig           | 1 -
 boards/risc-v/gap8/gapuino/configs/nsh/defconfig                 | 1 -
 boards/risc-v/litex/arty_a7/configs/nsh/defconfig                | 1 -
 boards/risc-v/nr5m100/nr5m100-nexys4/configs/nsh/defconfig       | 1 -
 boards/z80/ez80/z20x/configs/w25boot/defconfig                   | 1 -
 14 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/elf/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/elf/defconfig
index e4932c0..5c48047 100644
--- a/boards/arm/lc823450/lc823450-xgevk/configs/elf/defconfig
+++ b/boards/arm/lc823450/lc823450-xgevk/configs/elf/defconfig
@@ -26,7 +26,6 @@ CONFIG_ELF=y
 CONFIG_EXAMPLES_ELF=y
 CONFIG_FS_PROCFS=y
 CONFIG_FS_ROMFS=y
-CONFIG_FS_WRITABLE=y
 CONFIG_HAVE_CXX=y
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LC823450_UART0=y
diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig
index 08f0463..4dfca9a 100644
--- a/boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig
+++ b/boards/arm/lc823450/lc823450-xgevk/configs/knsh/defconfig
@@ -30,7 +30,6 @@ CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DEV_ZERO=y
 CONFIG_DISABLE_POSIX_TIMERS=y
 CONFIG_FS_PROCFS=y
-CONFIG_FS_WRITABLE=y
 CONFIG_HRT_TIMER=y
 CONFIG_I2C=y
 CONFIG_I2CTOOL_MAXBUS=1
diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/nsh/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/nsh/defconfig
index b00348a..3fd55c5 100644
--- a/boards/arm/lc823450/lc823450-xgevk/configs/nsh/defconfig
+++ b/boards/arm/lc823450/lc823450-xgevk/configs/nsh/defconfig
@@ -37,7 +37,6 @@ CONFIG_EXAMPLES_NXHELLO_BPP=1
 CONFIG_EXAMPLES_PIPE=y
 CONFIG_EXAMPLES_WATCHDOG=y
 CONFIG_FS_PROCFS=y
-CONFIG_FS_WRITABLE=y
 CONFIG_HRT_TIMER=y
 CONFIG_I2C=y
 CONFIG_I2CTOOL_MAXBUS=1
diff --git a/boards/arm/lc823450/lc823450-xgevk/configs/posix_spawn/defconfig b/boards/arm/lc823450/lc823450-xgevk/configs/posix_spawn/defconfig
index c01aae4..4f23e3b 100644
--- a/boards/arm/lc823450/lc823450-xgevk/configs/posix_spawn/defconfig
+++ b/boards/arm/lc823450/lc823450-xgevk/configs/posix_spawn/defconfig
@@ -25,7 +25,6 @@ CONFIG_ELF=y
 CONFIG_EXAMPLES_POSIXSPAWN=y
 CONFIG_FS_PROCFS=y
 CONFIG_FS_ROMFS=y
-CONFIG_FS_WRITABLE=y
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LC823450_UART0=y
 CONFIG_LIBC_EXECFUNCS=y
diff --git a/boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig b/boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig
index f2b1f74..9dfd07f 100644
--- a/boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig
+++ b/boards/arm/stm32/clicker2-stm32/configs/knsh/defconfig
@@ -19,7 +19,6 @@ CONFIG_BOARD_LATE_INITIALIZE=y
 CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILD_PROTECTED=y
 CONFIG_FS_PROCFS=y
-CONFIG_FS_WRITABLE=y
 CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_INTELHEX_BINARY=y
diff --git a/boards/arm/stm32/stm32f103-minimum/README.txt b/boards/arm/stm32/stm32f103-minimum/README.txt
index c59cb36..bf5b147 100644
--- a/boards/arm/stm32/stm32f103-minimum/README.txt
+++ b/boards/arm/stm32/stm32f103-minimum/README.txt
@@ -412,8 +412,6 @@ SDCard support:
 
     CONFIG_FS_FAT=y
 
-    CONFIG_FS_WRITABLE=y
-
     CONFIG_MMCSD=y
     CONFIG_MMCSD_NSLOTS=1
     CONFIG_MMCSD_SPI=y
diff --git a/boards/arm/stm32/stm32f103-minimum/configs/nsh/defconfig b/boards/arm/stm32/stm32f103-minimum/configs/nsh/defconfig
index 2f2b388..4bed7e9 100644
--- a/boards/arm/stm32/stm32f103-minimum/configs/nsh/defconfig
+++ b/boards/arm/stm32/stm32f103-minimum/configs/nsh/defconfig
@@ -26,7 +26,6 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_BOARD_LOOPSPERMSEC=5483
 CONFIG_BUILTIN=y
 CONFIG_DEFAULT_SMALL=y
-CONFIG_FS_WRITABLE=y
 CONFIG_MAX_TASKS=16
 CONFIG_MAX_WDOGPARMS=2
 CONFIG_NFILE_DESCRIPTORS=8
diff --git a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c
index abaa91d..8abe7db 100644
--- a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c
+++ b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c
@@ -271,14 +271,6 @@ FAR struct mtd_dev_s *mtd_temp;
 
       /* Now create a character device on the block device */
 
-      /* NOTE:  for this to work, you will need to make sure that
-       * CONFIG_FS_WRITABLE is set in the config.  It's not a user-
-       * visible setting, but you can make it set by selecting an
-       * arbitrary writable file system (you don't have to actually
-       * use it, just select it so that the block device created via
-       * ftl_initialize() will be writable).
-       */
-
       ret = bchdev_register(blockdev, chardev, false);
       if (ret < 0)
         {
diff --git a/boards/boardctl.c b/boards/boardctl.c
index c961132..cded6c4 100644
--- a/boards/boardctl.c
+++ b/boards/boardctl.c
@@ -48,10 +48,7 @@
 #include <nuttx/board.h>
 #include <nuttx/lib/modlib.h>
 #include <nuttx/binfmt/symtab.h>
-
-#ifdef CONFIG_FS_WRITABLE
-#  include <nuttx/drivers/ramdisk.h>
-#endif
+#include <nuttx/drivers/ramdisk.h>
 
 #ifdef CONFIG_NX
 #  include <nuttx/nx/nxmu.h>
diff --git a/boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig b/boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig
index 837201e..c89b818 100644
--- a/boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig
+++ b/boards/risc-v/fe310/hifive1-revb/configs/nsh/defconfig
@@ -38,7 +38,6 @@ CONFIG_EXAMPLES_BUTTONS_STACKSIZE=1024
 CONFIG_EXAMPLES_HELLO=y
 CONFIG_EXAMPLES_HELLO_STACKSIZE=1024
 CONFIG_FS_PROCFS=y
-CONFIG_FS_WRITABLE=y
 CONFIG_IDLETHREAD_STACKSIZE=1536
 CONFIG_INPUT=y
 CONFIG_INTELHEX_BINARY=y
diff --git a/boards/risc-v/gap8/gapuino/configs/nsh/defconfig b/boards/risc-v/gap8/gapuino/configs/nsh/defconfig
index 8e2c856..63a6685 100644
--- a/boards/risc-v/gap8/gapuino/configs/nsh/defconfig
+++ b/boards/risc-v/gap8/gapuino/configs/nsh/defconfig
@@ -20,7 +20,6 @@ CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DEV_ZERO=y
 CONFIG_FS_PROCFS=y
-CONFIG_FS_WRITABLE=y
 CONFIG_IDLETHREAD_STACKSIZE=2048
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBC_PERROR_STDOUT=y
diff --git a/boards/risc-v/litex/arty_a7/configs/nsh/defconfig b/boards/risc-v/litex/arty_a7/configs/nsh/defconfig
index 09fd4f1..3867bf8 100644
--- a/boards/risc-v/litex/arty_a7/configs/nsh/defconfig
+++ b/boards/risc-v/litex/arty_a7/configs/nsh/defconfig
@@ -28,7 +28,6 @@ CONFIG_DISABLE_MQUEUE=y
 CONFIG_EXAMPLES_HELLO=y
 CONFIG_EXAMPLES_HELLO_STACKSIZE=8192
 CONFIG_FS_PROCFS=y
-CONFIG_FS_WRITABLE=y
 CONFIG_IDLETHREAD_STACKSIZE=8192
 CONFIG_INTELHEX_BINARY=y
 CONFIG_LIBC_PERROR_STDOUT=y
diff --git a/boards/risc-v/nr5m100/nr5m100-nexys4/configs/nsh/defconfig b/boards/risc-v/nr5m100/nr5m100-nexys4/configs/nsh/defconfig
index 56f39bf..a3730e0 100644
--- a/boards/risc-v/nr5m100/nr5m100-nexys4/configs/nsh/defconfig
+++ b/boards/risc-v/nr5m100/nr5m100-nexys4/configs/nsh/defconfig
@@ -22,7 +22,6 @@ CONFIG_BUILTIN=y
 CONFIG_DEBUG_FULLOPT=y
 CONFIG_DEBUG_SYMBOLS=y
 CONFIG_DEV_ZERO=y
-CONFIG_FS_WRITABLE=y
 CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
 CONFIG_IDLETHREAD_STACKSIZE=2048
diff --git a/boards/z80/ez80/z20x/configs/w25boot/defconfig b/boards/z80/ez80/z20x/configs/w25boot/defconfig
index d4c1357..783fe0a 100644
--- a/boards/z80/ez80/z20x/configs/w25boot/defconfig
+++ b/boards/z80/ez80/z20x/configs/w25boot/defconfig
@@ -19,7 +19,6 @@ CONFIG_DISABLE_MQUEUE=y
 CONFIG_DISABLE_PTHREAD=y
 CONFIG_EZ80_SPI=y
 CONFIG_EZ80_UART1=y
-CONFIG_FS_WRITABLE=y
 CONFIG_HOST_WINDOWS=y
 CONFIG_MAX_TASKS=8
 CONFIG_MAX_WDOGPARMS=2


[incubator-nuttx] 03/12: Documentation/: Remove support for CONFIG_FS_WRITABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 9120c33c2187983b1acfa9ce8a0fc427e635d101
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:12:53 2020 -0600

    Documentation/:  Remove support for CONFIG_FS_WRITABLE
    
    Remove documentation of commands conditioned on CONFIG_FS_WRITABLE
---
 Documentation/NuttShell.html | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html
index 3903611..e5dfe63 100644
--- a/Documentation/NuttShell.html
+++ b/Documentation/NuttShell.html
@@ -646,7 +646,7 @@
   <tr align="center" bgcolor="#e4e4e4">
     <td>
       <h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
-      <p>Last Updated:  November 3, 2019</p>
+      <p>Last Updated:  March 21, 2020</p>
     </td>
   </tr>
 </table>
@@ -3785,7 +3785,7 @@ nsh&gt;
     <td><code>CONFIG_NSH_DISABLE_GET</code></td>
   </tr>
   <tr>
-    <td><b><code>help</code></b><sup>5</sup></td>
+    <td><b><code>help</code></b><sup>4</sup></td>
     <td><br></td>
     <td><code>CONFIG_NSH_DISABLE_HELP</code></td>
   </tr>
@@ -3860,7 +3860,7 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>mkdir</code></b></td>
-    <td>(((!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_WRITABLE</code>) || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code>)</td>
+    <td>(!<code>CONFIG_DISABLE_MOUNTPOINT</code> || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code>)</td>
     <td><code>CONFIG_NSH_DISABLE_MKDIR</code></td>
   </tr>
   <tr>
@@ -3875,7 +3875,7 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>mkrd</code></b></td>
-    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_WRITABLE</code><sup>4</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code></code></td>
     <td><code>CONFIG_NSH_DISABLE_MKRD</code></td>
   </tr>
   <tr>
@@ -3885,7 +3885,7 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>mv</code></b></td>
-    <td>(!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_WRITABLE</code>) || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code><sup>4</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code></td>
     <td><code>CONFIG_NSH_DISABLE_MV</code></td>
   </tr>
   <tr>
@@ -3900,7 +3900,7 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>passwd</code></b></td>
-    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_WRITABLE</code> &amp;&amp; <code>CONFIG_NSH_LOGIN_PASSWD</code>sup>4</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NSH_LOGIN_PASSWD</code></td>
     <td><code>CONFIG_NSH_DISABLE_PASSWD</code></td>
   </tr>
   <tr>
@@ -3941,12 +3941,12 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>rm</code></b></td>
-    <td>(!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_WRITABLE</code>) || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code><sup>4</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code></td>
     <td><code>CONFIG_NSH_DISABLE_RM</code></td>
   </tr>
   <tr>
     <td><b><code>rmdir</code></b></td>
-    <td>(!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_WRITABLE</code>) || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code><sup>4</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> || !<code>CONFIG_DISABLE_PSEUDOFS_OPERATIONS</code></td>
     <td><code>CONFIG_NSH_DISABLE_RMDIR</code></td>
   </tr>
   <tr>
@@ -4031,12 +4031,12 @@ nsh&gt;
   </tr>
   <tr>
     <td><b><code>useradd</code></b></td>
-    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_WRITABLE</code> &amp;&amp; <code>CONFIG_NSH_LOGIN_PASSWD</code>sup>4</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NSH_LOGIN_PASSWD</code></td>
     <td><code>CONFIG_NSH_DISABLE_USERADD</code></td>
   </tr>
   <tr>
     <td><b><code>userdel</code></b></td>
-    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_FS_WRITABLE</code> &amp;&amp; <code>CONFIG_NSH_LOGIN_PASSWD</code>sup>4</sup></td>
+    <td>!<code>CONFIG_DISABLE_MOUNTPOINT</code> &amp;&amp; <code>CONFIG_NSH_LOGIN_PASSWD</code></td>
     <td><code>CONFIG_NSH_DISABLE_USERDEL</code></td>
   </tr>
   <tr>
@@ -4066,9 +4066,6 @@ nsh&gt;
   if any readable file system is selected.  At present, this is either <code>CONFIG_FS_FAT</code>
   or <code>CONFIG_FS_ROMFS</code>.</small><br>
   <sup>4</sup><small>
-  <code>CONFIG_FS_WRITABLE</code> is not a user configuration but is set automatically
-  if any writable file system is selected.  At present, this is only <code>CONFIG_FS_FAT</code>.</small><br>
-  <sup>5</sup><small>
   Verbose help output can be suppressed by defining <code>CONFIG_NSH_HELP_TERSE</code>.
   In that case, the help command is still available but will be slightly smaller.
   </small>


[incubator-nuttx] 06/12: drivers/: Remove support for CONFIG_FS_WRITABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 66ab039b8969c3640a1c77b2853463bbe1c6e25b
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:36:26 2020 -0600

    drivers/:  Remove support for CONFIG_FS_WRITABLE
---
 drivers/Kconfig                   |  1 -
 drivers/loop/losetup.c            | 56 +++++++------------------------
 drivers/mmcsd/mmcsd_sdio.c        | 69 +++++++++------------------------------
 drivers/mmcsd/mmcsd_spi.c         | 59 +++++++++++++--------------------
 drivers/mtd/Kconfig               |  3 +-
 drivers/mtd/filemtd.c             |  5 +--
 drivers/mtd/ftl.c                 | 22 +------------
 drivers/mtd/smart.c               | 31 ------------------
 drivers/ramdisk.c                 | 65 +++++++-----------------------------
 drivers/usbdev/Kconfig            |  1 -
 drivers/usbhost/usbhost_storage.c | 55 ++++++++-----------------------
 11 files changed, 79 insertions(+), 288 deletions(-)

diff --git a/drivers/Kconfig b/drivers/Kconfig
index ed3612d..591023b 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -19,7 +19,6 @@ config DRVR_MKRD
 	bool "RAM disk wrapper (mkrd)"
 	default n
 	select FS_READABLE
-	select FS_WRITABLE
 	---help---
 		Build the mkrd() function which serves as a wrapper to simplify
 		creation of RAM disks.  If the boardctrl() interface is enabled,
diff --git a/drivers/loop/losetup.c b/drivers/loop/losetup.c
index f92b4cd..df2f8e7 100644
--- a/drivers/loop/losetup.c
+++ b/drivers/loop/losetup.c
@@ -1,36 +1,20 @@
 /****************************************************************************
  * drivers/loop/losetup.c
  *
- *   Copyright (C) 2008-2009, 2011, 2014-2015, 2017-2018 Gregory Nutt. All
- *     rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -79,9 +63,7 @@ struct loop_struct_s
   off_t        offset;       /* Offset (in bytes) to the first sector */
   uint16_t     sectsize;     /* The size of one sector */
   uint8_t      opencnt;      /* Count of open references to the loop device */
-#ifdef CONFIG_FS_WRITABLE
   bool         writeenabled; /* true: can write to device */
-#endif
   struct file  devfile;      /* File struct of char device/file */
 };
 
@@ -94,11 +76,9 @@ static int     loop_open(FAR struct inode *inode);
 static int     loop_close(FAR struct inode *inode);
 static ssize_t loop_read(FAR struct inode *inode, FAR unsigned char *buffer,
                        size_t start_sector, unsigned int nsectors);
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t loop_write(FAR struct inode *inode,
                           FAR const unsigned char *buffer,
                           size_t start_sector, unsigned int nsectors);
-#endif
 static int     loop_geometry(FAR struct inode *inode,
                              FAR struct geometry *geometry);
 
@@ -111,11 +91,7 @@ static const struct block_operations g_bops =
   loop_open,     /* open */
   loop_close,    /* close */
   loop_read,     /* read */
-#ifdef CONFIG_FS_WRITABLE
   loop_write,    /* write */
-#else
-  NULL,          /* write */
-#endif
   loop_geometry, /* geometry */
   NULL           /* ioctl */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
@@ -270,7 +246,6 @@ static ssize_t loop_read(FAR struct inode *inode, FAR unsigned char *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t loop_write(FAR struct inode *inode,
                           FAR const unsigned char *buffer,
                           size_t start_sector, unsigned int nsectors)
@@ -310,7 +285,6 @@ static ssize_t loop_write(FAR struct inode *inode,
 
   return nbyteswritten / dev->sectsize;
 }
-#endif
 
 /****************************************************************************
  * Name: loop_geometry
@@ -330,11 +304,7 @@ static int loop_geometry(FAR struct inode *inode,
       dev = (FAR struct loop_struct_s *)inode->i_private;
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
-#ifdef CONFIG_FS_WRITABLE
       geometry->geo_writeenabled  = dev->writeenabled;
-#else
-      geometry->geo_writeenabled  = false;
-#endif
       geometry->geo_nsectors      = dev->nsectors;
       geometry->geo_sectorsize    = dev->sectsize;
       return OK;
@@ -407,7 +377,6 @@ int losetup(FAR const char *devname, FAR const char *filename,
 
   /* Open the file. */
 
-#ifdef CONFIG_FS_WRITABLE
   /* First try to open the device R/W access (unless we are asked
    * to open it readonly).
    */
@@ -423,7 +392,6 @@ int losetup(FAR const char *devname, FAR const char *filename,
       dev->writeenabled = true; /* Success */
     }
   else
-#endif
     {
       /* If that fails, then try to open the device read-only */
 
diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c
index f30dc02..776c96b 100644
--- a/drivers/mmcsd/mmcsd_sdio.c
+++ b/drivers/mmcsd/mmcsd_sdio.c
@@ -1,37 +1,20 @@
 /****************************************************************************
  * drivers/mmcsd/mmcsd_sdio.c
  *
- *   Copyright (C) 2009-2013, 2016-2019 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
- *           Bob Feretich <bo...@rafresearch.com>
- *           Ivan Ucherdzhiev <iv...@gmail.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -190,9 +173,7 @@ static int     mmcsd_verifystate(FAR struct mmcsd_state_s *priv,
 
 /* Transfer helpers *********************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static bool    mmcsd_wrprotected(FAR struct mmcsd_state_s *priv);
-#endif
 static int     mmcsd_eventwait(FAR struct mmcsd_state_s *priv,
                  sdio_eventset_t failevents, uint32_t timeout);
 static int     mmcsd_transferready(FAR struct mmcsd_state_s *priv);
@@ -211,7 +192,6 @@ static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv,
 static ssize_t mmcsd_reload(FAR void *dev, FAR uint8_t *buffer,
                  off_t startblock, size_t nblocks);
 #endif
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
                  FAR const uint8_t *buffer, off_t startblock);
 #ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE
@@ -222,7 +202,6 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
 static ssize_t mmcsd_flush(FAR void *dev, FAR const uint8_t *buffer,
                  off_t startblock, size_t nblocks);
 #endif
-#endif
 
 /* Block driver methods *****************************************************/
 
@@ -230,11 +209,9 @@ static int     mmcsd_open(FAR struct inode *inode);
 static int     mmcsd_close(FAR struct inode *inode);
 static ssize_t mmcsd_read(FAR struct inode *inode, FAR unsigned char *buffer,
                  size_t startsector, unsigned int nsectors);
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t mmcsd_write(FAR struct inode *inode,
                  FAR const unsigned char *buffer, size_t startsector,
                  unsigned int nsectors);
-#endif
 static int     mmcsd_geometry(FAR struct inode *inode,
                  FAR struct geometry *geometry);
 static int     mmcsd_ioctl(FAR struct inode *inode, int cmd,
@@ -264,11 +241,7 @@ static const struct block_operations g_bops =
   mmcsd_open,     /* open     */
   mmcsd_close,    /* close    */
   mmcsd_read,     /* read     */
-#ifdef CONFIG_FS_WRITABLE
   mmcsd_write,    /* write    */
-#else
-  NULL,           /* write    */
-#endif
   mmcsd_geometry, /* geometry */
   mmcsd_ioctl     /* ioctl    */
 };
@@ -1127,7 +1100,6 @@ static int mmcsd_verifystate(FAR struct mmcsd_state_s *priv, uint32_t state)
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static bool mmcsd_wrprotected(FAR struct mmcsd_state_s *priv)
 {
   /* Check if the card is locked (priv->locked) or write protected either (1)
@@ -1138,7 +1110,6 @@ static bool mmcsd_wrprotected(FAR struct mmcsd_state_s *priv)
 
   return (priv->wrprotect || priv->locked || SDIO_WRPROTECTED(priv->dev));
 }
-#endif
 
 /****************************************************************************
  * Name: mmcsd_eventwait
@@ -1703,7 +1674,6 @@ static ssize_t mmcsd_reload(FAR void *dev, FAR uint8_t *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
                                  FAR const uint8_t *buffer, off_t startblock)
 {
@@ -1857,7 +1827,6 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
 
   return 1;
 }
-#endif
 
 /****************************************************************************
  * Name: mmcsd_writemultiple
@@ -1869,7 +1838,7 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
  *
  ****************************************************************************/
 
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE)
+#if !defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE)
 static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
                                    FAR const uint8_t *buffer, off_t startblock,
                                    size_t nblocks)
@@ -2085,7 +2054,7 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
  *
  ****************************************************************************/
 
-#if defined(CONFIG_FS_WRITABLE) && defined(CONFIG_DRVR_WRITEBUFFER)
+#if defined(CONFIG_DRVR_WRITEBUFFER)
 static ssize_t mmcsd_flush(FAR void *dev, FAR const uint8_t *buffer,
                            off_t startblock, size_t nblocks)
 {
@@ -2272,7 +2241,6 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t mmcsd_write(FAR struct inode *inode, FAR const unsigned char *buffer,
                            size_t startsector, unsigned int nsectors)
 {
@@ -2335,7 +2303,6 @@ static ssize_t mmcsd_write(FAR struct inode *inode, FAR const unsigned char *buf
 
   return ret;
 }
-#endif
 
 /****************************************************************************
  * Name: mmcsd_geometry
@@ -2371,11 +2338,7 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
 
           geometry->geo_available     = true;
           geometry->geo_mediachanged  = priv->mediachanged;
-#ifdef CONFIG_FS_WRITABLE
           geometry->geo_writeenabled  = !mmcsd_wrprotected(priv);
-#else
-          geometry->geo_writeenabled  = false;
-#endif
           geometry->geo_nsectors      = priv->nblocks;
           geometry->geo_sectorsize    = priv->blocksize;
 
diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c
index 5161b4e..e5ff295 100644
--- a/drivers/mmcsd/mmcsd_spi.c
+++ b/drivers/mmcsd/mmcsd_spi.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * drivers/mmcsd/mmcsd_spi.c
  *
- *   Copyright (C) 2008-2010, 2011-2013, 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -78,7 +63,7 @@
 
 #define MMCSD_IDMODE_CLOCK           (400000)
 
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 #  define MMCSD_MODE 0666
 #else
 #  define MMCSD_MODE 0444
@@ -200,7 +185,7 @@ static int      mmcsd_getcardinfo(FAR struct mmcsd_slot_s *slot,
 
 static int      mmcsd_recvblock(FAR struct mmcsd_slot_s *slot,
                  uint8_t *buffer, int nbytes);
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static int      mmcsd_xmitblock(FAR struct mmcsd_slot_s *slot,
                  const uint8_t *buffer, int nbytes, uint8_t token);
 #endif
@@ -211,7 +196,7 @@ static int       mmcsd_open(FAR struct inode *inode);
 static int       mmcsd_close(FAR struct inode *inode);
 static ssize_t   mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
                    size_t start_sector, unsigned int nsectors);
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static ssize_t   mmcsd_write(FAR struct inode *inode,
                    const unsigned char *buffer, size_t start_sector,
                    unsigned int nsectors);
@@ -237,7 +222,7 @@ static const struct block_operations g_bops =
   mmcsd_open,     /* open     */
   mmcsd_close,    /* close    */
   mmcsd_read,     /* read     */
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
   mmcsd_write,    /* write    */
 #else
   NULL,           /* write    */
@@ -335,13 +320,13 @@ static const struct mmcsd_cmdinfo_s g_cmd12  = {CMD12,  MMCSD_CMDRESP_R1, 0xff};
 static const struct mmcsd_cmdinfo_s g_cmd16  = {CMD16,  MMCSD_CMDRESP_R1, 0xff};
 static const struct mmcsd_cmdinfo_s g_cmd17  = {CMD17,  MMCSD_CMDRESP_R1, 0xff};
 static const struct mmcsd_cmdinfo_s g_cmd18  = {CMD18,  MMCSD_CMDRESP_R1, 0xff};
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static const struct mmcsd_cmdinfo_s g_cmd24  = {CMD24,  MMCSD_CMDRESP_R1, 0xff};
 static const struct mmcsd_cmdinfo_s g_cmd25  = {CMD25,  MMCSD_CMDRESP_R1, 0xff};
 #endif
 static const struct mmcsd_cmdinfo_s g_cmd55  = {CMD55,  MMCSD_CMDRESP_R1, 0xff};
 static const struct mmcsd_cmdinfo_s g_cmd58  = {CMD58,  MMCSD_CMDRESP_R3, 0xff};
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static const struct mmcsd_cmdinfo_s g_acmd23 = {ACMD23, MMCSD_CMDRESP_R1, 0xff};
 #endif
 static const struct mmcsd_cmdinfo_s g_acmd41 = {ACMD41, MMCSD_CMDRESP_R1, 0xff};
@@ -979,7 +964,7 @@ static int mmcsd_recvblock(FAR struct mmcsd_slot_s *slot, uint8_t *buffer,
  *
  ****************************************************************************/
 
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static int mmcsd_xmitblock(FAR struct mmcsd_slot_s *slot,
                            FAR const uint8_t *buffer, int nbytes,
                            uint8_t token)
@@ -1018,7 +1003,7 @@ static int mmcsd_xmitblock(FAR struct mmcsd_slot_s *slot,
 
   return OK;
 }
-#endif /* CONFIG_FS_WRITABLE && !CONFIG_MMCSD_READONLY */
+#endif /* !CONFIG_MMCSD_READONLY */
 
 /****************************************************************************
  * Block Driver Operations
@@ -1265,7 +1250,7 @@ errout_with_eio:
  *
  ****************************************************************************/
 
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
                         size_t start_sector, unsigned int nsectors)
 {
@@ -1511,7 +1496,7 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
     ((slot->state & (MMCSD_SLOTSTATUS_NOTREADY | MMCSD_SLOTSTATUS_NODISK)) == 0);
   geometry->geo_mediachanged =
     ((slot->state & MMCSD_SLOTSTATUS_MEDIACHGD) != 0);
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
   geometry->geo_writeenabled =
     ((slot->state & MMCSD_SLOTSTATUS_WRPROTECT) == 0);
 #else
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 13c6bb6..027689e 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -42,7 +42,7 @@ config MTD_PARTITION
 config FTL_WRITEBUFFER
 	bool "Enable write buffering in the FTL layer"
 	default n
-	depends on DRVR_WRITEBUFFER && FS_WRITABLE
+	depends on DRVR_WRITEBUFFER
 
 config FTL_READAHEAD
 	bool "Enable read-ahead buffering in the FTL layer"
@@ -791,7 +791,6 @@ endchoice # CRC level selection
 config MTD_SMART_FSCK
 	bool "Enable SMART file system check"
 	default n
-	depends on FS_WRITABLE
 	---help---
 		Enables fsck to check and repair the SMART file system.
 
diff --git a/drivers/mtd/filemtd.c b/drivers/mtd/filemtd.c
index e86095c..ed9eb2c 100644
--- a/drivers/mtd/filemtd.c
+++ b/drivers/mtd/filemtd.c
@@ -506,10 +506,7 @@ FAR struct mtd_dev_s *blockmtd_initialize(FAR const char *path, size_t offset,
 
   /* Determine the file open mode */
 
-  mode  = O_RDOK;
-#ifdef CONFIG_FS_WRITABLE
-  mode |= O_WROK;
-#endif
+  mode = O_RDOK |= O_WROK;
 
   /* Try to open the file.  NOTE that block devices will use a character
    * driver proxy.
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index eb1b37b..c2860bd 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -71,9 +71,7 @@ struct ftl_struct_s
   uint16_t              blkper;   /* R/W blocks per erase block */
   uint16_t              refs;     /* Number of references */
   bool                  unlinked; /* The driver has been unlinked */
-#ifdef CONFIG_FS_WRITABLE
   FAR uint8_t          *eblock;   /* One, in-memory erase block */
-#endif
 };
 
 /****************************************************************************
@@ -86,13 +84,11 @@ static ssize_t ftl_reload(FAR void *priv, FAR uint8_t *buffer,
                  off_t startblock, size_t nblocks);
 static ssize_t ftl_read(FAR struct inode *inode, FAR unsigned char *buffer,
                  size_t start_sector, unsigned int nsectors);
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
                  off_t startblock, size_t nblocks);
 static ssize_t ftl_write(FAR struct inode *inode,
                  FAR const unsigned char *buffer, size_t start_sector,
                  unsigned int nsectors);
-#endif
 static int     ftl_geometry(FAR struct inode *inode,
                  FAR struct geometry *geometry);
 static int     ftl_ioctl(FAR struct inode *inode, int cmd,
@@ -110,11 +106,7 @@ static const struct block_operations g_bops =
   ftl_open,     /* open     */
   ftl_close,    /* close    */
   ftl_read,     /* read     */
-#ifdef CONFIG_FS_WRITABLE
   ftl_write,    /* write    */
-#else
-  NULL,         /* write    */
-#endif
   ftl_geometry, /* geometry */
   ftl_ioctl     /* ioctl    */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
@@ -167,12 +159,10 @@ static int ftl_close(FAR struct inode *inode)
 #ifdef FTL_HAVE_RWBUFFER
       rwb_uninitialize(&dev->rwb);
 #endif
-#ifdef CONFIG_FS_WRITABLE
       if (dev->eblock)
         {
           kmm_free(dev->eblock);
         }
-#endif
 
       kmm_free(dev);
     }
@@ -236,7 +226,6 @@ static ssize_t ftl_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static int ftl_alloc_eblock(FAR struct ftl_struct_s *dev)
 {
   if (dev->eblock == NULL)
@@ -433,7 +422,6 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
 
   return nblocks;
 }
-#endif
 
 /****************************************************************************
  * Name: ftl_write
@@ -442,7 +430,6 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t ftl_write(FAR struct inode *inode,
                          FAR const unsigned char *buffer,
                          size_t start_sector, unsigned int nsectors)
@@ -459,7 +446,6 @@ static ssize_t ftl_write(FAR struct inode *inode,
   return ftl_flush(dev, buffer, start_sector, nsectors);
 #endif
 }
-#endif
 
 /****************************************************************************
  * Name: ftl_geometry
@@ -481,11 +467,7 @@ static int ftl_geometry(FAR struct inode *inode,
       dev = (struct ftl_struct_s *)inode->i_private;
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
-#ifdef CONFIG_FS_WRITABLE
       geometry->geo_writeenabled  = true;
-#else
-      geometry->geo_writeenabled  = false;
-#endif
       geometry->geo_nsectors      = dev->geo.neraseblocks * dev->blkper;
       geometry->geo_sectorsize    = dev->geo.blocksize;
 
@@ -583,12 +565,10 @@ static int ftl_unlink(FAR struct inode *inode)
 #ifdef FTL_HAVE_RWBUFFER
       rwb_uninitialize(&dev->rwb);
 #endif
-#ifdef CONFIG_FS_WRITABLE
       if (dev->eblock)
         {
           kmm_free(dev->eblock);
         }
-#endif
 
       kmm_free(dev);
     }
@@ -664,7 +644,7 @@ int ftl_initialize_by_path(FAR const char *path, FAR struct mtd_dev_s *mtd)
       dev->rwb.wrflush     = ftl_flush;
       dev->rwb.rhreload    = ftl_reload;
 
-#if defined(CONFIG_FS_WRITABLE) && defined(CONFIG_FTL_WRITEBUFFER)
+#if defined(CONFIG_FTL_WRITEBUFFER)
       dev->rwb.wrmaxblocks = dev->blkper;
 #endif
 
diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c
index 52cdf44..8700c13 100644
--- a/drivers/mtd/smart.c
+++ b/drivers/mtd/smart.c
@@ -408,21 +408,17 @@ static ssize_t smart_reload(struct smart_struct_s *dev, FAR uint8_t *buffer,
                  off_t startblock, size_t nblocks);
 static ssize_t smart_read(FAR struct inode *inode, unsigned char *buffer,
                  size_t start_sector, unsigned int nsectors);
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t smart_write(FAR struct inode *inode, const unsigned char *buffer,
                  size_t start_sector, unsigned int nsectors);
-#endif
 static int     smart_geometry(FAR struct inode *inode, struct geometry *geometry);
 static int     smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg);
 
 static int     smart_findfreephyssector(FAR struct smart_struct_s *dev,
                                         uint8_t canrelocate);
 
-#ifdef CONFIG_FS_WRITABLE
 static int smart_writesector(FAR struct smart_struct_s *dev, unsigned long arg);
 static inline int smart_allocsector(FAR struct smart_struct_s *dev,
                  unsigned long requested);
-#endif
 static int smart_readsector(FAR struct smart_struct_s *dev, unsigned long arg);
 
 #ifdef CONFIG_MTD_SMART_ENABLE_CRC
@@ -457,11 +453,7 @@ static const struct block_operations g_bops =
   smart_open,     /* open     */
   smart_close,    /* close    */
   smart_read,     /* read     */
-#ifdef CONFIG_FS_WRITABLE
   smart_write,    /* write    */
-#else
-  NULL,           /* write    */
-#endif
   smart_geometry, /* geometry */
   smart_ioctl     /* ioctl    */
 };
@@ -907,7 +899,6 @@ static ssize_t smart_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t smart_write(FAR struct inode *inode,
                 FAR const unsigned char *buffer,
                 size_t start_sector, unsigned int nsectors)
@@ -1018,7 +1009,6 @@ static ssize_t smart_write(FAR struct inode *inode,
 
   return nsectors;
 }
-#endif /* CONFIG_FS_WRITABLE */
 
 /****************************************************************************
  * Name: smart_geometry
@@ -1044,11 +1034,7 @@ static int smart_geometry(FAR struct inode *inode, struct geometry *geometry)
 #endif
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
-#ifdef CONFIG_FS_WRITABLE
       geometry->geo_writeenabled  = true;
-#else
-      geometry->geo_writeenabled  = false;
-#endif
 
       erasesize                   = dev->geo.erasesize;
       geometry->geo_nsectors      = dev->geo.neraseblocks * erasesize /
@@ -3042,7 +3028,6 @@ static crc_t smart_calc_sector_crc(FAR struct smart_struct_s *dev)
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static inline int smart_llformat(FAR struct smart_struct_s *dev, unsigned long arg)
 {
   FAR struct  smart_sect_header_s  *sectorheader;
@@ -3248,7 +3233,6 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, unsigned long a
 
   return OK;
 }
-#endif /* CONFIG_FS_WRITABLE */
 
 /****************************************************************************
  * Name: smart_relocate_sector
@@ -3923,7 +3907,6 @@ retry:
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static int smart_garbagecollect(FAR struct smart_struct_s *dev)
 {
   uint16_t  collectblock;
@@ -4046,7 +4029,6 @@ static int smart_garbagecollect(FAR struct smart_struct_s *dev)
 errout:
   return ret;
 }
-#endif /* CONFIG_FS_WRITABLE */
 
 /****************************************************************************
  * Name: smart_write_wearstatus
@@ -4254,8 +4236,6 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev)
 #endif
       if ((sector != 0) && (physsector == 0xffff))
         {
-#ifdef CONFIG_FS_WRITABLE
-
           /* This logical sector does not exist yet.  We must allocate it */
 
           ret = smart_allocsector(dev, sector);
@@ -4265,7 +4245,6 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev)
               ret = -EINVAL;
               goto errout;
             }
-#endif
         }
 
       /* Read the sector */
@@ -4324,7 +4303,6 @@ errout:
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static int smart_write_alloc_sector(FAR struct smart_struct_s *dev,
                     uint16_t logical, uint16_t physical)
 {
@@ -4394,7 +4372,6 @@ static int smart_write_alloc_sector(FAR struct smart_struct_s *dev,
 
   return ret;
 }
-#endif
 
 /****************************************************************************
  * Name: smart_validate_crc
@@ -4460,7 +4437,6 @@ static int smart_validate_crc(FAR struct smart_struct_s *dev)
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static int smart_writesector(FAR struct smart_struct_s *dev,
                     unsigned long arg)
 {
@@ -4857,7 +4833,6 @@ static int smart_writesector(FAR struct smart_struct_s *dev,
 errout:
   return ret;
 }
-#endif /* CONFIG_FS_WRITABLE */
 
 /****************************************************************************
  * Name: smart_readsector
@@ -5016,7 +4991,6 @@ errout:
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static inline int smart_allocsector(FAR struct smart_struct_s *dev,
                     unsigned long requested)
 {
@@ -5251,7 +5225,6 @@ static inline int smart_allocsector(FAR struct smart_struct_s *dev,
 
   return logsector;
 }
-#endif /* CONFIG_FS_WRITABLE */
 
 /****************************************************************************
  * Name: smart_freesector
@@ -5262,7 +5235,6 @@ static inline int smart_allocsector(FAR struct smart_struct_s *dev,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static inline int smart_freesector(FAR struct smart_struct_s *dev,
                     unsigned long logicalsector)
 {
@@ -5365,7 +5337,6 @@ static inline int smart_freesector(FAR struct smart_struct_s *dev,
 errout:
   return ret;
 }
-#endif /* CONFIG_FS_WRITABLE */
 
 /****************************************************************************
  * Name: smart_ioctl
@@ -5436,7 +5407,6 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
       ret = smart_readsector(dev, arg);
       goto ok_out;
 
-#ifdef CONFIG_FS_WRITABLE
     case BIOC_LLFORMAT:
 
       /* Perform a low-level format on the flash */
@@ -5481,7 +5451,6 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
 #endif
 
       goto ok_out;
-#endif /* CONFIG_FS_WRITABLE */
 
 #if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_SMARTFS)
     case BIOC_GETPROCFSD:
diff --git a/drivers/ramdisk.c b/drivers/ramdisk.c
index 842c36c..21d2f41 100644
--- a/drivers/ramdisk.c
+++ b/drivers/ramdisk.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * drivers/ramdisk.c
  *
- *   Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -83,11 +68,7 @@ struct rd_struct_s
   uint8_t rd_crefs;             /* Open reference count */
 #endif
   uint8_t rd_flags;             /* See RDFLAG_* definitions */
-#ifdef CONFIG_FS_WRITABLE
   FAR uint8_t *rd_buffer;       /* RAM disk backup memory */
-#else
-  FAR const uint8_t *rd_buffer; /* ROM disk backup memory */
-#endif
 };
 
 /****************************************************************************
@@ -103,11 +84,9 @@ static int     rd_close(FAR struct inode *inode);
 
 static ssize_t rd_read(FAR struct inode *inode, FAR unsigned char *buffer,
                  size_t start_sector, unsigned int nsectors);
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t rd_write(FAR struct inode *inode,
                  FAR const unsigned char *buffer, size_t start_sector,
                  unsigned int nsectors);
-#endif
 static int     rd_geometry(FAR struct inode *inode,
                  FAR struct geometry *geometry);
 static int     rd_ioctl(FAR struct inode *inode, int cmd,
@@ -131,11 +110,7 @@ static const struct block_operations g_bops =
   0,           /* close    */
 #endif
   rd_read,     /* read     */
-#ifdef CONFIG_FS_WRITABLE
   rd_write,    /* write    */
-#else
-  NULL,        /* write    */
-#endif
   rd_geometry, /* geometry */
   rd_ioctl,    /* ioctl    */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
@@ -162,14 +137,12 @@ static void rd_destroy(FAR struct rd_struct_s *dev)
 
   /* We we configured to free the RAM disk memory when unlinked? */
 
-#ifdef CONFIG_FS_WRITABLE
   if (RDFLAG_IS_UNLINKED(dev->rd_flags))
     {
       /* Yes.. do it */
 
       kmm_free(dev->rd_buffer);
     }
-#endif
 
   /* And free the block driver itself */
 
@@ -284,7 +257,6 @@ static ssize_t rd_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer,
                         size_t start_sector, unsigned int nsectors)
 {
@@ -315,7 +287,6 @@ static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer,
 
   return -EFBIG;
 }
-#endif
 
 /****************************************************************************
  * Name: rd_geometry
@@ -336,11 +307,7 @@ static int rd_geometry(FAR struct inode *inode, struct geometry *geometry)
       dev = (struct rd_struct_s *)inode->i_private;
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
-#ifdef CONFIG_FS_WRITABLE
       geometry->geo_writeenabled  = RDFLAG_IS_WRENABLED(dev->rd_flags);
-#else
-      geometry->geo_writeenabled  = false;
-#endif
       geometry->geo_nsectors      = dev->rd_nsectors;
       geometry->geo_sectorsize    = dev->rd_sectsize;
 
@@ -440,13 +407,8 @@ static int rd_unlink(FAR struct inode *inode)
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 int ramdisk_register(int minor, FAR uint8_t *buffer, uint32_t nsectors,
                      uint16_t sectsize, uint8_t rdflags)
-#else
-int romdisk_register(int minor, FAR const uint8_t *buffer, uint32_t nsectors,
-                     uint16_t sectsize)
-#endif
 {
   struct rd_struct_s *dev;
   char devname[16];
@@ -473,10 +435,7 @@ int romdisk_register(int minor, FAR const uint8_t *buffer, uint32_t nsectors,
       dev->rd_nsectors     = nsectors;     /* Number of sectors on device */
       dev->rd_sectsize     = sectsize;     /* The size of one sector */
       dev->rd_buffer       = buffer;       /* RAM disk backup memory */
-
-#ifdef CONFIG_FS_WRITABLE
       dev->rd_flags        = rdflags & RDFLAG_USER;
-#endif
 
       /* Create a ramdisk device name */
 
diff --git a/drivers/usbdev/Kconfig b/drivers/usbdev/Kconfig
index e76ebbc..fb7e112 100644
--- a/drivers/usbdev/Kconfig
+++ b/drivers/usbdev/Kconfig
@@ -572,7 +572,6 @@ menuconfig USBMSC
 	bool "USB Mass storage class device"
 	default n
 	select FS_READABLE
-	select FS_WRITABLE
 	---help---
 		References:
 		"Universal Serial Bus Mass Storage Class, Specification Overview,"
diff --git a/drivers/usbhost/usbhost_storage.c b/drivers/usbhost/usbhost_storage.c
index 62cec1e..0d41ad7 100644
--- a/drivers/usbhost/usbhost_storage.c
+++ b/drivers/usbhost/usbhost_storage.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * drivers/usbhost/usbhost_storage.c
  *
- *   Copyright (C) 2010-2013, 2015-2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -242,11 +227,9 @@ static int usbhost_open(FAR struct inode *inode);
 static int usbhost_close(FAR struct inode *inode);
 static ssize_t usbhost_read(FAR struct inode *inode, FAR unsigned char *buffer,
                             size_t startsector, unsigned int nsectors);
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t usbhost_write(FAR struct inode *inode,
                              FAR const unsigned char *buffer, size_t startsector,
                              unsigned int nsectors);
-#endif
 static int usbhost_geometry(FAR struct inode *inode,
                             FAR struct geometry *geometry);
 static int usbhost_ioctl(FAR struct inode *inode, int cmd,
@@ -289,11 +272,7 @@ static const struct block_operations g_bops =
   usbhost_open,           /* open     */
   usbhost_close,          /* close    */
   usbhost_read,           /* read     */
-#ifdef CONFIG_FS_WRITABLE
   usbhost_write,          /* write    */
-#else
-  NULL,                   /* write    */
-#endif
   usbhost_geometry,       /* geometry */
   usbhost_ioctl           /* ioctl    */
 };
@@ -2070,7 +2049,6 @@ static ssize_t usbhost_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffer,
                            size_t startsector, unsigned int nsectors)
 {
@@ -2157,7 +2135,6 @@ static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffe
 
   return nbytes < 0 ? (int)nbytes : nsectors;
 }
-#endif
 
 /****************************************************************************
  * Name: usbhost_geometry
@@ -2194,11 +2171,7 @@ static int usbhost_geometry(FAR struct inode *inode, struct geometry *geometry)
 
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
-#ifdef CONFIG_FS_WRITABLE
       geometry->geo_writeenabled  = true;
-#else
-      geometry->geo_writeenabled  = false;
-#endif
       geometry->geo_nsectors      = priv->nblocks;
       geometry->geo_sectorsize    = priv->blocksize;
       usbhost_givesem(&priv->exclsem);


[incubator-nuttx] 08/12: drivers/: Remove support for CONFIG_FS_READABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 431286532c42e873d5704bd450d563781d92baa9
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:58:23 2020 -0600

    drivers/:  Remove support for CONFIG_FS_READABLE
---
 drivers/Kconfig        | 1 -
 drivers/usbdev/Kconfig | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 591023b..5220a94 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -18,7 +18,6 @@ config DEV_ZERO
 config DRVR_MKRD
 	bool "RAM disk wrapper (mkrd)"
 	default n
-	select FS_READABLE
 	---help---
 		Build the mkrd() function which serves as a wrapper to simplify
 		creation of RAM disks.  If the boardctrl() interface is enabled,
diff --git a/drivers/usbdev/Kconfig b/drivers/usbdev/Kconfig
index fb7e112..ac95c38 100644
--- a/drivers/usbdev/Kconfig
+++ b/drivers/usbdev/Kconfig
@@ -571,7 +571,6 @@ endif # CDCACM
 menuconfig USBMSC
 	bool "USB Mass storage class device"
 	default n
-	select FS_READABLE
 	---help---
 		References:
 		"Universal Serial Bus Mass Storage Class, Specification Overview,"


[incubator-nuttx] 10/12: syscall/: Remove support for CONFIG_FS_READABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit d22b22a23f43a7c8c890c3e53b5a80fbc26b0167
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 11:02:42 2020 -0600

    syscall/:  Remove support for CONFIG_FS_READABLE
---
 include/sys/syscall.h    | 62 ++++++++++++++++--------------------------------
 syscall/syscall.csv      |  2 +-
 syscall/syscall_lookup.h | 41 ++++++++++----------------------
 3 files changed, 34 insertions(+), 71 deletions(-)

diff --git a/include/sys/syscall.h b/include/sys/syscall.h
index 8f643cf..14c2309 100644
--- a/include/sys/syscall.h
+++ b/include/sys/syscall.h
@@ -2,35 +2,20 @@
  * include/sys/syscall.h
  * This file contains the system call numbers.
  *
- *   Copyright (C) 2011-2019, 2020 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -414,20 +399,15 @@
 #endif
 
 #if !defined(CONFIG_DISABLE_MOUNTPOINT)
-#if defined(CONFIG_FS_READABLE)
-#    define SYS_mount                  (__SYS_mountpoint + 0)
-#    define __SYS_fs                   (__SYS_mountpoint + 1)
-#else
-#    define __SYS_fs                   (__SYS_mountpoint + 0)
-#endif
-#  define SYS_fsync                    (__SYS_fs + 0)
-#  define SYS_ftruncate                (__SYS_fs + 1)
-#  define SYS_mkdir                    (__SYS_fs + 2)
-#  define SYS_rename                   (__SYS_fs + 3)
-#  define SYS_rmdir                    (__SYS_fs + 4)
-#  define SYS_umount2                  (__SYS_fs + 5)
-#  define SYS_unlink                   (__SYS_fs + 6)
-#  define __SYS_shm                    (__SYS_fs + 7)
+#  define SYS_mount                    (__SYS_mountpoint + 0)
+#  define SYS_fsync                    (__SYS_mountpoint + 1)
+#  define SYS_ftruncate                (__SYS_mountpoint + 2)
+#  define SYS_mkdir                    (__SYS_mountpoint + 3)
+#  define SYS_rename                   (__SYS_mountpoint + 4)
+#  define SYS_rmdir                    (__SYS_mountpoint + 5)
+#  define SYS_umount2                  (__SYS_mountpoint + 6)
+#  define SYS_unlink                   (__SYS_mountpoint + 7)
+#  define __SYS_shm                    (__SYS_mountpoint + 8)
 #else
 #  define __SYS_shm                    __SYS_mountpoint
 #endif
diff --git a/syscall/syscall.csv b/syscall/syscall.csv
index 85ec82e..ab24d4e 100644
--- a/syscall/syscall.csv
+++ b/syscall/syscall.csv
@@ -53,7 +53,7 @@
 "mmap","sys/mman.h","","FAR void*","FAR void*","size_t","int","int","int","off_t"
 "munmap","sys/mman.h","defined(CONFIG_FS_RAMMAP)","int","FAR void *","size_t"
 "modhandle","nuttx/module.h","defined(CONFIG_MODULE)","FAR void *","FAR const char *"
-"mount","sys/mount.h","!defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_READABLE)","int","const char*","const char*","const char*","unsigned long","const void*"
+"mount","sys/mount.h","!defined(CONFIG_DISABLE_MOUNTPOINT)","int","const char*","const char*","const char*","unsigned long","const void*"
 "mq_close","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t"
 "mq_getattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","struct mq_attr *"
 "mq_notify","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct sigevent*"
diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h
index b42f465..0e85d59 100644
--- a/syscall/syscall_lookup.h
+++ b/syscall/syscall_lookup.h
@@ -1,35 +1,20 @@
 /****************************************************************************
  * syscall/syscall_lookup.h
  *
- *   Copyright (C) 2011, 2013-2019, 2020 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -290,9 +275,7 @@ SYSCALL_LOOKUP(up_assert,                  2, STUB_up_assert)
 #endif
 
 #if !defined(CONFIG_DISABLE_MOUNTPOINT)
-#  if defined(CONFIG_FS_READABLE)
   SYSCALL_LOOKUP(mount,                    5, STUB_mount)
-#  endif
   SYSCALL_LOOKUP(fsync,                    1, STUB_fsync)
   SYSCALL_LOOKUP(ftruncate,                2, STUB_ftruncate)
   SYSCALL_LOOKUP(mkdir,                    2, STUB_mkdir)


[incubator-nuttx] 04/12: include/: Remove support for CONFIG_FS_WRITABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 74ce4ab0ee038db36802fb6d3930fe3abeb51341
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:14:47 2020 -0600

    include/:  Remove support for CONFIG_FS_WRITABLE
---
 include/nuttx/drivers/ramdisk.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/include/nuttx/drivers/ramdisk.h b/include/nuttx/drivers/ramdisk.h
index 9706a4f..63848be 100644
--- a/include/nuttx/drivers/ramdisk.h
+++ b/include/nuttx/drivers/ramdisk.h
@@ -92,14 +92,9 @@ extern "C"
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 int ramdisk_register(int minor, FAR uint8_t *buffer, uint32_t nsectors,
                      uint16_t sectsize, uint8_t rdflags);
 #define romdisk_register(m,b,n,s) ramdisk_register(m,(FAR uint8_t *)b,n,s,0)
-#else
-int romdisk_register(int minor, FAR const uint8_t *buffer, uint32_t nsectors,
-                     uint16_t sectsize);
-#endif
 
 /****************************************************************************
  * Name: mkrd


[incubator-nuttx] 02/12: arch/: Remove support for CONFIG_FS_WRITABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 7dc4ae47727e9e2535dc145eb3d16937810c7982
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:06:50 2020 -0600

    arch/:  Remove support for CONFIG_FS_WRITABLE
    
    Remove support for CONFIG_FS_WRITABLE from some MMC drivers.
---
 arch/arm/src/cxd56xx/cxd56_emmc.c     | 12 ++++++------
 arch/arm/src/lc823450/lc823450_mmcl.c | 10 ----------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_emmc.c b/arch/arm/src/cxd56xx/cxd56_emmc.c
index e0659b7..05579f7 100644
--- a/arch/arm/src/cxd56xx/cxd56_emmc.c
+++ b/arch/arm/src/cxd56xx/cxd56_emmc.c
@@ -88,7 +88,7 @@ static int       cxd56_emmc_close(FAR struct inode *inode);
 static ssize_t   cxd56_emmc_read(FAR struct inode *inode,
                                  unsigned char *buffer, size_t start_sector,
                                  unsigned int nsectors);
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static ssize_t   cxd56_emmc_write(FAR struct inode *inode,
                                   const unsigned char *buffer,
                                   size_t start_sector,
@@ -103,7 +103,7 @@ static const struct block_operations g_bops =
   cxd56_emmc_open,     /* open     */
   cxd56_emmc_close,    /* close    */
   cxd56_emmc_read,     /* read     */
-#if defined(CONFIG_FS_WRITABLE)
+#if !defined(CONFIG_MMCSD_READONLY)
   cxd56_emmc_write,    /* write    */
 #else
   NULL,           /* write    */
@@ -164,7 +164,7 @@ static void emmc_reset(uint32_t reg, uint32_t bits)
   while (val & bits);
 }
 
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static void emmc_flushwritefifo(void)
 {
   /* eMMC host controller has a problem that invalid data is still remained
@@ -723,7 +723,7 @@ static int cxd56_emmc_readsectors(FAR struct cxd56_emmc_state_s *priv,
   return ret;
 }
 
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static int cxd56_emmc_writesectors(FAR struct cxd56_emmc_state_s *priv,
                                    const void *buf, size_t start_sector,
                                    unsigned int nsectors)
@@ -848,7 +848,7 @@ static ssize_t cxd56_emmc_read(FAR struct inode *inode, unsigned char *buffer,
   return nsectors;
 }
 
-#if defined(CONFIG_FS_WRITABLE) && !defined(CONFIG_MMCSD_READONLY)
+#if !defined(CONFIG_MMCSD_READONLY)
 static ssize_t cxd56_emmc_write(FAR struct inode *inode,
                                 const unsigned char *buffer,
                                 size_t start_sector,
@@ -884,7 +884,7 @@ static int cxd56_emmc_geometry(FAR struct inode *inode,
 
   geometry->geo_available = true;
   geometry->geo_mediachanged = false;
-#if defined(CONFIG_FS_WRITABLE)
+#if !defined(CONFIG_MMCSD_READONLY)
   geometry->geo_writeenabled = true;
 #else
   geometry->geo_writeenabled = false;
diff --git a/arch/arm/src/lc823450/lc823450_mmcl.c b/arch/arm/src/lc823450/lc823450_mmcl.c
index ac14392..d5f2fcf 100644
--- a/arch/arm/src/lc823450/lc823450_mmcl.c
+++ b/arch/arm/src/lc823450/lc823450_mmcl.c
@@ -92,11 +92,7 @@ static const struct block_operations g_bops =
   mmcl_open,      /* open     */
   mmcl_close,     /* close    */
   mmcl_read,      /* read     */
-#ifdef CONFIG_FS_WRITABLE
   mmcl_write,     /* write    */
-#else
-  NULL,           /* write    */
-#endif
   mmcl_geometry,  /* geometry */
   mmcl_ioctl      /* ioctl    */
 };
@@ -167,7 +163,6 @@ static ssize_t mmcl_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-#ifdef CONFIG_FS_WRITABLE
 static ssize_t mmcl_write(FAR struct inode *inode, const unsigned char *buffer,
   size_t start_sector, unsigned int nsectors)
 {
@@ -189,7 +184,6 @@ static ssize_t mmcl_write(FAR struct inode *inode, const unsigned char *buffer,
 
   return nwrite;
 }
-#endif
 
 /****************************************************************************
  * Name: mmcl_geometry
@@ -210,11 +204,7 @@ static int mmcl_geometry(FAR struct inode *inode, struct geometry *geometry)
       dev = (struct mmcl_dev_s *)inode->i_private;
       geometry->geo_available     = true;
       geometry->geo_mediachanged  = false;
-#ifdef CONFIG_FS_WRITABLE
       geometry->geo_writeenabled  = true;
-#else
-      geometry->geo_writeenabled  = false;
-#endif
       geometry->geo_nsectors      = dev->geo.neraseblocks;
       geometry->geo_sectorsize    = dev->geo.blocksize;
 


[incubator-nuttx] 12/12: Run all .c and .h files in previous commits through nxstyle.

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 547a3cb3d9af4b86ad9b8c67b13eccd7688e8481
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 13:54:03 2020 -0600

    Run all .c and .h files in previous commits through nxstyle.
---
 arch/arm/src/cxd56xx/cxd56_emmc.c                  |  82 +++-
 arch/arm/src/lc823450/lc823450_mmcl.c              |  23 +-
 .../stm32l4/stm32l476vg-disco/src/stm32_appinit.c  |  59 +--
 boards/boardctl.c                                  | 144 +++---
 drivers/mmcsd/mmcsd_sdio.c                         | 460 ++++++++++--------
 drivers/mmcsd/mmcsd_spi.c                          | 219 ++++++---
 drivers/mtd/filemtd.c                              |  16 +-
 drivers/mtd/smart.c                                | 526 +++++++++++++--------
 drivers/ramdisk.c                                  |   3 +-
 drivers/usbhost/usbhost_storage.c                  | 197 ++++----
 fs/driver/fs_blockpartition.c                      |  27 +-
 fs/vfs/fs_rename.c                                 |   4 +-
 fs/vfs/fs_rmdir.c                                  |   6 +-
 include/nuttx/drivers/ramdisk.h                    |  39 +-
 libs/libc/stdlib/lib_mkstemp.c                     |  16 +-
 15 files changed, 1049 insertions(+), 772 deletions(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_emmc.c b/arch/arm/src/cxd56xx/cxd56_emmc.c
index 05579f7..eac83c8 100644
--- a/arch/arm/src/cxd56xx/cxd56_emmc.c
+++ b/arch/arm/src/cxd56xx/cxd56_emmc.c
@@ -33,6 +33,10 @@
  *
  ****************************************************************************/
 
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
 #include <nuttx/config.h>
 
 #include <sys/types.h>
@@ -55,6 +59,10 @@
 #include "hardware/cxd56_emmc.h"
 #include "cxd56_pinconfig.h"
 
+/****************************************************************************
+ * Pre-processoro Definitions
+ ****************************************************************************/
+
 #define SECTOR_SIZE (512)
 
 #define EMMC_DATA_WRITE 0
@@ -67,7 +75,27 @@
 #define EMMC_RESP_R2  3
 #define EMMC_RESP_R3  4
 
-struct emmc_dma_desc_s {
+#define EMMC_CLKDIV_UNDER_400KHZ  (32u)
+#define EMMC_CLKDIV_NON_DIV       (0u)
+
+#define EMMC_RCA                  (2)         /* greater than 1 */
+
+#define EMMC_DATA_TIMEOUT         (0xFFFFFFu) /* max reg value */
+#define EMMC_RESP_TIMEOUT         (0xFFu)     /* max reg value */
+
+#define EMMC_MSIZE                (6)         /* Burst size is 512B */
+#define EMMC_FIFO_DEPTH           (0x100)     /* FIFO size is 1KB */
+
+#ifndef MIN
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+struct emmc_dma_desc_s
+{
   uint32_t ctrl;
   uint32_t size;
   uint32_t addr;
@@ -81,6 +109,10 @@ struct cxd56_emmc_state_s
   uint32_t total_sectors;
 };
 
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
 /* Block driver interfaces **************************************************/
 
 static int       cxd56_emmc_open(FAR struct inode *inode);
@@ -98,6 +130,10 @@ static int       cxd56_emmc_geometry(FAR struct inode *inode,
                                      struct geometry *geometry);
 static int       emmc_interrupt(int irq, FAR void *context, FAR void *arg);
 
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
 static const struct block_operations g_bops =
 {
   cxd56_emmc_open,     /* open     */
@@ -106,29 +142,18 @@ static const struct block_operations g_bops =
 #if !defined(CONFIG_MMCSD_READONLY)
   cxd56_emmc_write,    /* write    */
 #else
-  NULL,           /* write    */
+  NULL,                /* write    */
 #endif
   cxd56_emmc_geometry, /* geometry */
-  NULL            /* ioctl    */
+  NULL                 /* ioctl    */
 };
 
 static sem_t g_waitsem;
 struct cxd56_emmc_state_s g_emmcdev;
 
-#define EMMC_CLKDIV_UNDER_400KHZ  (32u)
-#define EMMC_CLKDIV_NON_DIV       (0u)
-
-#define EMMC_RCA                  (2) /* greater than 1 */
-
-#define EMMC_DATA_TIMEOUT         (0xFFFFFFu) /* max reg value */
-#define EMMC_RESP_TIMEOUT         (0xFFu) /* max reg value */
-
-#define EMMC_MSIZE                (6) /* Burst size is 512B */
-#define EMMC_FIFO_DEPTH           (0x100) /* FIFO size is 1KB */
-
-#ifndef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
 
 static void emmc_takesem(FAR sem_t *sem)
 {
@@ -308,9 +333,9 @@ static struct emmc_dma_desc_s *emmc_setupdma(void *buf, unsigned int nbytes)
 
   /* Adjust first and last descriptor members */
 
-  descs[0].ctrl |= EMMC_IDMAC_DES0_FD;
-  descs[ndescs-1].ctrl |= EMMC_IDMAC_DES0_LD;
-  descs[ndescs-1].next = 0;
+  descs[0].ctrl          |= EMMC_IDMAC_DES0_FD;
+  descs[ndescs - 1].ctrl |= EMMC_IDMAC_DES0_LD;
+  descs[ndescs - 1].next  = 0;
 
 #ifdef CONFIG_DEBUG_VERBOSE
   for (i = 0, d = descs; i < ndescs; i++, d++)
@@ -341,6 +366,7 @@ static int emmc_checkresponse(void)
       ferr("Response error %08x\n", resp);
       return -EIO;
     }
+
   return OK;
 }
 
@@ -454,6 +480,7 @@ static int emmc_is_powerup(void)
         {
           return 0;
         }
+
       up_mdelay(5);
     }
   while (--retry);
@@ -716,7 +743,7 @@ static int cxd56_emmc_readsectors(FAR struct cxd56_emmc_state_s *priv,
       ret = -EIO;
     }
 
- finish:
+finish:
   emmc_givesem(&priv->excsem);
   kmm_free(descs);
 
@@ -787,7 +814,7 @@ static int cxd56_emmc_writesectors(FAR struct cxd56_emmc_state_s *priv,
 
   emmc_flushwritefifo();
 
- finish:
+finish:
   emmc_givesem(&priv->excsem);
   kmm_free(descs);
 
@@ -826,8 +853,9 @@ static int cxd56_emmc_close(FAR struct inode *inode)
   return OK;
 }
 
-static ssize_t cxd56_emmc_read(FAR struct inode *inode, unsigned char *buffer,
-                               size_t start_sector, unsigned int nsectors)
+static ssize_t cxd56_emmc_read(FAR struct inode *inode,
+                               unsigned char *buffer, size_t start_sector,
+                               unsigned int nsectors)
 {
   FAR struct cxd56_emmc_state_s *priv;
   int ret;
@@ -927,9 +955,11 @@ int cxd56_emmcinitialize(void)
               kmm_free(buf);
               return -EIO;
             }
+
           priv->total_sectors = *(FAR uint32_t *)&buf[EXTCSD_SEC_COUNT];
           kmm_free(descs);
         }
+
       kmm_free(buf);
     }
 
@@ -943,6 +973,10 @@ int cxd56_emmcinitialize(void)
   return OK;
 }
 
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
 int emmc_uninitialize(void)
 {
   /* Send power off command */
diff --git a/arch/arm/src/lc823450/lc823450_mmcl.c b/arch/arm/src/lc823450/lc823450_mmcl.c
index d5f2fcf..4ace75f 100644
--- a/arch/arm/src/lc823450/lc823450_mmcl.c
+++ b/arch/arm/src/lc823450/lc823450_mmcl.c
@@ -78,10 +78,13 @@ static int     mmcl_open(FAR struct inode *inode);
 static int     mmcl_close(FAR struct inode *inode);
 static ssize_t mmcl_read(FAR struct inode *inode, unsigned char *buffer,
                          size_t start_sector, unsigned int nsectors);
-static ssize_t mmcl_write(FAR struct inode *inode, const unsigned char *buffer,
-                          size_t start_sector, unsigned int nsectors);
-static int     mmcl_geometry(FAR struct inode *inode, struct geometry *geometry);
-static int     mmcl_ioctl(FAR struct inode *inode, int cmd, unsigned long arg);
+static ssize_t mmcl_write(FAR struct inode *inode,
+                          const unsigned char *buffer, size_t start_sector,
+                          unsigned int nsectors);
+static int     mmcl_geometry(FAR struct inode *inode,
+                             struct geometry *geometry);
+static int     mmcl_ioctl(FAR struct inode *inode, int cmd,
+                          unsigned long arg);
 
 /****************************************************************************
  * Private Data
@@ -163,8 +166,9 @@ static ssize_t mmcl_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-static ssize_t mmcl_write(FAR struct inode *inode, const unsigned char *buffer,
-  size_t start_sector, unsigned int nsectors)
+static ssize_t mmcl_write(FAR struct inode *inode,
+                          const unsigned char *buffer, size_t start_sector,
+                          unsigned int nsectors)
 {
   ssize_t nwrite;
   struct mmcl_dev_s *dev;
@@ -249,7 +253,8 @@ static int mmcl_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
  * Name: mmcl_allocdev
  ****************************************************************************/
 
-static FAR struct mmcl_dev_s *mmcl_allocdev(int number, FAR struct mtd_dev_s *mtd)
+static FAR struct mmcl_dev_s *mmcl_allocdev(int number,
+                                            FAR struct mtd_dev_s *mtd)
 {
   struct mmcl_dev_s *dev;
   int ret;
@@ -268,7 +273,8 @@ static FAR struct mmcl_dev_s *mmcl_allocdev(int number, FAR struct mtd_dev_s *mt
        * from the size of a pointer).
        */
 
-      ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&dev->geo));
+      ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY,
+                      (unsigned long)((uintptr_t)&dev->geo));
       if (ret < 0)
         {
           finfo("MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret);
@@ -317,6 +323,7 @@ int mmcl_initialize(int minor, FAR struct mtd_dev_s *mtd)
     CONFIG_MTD_DEVPATH1,
 #endif
   };
+
   int ret = -ENOMEM;
 
   /* Sanity check */
diff --git a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c
index 8abe7db..d884a8d 100644
--- a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c
+++ b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c
@@ -65,9 +65,9 @@
 
 #include "stm32l476vg-disco.h"
 
-/* Conditional logic in stm32l476vg-disco.h will determine if certain features
- * are supported.  Tests for these features need to be made after including
- * stm32l476vg-disco.h.
+/* Conditional logic in stm32l476vg-disco.h will determine if certain
+ * features are supported.  Tests for these features need to be made after
+ * including stm32l476vg-disco.h.
  */
 
 #ifdef HAVE_RTC_DRIVER
@@ -129,7 +129,7 @@ int board_app_initialize(uintptr_t arg)
   FAR struct rtc_lowerhalf_s *rtclower;
 #endif
 #if defined(HAVE_N25QXXX)
-FAR struct mtd_dev_s *mtd_temp;
+  FAR struct mtd_dev_s *mtd_temp;
 #endif
 #if defined(HAVE_N25QXXX_CHARDEV)
   char blockdev[18];
@@ -197,34 +197,35 @@ FAR struct mtd_dev_s *mtd_temp;
           _err("ERROR: n25qxxx_initialize failed\n");
           return ret;
         }
+
       g_mtd_fs = mtd_temp;
 
 #ifdef CONFIG_MTD_PARTITION
-      {
-        FAR struct mtd_geometry_s geo;
-        off_t nblocks;
-
-        /* Setup a partition of 256KiB for our file system. */
-
-        ret = MTD_IOCTL(g_mtd_fs, MTDIOC_GEOMETRY,
-                        (unsigned long)(uintptr_t)&geo);
-        if (ret < 0)
-          {
-            _err("ERROR: MTDIOC_GEOMETRY failed\n");
-            return ret;
-          }
-
-        nblocks = (256*1024) / geo.blocksize;
-
-        mtd_temp = mtd_partition(g_mtd_fs, 0, nblocks);
-        if (!mtd_temp)
-          {
-            _err("ERROR: mtd_partition failed\n");
-            return ret;
-          }
-
-        g_mtd_fs = mtd_temp;
-      }
+        {
+          FAR struct mtd_geometry_s geo;
+          off_t nblocks;
+
+          /* Setup a partition of 256KiB for our file system. */
+
+          ret = MTD_IOCTL(g_mtd_fs, MTDIOC_GEOMETRY,
+                          (unsigned long)(uintptr_t)&geo);
+          if (ret < 0)
+            {
+              _err("ERROR: MTDIOC_GEOMETRY failed\n");
+              return ret;
+            }
+
+          nblocks = (256 * 1024) / geo.blocksize;
+
+          mtd_temp = mtd_partition(g_mtd_fs, 0, nblocks);
+          if (!mtd_temp)
+            {
+              _err("ERROR: mtd_partition failed\n");
+              return ret;
+            }
+
+          g_mtd_fs = mtd_temp;
+        }
 #endif
 
 #ifdef HAVE_N25QXXX_SMARTFS
diff --git a/boards/boardctl.c b/boards/boardctl.c
index cded6c4..f573665 100644
--- a/boards/boardctl.c
+++ b/boards/boardctl.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * boards/boardctl.c
  *
- *   Copyright (C) 2015-2017, 2018-2019 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -95,7 +80,8 @@
  ****************************************************************************/
 
 #ifdef CONFIG_BOARDCTL_USBDEVCTRL
-static inline int boardctl_usbdevctrl(FAR struct boardioc_usbdev_ctrl_s *ctrl)
+static inline int
+  boardctl_usbdevctrl(FAR struct boardioc_usbdev_ctrl_s *ctrl)
 {
   int ret = OK;
 
@@ -297,10 +283,10 @@ static inline int boardctl_pmctrl(FAR struct boardioc_pm_ctrl_s *ctrl)
  *   to "correct" but awkward implementations.
  *
  *   boardctl() is non-standard OS interface to alleviate the problem.  It
- *   basically circumvents the normal device driver ioctl interlace and allows
- *   the application to perform direction IOCTL-like calls to the board-specific
- *   logic.  In it is especially useful for setting up board operational and
- *   test configurations.
+ *   basically circumvents the normal device driver ioctl interlace and
+ *   allows the application to perform direction IOCTL-like calls to the
+ *   board-specific logic.  In it is especially useful for setting up board
+ *   operational and test configurations.
  *
  * Input Parameters:
  *   cmd - Identifies the board command to be executed
@@ -322,16 +308,16 @@ int boardctl(unsigned int cmd, uintptr_t arg)
       /* CMD:           BOARDIOC_INIT
        * DESCRIPTION:   Perform one-time application initialization.
        * ARG:           The boardctl() argument is passed to the
-       *                board_app_initialize() implementation without modification.
-       *                The argument has no meaning to NuttX; the meaning of the
-       *                argument is a contract between the board-specific
-       *                initialization logic and the matching application logic.
-       *                The value cold be such things as a mode enumeration value,
-       *                a set of DIP switch switch settings, a pointer to
-       *                configuration data read from a file or serial FLASH, or
-       *                whatever you would like to do with it.  Every
-       *                implementation should accept zero/NULL as a default
-       *                configuration.
+       *                board_app_initialize() implementation without
+       *                modification.  The argument has no meaning to NuttX;
+       *                the meaning of the argument is a contract between
+       *                the board-specific initialization logic and the
+       *                matching application logic.  The value cold be such
+       *                things as a mode enumeration value, a set of DIP
+       *                switch switch settings, a pointer to configuration
+       *                data read from a file or serial FLASH, or whatever
+       *                you would like to do with it.  Every implementation
+       *                should accept zero/NULL as a default configuration.
        * CONFIGURATION: CONFIG_LIB_BOARDCTL
        * DEPENDENCIES:  Board logic must provide board_app_initialization
        */
@@ -411,8 +397,9 @@ int boardctl(unsigned int cmd, uintptr_t arg)
       /* CMD:           BOARDIOC_UNIQUEID
        * DESCRIPTION:   Return a unique ID associated with the board (such
        *                as a serial number or a MAC address).
-       * ARG:           A writable array of size CONFIG_BOARDCTL_UNIQUEID_SIZE
-       *                in which to receive the board unique ID.
+       * ARG:           A writable array of size
+       *                CONFIG_BOARDCTL_UNIQUEID_SIZE in which to receive
+       *                the board unique ID.
        * DEPENDENCIES:  Board logic must provide the board_uniqueid()
        *                interface.
        */
@@ -427,7 +414,8 @@ int boardctl(unsigned int cmd, uintptr_t arg)
 #ifdef CONFIG_BOARDCTL_MKRD
       /* CMD:           BOARDIOC_MKRD
        * DESCRIPTION:   Create a RAM disk
-       * ARG:           Pointer to read-only instance of struct boardioc_mkrd_s.
+       * ARG:           Pointer to read-only instance of struct
+       *                boardioc_mkrd_s.
        * CONFIGURATION: CONFIG_BOARDCTL_MKRD
        * DEPENDENCIES:  None
        */
@@ -453,7 +441,8 @@ int boardctl(unsigned int cmd, uintptr_t arg)
 #ifdef CONFIG_BOARDCTL_ROMDISK
       /* CMD:           BOARDIOC_ROMDISK
        * DESCRIPTION:   Register
-       * ARG:           Pointer to read-only instance of struct boardioc_romdisk_s.
+       * ARG:           Pointer to read-only instance of struct
+       *                boardioc_romdisk_s.
        * CONFIGURATION: CONFIG_BOARDCTL_ROMDISK
        * DEPENDENCIES:  None
        */
@@ -469,8 +458,8 @@ int boardctl(unsigned int cmd, uintptr_t arg)
             }
           else
             {
-              ret = romdisk_register((int)desc->minor, desc->image, desc->nsectors,
-                                     desc->sectsize);
+              ret = romdisk_register((int)desc->minor, desc->image,
+                                     desc->nsectors, desc->sectsize);
             }
         }
         break;
@@ -478,9 +467,9 @@ int boardctl(unsigned int cmd, uintptr_t arg)
 
 #ifdef CONFIG_BOARDCTL_APP_SYMTAB
       /* CMD:           BOARDIOC_APP_SYMTAB
-       * DESCRIPTION:   Select the application symbol table.  This symbol table
-       *                provides the symbol definitions exported to application
-       *                code from application space.
+       * DESCRIPTION:   Select the application symbol table.  This symbol
+       *                table provides the symbol definitions exported to
+       *                application code from application space.
        * ARG:           A pointer to an instance of struct boardioc_symtab_s
        * CONFIGURATION: CONFIG_BOARDCTL_APP_SYMTAB
        * DEPENDENCIES:  None
@@ -500,9 +489,9 @@ int boardctl(unsigned int cmd, uintptr_t arg)
 
 #ifdef CONFIG_BOARDCTL_OS_SYMTAB
       /* CMD:           BOARDIOC_OS_SYMTAB
-       * DESCRIPTION:   Select the OS symbol table.  This symbol table provides
-       *                the symbol definitions exported by the OS to kernel
-       *                modules.
+       * DESCRIPTION:   Select the OS symbol table.  This symbol table
+       *                provides the symbol definitions exported by the OS to
+       *                kernal modules.
        * ARG:           A pointer to an instance of struct boardioc_symtab_s
        * CONFIGURATION: CONFIG_BOARDCTL_OS_SYMTAB
        * DEPENDENCIES:  None
@@ -522,17 +511,18 @@ int boardctl(unsigned int cmd, uintptr_t arg)
 
 #ifdef CONFIG_BUILTIN
       /* CMD:           BOARDIOC_BUILTINS
-       * DESCRIPTION:   Provide the user-space list of built-in applications for
-       *                use by BINFS in protected mode.  Normally this is small
-       *                set of globals provided by user-space logic.  It provides
-       *                name-value pairs for associating built-in application
-       *                names with user-space entry point addresses.  These
-       *                globals are only needed for use by BINFS which executes
-       *                built-in applications from kernel-space in PROTECTED mode.
-       *                In the FLAT build, the user space globals are readily
-      *                 available.  (BINFS is not supportable in KERNEL mode since
-       *                user-space address have no general meaning that
-       *                configuration).
+       * DESCRIPTION:   Provide the user-space list of built-in applications
+       *                for use by BINFS in protected mode.  Normally this
+       *                is small set of globals provided by user-space
+       *                logic.  It provides name-value pairs for associating
+       *                built-in application names with user-space entry
+       *                point addresses.  These globals are only needed for
+       *                use by BINFS which executes built-in applications
+       *                from kernel-space in PROTECTED mode. In the FLAT
+       *                build, the user space globals are readily
+       *                available.  (BINFS is not supportable in KERNEL mode
+       *                since user-space address have no general meaning
+       *                that configuration).
        * ARG:           A pointer to an instance of struct boardioc_builtin_s
        * CONFIGURATION: This BOARDIOC command is always available when
        *                CONFIG_BUILTIN is enabled, but does nothing unless
@@ -557,7 +547,8 @@ int boardctl(unsigned int cmd, uintptr_t arg)
 #ifdef CONFIG_BOARDCTL_USBDEVCTRL
       /* CMD:           BOARDIOC_USBDEV_CONTROL
        * DESCRIPTION:   Manage USB device classes
-       * ARG:           A pointer to an instance of struct boardioc_usbdev_ctrl_s
+       * ARG:           A pointer to an instance of struct
+       *                boardioc_usbdev_ctrl_s
        * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_USBDEVCTRL
        * DEPENDENCIES:  Board logic must provide board_<usbdev>_initialize()
        */
@@ -673,9 +664,10 @@ int boardctl(unsigned int cmd, uintptr_t arg)
         break;
 
       /* CMD:           BOARDIOC_NXTERM_IOCTL
-       * DESCRIPTION:   Create an NX terminal IOCTL command.  Normal IOCTLs
-       *                cannot be be performed in most graphics contexts since
-       *                the depend on the task holding an open file descriptor
+       * DESCRIPTION:   Create an NX terminal IOCTL command.  Normal
+       *                IOCTLs cannot be be performed in most graphics
+       *                contexts since the depend on the task holding an
+       *                open file descriptor
        * ARG:           A reference readable/writable instance of struct
        *                boardioc_nxterm_ioctl_s
        * CONFIGURATION: CONFIG_NXTERM
@@ -696,9 +688,9 @@ int boardctl(unsigned int cmd, uintptr_t arg)
 #ifdef CONFIG_BOARDCTL_TESTSET
       /* CMD:           BOARDIOC_TESTSET
        * DESCRIPTION:   Access architecture-specific up_testset() operation
-       * ARG:           A pointer to a write-able spinlock object.  On success
-       *                the  preceding spinlock state is returned:  0=unlocked,
-       *                1=locked.
+       * ARG:           A pointer to a write-able spinlock object.  On
+       *                success the  preceding spinlock state is returned:
+       *                0=unlocked, 1=locked.
        * CONFIGURATION: CONFIG_BOARDCTL_TESTSET
        * DEPENDENCIES:  Architecture-specific logic provides up_testset()
        */
@@ -722,10 +714,10 @@ int boardctl(unsigned int cmd, uintptr_t arg)
        default:
          {
 #ifdef CONFIG_BOARDCTL_IOCTL
-           /* Boards may also select CONFIG_BOARDCTL_IOCTL=y to enable board-
-            * specific commands.  In this case, all commands not recognized
-            * by boardctl() will be forwarded to the board-provided board_ioctl()
-            * function.
+           /* Boards may also select CONFIG_BOARDCTL_IOCTL=y to enable
+            * board-specific commands.  In this case, all commands not
+            * recognized by boardctl() will be forwarded to the board-
+            * provided board_ioctl() function.
             */
 
            ret = board_ioctl(cmd, arg);
diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c
index 776c96b..c34aedd 100644
--- a/drivers/mmcsd/mmcsd_sdio.c
+++ b/drivers/mmcsd/mmcsd_sdio.c
@@ -72,11 +72,11 @@
 
 /* Data delays (all in units of milliseconds).
  *
- *   For MMC & SD V1.x, these should be based on Nac = TAAC + NSAC; The maximum
- *   value of TAAC is 80MS and the maximum value of NSAC is 25.5K clock cycle.
- *   For SD V2.x, a fixed delay of 100MS is recommend which is pretty close to
- *   the worst case SD V1.x Nac.  Here we just use 100MS delay for all data
- *   transfers.
+ *   For MMC & SD V1.x, these should be based on Nac = TAAC + NSAC; The
+ *   maximum value of TAAC is 80MS and the maximum value of NSAC is 25.5K
+ *   clock cycle.  For SD V2.x, a fixed delay of 100MS is recommend which is
+ *   pretty close to the worst case SD V1.x Nac.  Here we just use 100MS
+ *   delay for all data transfers.
  */
 
 #define MMCSD_SCR_DATADELAY     (100)      /* Wait up to 100MS to get SCR */
@@ -152,22 +152,23 @@ static void    mmcsd_takesem(FAR struct mmcsd_state_s *priv);
 
 static int     mmcsd_sendcmdpoll(FAR struct mmcsd_state_s *priv,
                  uint32_t cmd, uint32_t arg);
-static int     mmcsd_recvR1(FAR struct mmcsd_state_s *priv, uint32_t cmd);
-static int     mmcsd_recvR6(FAR struct mmcsd_state_s *priv, uint32_t cmd);
-static int     mmcsd_getSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2]);
+static int     mmsd_recv_r1(FAR struct mmcsd_state_s *priv, uint32_t cmd);
+static int     mmsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd);
+static int     mmsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2]);
 
-static void    mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv,
+static void    mmcsd_decode_csd(FAR struct mmcsd_state_s *priv,
                  uint32_t csd[4]);
 #ifdef CONFIG_DEBUG_FS_INFO
-static void    mmcsd_decodeCID(FAR struct mmcsd_state_s *priv,
+static void    mmcsd_decode_cid(FAR struct mmcsd_state_s *priv,
                  uint32_t cid[4]);
 #else
-#  define mmcsd_decodeCID(priv,cid)
+#  define mmcsd_decode_cid(priv,cid)
 #endif
-static void    mmcsd_decodeSCR(FAR struct mmcsd_state_s *priv,
+static void    mmsd_decode_scr(FAR struct mmcsd_state_s *priv,
                 uint32_t scr[2]);
 
-static int     mmcsd_getR1(FAR struct mmcsd_state_s *priv, FAR uint32_t *r1);
+static int     mmcsd_get_r1(FAR struct mmcsd_state_s *priv,
+                 FAR uint32_t *r1);
 static int     mmcsd_verifystate(FAR struct mmcsd_state_s *priv,
                  uint32_t status);
 
@@ -196,7 +197,8 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
                  FAR const uint8_t *buffer, off_t startblock);
 #ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE
 static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
-                 FAR const uint8_t *buffer, off_t startblock, size_t nblocks);
+                 FAR const uint8_t *buffer, off_t startblock,
+                 size_t nblocks);
 #endif
 #ifdef CONFIG_DRVR_WRITEBUFFER
 static ssize_t mmcsd_flush(FAR void *dev, FAR const uint8_t *buffer,
@@ -223,7 +225,7 @@ static void    mmcsd_mediachange(FAR void *arg);
 static int     mmcsd_widebus(FAR struct mmcsd_state_s *priv);
 #ifdef CONFIG_MMCSD_MMCSUPPORT
 static int     mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv);
-static int     mmcsd_mmcreadextCSD (FAR struct mmcsd_state_s *priv);
+static int     mmcsd_read_csd (FAR struct mmcsd_state_s *priv);
 #endif
 static int     mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv);
 static int     mmcsd_cardidentify(FAR struct mmcsd_state_s *priv);
@@ -311,7 +313,8 @@ static int mmcsd_sendcmdpoll(FAR struct mmcsd_state_s *priv, uint32_t cmd,
       ret = SDIO_WAITRESPONSE(priv->dev, cmd);
       if (ret != OK)
         {
-          ferr("ERROR: Wait for response to cmd: %08x failed: %d\n", cmd, ret);
+          ferr("ERROR: Wait for response to cmd: %08x failed: %d\n",
+               cmd, ret);
         }
     }
 
@@ -359,14 +362,14 @@ static inline int mmcsd_sendcmd4(FAR struct mmcsd_state_s *priv)
 }
 
 /****************************************************************************
- * Name: mmcsd_recvR1
+ * Name: mmsd_recv_r1
  *
  * Description:
  *   Receive R1 response and check for errors.
  *
  ****************************************************************************/
 
-static int mmcsd_recvR1(FAR struct mmcsd_state_s *priv, uint32_t cmd)
+static int mmsd_recv_r1(FAR struct mmcsd_state_s *priv, uint32_t cmd)
 {
   uint32_t r1;
   int ret;
@@ -394,7 +397,7 @@ static int mmcsd_recvR1(FAR struct mmcsd_state_s *priv, uint32_t cmd)
 }
 
 /****************************************************************************
- * Name: mmcsd_recvR6
+ * Name: mmsd_recv_r6
  *
  * Description:
  *   Receive R6 response and check for errors.  On success, priv->rca is set
@@ -402,7 +405,7 @@ static int mmcsd_recvR1(FAR struct mmcsd_state_s *priv, uint32_t cmd)
  *
  ****************************************************************************/
 
-static int mmcsd_recvR6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
+static int mmsd_recv_r6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
 {
   uint32_t r6 = 0;
   int ret;
@@ -443,7 +446,7 @@ static int mmcsd_recvR6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
 }
 
 /****************************************************************************
- * Name: mmcsd_getSCR
+ * Name: mmsd_get_scr
  *
  * Description:
  *   Obtain the SD card's Configuration Register (SCR)
@@ -453,7 +456,7 @@ static int mmcsd_recvR6(FAR struct mmcsd_state_s *priv, uint32_t cmd)
  *
  ****************************************************************************/
 
-static int mmcsd_getSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
+static int mmsd_get_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
 {
   int ret;
 
@@ -478,7 +481,7 @@ static int mmcsd_getSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
   /* Send CMD55 APP_CMD with argument as card's RCA */
 
   mmcsd_sendcmdpoll(priv, SD_CMD55, (uint32_t)priv->rca << 16);
-  ret = mmcsd_recvR1(priv, SD_CMD55);
+  ret = mmsd_recv_r1(priv, SD_CMD55);
   if (ret != OK)
     {
       ferr("ERROR: RECVR1 for CMD55 failed: %d\n", ret);
@@ -488,7 +491,7 @@ static int mmcsd_getSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
   /* Send ACMD51 SD_APP_SEND_SCR with argument as 0 to start data receipt */
 
   mmcsd_sendcmdpoll(priv, SD_ACMD51, 0);
-  ret = mmcsd_recvR1(priv, SD_ACMD51);
+  ret = mmsd_recv_r1(priv, SD_ACMD51);
   if (ret != OK)
     {
       ferr("ERROR: RECVR1 for ACMD51 failed: %d\n", ret);
@@ -509,7 +512,7 @@ static int mmcsd_getSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
 }
 
 /****************************************************************************
- * Name: mmcsd_decodeCSD
+ * Name: mmcsd_decode_csd
  *
  * Description:
  *   Decode and extract necessary information from the CSD. If debug is
@@ -527,7 +530,7 @@ static int mmcsd_getSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
  *
  ****************************************************************************/
 
-static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
+static void mmcsd_decode_csd(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
 {
 #ifdef CONFIG_DEBUG_FS_INFO
   struct mmcsd_csd_s decoded;
@@ -543,10 +546,11 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
    * TAAC               119:112 Data read access-time-1
    *   TIME_VALUE         6:3   Time mantissa
    *   TIME_UNIT          2:0   Time exponent
-   * NSAC               111:104 Data read access-time-2 in CLK cycle(NSAC*100)
-   * TRAN_SPEED         103:96 Max. data transfer rate
-   *   TIME_VALUE         6:3  Rate exponent
-   *   TRANSFER_RATE_UNIT 2:0 Rate mantissa
+   * NSAC               111:104 Data read access-time-2 in CLK
+   *                            cycle(NSAC*100)
+   * TRAN_SPEED         103:96  Max. data transfer rate
+   *   TIME_VALUE         6:3   Rate exponent
+   *   TRANSFER_RATE_UNIT 2:0   Rate mantissa
    */
 
 #ifdef CONFIG_DEBUG_FS_INFO
@@ -633,7 +637,8 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
            */
 
 #ifdef CONFIG_DEBUG_FS_INFO
-          uint16_t csize        = ((csd[1] & 0x03ff) << 2) | ((csd[2] >> 30) & 3);
+          uint16_t csize        = ((csd[1] & 0x03ff) << 2) |
+                                  ((csd[2] >> 30) & 3);
           uint8_t  csizemult    = (csd[2] >> 15) & 7;
 #endif
 
@@ -700,19 +705,22 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
        * C_SIZE: 73:64 from Word 2 and 63:62 from Word 3
        */
 
-      uint16_t csize            = ((csd[1] & 0x03ff) << 2) | ((csd[2] >> 30) & 3);
+      uint16_t csize            = ((csd[1] & 0x03ff) << 2) |
+                                  ((csd[2] >> 30) & 3);
       uint8_t  csizemult        = (csd[2] >> 15) & 7;
 
-      priv->nblocks             = ((uint32_t)csize + 1) * (1 << (csizemult + 2));
+      priv->nblocks             = ((uint32_t)csize + 1) *
+                                  (1 << (csizemult + 2));
       priv->blockshift          = readbllen;
       priv->blocksize           = (1 << readbllen);
       priv->capacity            = (priv->nblocks << readbllen);
 
-      /* Some devices, such as 2Gb devices, report blocksizes larger than 512 bytes
-       * but still expect to be accessed with a 512 byte blocksize.
+      /* Some devices, such as 2Gb devices, report blocksizes larger than
+       * 512 bytes but still expect to be accessed with a 512 byte blocksize.
        *
-       * NOTE: A minor optimization would be to eliminated priv->blocksize and
-       * priv->blockshift:  Those values will be 512 and 9 in all cases anyway.
+       * NOTE: A minor optimization would be to eliminated priv->blocksize
+       * and priv->blockshift:  Those values will be 512 and 9 in all cases
+       * anyway.
        */
 
       if (priv->blocksize > 512)
@@ -813,8 +821,10 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
                 decoded.u.mmc.vddrcurrmin, decoded.u.mmc.vddrcurrmax);
           finfo("    VDD_W_CURR_MIN: %d VDD_W_CURR_MAX: %d\n",
                 decoded.u.mmc.vddwcurrmin, decoded.u.mmc.vddwcurrmax);
-          finfo("    MMC_SECTOR_SIZE: %d MMC_ER_GRP_SIZE: %d MMC_WP_GRP_SIZE: %d\n",
-                decoded.u.mmc.er.mmc22.sectorsize, decoded.u.mmc.er.mmc22.ergrpsize,
+          finfo("    MMC_SECTOR_SIZE: %d MMC_ER_GRP_SIZE: %d "
+                "MMC_WP_GRP_SIZE: %d\n",
+                decoded.u.mmc.er.mmc22.sectorsize,
+                decoded.u.mmc.er.mmc22.ergrpsize,
                 decoded.u.mmc.mmcwpgrpsize);
         }
       else
@@ -824,7 +834,8 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
           finfo("    C_SIZE: %d SD_ER_BLK_EN: %d\n",
                 decoded.u.sdblock.csize, decoded.u.sdblock.sderblen);
           finfo("    SD_SECTOR_SIZE: %d SD_WP_GRP_SIZE: %d\n",
-                decoded.u.sdblock.sdsectorsize, decoded.u.sdblock.sdwpgrpsize);
+                decoded.u.sdblock.sdsectorsize,
+                decoded.u.sdblock.sdwpgrpsize);
         }
     }
   else if (IS_SD(priv->type))
@@ -836,7 +847,8 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
             decoded.u.sdbyte.vddrcurrmin, decoded.u.sdbyte.vddrcurrmax);
       finfo("    VDD_W_CURR_MIN: %d VDD_W_CURR_MAX: %d\n",
             decoded.u.sdbyte.vddwcurrmin, decoded.u.sdbyte.vddwcurrmax);
-      finfo("    SD_ER_BLK_EN: %d SD_SECTOR_SIZE: %d (SD) SD_WP_GRP_SIZE: %d\n",
+      finfo("    SD_ER_BLK_EN: %d SD_SECTOR_SIZE: %d (SD) "
+            "SD_WP_GRP_SIZE: %d\n",
             decoded.u.sdbyte.sderblen, decoded.u.sdbyte.sdsectorsize,
             decoded.u.sdbyte.sdwpgrpsize);
     }
@@ -850,8 +862,10 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
             decoded.u.mmc.vddrcurrmin, decoded.u.mmc.vddrcurrmax);
       finfo("    VDD_W_CURR_MIN: %d VDD_W_CURR_MAX: %d\n",
             decoded.u.mmc.vddwcurrmin, decoded.u.mmc.vddwcurrmax);
-      finfo("    MMC_SECTOR_SIZE: %d MMC_ER_GRP_SIZE: %d MMC_WP_GRP_SIZE: %d\n",
-            decoded.u.mmc.er.mmc22.sectorsize, decoded.u.mmc.er.mmc22.ergrpsize,
+      finfo("    MMC_SECTOR_SIZE: %d MMC_ER_GRP_SIZE: %d "
+            "MMC_WP_GRP_SIZE: %d\n",
+            decoded.u.mmc.er.mmc22.sectorsize,
+            decoded.u.mmc.er.mmc22.ergrpsize,
             decoded.u.mmc.mmcwpgrpsize);
     }
 #endif
@@ -874,7 +888,7 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
 }
 
 /****************************************************************************
- * Name: mmcsd_decodeCID
+ * Name: mmcsd_decode_cid
  *
  * Description:
  *   Show the contents of the Card Identification Data (CID) (for debug
@@ -883,7 +897,7 @@ static void mmcsd_decodeCSD(FAR struct mmcsd_state_s *priv, uint32_t csd[4])
  ****************************************************************************/
 
 #ifdef CONFIG_DEBUG_FS_INFO
-static void mmcsd_decodeCID(FAR struct mmcsd_state_s *priv, uint32_t cid[4])
+static void mmcsd_decode_cid(FAR struct mmcsd_state_s *priv, uint32_t cid[4])
 {
   struct mmcsd_cid_s decoded;
 
@@ -938,7 +952,7 @@ static void mmcsd_decodeCID(FAR struct mmcsd_state_s *priv, uint32_t cid[4])
 #endif
 
 /****************************************************************************
- * Name: mmcsd_decodeSCR
+ * Name: mmsd_decode_scr
  *
  * Description:
  *   Show the contents of the SD Configuration Register (SCR).  The only
@@ -946,7 +960,7 @@ static void mmcsd_decodeCID(FAR struct mmcsd_state_s *priv, uint32_t cid[4])
  *
  ****************************************************************************/
 
-static void mmcsd_decodeSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
+static void mmsd_decode_scr(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
 {
 #ifdef CONFIG_DEBUG_FS_INFO
   struct mmcsd_scr_s decoded;
@@ -968,16 +982,22 @@ static void mmcsd_decodeSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
 #endif
 
 #ifdef CONFIG_DEBUG_FS_INFO
-#ifdef CONFIG_ENDIAN_BIG    /* Card SCR is big-endian order / CPU also big-endian
-                             *   60   56   52   48   44   40   36   32
-                             * VVVV SSSS ESSS BBBB RRRR RRRR RRRR RRRR */
+#ifdef CONFIG_ENDIAN_BIG
+  /* Card SCR is big-endian order / CPU also big-endian
+   *   60   56   52   48   44   40   36   32
+   * VVVV SSSS ESSS BBBB RRRR RRRR RRRR RRRR
+   */
+
   decoded.scrversion =  scr[0] >> 28;
   decoded.sdversion  = (scr[0] >> 24) & 15;
   decoded.erasestate = (scr[0] >> 23) & 1;
   decoded.security   = (scr[0] >> 20) & 7;
-#else                       /* Card SCR is big-endian order / CPU is little-endian
-                             *   36   32   44   40   52   48   60   56
-                             * RRRR RRRR RRRR RRRR ESSS BBBB VVVV SSSS */
+#else
+  /* Card SCR is big-endian order / CPU is little-endian
+   *   36   32   44   40   52   48   60   56
+   * RRRR RRRR RRRR RRRR ESSS BBBB VVVV SSSS
+   */
+
   decoded.scrversion = (scr[0] >> 4)  & 15;
   decoded.sdversion  =  scr[0]        & 15;
   decoded.erasestate = (scr[0] >> 15) & 1;
@@ -1004,16 +1024,16 @@ static void mmcsd_decodeSCR(FAR struct mmcsd_state_s *priv, uint32_t scr[2])
 }
 
 /****************************************************************************
- * Name: mmcsd_getR1
+ * Name: mmcsd_get_r1
  *
  * Description:
  *   Get the R1 status of the card using CMD13
  *
  ****************************************************************************/
 
-static int mmcsd_getR1(FAR struct mmcsd_state_s *priv, FAR uint32_t *r1)
+static int mmcsd_get_r1(FAR struct mmcsd_state_s *priv, FAR uint32_t *r1)
 {
-  uint32_t localR1;
+  uint32_t local_r1;
   int ret;
 
   DEBUGASSERT(priv != NULL && r1 != NULL);
@@ -1023,29 +1043,30 @@ static int mmcsd_getR1(FAR struct mmcsd_state_s *priv, FAR uint32_t *r1)
    */
 
   mmcsd_sendcmdpoll(priv, MMCSD_CMD13, (uint32_t)priv->rca << 16);
-  ret = SDIO_RECVR1(priv->dev, MMCSD_CMD13, &localR1);
+  ret = SDIO_RECVR1(priv->dev, MMCSD_CMD13, &local_r1);
   if (ret == OK)
     {
       /* Check if R1 reports an error */
 
-      if ((localR1 & MMCSD_R1_ERRORMASK) != 0)
+      if ((local_r1 & MMCSD_R1_ERRORMASK) != 0)
         {
           /* Card locked is considered an error. Save the card locked
            * indication for later use.
            */
 
-          priv->locked = ((localR1 & MMCSD_R1_CARDISLOCKED) != 0);
+          priv->locked = ((local_r1 & MMCSD_R1_CARDISLOCKED) != 0);
 
           /* We must tell someone which error bits were set. */
 
-          fwarn("WARNING: mmcsd_getR1 returned errors: R1=%08x\n", localR1);
+          fwarn("WARNING: mmcsd_get_r1 returned errors: R1=%08x\n",
+                local_r1);
           ret = -EIO;
         }
       else
         {
           /* No errors, return R1 */
 
-          *r1 = localR1;
+          *r1 = local_r1;
         }
     }
 
@@ -1067,10 +1088,10 @@ static int mmcsd_verifystate(FAR struct mmcsd_state_s *priv, uint32_t state)
 
   /* Get the current R1 status from the card */
 
-  ret = mmcsd_getR1(priv, &r1);
+  ret = mmcsd_get_r1(priv, &r1);
   if (ret != OK)
     {
-      ferr("ERROR: mmcsd_getR1 failed: %d\n", ret);
+      ferr("ERROR: mmcsd_get_r1 failed: %d\n", ret);
       return ret;
     }
 
@@ -1115,7 +1136,8 @@ static bool mmcsd_wrprotected(FAR struct mmcsd_state_s *priv)
  * Name: mmcsd_eventwait
  *
  * Description:
- *   Wait for the specified events to occur.  Check for wakeup on error events.
+ *   Wait for the specified events to occur.  Check for wakeup on error
+ *   events.
  *
  ****************************************************************************/
 
@@ -1183,14 +1205,15 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
     }
 
   /* The card is still present and the last transfer was a write transfer.
-   * Loop, querying the card state.  Return when (1) the card is in the TRANSFER
-   * state, (2) the card stays in the PROGRAMMING state too long, or (3) the
-   * card is in any other state.
+   * Loop, querying the card state.  Return when (1) the card is in the
+   * TRANSFER state, (2) the card stays in the PROGRAMMING state too long,
+   * or (3) the card is in any other state.
    *
-   * The PROGRAMMING state occurs normally after a WRITE operation.  During this
-   * time, the card may be busy completing the WRITE and is not available for
-   * other operations.  The card will transition from the PROGRAMMING state to
-   * the TRANSFER state when the card completes the WRITE operation.
+   * The PROGRAMMING state occurs normally after a WRITE operation.  During
+   * this time, the card may be busy completing the WRITE and is not
+   * available for other operations.  The card will transition from the
+   * PROGRAMMING state to the TRANSFER state when the card completes the
+   * WRITE operation.
    */
 
 #if defined(CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE)
@@ -1207,10 +1230,10 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
     {
       /* Get the current R1 status from the card */
 
-      ret = mmcsd_getR1(priv, &r1);
+      ret = mmcsd_get_r1(priv, &r1);
       if (ret != OK)
         {
-          ferr("ERROR: mmcsd_getR1 failed: %d\n", ret);
+          ferr("ERROR: mmcsd_get_r1 failed: %d\n", ret);
           goto errorout;
         }
 
@@ -1276,10 +1299,10 @@ static int mmcsd_stoptransmission(FAR struct mmcsd_state_s *priv)
   /* Send CMD12, STOP_TRANSMISSION, and verify good R1 return status  */
 
   mmcsd_sendcmdpoll(priv, MMCSD_CMD12, 0);
-  ret = mmcsd_recvR1(priv, MMCSD_CMD12);
+  ret = mmsd_recv_r1(priv, MMCSD_CMD12);
   if (ret != OK)
     {
-      ferr("ERROR: mmcsd_recvR1 for CMD12 failed: %d\n", ret);
+      ferr("ERROR: mmsd_recv_r1 for CMD12 failed: %d\n", ret);
     }
 
   return ret;
@@ -1294,7 +1317,8 @@ static int mmcsd_stoptransmission(FAR struct mmcsd_state_s *priv)
  *
  ****************************************************************************/
 
-static int mmcsd_setblocklen(FAR struct mmcsd_state_s *priv, uint32_t blocklen)
+static int mmcsd_setblocklen(FAR struct mmcsd_state_s *priv,
+                             uint32_t blocklen)
 {
   int ret = OK;
 
@@ -1308,14 +1332,14 @@ static int mmcsd_setblocklen(FAR struct mmcsd_state_s *priv, uint32_t blocklen)
        */
 
       mmcsd_sendcmdpoll(priv, MMCSD_CMD16, blocklen);
-      ret = mmcsd_recvR1(priv, MMCSD_CMD16);
+      ret = mmsd_recv_r1(priv, MMCSD_CMD16);
       if (ret == OK)
         {
           priv->selblocklen = blocklen;
         }
       else
         {
-          ferr("ERROR: mmcsd_recvR1 for CMD16 failed: %d\n", ret);
+          ferr("ERROR: mmsd_recv_r1 for CMD16 failed: %d\n", ret);
         }
     }
 
@@ -1430,10 +1454,10 @@ static ssize_t mmcsd_readsingle(FAR struct mmcsd_state_s *priv,
    */
 
   mmcsd_sendcmdpoll(priv, MMCSD_CMD17, offset);
-  ret = mmcsd_recvR1(priv, MMCSD_CMD17);
+  ret = mmsd_recv_r1(priv, MMCSD_CMD17);
   if (ret != OK)
     {
-      ferr("ERROR: mmcsd_recvR1 for CMD17 failed: %d\n", ret);
+      ferr("ERROR: mmsd_recv_r1 for CMD17 failed: %d\n", ret);
       SDIO_CANCEL(priv->dev);
       return ret;
     }
@@ -1514,8 +1538,9 @@ static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv,
       return ret;
     }
 
-  /* If this is a byte addressed SD card, then convert both the total transfer
-   * size to bytes and the sector start sector number to a byte offset
+  /* If this is a byte addressed SD card, then convert both the total
+   * transfer size to bytes and the sector start sector number to a byte
+   * offset
    */
 
   nbytes = nblocks << priv->blockshift;
@@ -1566,10 +1591,10 @@ static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv,
    */
 
   mmcsd_sendcmdpoll(priv, MMCSD_CMD18, offset);
-  ret = mmcsd_recvR1(priv, MMCSD_CMD18);
+  ret = mmsd_recv_r1(priv, MMCSD_CMD18);
   if (ret != OK)
     {
-      ferr("ERROR: mmcsd_recvR1 for CMD18 failed: %d\n", ret);
+      ferr("ERROR: mmsd_recv_r1 for CMD18 failed: %d\n", ret);
       SDIO_CANCEL(priv->dev);
       return ret;
     }
@@ -1756,10 +1781,10 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
       /* Send CMD24, WRITE_BLOCK, and verify that good R1 status is returned */
 
       mmcsd_sendcmdpoll(priv, MMCSD_CMD24, offset);
-      ret = mmcsd_recvR1(priv, MMCSD_CMD24);
+      ret = mmsd_recv_r1(priv, MMCSD_CMD24);
       if (ret != OK)
         {
-          ferr("ERROR: mmcsd_recvR1 for CMD24 failed: %d\n", ret);
+          ferr("ERROR: mmsd_recv_r1 for CMD24 failed: %d\n", ret);
           return ret;
         }
     }
@@ -1793,10 +1818,10 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
       /* Send CMD24, WRITE_BLOCK, and verify that good R1 status is returned */
 
       mmcsd_sendcmdpoll(priv, MMCSD_CMD24, offset);
-      ret = mmcsd_recvR1(priv, MMCSD_CMD24);
+      ret = mmsd_recv_r1(priv, MMCSD_CMD24);
       if (ret != OK)
         {
-          ferr("ERROR: mmcsd_recvR1 for CMD24 failed: %d\n", ret);
+          ferr("ERROR: mmsd_recv_r1 for CMD24 failed: %d\n", ret);
           return ret;
         }
     }
@@ -1804,7 +1829,8 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
   /* Wait for the transfer to complete */
 
   ret = mmcsd_eventwait(priv,
-                        SDIOWAIT_TIMEOUT | SDIOWAIT_ERROR, MMCSD_BLOCK_WDATADELAY);
+                        SDIOWAIT_TIMEOUT | SDIOWAIT_ERROR,
+                        MMCSD_BLOCK_WDATADELAY);
   if (ret != OK)
     {
       ferr("ERROR: CMD24 transfer failed: %d\n", ret);
@@ -1840,8 +1866,8 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
 
 #if !defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE)
 static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
-                                   FAR const uint8_t *buffer, off_t startblock,
-                                   size_t nblocks)
+                                   FAR const uint8_t *buffer,
+                                   off_t startblock, size_t nblocks)
 {
   off_t  offset;
   size_t nbytes;
@@ -1891,8 +1917,9 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
       return ret;
     }
 
-  /* If this is a byte addressed SD card, then convert both the total transfer
-   * size to bytes and the sector start sector number to a byte offset
+  /* If this is a byte addressed SD card, then convert both the total
+   * transfer size to bytes and the sector start sector number to a byte
+   * offset
    */
 
   nbytes = nblocks << priv->blockshift;
@@ -1918,8 +1945,8 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
 
   /* If this is an SD card, then send ACMD23 (SET_WR_BLK_ERASE_COUNT) just
    * before sending CMD25 (WRITE_MULTIPLE_BLOCK).  This sets the number of
-   * write blocks to be pre-erased and might make the following multiple block
-   * write command faster.
+   * write blocks to be pre-erased and might make the following multiple
+   * block write command faster.
    */
 
   if (IS_SD(priv->type))
@@ -1927,10 +1954,10 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
       /* Send CMD55, APP_CMD, a verify that good R1 status is returned */
 
       mmcsd_sendcmdpoll(priv, SD_CMD55, (uint32_t)priv->rca << 16);
-      ret = mmcsd_recvR1(priv, SD_CMD55);
+      ret = mmsd_recv_r1(priv, SD_CMD55);
       if (ret != OK)
         {
-          ferr("ERROR: mmcsd_recvR1 for CMD55 (ACMD23) failed: %d\n", ret);
+          ferr("ERROR: mmsd_recv_r1 for CMD55 (ACMD23) failed: %d\n", ret);
           return ret;
         }
 
@@ -1939,10 +1966,10 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
        */
 
       mmcsd_sendcmdpoll(priv, SD_ACMD23, nblocks);
-      ret = mmcsd_recvR1(priv, SD_ACMD23);
+      ret = mmsd_recv_r1(priv, SD_ACMD23);
       if (ret != OK)
         {
-          ferr("ERROR: mmcsd_recvR1 for ACMD23 failed: %d\n", ret);
+          ferr("ERROR: mmsd_recv_r1 for ACMD23 failed: %d\n", ret);
           return ret;
         }
     }
@@ -1958,10 +1985,10 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
        */
 
       mmcsd_sendcmdpoll(priv, MMCSD_CMD25, offset);
-      ret = mmcsd_recvR1(priv, MMCSD_CMD25);
+      ret = mmsd_recv_r1(priv, MMCSD_CMD25);
       if (ret != OK)
         {
-          ferr("ERROR: mmcsd_recvR1 for CMD25 failed: %d\n", ret);
+          ferr("ERROR: mmsd_recv_r1 for CMD25 failed: %d\n", ret);
           return ret;
         }
     }
@@ -1997,10 +2024,10 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
        */
 
       mmcsd_sendcmdpoll(priv, MMCSD_CMD25, offset);
-      ret = mmcsd_recvR1(priv, MMCSD_CMD25);
+      ret = mmsd_recv_r1(priv, MMCSD_CMD25);
       if (ret != OK)
         {
-          ferr("ERROR: mmcsd_recvR1 for CMD25 failed: %d\n", ret);
+          ferr("ERROR: mmsd_recv_r1 for CMD25 failed: %d\n", ret);
           return ret;
         }
     }
@@ -2108,9 +2135,6 @@ static ssize_t mmcsd_flush(FAR void *dev, FAR const uint8_t *buffer,
 #endif
 
 /****************************************************************************
- * Block Driver Methods
- ****************************************************************************/
-/****************************************************************************
  * Name: mmcsd_open
  *
  * Description: Open the block device
@@ -2241,7 +2265,8 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-static ssize_t mmcsd_write(FAR struct inode *inode, FAR const unsigned char *buffer,
+static ssize_t mmcsd_write(FAR struct inode *inode,
+                           FAR const unsigned char *buffer,
                            size_t startsector, unsigned int nsectors)
 {
   FAR struct mmcsd_state_s *priv;
@@ -2451,18 +2476,20 @@ static void mmcsd_mediachange(FAR void *arg)
   mmcsd_takesem(priv);
   if (SDIO_PRESENT(priv->dev))
     {
-      /* No... process the card insertion.  This could cause chaos if we think
-       * that a card is already present and there are mounted file systems!
-       * NOTE that mmcsd_probe() will always re-enable callbacks appropriately.
+      /* No... process the card insertion.  This could cause chaos if we
+       * think that a card is already present and there are mounted file
+       * systems!  NOTE that mmcsd_probe() will always re-enable callbacks
+       * appropriately.
        */
 
       mmcsd_probe(priv);
     }
   else
     {
-      /* No... process the card removal.  This could have very bad implications
-       * for any mounted file systems!  NOTE that mmcsd_removed() does NOT
-       * re-enable callbacks so we will need to do that here.
+      /* No... process the card removal.  This could have very bad
+       * implications for any mounted file systems!  NOTE that
+       * mmcsd_removed() does NOT re-enable callbacks so we will need to
+       * do that here.
        */
 
       mmcsd_removed(priv);
@@ -2508,7 +2535,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
        */
 
       mmcsd_sendcmdpoll(priv, SD_CMD55, (uint32_t)priv->rca << 16);
-      ret = mmcsd_recvR1(priv, SD_CMD55);
+      ret = mmsd_recv_r1(priv, SD_CMD55);
       if (ret != OK)
         {
           ferr("ERROR: RECVR1 for CMD55 of ACMD42: %d\n", ret);
@@ -2523,7 +2550,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
        */
 
       mmcsd_sendcmdpoll(priv, SD_ACMD42, MMCSD_ACMD42_CD_DISCONNECT);
-      ret = mmcsd_recvR1(priv, SD_ACMD42);
+      ret = mmsd_recv_r1(priv, SD_ACMD42);
       if (ret != OK)
         {
           fwarn("WARNING: SD card does not support ACMD42: %d\n", ret);
@@ -2535,7 +2562,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
        */
 
       mmcsd_sendcmdpoll(priv, SD_CMD55, (uint32_t)priv->rca << 16);
-      ret = mmcsd_recvR1(priv, SD_CMD55);
+      ret = mmsd_recv_r1(priv, SD_CMD55);
       if (ret != OK)
         {
           ferr("ERROR: RECVR1 for CMD55 of ACMD6: %d\n", ret);
@@ -2545,7 +2572,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv)
       /* Then send ACMD6 */
 
       mmcsd_sendcmdpoll(priv, SD_ACMD6, MMCSD_ACMD6_BUSWIDTH_4);
-      ret = mmcsd_recvR1(priv, SD_ACMD6);
+      ret = mmsd_recv_r1(priv, SD_ACMD6);
       if (ret != OK)
         {
           return ret;
@@ -2589,12 +2616,12 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
    * so there is good evidence that we have an MMC card inserted into the
    * slot.
    *
-   * Send CMD2, ALL_SEND_CID. This implementation supports only one MMC slot.
-   * If multiple cards were installed, each card would respond to CMD2 by
-   * sending its CID (only one card completes the response at a time).  The
-   * driver should send CMD2 and assign an RCAs until no response to
-   * ALL_SEND_CID is received. CMD2 causes transition to identification state/
-   * card-identification mode.
+   * Send CMD2, ALL_SEND_CID. This implementation supports only one MMC
+   * slot.  If multiple cards were installed, each card would respond to
+   * CMD2 by sending its CID (only one card completes the response at a
+   * time).  The driver should send CMD2 and assign an RCAs until no
+   * response to ALL_SEND_CID is received. CMD2 causes transition to
+   * identification state / card-identification mode.
    */
 
   mmcsd_sendcmdpoll(priv, MMCSD_CMD2, 0);
@@ -2605,7 +2632,7 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
       return ret;
     }
 
-  mmcsd_decodeCID(priv, cid);
+  mmcsd_decode_cid(priv, cid);
 
   /* Send CMD3, SET_RELATIVE_ADDR.  This command is used to assign a logical
    * address to the card.  For MMC, the host assigns the address. CMD3 causes
@@ -2614,16 +2641,17 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
 
   priv->rca = 1;  /* There is only one card */
   mmcsd_sendcmdpoll(priv, MMC_CMD3, priv->rca << 16);
-  ret = mmcsd_recvR1(priv, MMC_CMD3);
+  ret = mmsd_recv_r1(priv, MMC_CMD3);
   if (ret != OK)
     {
-      ferr("ERROR: mmcsd_recvR1(CMD3) failed: %d\n", ret);
+      ferr("ERROR: mmsd_recv_r1(CMD3) failed: %d\n", ret);
       return ret;
     }
 
-  /* This should have caused a transition to standby state. However, this will
-   * not be reflected in the present R1 status.  R1/6 contains the state of the
-   * card when the command was received, not when it completed execution.
+  /* This should have caused a transition to standby state. However, this
+   * will not be reflected in the present R1 status.  R1/6 contains the
+   * state of the card when the command was received, not when it completed
+   * execution.
    *
    * Verify that we are in standby state/data-transfer mode
    */
@@ -2661,10 +2689,10 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
    */
 
   mmcsd_sendcmdpoll(priv, MMCSD_CMD7S, (uint32_t)priv->rca << 16);
-  ret = mmcsd_recvR1(priv, MMCSD_CMD7S);
+  ret = mmsd_recv_r1(priv, MMCSD_CMD7S);
   if (ret != OK)
     {
-      ferr("ERROR: mmcsd_recvR1 for CMD7 failed: %d\n", ret);
+      ferr("ERROR: mmsd_recv_r1 for CMD7 failed: %d\n", ret);
       return ret;
     }
 
@@ -2676,7 +2704,7 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
 
   if (IS_BLOCK(priv->type))
     {
-      ret = mmcsd_mmcreadextCSD(priv);
+      ret = mmcsd_read_csd(priv);
       if (ret != OK)
         {
           ferr("ERROR: Failed to determinate number of blocks: %d\n", ret);
@@ -2684,7 +2712,7 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
         }
     }
 
-  mmcsd_decodeCSD(priv, csd);
+  mmcsd_decode_csd(priv, csd);
 
   /* Select high speed MMC clocking (which may depend on the DSR setting) */
 
@@ -2694,18 +2722,18 @@ static int mmcsd_mmcinitialize(FAR struct mmcsd_state_s *priv)
 }
 
 /****************************************************************************
- * Name: mmcsd_mmcreadextCSD
+ * Name: mmcsd_read_csd
  *
  * Description:
  *   MMC card is detected with block addressing and this function will read
  *   the correct number of blocks and capacity. Returns OK if ext CSD is read
- *       correctly or error in not.
+ *   correctly or error in not.
  *
  *   Note:  For some MCU architectures, buffer[] must be aligned.
  *
  ****************************************************************************/
 
-static int mmcsd_mmcreadextCSD (FAR struct mmcsd_state_s *priv)
+static int mmcsd_read_csd(FAR struct mmcsd_state_s *priv)
 {
   uint8_t buffer[512] aligned_data(16);
   int ret;
@@ -2781,12 +2809,12 @@ static int mmcsd_mmcreadextCSD (FAR struct mmcsd_state_s *priv)
     }
 
   /* Send CMD8 in data-transfer mode to obtain the
-   * extended Card Specific Data (CSD) register, e.g., block length, card storage
-   * capacity, etc.
+   * extended Card Specific Data (CSD) register, e.g., block length, card
+   * storage capacity, etc.
    */
 
   mmcsd_sendcmdpoll(priv, MMC_CMD8, 0);
-  ret = mmcsd_recvR1(priv, MMC_CMD8);
+  ret = mmsd_recv_r1(priv, MMC_CMD8);
   if (ret != OK)
     {
       ferr("ERROR: Could not get MMC extended CSD register: %d\n", ret);
@@ -2859,7 +2887,7 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
       return ret;
     }
 
-  mmcsd_decodeCID(priv, cid);
+  mmcsd_decode_cid(priv, cid);
 
   /* Send CMD3, SET_RELATIVE_ADDR.  In both protocols, this command is used
    * to assign a logical address to the card.  For MMC, the host assigns the
@@ -2870,7 +2898,7 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
    */
 
   mmcsd_sendcmdpoll(priv, SD_CMD3, 0);
-  ret = mmcsd_recvR6(priv, SD_CMD3);
+  ret = mmsd_recv_r6(priv, SD_CMD3);
   if (ret != OK)
     {
       ferr("ERROR: mmcsd_recvR2 for SD RCA failed: %d\n", ret);
@@ -2879,9 +2907,10 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
 
   finfo("RCA: %04x\n", priv->rca);
 
-  /* This should have caused a transition to standby state. However, this will
-   * not be reflected in the present R1 status.  R1/6 contains the state of
-   * the card when the command was received, not when it completed execution.
+  /* This should have caused a transition to standby state. However, this
+   * will not be reflected in the present R1 status.  R1/6 contains the
+   * state of the card when the command was received, not when it
+   * completed execution.
    *
    * Verify that we are in standby state/data-transfer mode
    */
@@ -2907,7 +2936,7 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
       return ret;
     }
 
-  mmcsd_decodeCSD(priv, csd);
+  mmcsd_decode_csd(priv, csd);
 
   /* Send CMD7 with the argument == RCA in order to select the card.
    * Since we are supporting only a single card, we just leave the
@@ -2915,10 +2944,10 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
    */
 
   mmcsd_sendcmdpoll(priv, MMCSD_CMD7S, (uint32_t)priv->rca << 16);
-  ret = mmcsd_recvR1(priv, MMCSD_CMD7S);
+  ret = mmsd_recv_r1(priv, MMCSD_CMD7S);
   if (ret != OK)
     {
-      ferr("ERROR: mmcsd_recvR1 for CMD7 failed: %d\n", ret);
+      ferr("ERROR: mmsd_recv_r1 for CMD7 failed: %d\n", ret);
       return ret;
     }
 
@@ -2939,14 +2968,14 @@ static int mmcsd_sdinitialize(FAR struct mmcsd_state_s *priv)
    * this card supports wide bus operation.
    */
 
-  ret = mmcsd_getSCR(priv, scr);
+  ret = mmsd_get_scr(priv, scr);
   if (ret != OK)
     {
       ferr("ERROR: Could not get SD SCR register(%d)\n", ret);
       return ret;
     }
 
-  mmcsd_decodeSCR(priv, scr);
+  mmsd_decode_scr(priv, scr);
 
   /* Select width (4-bit) bus operation (if the card supports it) */
 
@@ -2988,8 +3017,8 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
 
   priv->type = MMCSD_CARDTYPE_UNKNOWN;
 
-  /* Check if there is a card present in the slot.  This is normally a matter is
-   * of GPIO sensing.
+  /* Check if there is a card present in the slot.  This is normally a
+   * matter is of GPIO sensing.
    */
 
   if (!SDIO_PRESENT(priv->dev))
@@ -3002,8 +3031,8 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
 
   SDIO_CLOCK(priv->dev, CLOCK_IDMODE);
 
-  /* After power up at least 74 clock cycles are required prior to starting bus
-   * communication
+  /* After power up at least 74 clock cycles are required prior to starting
+   * bus communication
    */
 
   up_udelay(MMCSD_POWERUP_DELAY);
@@ -3058,8 +3087,8 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
       if ((response & MMCSD_CARD_BUSY) != 0)
         {
           /* NO.. We really should check the current state to see if the
-           * MMC successfully made it to the IDLE state, but at least for now,
-           * we will simply assume that that is the case.
+           * MMC successfully made it to the IDLE state, but at least for
+           * now, we will simply assume that that is the case.
            *
            * Then break out of the look with an MMC card identified
            */
@@ -3095,8 +3124,9 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
 
       if (ret == OK)
         {
-          /* CMD8 succeeded this is probably a SDHC card. Verify the operating
-           * voltage and that the check pattern was correctly echoed
+          /* CMD8 succeeded this is probably a SDHC card. Verify the
+           * operating voltage and that the check pattern was correctly
+           * echoed
            */
 
           if (((response & MMCSD_R7VOLTAGE_MASK) == MMCSD_R7VOLTAGE_27) &&
@@ -3135,36 +3165,40 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
           /* Send CMD55 with argument = 0 */
 
           mmcsd_sendcmdpoll(priv, SD_CMD55, 0);
-          ret = mmcsd_recvR1(priv, SD_CMD55);
+          ret = mmsd_recv_r1(priv, SD_CMD55);
           if (ret != OK)
             {
-              /* I am a little confused.. I think both SD and MMC cards support
-               * CMD55 (but maybe only SD cards support CMD55).  We'll make the
-               * the MMC vs. SD decision based on CMD1 and ACMD41.
+              /* I am a little confused.. I think both SD and MMC cards
+               * support CMD55 (but maybe only SD cards support CMD55).
+               * We'll make the the MMC vs. SD decision based on CMD1 and
+               * ACMD41.
                */
 
-              ferr("ERROR: mmcsd_recvR1(CMD55) failed: %d\n", ret);
+              ferr("ERROR: mmsd_recv_r1(CMD55) failed: %d\n", ret);
             }
           else
             {
               /* Send ACMD41 */
 
               mmcsd_sendcmdpoll(priv, SD_ACMD41,
-                                MMCSD_ACMD41_VOLTAGEWINDOW_33_32 | sdcapacity);
+                                MMCSD_ACMD41_VOLTAGEWINDOW_33_32 |
+                                sdcapacity);
               ret = SDIO_RECVR3(priv->dev, SD_ACMD41, &response);
               if (ret != OK)
                 {
-                  /* If the error is a timeout, then it is probably an MMC card,
-                   * but we will make the decision based on CMD1 below
+                  /* If the error is a timeout, then it is probably an MMC
+                   * card, but we will make the decision based on CMD1
+                   * below.
                    */
 
                   ferr("ERROR: ACMD41 RECVR3: %d\n", ret);
                 }
               else
                 {
-                  /* ACMD41 succeeded.  ACMD41 is supported by SD V1.x and SD V2.x,
-                   * but not MMC.  If we did not previously determine that this is
-                   * an SD V2.x (via CMD8), then this must be SD V1.x
+                  /* ACMD41 succeeded.  ACMD41 is supported by SD V1.x and
+                   * SD V2.x, but not MMC.  If we did not previously
+                   * determine that this is an SD V2.x (via CMD8), then this
+                   * must be SD V1.x
                    */
 
                   finfo("R3: %08x\n", response);
@@ -3174,20 +3208,20 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
                       priv->type = MMCSD_CARDTYPE_SDV1;
                     }
 
-                  /* Check if the card is busy.  Very confusing, BUSY is set LOW
-                   * if the card has not finished its initialization, so it really
-                   * means NOT busy.
+                  /* Check if the card is busy.  Very confusing, BUSY is set
+                   * LOW if the card has not finished its initialization,
+                   * so it really means NOT busy.
                    */
 
                   if ((response & MMCSD_CARD_BUSY) != 0)
                     {
-                      /* No.. We really should check the current state to see if
-                       * the SD card successfully made it to the IDLE state, but
-                       * at least for now, we will simply assume that that is the
-                       * case.
+                      /* No.. We really should check the current state to
+                       * see if the SD card successfully made it to the IDLE
+                       * state, but at least for now, we will simply assume
+                       * that that is the case.
                        *
-                       * Now, check if this is a SD V2.x card that supports block
-                       * addressing
+                       * Now, check if this is a SD V2.x card that supports
+                       * block addressing
                        */
 
                       if ((response & MMCSD_R3_HIGHCAPACITY) != 0)
@@ -3205,27 +3239,27 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
             }
         }
 
-      /* If we get here then either (1) CMD55 failed, (2) CMD41 failed, or (3)
-       * and SD or MMC card has been identified, but it is not yet in the IDLE state.
-       * If SD card has not been identified, then we might be looking at an
-       * MMC card.  We can send the CMD1 to find out for sure.  CMD1 is supported
-       * by MMC cards, but not by SD cards.
+      /* If we get here then either (1) CMD55 failed, (2) CMD41 failed, or
+       * (3) and SD or MMC card has been identified, but it is not yet in
+       * the IDLE state.  If SD card has not been identified, then we might
+       * be looking at an MMC card.  We can send the CMD1 to find out for
+       * sure.  CMD1 is supported by MMC cards, but not by SD cards.
        */
 
 #ifdef CONFIG_MMCSD_MMCSUPPORT
       if (IS_MMC(priv->type))
         {
           /* Send the MMC CMD1 to specify the operating voltage. CMD1 causes
-           * transition to ready state/ card-identification mode.  NOTE: If the
-           * card does not support this voltage range, it will go the inactive
-           * state.
+           * transition to ready state/ card-identification mode.  NOTE: If
+           * the card does not support this voltage range, it will go the
+           * inactive state.
            *
-           * NOTE: An MMC card will only respond once to CMD1 (unless it is busy).
-           * This is part of the logic used to determine how  many MMC cards are
-           * connected (This implementation supports only a single MMC card).  So
-           * we cannot re-send CMD1 without first placing the card back into
-           * stand-by state (if the card is busy, it will automatically
-           * go back to the standby state).
+           * NOTE: An MMC card will only respond once to CMD1 (unless it is
+           * busy).  This is part of the logic used to determine how  many
+           * MMC cards are connected (This implementation supports only a
+           * single MMC card).  So we cannot re-send CMD1 without first
+           * placing the card back into stand-by state (if the card is busy,
+           * it will automatically go back to the standby state).
            */
 
           mmcsd_sendcmdpoll(priv, MMC_CMD1, MMCSD_VDD_33_34 | mmccapacity);
@@ -3258,15 +3292,16 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
                 }
 
               /* Check if the card is busy.  Very confusing, BUSY is set LOW
-               * if the card has not finished its initialization, so it really
-               * means NOT busy.
+               * if the card has not finished its initialization, so it
+               * really means NOT busy.
                */
 
               if ((response & MMCSD_CARD_BUSY) != 0)
                 {
-                  /* NO.. We really should check the current state to see if the
-                   * MMC successfully made it to the IDLE state, but at least for now,
-                   * we will simply assume that that is the case.
+                  /* NO.. We really should check the current state to see if
+                   * the MMC successfully made it to the IDLE state, but at
+                   * least for now we will simply assume that that is the
+                   * case.
                    *
                    * Then break out of the look with an MMC card identified
                    */
@@ -3277,6 +3312,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
             }
         }
 #endif
+
       /* Check the elapsed time.  We won't keep trying this forever! */
 
       elapsed = clock_systimer() - start;
@@ -3395,7 +3431,8 @@ static int mmcsd_probe(FAR struct mmcsd_state_s *priv)
             {
               /* Yes...  */
 
-              finfo("Capacity: %lu Kbytes\n", (unsigned long)(priv->capacity / 1024));
+              finfo("Capacity: %lu Kbytes\n",
+                    (unsigned long)(priv->capacity / 1024));
               priv->mediachanged = true;
             }
         }
@@ -3404,11 +3441,11 @@ static int mmcsd_probe(FAR struct mmcsd_state_s *priv)
 
       priv->probed = true;
 
-      /* Regardless of whether or not a card was successfully initialized, there
-       * is appartently a card inserted. If it wasn't successfully initialized,
-       * there's nothing we can do about it now. Perhaps it's a bad card? The best
-       * we can do is wait for the card to be ejected and re-inserted. Then we
-       * can try to initialize again.
+      /* Regardless of whether or not a card was successfully initialized,
+       * there is apparently a card inserted. If it wasn't successfully
+       * initialized, there's nothing we can do about it now. Perhaps it's
+       * a bad card? The best we can do is wait for the card to be ejected
+       * and re-inserted. Then we can try to initialize again.
        */
 
 #ifdef CONFIG_MMCSD_HAVE_CARDDETECT
@@ -3515,10 +3552,10 @@ static int mmcsd_hwinitialize(FAR struct mmcsd_state_s *priv)
    *     on CD/DAT3 (both SD/MMC),
    *  3. Or by periodic attempts to initialize the card from software.
    *
-   * The behavior of SDIO_PRESENT() is to use whatever information is available
-   * on the particular platform.  If no card insertion information is available
-   * (polling only), then SDIO_PRESENT() will always return true and we will
-   * try to initialize the card.
+   * The behavior of SDIO_PRESENT() is to use whatever information is
+   * available on the particular platform.  If no card insertion information
+   * is available (polling only), then SDIO_PRESENT() will always return
+   * true and we will try to initialize the card.
    */
 
   if (SDIO_PRESENT(priv->dev))
@@ -3614,7 +3651,8 @@ int mmcsd_slotinitialize(int minor, FAR struct sdio_dev_s *dev)
 
   /* Allocate a MMC/SD state structure */
 
-  priv = (FAR struct mmcsd_state_s *)kmm_malloc(sizeof(struct mmcsd_state_s));
+  priv = (FAR struct mmcsd_state_s *)
+    kmm_malloc(sizeof(struct mmcsd_state_s));
   if (priv)
     {
       /* Initialize the MMC/SD state structure */
@@ -3634,9 +3672,10 @@ int mmcsd_slotinitialize(int minor, FAR struct sdio_dev_s *dev)
 
       if (ret != OK)
         {
-          /* No... But the error ENODEV is returned if hardware initialization
-           * succeeded but no card is inserted in the slot. In this case, the
-           * no error occurred, but the driver is still not ready.
+          /* No... But the error ENODEV is returned if hardware
+           * initialization succeeded but no card is inserted in the slot.
+           * In this case, the no error occurred, but the driver is still
+           * not ready.
            */
 
           if (ret == -ENODEV)
@@ -3683,6 +3722,7 @@ int mmcsd_slotinitialize(int minor, FAR struct sdio_dev_s *dev)
           goto errout_with_buffers;
         }
     }
+
   return OK;
 
 errout_with_buffers:
diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c
index e5ff295..ce82a86 100644
--- a/drivers/mmcsd/mmcsd_spi.c
+++ b/drivers/mmcsd/mmcsd_spi.c
@@ -82,6 +82,7 @@
 #endif
 
 /* Slot struct info *********************************************************/
+
 /* Slot status definitions */
 
 #define MMCSD_SLOTSTATUS_NOTREADY    0x01 /* Card not initialized */
@@ -90,6 +91,7 @@
 #define MMCSD_SLOTSTATUS_MEDIACHGD   0x08 /* Media changed in slot */
 
 /* Values in the MMC/SD command table ***************************************/
+
 /* These define the value returned by the MMC/SD command */
 
 #define MMCSD_CMDRESP_R1             0
@@ -250,9 +252,9 @@ static struct mmcsd_slot_s g_mmcsdslot[CONFIG_MMCSD_NSLOTS];
 
 static const uint32_t g_transpeedru[8] =
 {
-     10000,   /*  0:  100 Kbit/sec / 10 */
-    100000,   /*  1:    1 Mbit/sec / 10 */
-   1000000,   /*  2:   10 Mbit/sec / 10 */
+  10000,      /*  0:  100 Kbit/sec / 10 */
+  100000,     /*  1:    1 Mbit/sec / 10 */
+  1000000,    /*  2:   10 Mbit/sec / 10 */
   10000000,   /*  3:  100 Mbit/sec / 10 */
 
   0, 0, 0, 0  /* 4-7: Reserved values */
@@ -260,7 +262,7 @@ static const uint32_t g_transpeedru[8] =
 
 static const uint32_t g_transpeedtu[16] =
 {
-   0, 10, 12, 13, /*  0-3:  Reserved, 1.0, 1.1, 1.2, 1.3 */
+  0,  10, 12, 13, /*  0-3:  Reserved, 1.0, 1.1, 1.2, 1.3 */
   15, 20, 25, 30, /*  4-7:  1.5, 2.0, 2.5, 3.0 */
   35, 40, 45, 50, /*  8-11: 3.5, 4.0, 4.5, 5.0 */
   55, 60, 70, 80, /* 12-15: 5.5, 6.0, 7.0, 8.0 */
@@ -286,16 +288,16 @@ static const uint16_t g_taactu[8] =
 {
   /* Units of nanoseconds */
 
-      1, /* 0:   1 ns */
-     10, /* 1:  10 ns */
-    100, /* 2: 100 ns */
+  1,     /* 0:   1 ns */
+  10,    /* 1:  10 ns */
+  100,   /* 2: 100 ns */
 
   /* Units of microseconds */
 
-      1, /* 3:   1 us 1,000 ns */
-     10, /* 4:  10 us 10,000 ns */
-    100, /* 5: 100 us 100,000 ns */
-   1000, /* 6:   1 ms 1,000,000 ns */
+  1,     /* 3:   1 us 1,000 ns */
+  10,    /* 4:  10 us 10,000 ns */
+  100,   /* 5: 100 us 100,000 ns */
+  1000,  /* 6:   1 ms 1,000,000 ns */
   10000, /* 7:  10 ms 10,000,000 ns */
 };
 
@@ -309,27 +311,72 @@ static const uint16_t g_taactv[] =
 
 /* Commands *****************************************************************/
 
-static const struct mmcsd_cmdinfo_s g_cmd0   = {CMD0,   MMCSD_CMDRESP_R1, 0x95};
-static const struct mmcsd_cmdinfo_s g_cmd1   = {CMD1,   MMCSD_CMDRESP_R1, 0xff};
-static const struct mmcsd_cmdinfo_s g_cmd8   = {CMD8,   MMCSD_CMDRESP_R7, 0x87};
-static const struct mmcsd_cmdinfo_s g_cmd9   = {CMD9,   MMCSD_CMDRESP_R1, 0xff};
+static const struct mmcsd_cmdinfo_s g_cmd0   =
+{
+  CMD0,   MMCSD_CMDRESP_R1, 0x95
+};
+static const struct mmcsd_cmdinfo_s g_cmd1   =
+{
+  CMD1,   MMCSD_CMDRESP_R1, 0xff
+};
+static const struct mmcsd_cmdinfo_s g_cmd8   =
+{
+  CMD8,   MMCSD_CMDRESP_R7, 0x87
+};
+static const struct mmcsd_cmdinfo_s g_cmd9   =
+{
+  CMD9,   MMCSD_CMDRESP_R1, 0xff
+};
 #if 0 /* Not used */
-static const struct mmcsd_cmdinfo_s g_cmd10  = {CMD10,  MMCSD_CMDRESP_R1, 0xff};
+static const struct mmcsd_cmdinfo_s g_cmd10  =
+{
+  CMD10,  MMCSD_CMDRESP_R1, 0xff
+};
 #endif
-static const struct mmcsd_cmdinfo_s g_cmd12  = {CMD12,  MMCSD_CMDRESP_R1, 0xff};
-static const struct mmcsd_cmdinfo_s g_cmd16  = {CMD16,  MMCSD_CMDRESP_R1, 0xff};
-static const struct mmcsd_cmdinfo_s g_cmd17  = {CMD17,  MMCSD_CMDRESP_R1, 0xff};
-static const struct mmcsd_cmdinfo_s g_cmd18  = {CMD18,  MMCSD_CMDRESP_R1, 0xff};
+static const struct mmcsd_cmdinfo_s g_cmd12  =
+{
+  CMD12,  MMCSD_CMDRESP_R1, 0xff
+};
+static const struct mmcsd_cmdinfo_s g_cmd16  =
+{
+  CMD16,  MMCSD_CMDRESP_R1, 0xff
+};
+static const struct mmcsd_cmdinfo_s g_cmd17  =
+{
+  CMD17,  MMCSD_CMDRESP_R1, 0xff
+};
+static const struct mmcsd_cmdinfo_s g_cmd18  =
+{
+  CMD18,  MMCSD_CMDRESP_R1, 0xff
+};
 #if !defined(CONFIG_MMCSD_READONLY)
-static const struct mmcsd_cmdinfo_s g_cmd24  = {CMD24,  MMCSD_CMDRESP_R1, 0xff};
-static const struct mmcsd_cmdinfo_s g_cmd25  = {CMD25,  MMCSD_CMDRESP_R1, 0xff};
+static const struct mmcsd_cmdinfo_s g_cmd24  =
+{
+  CMD24,  MMCSD_CMDRESP_R1, 0xff
+};
+static const struct mmcsd_cmdinfo_s g_cmd25  =
+{
+  CMD25,  MMCSD_CMDRESP_R1, 0xff
+};
 #endif
-static const struct mmcsd_cmdinfo_s g_cmd55  = {CMD55,  MMCSD_CMDRESP_R1, 0xff};
-static const struct mmcsd_cmdinfo_s g_cmd58  = {CMD58,  MMCSD_CMDRESP_R3, 0xff};
+static const struct mmcsd_cmdinfo_s g_cmd55  =
+{
+  CMD55,  MMCSD_CMDRESP_R1, 0xff
+};
+static const struct mmcsd_cmdinfo_s g_cmd58  =
+{
+  CMD58,  MMCSD_CMDRESP_R3, 0xff
+};
 #if !defined(CONFIG_MMCSD_READONLY)
-static const struct mmcsd_cmdinfo_s g_acmd23 = {ACMD23, MMCSD_CMDRESP_R1, 0xff};
+static const struct mmcsd_cmdinfo_s g_acmd23 =
+{
+  ACMD23, MMCSD_CMDRESP_R1, 0xff
+};
 #endif
-static const struct mmcsd_cmdinfo_s g_acmd41 = {ACMD41, MMCSD_CMDRESP_R1, 0xff};
+static const struct mmcsd_cmdinfo_s g_acmd41 =
+{
+  ACMD41, MMCSD_CMDRESP_R1, 0xff
+};
 
 /****************************************************************************
  * Private Functions
@@ -416,11 +463,11 @@ static int mmcsd_waitready(FAR struct mmcsd_slot_s *slot)
       elapsed = ELAPSED_TIME(start);
 
       if (elapsed > MMCSD_DELAY_10MS)
-      {
-        /* Give other threads time to run */
+        {
+          /* Give other threads time to run */
 
-        nxsig_usleep(10000);
-      }
+          nxsig_usleep(10000);
+        }
     }
   while (elapsed < MMCSD_DELAY_500MS);
 
@@ -440,7 +487,8 @@ static int mmcsd_waitready(FAR struct mmcsd_slot_s *slot)
  ****************************************************************************/
 
 static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot,
-                              const struct mmcsd_cmdinfo_s *cmd, uint32_t arg)
+                              FAR const struct mmcsd_cmdinfo_s *cmd,
+                              uint32_t arg)
 {
   FAR struct spi_dev_s *spi = slot->spi;
   uint32_t result;
@@ -624,7 +672,7 @@ static uint32_t mmcsd_nsac(FAR struct mmcsd_slot_s *slot, uint8_t *csd,
    * the maximum value is 25.5K clock cycles.
    */
 
-  uint32_t nsac = MMCSD_CSD_NSAC(csd) * ((uint32_t)100*1000);
+  uint32_t nsac = MMCSD_CSD_NSAC(csd) * ((uint32_t)100 * 1000);
   uint32_t fhkz = (frequency + 500) / 1000;
   return (nsac + (fhkz >> 1)) / fhkz;
 }
@@ -647,7 +695,8 @@ static uint32_t mmcsd_taac(FAR struct mmcsd_slot_s *slot, uint8_t *csd)
    *   taccess = TU*TV + NSAC/spifrequency
    *
    * g_taactu holds TU in units of nanoseconds and microseconds (you have to
-   * use the index to distinguish.  g_taactv holds TV with 8-bits of fraction.
+   * use the index to distinguish.  g_taactv holds TV with 8-bits of
+   * fraction.
    */
 
   tundx  = MMCSD_CSD_TAAC_TIMEUNIT(csd);
@@ -663,7 +712,8 @@ static uint32_t mmcsd_taac(FAR struct mmcsd_slot_s *slot, uint8_t *csd)
     {
       /* Return the answer in microseconds */
 
-      return (g_taactu[tundx]*g_taactv[MMCSD_CSD_TAAC_TIMEVALUE(csd)] + 0x80) >> 8;
+      return (g_taactu[tundx] * g_taactv[MMCSD_CSD_TAAC_TIMEVALUE(csd)] +
+              0x80) >> 8;
     }
 }
 
@@ -714,24 +764,31 @@ static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd)
        *
        * Example: TAAC = 1.5 ms,  NSAC = 0, r2wfactor = 4, CLK_TCK=100
        *          taccessus = 1,500uS
-       *          taccess   = (1,500 * 100) / 100,000) + 1 = 2 (ideal, 1.5)
-       *          twrite    = (1,500 * 4 * 100) / 100,000) + 1 = 7 (ideal 6.0)
+       *          taccess   = (1,500 * 100) / 100,000) + 1 = 2
+       *                      (ideal, 1.5)
+       *          twrite    = (1,500 * 4 * 100) / 100,000) + 1 = 7
+       *                      (ideal 6.0)
        *
        * First get the access time in microseconds
        */
 
-      uint32_t taccessus = mmcsd_taac(slot, csd) + mmcsd_nsac(slot, csd, frequency);
+      uint32_t taccessus = mmcsd_taac(slot, csd) +
+                           mmcsd_nsac(slot, csd, frequency);
 
-      /* Then convert to system clock ticks.  The maximum read access is 10 times
-       * the tacc value: taccess = 10 * (taccessus / 1,000,000) * CLK_TCK, or
+      /* Then convert to system clock ticks.  The maximum read access is 10
+       * times the tacc value:
+       *
+       *   taccess = 10 * (taccessus / 1,000,000) * CLK_TCK
        */
 
       slot->taccess = (taccessus * CLK_TCK) / 100000 + 1;
 
-      /* NOTE that we add one to taccess to assure that we wait at least this
-       * time.  The write access time is larger by the R2WFACTOR: */
+      /* NOTE that we add one to taccess to assure that we wait at least
+       * this time.  The write access time is larger by the R2WFACTOR:
+       */
 
-      slot->taccess = (taccessus * MMCSD_CSD_R2WFACTOR(csd) * CLK_TCK) / 100000 + 1;
+      slot->taccess = (taccessus * MMCSD_CSD_R2WFACTOR(csd) * CLK_TCK) /
+                      100000 + 1;
     }
   else
     {
@@ -769,6 +826,7 @@ static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd)
   if (MMCSD_CSD_CSDSTRUCT(csd) != 0)
     {
       /* SDC structure ver 2.xx */
+
       /* Note: On SD card WRITE_BL_LEN is always the same as READ_BL_LEN */
 
       readbllen = SD20_CSD_READBLLEN(csd);
@@ -778,6 +836,7 @@ static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd)
   else
     {
       /* MMC or SD structure ver 1.xx */
+
       /* Note: On SD card WRITE_BL_LEN is always the same as READ_BL_LEN */
 
       readbllen = MMCSD_CSD_READBLLEN(csd);
@@ -930,7 +989,8 @@ static int mmcsd_recvblock(FAR struct mmcsd_slot_s *slot, uint8_t *buffer,
 
   /* Wait up to the maximum to receive a valid data token.  taccess is the
    * time from when the command is sent until the first byte of data is
-   * received */
+   * received.
+   */
 
   start = START_TIME;
   do
@@ -1218,8 +1278,8 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
               goto errout_with_eio;
             }
 
-         buffer += SECTORSIZE(slot);
-       }
+          buffer += SECTORSIZE(slot);
+        }
 
       /* Send CMD12: Stops transmission */
 
@@ -1251,8 +1311,9 @@ errout_with_eio:
  ****************************************************************************/
 
 #if !defined(CONFIG_MMCSD_READONLY)
-static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
-                        size_t start_sector, unsigned int nsectors)
+static ssize_t mmcsd_write(FAR struct inode *inode,
+                           FAR const unsigned char *buffer,
+                           size_t start_sector, unsigned int nsectors)
 {
   FAR struct mmcsd_slot_s *slot;
   FAR struct spi_dev_s *spi;
@@ -1376,7 +1437,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
               ferr("ERROR: ACMD23 failed: R1=%02x\n", response);
               goto errout_with_sem;
             }
-       }
+        }
 
       /* Send CMD25:  Continuously write blocks of data until the
        * transmission is stopped.
@@ -1398,6 +1459,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
               ferr("ERROR: Failed: to receive the block\n");
               goto errout_with_sem;
             }
+
           buffer += SECTORSIZE(slot);
 
           if (mmcsd_waitready(slot) != OK)
@@ -1493,7 +1555,8 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
   /* Then return the card geometry */
 
   geometry->geo_available =
-    ((slot->state & (MMCSD_SLOTSTATUS_NOTREADY | MMCSD_SLOTSTATUS_NODISK)) == 0);
+    ((slot->state & (MMCSD_SLOTSTATUS_NOTREADY |
+                     MMCSD_SLOTSTATUS_NODISK)) == 0);
   geometry->geo_mediachanged =
     ((slot->state & MMCSD_SLOTSTATUS_MEDIACHGD) != 0);
 #if !defined(CONFIG_MMCSD_READONLY)
@@ -1522,10 +1585,6 @@ static int mmcsd_geometry(FAR struct inode *inode, struct geometry *geometry)
 }
 
 /****************************************************************************
- * Initialization
- ****************************************************************************/
-
-/****************************************************************************
  * Name: mmcsd_mediainitialize
  *
  * Description:
@@ -1551,10 +1610,10 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
 
   slot->state |= MMCSD_SLOTSTATUS_NOTREADY;
 
-  /* Check if there is a card present in the slot.  This is normally a matter is
-   * of GPIO sensing and does not really involve SPI, but by putting this
-   * functionality in the SPI interface, we encapsulate the SPI MMC/SD
-   * interface
+  /* Check if there is a card present in the slot.  This is normally a
+   * matter is of GPIO sensing and does not really involve SPI, but by
+   * putting this functionality in the SPI interface, we encapsulate the
+   * SPI MMC/SD interface
    */
 
   if ((SPI_STATUS(spi, SPIDEV_MMCSD(0)) & SPI_STATUS_PRESENT) == 0)
@@ -1632,7 +1691,8 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
     {
       /* Verify the operating voltage and that the 0xaa was correctly echoed */
 
-      if (((slot->r7 & MMCSD_SPIR7_VOLTAGE_MASK) == MMCSD_SPIR7_VOLTAGE_27) &&
+      if (((slot->r7 & MMCSD_SPIR7_VOLTAGE_MASK) ==
+           MMCSD_SPIR7_VOLTAGE_27) &&
           ((slot->r7 & MMCSD_SPIR7_ECHO_MASK) == 0xaa))
         {
           /* Try CMD55/ACMD41 for up to 1 second or until the card exits
@@ -1645,7 +1705,8 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
             {
               finfo("%d. Send CMD55/ACMD41\n", elapsed);
               result = mmcsd_sendcmd(slot, &g_cmd55, 0);
-              if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK)
+              if (result == MMCSD_SPIR1_IDLESTATE ||
+                  result == MMCSD_SPIR1_OK)
                 {
                   result = mmcsd_sendcmd(slot, &g_acmd41, (uint32_t)1 << 30);
                   if (result == MMCSD_SPIR1_OK)
@@ -1661,26 +1722,27 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
           /* Check if ACMD41 was sent successfully */
 
           if (elapsed < MMCSD_DELAY_1SEC)
-           {
-             finfo("Send CMD58\n");
+            {
+              finfo("Send CMD58\n");
 
-             SPI_SEND(spi, 0xff);
-             result = mmcsd_sendcmd(slot, &g_cmd58, 0);
-             if (result == MMCSD_SPIR1_OK)
-               {
+              SPI_SEND(spi, 0xff);
+              result = mmcsd_sendcmd(slot, &g_cmd58, 0);
+              if (result == MMCSD_SPIR1_OK)
+                {
                   finfo("OCR: %08x\n", slot->ocr);
                   if ((slot->ocr & MMCSD_OCR_CCS) != 0)
                     {
                       finfo("Identified SD ver2 card/with block access\n");
-                      slot->type = MMCSD_CARDTYPE_SDV2 | MMCSD_CARDTYPE_BLOCK;
+                      slot->type = MMCSD_CARDTYPE_SDV2 |
+                                   MMCSD_CARDTYPE_BLOCK;
                     }
                   else
                     {
                       finfo("Identified SD ver2 card\n");
                       slot->type = MMCSD_CARDTYPE_SDV2;
                     }
-               }
-           }
+                }
+            }
         }
     }
 
@@ -1714,7 +1776,8 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
             {
               finfo("%d. Send CMD55/ACMD41\n", elapsed);
               result = mmcsd_sendcmd(slot, &g_cmd55, 0);
-              if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK)
+              if (result == MMCSD_SPIR1_IDLESTATE ||
+                  result == MMCSD_SPIR1_OK)
                 {
                   result = mmcsd_sendcmd(slot, &g_acmd41, 0);
                   if (result == MMCSD_SPIR1_OK)
@@ -1733,7 +1796,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
                    slot->type = MMCSD_CARDTYPE_MMC;
                    break;
                 }
-             }
+            }
 
           elapsed = ELAPSED_TIME(start);
         }
@@ -1785,13 +1848,13 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot)
    */
 
 #ifdef CONFIG_MMCSD_SECTOR512
-  /* Using 512 byte sectors, the maximum ver1.x capacity is 4096 x 512 blocks.
-   * The saved slot->nsectors is converted to 512 byte blocks, so if slot->nsectors
-   * exceeds 4096 x 512, then we must be dealing with a card with read_bl_len
-   * of 1024 or 2048.
+  /* Using 512 byte sectors, the maximum ver1.x capacity is 4096 x 512
+   * blocks.  The saved slot->nsectors is converted to 512 byte blocks, so
+   * if slot->nsectors exceeds 4096 x 512, then we must be dealing with a
+   * card with read_bl_len of 1024 or 2048.
    */
 
-  if (!IS_SDV2(slot->type) && slot->nsectors <= ((uint32_t)4096*12))
+  if (!IS_SDV2(slot->type) && slot->nsectors <= ((uint32_t)4096 * 12))
     {
       /* Don't set the block len on high capacity cards (ver1.x or ver2.x) */
 
@@ -1865,7 +1928,8 @@ static void mmcsd_mediachanged(void *arg)
    * ready, then try re-initializing it
    */
 
-  else if ((oldstate & (MMCSD_SLOTSTATUS_NODISK | MMCSD_SLOTSTATUS_NOTREADY)) != 0)
+  else if ((oldstate & (MMCSD_SLOTSTATUS_NODISK |
+                        MMCSD_SLOTSTATUS_NOTREADY)) != 0)
     {
       /* (Re-)initialize for the media in the slot */
 
@@ -1909,7 +1973,8 @@ int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi)
   int ret;
 
 #ifdef CONFIG_DEBUG_FEATURES
-  if ((unsigned)slotno >= CONFIG_MMCSD_NSLOTS || (unsigned)minor > 255 || !spi)
+  if ((unsigned)slotno >= CONFIG_MMCSD_NSLOTS || (unsigned)minor > 255 ||
+      spi == NULL)
     {
       ferr("ERROR: Invalid arguments\n");
       return -EINVAL;
diff --git a/drivers/mtd/filemtd.c b/drivers/mtd/filemtd.c
index ed9eb2c..252d50a 100644
--- a/drivers/mtd/filemtd.c
+++ b/drivers/mtd/filemtd.c
@@ -56,6 +56,7 @@
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
+
 /* Configuration ************************************************************/
 
 #ifndef CONFIG_FILEMTD_BLOCKSIZE
@@ -383,9 +384,9 @@ static ssize_t filemtd_byteread(FAR struct mtd_dev_s *dev, off_t offset,
   /* Don't let read read past end of buffer */
 
   if (offset + nbytes > priv->nblocks * priv->erasesize)
-   {
-     return 0;
-   }
+    {
+      return 0;
+    }
 
   filemtd_read(priv, buf, offset, nbytes);
   return nbytes;
@@ -438,8 +439,8 @@ static int filemtd_ioctl(FAR struct mtd_dev_s *dev, int cmd,
 
           if (geo)
             {
-              /* Populate the geometry structure with information need to know
-               * the capacity and how to access the device.
+              /* Populate the geometry structure with information need to
+               * know the capacity and how to access the device.
                */
 
               geo->blocksize    = priv->blocksize;
@@ -486,8 +487,9 @@ static int filemtd_ioctl(FAR struct mtd_dev_s *dev, int cmd,
  *
  ****************************************************************************/
 
-FAR struct mtd_dev_s *blockmtd_initialize(FAR const char *path, size_t offset,
-                                          size_t mtdlen, int16_t sectsize,
+FAR struct mtd_dev_s *blockmtd_initialize(FAR const char *path,
+                                          size_t offset, size_t mtdlen,
+                                          int16_t sectsize,
                                           int32_t erasesize)
 {
   FAR struct file_dev_s *priv;
diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c
index 8700c13..bc2d863 100644
--- a/drivers/mtd/smart.c
+++ b/drivers/mtd/smart.c
@@ -117,12 +117,14 @@
 #define SMART_PARTNAME_SIZE         4
 
 #define SMART_FIRST_DIR_SECTOR      3       /* First root directory sector */
-#define SMART_FIRST_ALLOC_SECTOR    12      /* First logical sector number we will
-                                             * use for assignment of requested alloc
-                                             * sectors. All entries below this are
-                                             * reserved (some for root dir entries,
-                                             * other for our use, such as format
-                                             * sector, etc. */
+#define SMART_FIRST_ALLOC_SECTOR    12      /* First logical sector number
+                                             * we will use for assignment
+                                             * of requested alloc sectors.
+                                             * All entries below this are
+                                             * reserved (some for root dir
+                                             * entries other for our use
+                                             * such as format, sector,
+                                             * etc.) */
 
 #if defined(CONFIG_MTD_SMART_READAHEAD) || (defined(CONFIG_DRVR_WRITABLE) && \
     defined(CONFIG_MTD_SMART_WRITEBUFFER))
@@ -252,7 +254,7 @@ struct smart_struct_s
   FAR uint8_t          *releasecount;     /* Count of released sectors per erase block */
   FAR uint8_t          *freecount;        /* Count of free sectors per erase block */
   FAR char             *rwbuffer;         /* Our sector read/write buffer */
-  char                  partname[SMART_PARTNAME_SIZE]; /* Optional partition name */
+  char                  partname[SMART_PARTNAME_SIZE];
   uint8_t               formatversion;    /* Format version on the device */
   uint8_t               formatstatus;     /* Indicates the status of the device format */
   uint8_t               namesize;         /* Length of filenames on this device */
@@ -375,27 +377,27 @@ typedef uint32_t crc_t;
 #if defined(CONFIG_MTD_SMART_ENABLE_CRC) && defined(CONFIG_SMART_CRC_32)
 struct smart_chain_header_s
 {
-  uint8_t           nextsector[4];/* Next logical sector in the chain */
-  uint8_t           used[4];      /* Number of bytes used in this sector */
-  uint8_t           type;         /* Type of sector entry (file or dir) */
+  uint8_t           nextsector[4]; /* Next logical sector in the chain */
+  uint8_t           used[4];       /* Number of bytes used in this sector */
+  uint8_t           type;          /* Type of sector entry (file or dir) */
 };
 #else
 struct smart_chain_header_s
 {
-  uint8_t           type;         /* Type of sector entry (file or dir) */
-  uint8_t           nextsector[2];/* Next logical sector in the chain */
-  uint8_t           used[2];      /* Number of bytes used in this sector */
+  uint8_t           type;          /* Type of sector entry (file or dir) */
+  uint8_t           nextsector[2]; /* Next logical sector in the chain */
+  uint8_t           used[2];       /* Number of bytes used in this sector */
 };
 #endif
 
 struct smart_entry_header_s
 {
-  uint16_t          flags;        /* Flags, including permissions:
-                                   *  15:   Empty entry
-                                   *  14:   Active entry
-                                   *  12-0: Permissions bits */
-  int16_t           firstsector;  /* Sector number of the name */
-  uint32_t          utc;          /* Time stamp */
+  uint16_t          flags;         /* Flags, including permissions:
+                                    *  15:   Empty entry
+                                    *  14:   Active entry
+                                    *  12-0: Permissions bits */
+  int16_t           firstsector;   /* Sector number of the name */
+  uint32_t          utc;           /* Time stamp */
 };
 
 /****************************************************************************
@@ -408,40 +410,47 @@ static ssize_t smart_reload(struct smart_struct_s *dev, FAR uint8_t *buffer,
                  off_t startblock, size_t nblocks);
 static ssize_t smart_read(FAR struct inode *inode, unsigned char *buffer,
                  size_t start_sector, unsigned int nsectors);
-static ssize_t smart_write(FAR struct inode *inode, const unsigned char *buffer,
-                 size_t start_sector, unsigned int nsectors);
-static int     smart_geometry(FAR struct inode *inode, struct geometry *geometry);
-static int     smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg);
+static ssize_t smart_write(FAR struct inode *inode,
+                 FAR const unsigned char *buffer, size_t start_sector,
+                 unsigned int nsectors);
+static int     smart_geometry(FAR struct inode *inode,
+                 FAR struct geometry *geometry);
+static int     smart_ioctl(FAR struct inode *inode, int cmd,
+                 unsigned long arg);
 
 static int     smart_findfreephyssector(FAR struct smart_struct_s *dev,
                                         uint8_t canrelocate);
 
-static int smart_writesector(FAR struct smart_struct_s *dev, unsigned long arg);
+static int     smart_writesector(FAR struct smart_struct_s *dev,
+                 unsigned long arg);
 static inline int smart_allocsector(FAR struct smart_struct_s *dev,
                  unsigned long requested);
-static int smart_readsector(FAR struct smart_struct_s *dev, unsigned long arg);
+static int     smart_readsector(FAR struct smart_struct_s *dev,
+                 unsigned long arg);
 
 #ifdef CONFIG_MTD_SMART_ENABLE_CRC
-static int smart_validate_crc(FAR struct smart_struct_s *dev);
+static int     smart_validate_crc(FAR struct smart_struct_s *dev);
 #endif
 #ifdef CONFIG_MTD_SMART_WEAR_LEVEL
-static int smart_read_wearstatus(FAR struct smart_struct_s *dev);
-static int smart_relocate_static_data(FAR struct smart_struct_s *dev, uint16_t block);
+static int     smart_read_wearstatus(FAR struct smart_struct_s *dev);
+static int     smart_relocate_static_data(FAR struct smart_struct_s *dev,
+                 uint16_t block);
 #endif
 
-static int smart_relocate_sector(FAR struct smart_struct_s *dev,
+static int     smart_relocate_sector(FAR struct smart_struct_s *dev,
                  uint16_t oldsector, uint16_t newsector);
 
 #ifdef CONFIG_MTD_SMART_FSCK
-static int smart_fsck(FAR struct smart_struct_s *dev);
+static int     smart_fsck(FAR struct smart_struct_s *dev);
 #endif
 
 #ifdef CONFIG_SMART_DEV_LOOP
 static ssize_t smart_loop_read(FAR struct file *filep, FAR char *buffer,
                  size_t buflen);
-static ssize_t smart_loop_write(FAR struct file *filep, FAR const char *buffer,
-                 size_t buflen);
-static int     smart_loop_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
+static ssize_t smart_loop_write(FAR struct file *filep,
+                 FAR const char *buffer, size_t buflen);
+static int     smart_loop_ioctl(FAR struct file *filep, int cmd,
+                 unsigned long arg);
 #endif /* CONFIG_SMART_DEV_LOOP */
 
 /****************************************************************************
@@ -625,15 +634,17 @@ static void smart_set_count(FAR struct smart_struct_s *dev,
 
       if (block & 0x01)
         {
-          pcount[block >> 1] = (pcount[block >> 1] & 0xf0) | (count & 0x0f);
+          pcount[block >> 1] = (pcount[block >> 1] & 0xf0) |
+                               (count & 0x0f);
         }
       else
         {
-          pcount[block >> 1] = (pcount[block >> 1] & 0x0f) | ((count & 0x0f) << 4);
+          pcount[block >> 1] = (pcount[block >> 1] & 0x0f) |
+                               ((count & 0x0f) << 4);
         }
 
-      /* If we have 16 sectors per block, then the upper bit (representing 16)
-       * all get packed into shared bytes.
+      /* If we have 16 sectors per block, then the upper bit (representing
+       * 16) all get packed into shared bytes.
        */
 
       if (dev->sectorsperblk == 16)
@@ -684,8 +695,8 @@ static uint8_t smart_get_count(FAR struct smart_struct_s *dev,
           count = pcount[block >> 1] >> 4;
         }
 
-      /* If we have 16 sectors per block, then the upper bit (representing 16)
-       * all get packed into shared bytes.
+      /* If we have 16 sectors per block, then the upper bit (representing
+       * 16) all get packed into shared bytes.
        */
 
       if (dev->sectorsperblk == 16)
@@ -731,9 +742,11 @@ static void smart_add_count(struct smart_struct_s *dev, uint8_t *pcount,
 #ifdef CONFIG_SMART_LOCAL_CHECKFREE
 int smart_checkfree(FAR struct smart_struct_s *dev, int lineno)
 {
-  uint16_t        x, freecount;
+  uint16_t        x;
+  uint16_t        freecount;
 #ifdef CONFIG_DEBUG_FS
-  uint16_t        blockfree, blockrelease;
+  uint16_t        blockfree;
+  uint16_t        blockrelease;
   static uint16_t prev_freesectors = 0;
   static uint16_t prev_releasesectors = 0;
   static uint8_t  *prev_freecount = NULL;
@@ -790,8 +803,8 @@ int smart_checkfree(FAR struct smart_struct_s *dev, int lineno)
             }
         }
 
-      /* Modify the freesector count to reflect the actual calculated freecount
-       * to get us back in line.
+      /* Modify the freesector count to reflect the actual calculated
+       * freecount to get us back in line.
        */
 
       dev->freesectors = freecount;
@@ -914,7 +927,8 @@ static ssize_t smart_write(FAR struct inode *inode,
   size_t remaining;
   size_t nxfrd;
   int    ret;
-  off_t  mtdstartblock, mtdblockcount;
+  off_t  mtdstartblock;
+  off_t  mtdblockcount;
 
   finfo("sector: %d nsectors: %d\n", start_sector, nsectors);
 
@@ -1183,15 +1197,17 @@ static int smart_setsectorsize(FAR struct smart_struct_s *dev, uint16_t size)
 
 #ifndef CONFIG_MTD_SMART_MINIMIZE_RAM
   allocsize = dev->neraseblocks << 1;
-  dev->smap = (FAR uint16_t *) smart_malloc(dev, totalsectors * sizeof(uint16_t) +
-              allocsize, "Sector map");
+  dev->smap = (FAR uint16_t *)
+    smart_malloc(dev, totalsectors * sizeof(uint16_t) + allocsize,
+                 "Sector map");
   if (!dev->smap)
     {
       ferr("ERROR: Error allocating SMART virtual map buffer\n");
       goto errexit;
     }
 
-  dev->releasecount = (FAR uint8_t *) dev->smap + (totalsectors * sizeof(uint16_t));
+  dev->releasecount = (FAR uint8_t *) dev->smap +
+                      (totalsectors * sizeof(uint16_t));
   dev->freecount = dev->releasecount + dev->neraseblocks;
 #else
   dev->sbitmap = (FAR uint8_t *)
@@ -1411,7 +1427,8 @@ static ssize_t smart_bytewrite(FAR struct smart_struct_s *dev, size_t offset,
 
       /* Write the data back to the device */
 
-      ret = MTD_BWRITE(dev->mtd, startblock, nblocks, (FAR uint8_t *) dev->rwbuffer);
+      ret = MTD_BWRITE(dev->mtd, startblock, nblocks,
+                       (FAR uint8_t *) dev->rwbuffer);
       if (ret < 0)
         {
           ferr("ERROR: Error %d writing to device\n", -ret);
@@ -1442,8 +1459,9 @@ errout:
 static int smart_add_sector_to_cache(FAR struct smart_struct_s *dev,
             uint16_t logical, uint16_t physical, int line)
 {
-  uint16_t    index, x;
-  uint16_t    oldest;
+  uint16_t index;
+  uint16_t x;
+  uint16_t oldest;
 
   /* If we aren't full yet, just add the sector to the end of the list */
 
@@ -1512,16 +1530,21 @@ static int smart_add_sector_to_cache(FAR struct smart_struct_s *dev,
  *              If the sector is in the cache, then update the hitcount and
  *              return the physical mapping.  If a cache miss occurs, then
  *              the routine will scan the volume to find the logical sector
- *              and add / replace a cache entry with the newly located sector.
+ *              and add / replace a cache entry with the newly located
+ *              sector.
  *
  ****************************************************************************/
 
 #ifdef CONFIG_MTD_SMART_MINIMIZE_RAM
-static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev, uint16_t logical)
+static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev,
+                                   uint16_t logical)
 {
   int       ret;
-  uint16_t  block, sector;
-  uint16_t  x, physical, logicalsector;
+  uint16_t  block;
+  uint16_t  sector;
+  uint16_t  x;
+  uint16_t  physical;
+  uint16_t  logicalsector;
   struct    smart_sect_header_s header;
   size_t    readaddress;
 
@@ -1560,7 +1583,9 @@ static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev, uint16_t logi
        * numbers in each erase block first.
        */
 
-      for (sector = 0; sector < dev->availsectperblk && physical == 0xffff; sector++)
+      for (sector = 0;
+           sector < dev->availsectperblk && physical == 0xffff;
+           sector++)
         {
           /* Now scan across each erase block */
 
@@ -1574,7 +1599,8 @@ static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev, uint16_t logi
               /* Read the header for this sector */
 
               ret = MTD_READ(dev->mtd, readaddress,
-                  sizeof(struct smart_sect_header_s), (FAR uint8_t *) &header);
+                             sizeof(struct smart_sect_header_s),
+                             (FAR uint8_t *) &header);
               if (ret != sizeof(struct smart_sect_header_s))
                 {
                   goto err_out;
@@ -1606,7 +1632,8 @@ static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev, uint16_t logi
                   continue;
                 }
 
-              if ((header.status & SMART_STATUS_VERBITS) != SMART_STATUS_VERSION)
+              if ((header.status & SMART_STATUS_VERBITS) !=
+                  SMART_STATUS_VERSION)
                 {
                   continue;
                 }
@@ -1618,7 +1645,8 @@ static uint16_t smart_cache_lookup(FAR struct smart_struct_s *dev, uint16_t logi
                   /* This is the sector we are looking for!  Add it to the cache */
 
                   physical = block * dev->sectorsperblk + sector;
-                  smart_add_sector_to_cache(dev, logical, physical, __LINE__);
+                  smart_add_sector_to_cache(dev, logical, physical,
+                                            __LINE__);
                   break;
                 }
             }
@@ -1701,9 +1729,10 @@ static void smart_update_cache(FAR struct smart_struct_s *dev, uint16_t
  ****************************************************************************/
 
 #ifdef CONFIG_MTD_SMART_WEAR_LEVEL
-static uint8_t smart_get_wear_level(FAR struct smart_struct_s *dev, uint16_t block)
+static uint8_t smart_get_wear_level(FAR struct smart_struct_s *dev,
+                                    uint16_t block)
 {
-  uint8_t   bits;
+  uint8_t bits;
 
   bits = dev->wearstatus[block >> SMART_WEAR_BIT_DIVIDE];
   if (block & 0x01)
@@ -1730,8 +1759,8 @@ static uint8_t smart_get_wear_level(FAR struct smart_struct_s *dev, uint16_t blo
  *
  * Description: Find the minimum and maximum wear levels.  This is used when
  *              we increment the wear level of a minimum value block so that
- *              we can detect if a new minimum exists and perform normalization
- *              of the wear-levels.
+ *              we can detect if a new minimum exists and perform
+ *              normalization of the wear-levels.
  *
  ****************************************************************************/
 
@@ -1801,10 +1830,11 @@ static void smart_find_wear_minmax(FAR struct smart_struct_s *dev)
  ****************************************************************************/
 
 #ifdef CONFIG_MTD_SMART_WEAR_LEVEL
-static int smart_set_wear_level(FAR struct smart_struct_s *dev, uint16_t block,
-                                uint8_t level)
+static int smart_set_wear_level(FAR struct smart_struct_s *dev,
+                                uint16_t block, uint8_t level)
 {
-  uint8_t   bits, oldlevel;
+  uint8_t bits;
+  uint8_t oldlevel;
 
   /* Get the old wear level to test if we need to update min / max */
 
@@ -1891,7 +1921,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
   int       sector;
   int       ret;
   uint16_t  totalsectors;
-  uint16_t  sectorsize, prerelease;
+  uint16_t  sectorsize;
+  uint16_t  prerelease;
   uint16_t  logicalsector;
   uint16_t  winner;
   uint16_t  loser;
@@ -1937,7 +1968,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
         {
           /* Read the next sector from the device */
 
-          ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s),
+          ret = MTD_READ(dev->mtd, readaddress,
+                         sizeof(struct smart_sect_header_s),
                          (FAR uint8_t *) &header);
           if (ret != sizeof(struct smart_sect_header_s))
             {
@@ -1946,7 +1978,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
 
           if (header.status != CONFIG_SMARTFS_ERASEDSTATE)
             {
-              sectorsize = sizetbl[(header.status & SMART_STATUS_SIZEBITS) >> 2];
+              sectorsize =
+                sizetbl[(header.status & SMART_STATUS_SIZEBITS) >> 2];
               break;
             }
 
@@ -1998,7 +2031,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
         }
 
 #ifdef CONFIG_MTD_SMART_PACK_COUNTS
-      smart_set_count(dev, dev->freecount, sector, dev->availsectperblk - prerelease);
+      smart_set_count(dev, dev->freecount, sector,
+                      dev->availsectperblk - prerelease);
       smart_set_count(dev, dev->releasecount, sector, prerelease);
 #else
       dev->freecount[sector] = dev->availsectperblk - prerelease;
@@ -2037,8 +2071,9 @@ static int smart_scan(FAR struct smart_struct_s *dev)
 
       /* Read the header for this sector */
 
-      ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s),
-                     (FAR uint8_t *) &header);
+      ret = MTD_READ(dev->mtd, readaddress,
+                     sizeof(struct smart_sect_header_s),
+                     (FAR uint8_t *)&header);
       if (ret != sizeof(struct smart_sect_header_s))
         {
           goto err_out;
@@ -2086,7 +2121,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
 
           dev->releasesectors++;
 #ifdef CONFIG_MTD_SMART_PACK_COUNTS
-          smart_add_count(dev, dev->releasecount, sector / dev->sectorsperblk, 1);
+          smart_add_count(dev, dev->releasecount,
+                          sector / dev->sectorsperblk, 1);
 #else
           dev->releasecount[sector / dev->sectorsperblk]++;
 #endif
@@ -2156,13 +2192,14 @@ static int smart_scan(FAR struct smart_struct_s *dev)
             {
               if (dev->partname[0] != '\0')
                 {
-                  snprintf(dev->rwbuffer, sizeof(devname), "/dev/smart%d%sd%d",
-                          dev->minor, dev->partname, x + 1);
+                  snprintf(dev->rwbuffer, sizeof(devname),
+                           "/dev/smart%d%sd%d",
+                           dev->minor, dev->partname, x + 1);
                 }
               else
                 {
-                  snprintf(devname, sizeof(devname), "/dev/smart%dd%d", dev->minor,
-                           x + 1);
+                  snprintf(devname, sizeof(devname), "/dev/smart%dd%d",
+                           dev->minor, x + 1);
                 }
 
               /* Inode private data is a reference to a struct containing
@@ -2182,9 +2219,12 @@ static int smart_scan(FAR struct smart_struct_s *dev)
 
               rootdirdev->dev = dev;
               rootdirdev->rootdirnum = x;
-              ret = register_blockdriver(dev->rwbuffer, &g_bops, 0, rootdirdev);
+              ret = register_blockdriver(dev->rwbuffer, &g_bops, 0,
+                                         rootdirdev);
 
-              /* Inode private data is a reference to the SMART device structure */
+              /* Inode private data is a reference to the SMART device
+               * structure.
+               */
 
               ret = register_blockdriver(devname, &g_bops, 0, rootdirdev);
             }
@@ -2232,7 +2272,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
             {
               /* Calculate the read address for this sector */
 
-              readaddress = dupsector * dev->mtdblkspersector * dev->geo.blocksize;
+              readaddress = dupsector * dev->mtdblkspersector *
+                            dev->geo.blocksize;
 
               /* Read the header for this sector */
 
@@ -2271,7 +2312,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
                   continue;
                 }
 
-              if ((header.status & SMART_STATUS_VERBITS) != SMART_STATUS_VERSION)
+              if ((header.status & SMART_STATUS_VERBITS) !=
+                  SMART_STATUS_VERSION)
                 {
                   continue;
                 }
@@ -2285,8 +2327,9 @@ static int smart_scan(FAR struct smart_struct_s *dev)
             }
 #endif
 
-          ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s),
-                  (FAR uint8_t *) &header);
+          ret = MTD_READ(dev->mtd, readaddress,
+                         sizeof(struct smart_sect_header_s),
+                         (FAR uint8_t *) &header);
           if (ret != sizeof(struct smart_sect_header_s))
             {
               goto err_out;
@@ -2340,7 +2383,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
           /* Check CRC of the winner sector just in case */
 
           ret = MTD_BREAD(dev->mtd, winner * dev->mtdblkspersector,
-                          dev->mtdblkspersector, (FAR uint8_t *) dev->rwbuffer);
+                          dev->mtdblkspersector,
+                          (FAR uint8_t *) dev->rwbuffer);
           if (ret == dev->mtdblkspersector)
             {
               /* Validate the CRC of the read-back data */
@@ -2350,9 +2394,9 @@ static int smart_scan(FAR struct smart_struct_s *dev)
 
           if (ret != OK)
             {
-              /* The winner sector has CRC error, so we select the loser sector.
-               * After swapping the winner and the loser sector, we will release
-               * the loser sector with CRC error.
+              /* The winner sector has CRC error, so we select the loser
+               * sector.  After swapping the winner and the loser sector, we
+               * will release the loser sector with CRC error.
                */
 
               if (sector == winner)
@@ -2381,8 +2425,9 @@ static int smart_scan(FAR struct smart_struct_s *dev)
           /* Now release the loser sector */
 
           readaddress = loser  * dev->mtdblkspersector * dev->geo.blocksize;
-          ret = MTD_READ(dev->mtd, readaddress, sizeof(struct smart_sect_header_s),
-                  (FAR uint8_t *) &header);
+          ret = MTD_READ(dev->mtd, readaddress,
+                         sizeof(struct smart_sect_header_s),
+                        (FAR uint8_t *)&header);
           if (ret != sizeof(struct smart_sect_header_s))
             {
               goto err_out;
@@ -2393,8 +2438,9 @@ static int smart_scan(FAR struct smart_struct_s *dev)
 #else
           header.status |= SMART_STATUS_RELEASED;
 #endif
-          offset = readaddress + offsetof(struct smart_sect_header_s, status);
-          ret = smart_bytewrite(dev, offset, 1, &header.status);
+          offset = readaddress +
+                   offsetof(struct smart_sect_header_s, status);
+          ret    = smart_bytewrite(dev, offset, 1, &header.status);
           if (ret < 0)
             {
               ferr("ERROR: Error %d releasing duplicate sector\n", -ret);
@@ -2490,8 +2536,10 @@ static int smart_scan(FAR struct smart_struct_s *dev)
 #else
           smart_update_cache(dev, 0, newsector);
 #ifdef CONFIG_MTD_SMART_PACK_COUNTS
-          smart_add_count(dev, dev->freecount, newsector / dev->sectorsperblk, -1);
-          smart_add_count(dev, dev->releasecount, sector / dev->sectorsperblk, 1);
+          smart_add_count(dev, dev->freecount,
+                          newsector / dev->sectorsperblk, -1);
+          smart_add_count(dev, dev->releasecount,
+                          sector / dev->sectorsperblk, 1);
 #endif
 #endif
         }
@@ -2531,7 +2579,8 @@ static int smart_scan(FAR struct smart_struct_s *dev)
     {
       if (dev->alloc[sector].ptr != NULL)
         {
-          finfo("       %s: %d\n", dev->alloc[sector].name, dev->alloc[sector].size);
+          finfo("       %s: %d\n",
+                dev->alloc[sector].name, dev->alloc[sector].size);
         }
     }
 #endif
@@ -2593,10 +2642,10 @@ static inline int smart_getformat(FAR struct smart_struct_s *dev,
     }
 
   fmt->sectorsize      = dev->sectorsize;
-  fmt->availbytes      = dev->sectorsize - sizeof(struct smart_sect_header_s);
+  fmt->availbytes      = dev->sectorsize -
+                         sizeof(struct smart_sect_header_s);
   fmt->nsectors        = dev->totalsectors;
-
-  fmt->nfreesectors = dev->freesectors;
+  fmt->nfreesectors    = dev->freesectors;
   fmt->namesize        = dev->namesize;
 #ifdef CONFIG_SMARTFS_MULTI_ROOT_DIRS
   fmt->nrootdirentries = dev->rootdirentries;
@@ -2687,11 +2736,11 @@ static void smart_erase_block_if_empty(FAR struct smart_struct_s *dev,
       dev->freecount[block] = dev->availsectperblk - prerelease;
 #endif
 
-      /* Now that we have erased this block and updated the release / free counts,
-       * if we are in WEAR LEVELING enabled mode, we must check if this erase block's
-       * wear level has reached the threshold to warrant moving a minimum wear level
-       * block's data into it (i.e. relocating static data to this block so it will
-       * be worn less).
+      /* Now that we have erased this block and updated the release / free
+       * counts, if we are in WEAR LEVELING enabled mode, we must check if
+       * this erase block's wear level has reached the threshold to warrant
+       * moving a minimum wear level block's data into it (i.e. relocating
+       * static data to this block so it will be worn less).
        */
 
 #ifdef CONFIG_MTD_SMART_WEAR_LEVEL
@@ -2720,7 +2769,8 @@ static void smart_erase_block_if_empty(FAR struct smart_struct_s *dev,
  ****************************************************************************/
 
 #ifdef CONFIG_MTD_SMART_WEAR_LEVEL
-static int smart_relocate_static_data(FAR struct smart_struct_s *dev, uint16_t block)
+static int smart_relocate_static_data(FAR struct smart_struct_s *dev,
+                                      uint16_t block)
 {
   uint16_t    freecount, x, sector, minblock;
   uint16_t    nextsector, newsector, mincount;
@@ -2730,11 +2780,11 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, uint16_t b
   FAR struct smart_allocsector_s *allocsector;
 #endif
 
-  /* Now that we have erased this block and updated the release / free counts,
-   * if we are in WEAR LEVELING enabled mode, we must check if this erase block's
-   * wear level has reached the threshold to warrant moving a minimum wear level
-   * block's data into it (i.e. relocating static data to this block so it will
-   * be worn less).
+  /* Now that we have erased this block and updated the release / free
+   * counts, if we are in WEAR LEVELING enabled mode, we must check if this
+   * erase block's wear level has reached the threshold to warrant moving a
+   * minimum wear level block's data into it (i.e. relocating static data to
+   * this block so it will be worn less).
    */
 
   ret = OK;
@@ -2791,8 +2841,9 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, uint16_t b
 
               if (freecount == 0)
                 {
-                  /* We found a minimum wear-level block with no free sectors.
-                   * relocate this block to the more highly worn block.
+                  /* We found a minimum wear-level block with no free
+                   * sectors.  relocate this block to the more highly worn
+                   * block.
                    */
 
                   break;
@@ -2819,10 +2870,11 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, uint16_t b
       nextsector = dev->freecount[x];
       newsector = dev->releasecount[x];
 #endif
-      finfo("Moving block %d, wear %d, free %d, released %d to block %d, wear %d\n",
-              x, smart_get_wear_level(dev, x),
-              nextsector, newsector,
-              block, smart_get_wear_level(dev, block));
+      finfo("Moving block %d, wear %d, free %d, "
+            "released %d to block %d, wear %d\n",
+            x, smart_get_wear_level(dev, x),
+            nextsector, newsector,
+            block, smart_get_wear_level(dev, block));
 
       nextsector = block * dev->sectorsperblk;
       for (sector = x * dev->sectorsperblk; sector <
@@ -2878,7 +2930,8 @@ static int smart_relocate_static_data(FAR struct smart_struct_s *dev, uint16_t b
               /* Update the temporary allocation's physical sector */
 
               allocsector->physical = newsector;
-              *((FAR uint16_t *) header->logicalsector) = allocsector->logical;
+              *((FAR uint16_t *) header->logicalsector) =
+                allocsector->logical;
             }
           else
 #endif
@@ -2992,8 +3045,8 @@ static crc_t smart_calc_sector_crc(FAR struct smart_struct_s *dev)
 
   /* Add status and seq to the CRC calculation */
 
-  crc = crc16part((uint8_t *) &dev->rwbuffer[offsetof(struct smart_sect_header_s,
-        status)], 2, crc);
+  crc = crc16part((uint8_t *)
+    &dev->rwbuffer[offsetof(struct smart_sect_header_s, status)], 2, crc);
 
 #elif defined(CONFIG_SMART_CRC_32)
   /* Calculate CRC on data region of the sector */
@@ -3028,7 +3081,8 @@ static crc_t smart_calc_sector_crc(FAR struct smart_struct_s *dev)
  *
  ****************************************************************************/
 
-static inline int smart_llformat(FAR struct smart_struct_s *dev, unsigned long arg)
+static inline int smart_llformat(FAR struct smart_struct_s *dev,
+                                 unsigned long arg)
 {
   FAR struct  smart_sect_header_s  *sectorheader;
   size_t      wrcount;
@@ -3061,10 +3115,14 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, unsigned long a
     {
       dev->erasesize = dev->geo.erasesize;
 
-      ferr("ERROR:  Invalid geometery ... Sectors per erase block must be 1-256\n");
-      ferr("        Erase block size    = %d\n", dev->erasesize);
-      ferr("        Sector size         = %d\n", dev->sectorsize);
-      ferr("        Sectors/erase block = %d\n", dev->erasesize / dev->sectorsize);
+      ferr("ERROR:  Invalid geometery ... "
+          "Sectors per erase block must be 1-256\n");
+      ferr("        Erase block size    = %d\n",
+           dev->erasesize);
+      ferr("        Sector size         = %d\n",
+           dev->sectorsize);
+      ferr("        Sectors/erase block = %d\n",
+           dev->erasesize / dev->sectorsize);
 
       return -EINVAL;
     }
@@ -3106,17 +3164,20 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, unsigned long a
 
 #if ( CONFIG_SMARTFS_ERASEDSTATE == 0xff )
   *((FAR uint16_t *) sectorheader->logicalsector) = 0;
-  sectorheader->status = (uint8_t) ~(SMART_STATUS_COMMITTED | SMART_STATUS_VERBITS |
-          SMART_STATUS_SIZEBITS) | SMART_STATUS_VERSION |
-          sectsize;
+  sectorheader->status = (uint8_t)~(SMART_STATUS_COMMITTED |
+                                    SMART_STATUS_VERBITS |
+                                    SMART_STATUS_SIZEBITS) |
+                                    SMART_STATUS_VERSION |
+                                    sectsize;
 #ifdef CONFIG_MTD_SMART_ENABLE_CRC
   sectorheader->status &= ~SMART_STATUS_CRC;
 #endif /* CONFIG_MTD_SMART_ENABLE_CRC */
 
 #else   /* CONFIG_SMARTFS_ERASEDSTATE == 0xff */
   *((FAR uint16_t *) sectorheader->logicalsector) = 0xffff;
-  sectorheader->status = (uint8_t) (SMART_STATUS_COMMITTED | SMART_STATUS_VERSION |
-          sectsize);
+  sectorheader->status = (uint8_t)(SMART_STATUS_COMMITTED |
+                                   SMART_STATUS_VERSION |
+                                   sectsize);
 #ifdef CONFIG_MTD_SMART_ENABLE_CRC
   sectorheader->status |= SMART_STATUS_CRC;
 #endif /* CONFIG_MTD_SMART_ENABLE_CRC */
@@ -3193,7 +3254,8 @@ static inline int smart_llformat(FAR struct smart_struct_s *dev, unsigned long a
 
 #ifdef CONFIG_MTD_SMART_PACK_COUNTS
       smart_set_count(dev, dev->releasecount, x, prerelease);
-      smart_set_count(dev, dev->freecount, x, dev->availsectperblk - prerelease);
+      smart_set_count(dev, dev->freecount, x,
+                      dev->availsectperblk - prerelease);
 #else
       dev->releasecount[x] = prerelease;
       dev->freecount[x] = dev->availsectperblk - prerelease;
@@ -3352,9 +3414,11 @@ static int smart_relocate_sector(FAR struct smart_struct_s *dev,
   /* Release the old physical sector */
 
 #if CONFIG_SMARTFS_ERASEDSTATE == 0xff
-  newstatus = header->status & ~(SMART_STATUS_RELEASED | SMART_STATUS_COMMITTED);
+  newstatus = header->status & ~(SMART_STATUS_RELEASED |
+                                 SMART_STATUS_COMMITTED);
 #else
-  newstatus = header->status | SMART_STATUS_RELEASED | SMART_STATUS_COMMITTED;
+  newstatus = header->status | SMART_STATUS_RELEASED |
+              SMART_STATUS_COMMITTED;
 #endif
   offset = oldsector * dev->mtdblkspersector * dev->geo.blocksize +
       offsetof(struct smart_sect_header_s, status);
@@ -3377,7 +3441,8 @@ errout:
  *
  ****************************************************************************/
 
-static int smart_relocate_block(FAR struct smart_struct_s *dev, uint16_t block)
+static int smart_relocate_block(FAR struct smart_struct_s *dev,
+                                uint16_t block)
 {
   uint16_t    newsector, oldrelease;
   int         x;
@@ -3420,7 +3485,8 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, uint16_t block)
 
   if (freecount >= dev->freesectors)
     {
-      ferr("ERROR: Program bug!  Relocating the only block (%d) with free sectors!\n",
+      ferr("ERROR: Program bug!  "
+           "Relocating the only block (%d) with free sectors!\n",
            block);
       ret = -EIO;
       goto errout;
@@ -3531,11 +3597,13 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, uint16_t block)
 #ifndef CONFIG_MTD_SMART_MINIMIZE_RAM
       dev->smap[*((FAR uint16_t *) header->logicalsector)] = newsector;
 #else
-      smart_update_cache(dev, *((FAR uint16_t *) header->logicalsector), newsector);
+      smart_update_cache(dev, *((FAR uint16_t *) header->logicalsector),
+                         newsector);
 #endif
 
 #ifdef CONFIG_MTD_SMART_PACK_COUNTS
-      smart_add_count(dev, dev->freecount, newsector / dev->sectorsperblk, -1);
+      smart_add_count(dev, dev->freecount, newsector / dev->sectorsperblk,
+                      -1);
 #else
       dev->freecount[newsector / dev->sectorsperblk]--;
 #endif
@@ -3582,7 +3650,8 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, uint16_t block)
   oldrelease               = smart_get_count(dev, dev->releasecount, block);
   dev->freesectors        += oldrelease - prerelease;
   dev->releasesectors     -= oldrelease - prerelease;
-  smart_set_count(dev, dev->freecount, block, dev->availsectperblk - prerelease);
+  smart_set_count(dev, dev->freecount, block,
+                  dev->availsectperblk - prerelease);
   smart_set_count(dev, dev->releasecount, block, prerelease);
 #else
   oldrelease               = dev->releasecount[block];
@@ -3595,7 +3664,8 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, uint16_t block)
 #ifdef CONFIG_SMART_LOCAL_CHECKFREE
   if (smart_checkfree(dev, __LINE__) != OK)
     {
-      fwarn("   ...while relocating block %d, free=%d, release=%d, oldrelease=%d\n",
+      fwarn("   ...while relocating block %d, "
+            "free=%d, release=%d, oldrelease=%d\n",
             block, freecount, releasecount, oldrelease);
     }
 #endif
@@ -3694,8 +3764,8 @@ retry:
 
           if (count > wornfreecount || (count > 0 && wearlevel < wornlevel))
             {
-              /* Keep track of this block.  If there are only worn blocks with
-               * free sectors left, then we will use it.
+              /* Keep track of this block.  If there are only worn blocks
+               * with free sectors left, then we will use it.
                */
 
               if (i < dev->neraseblocks - 1 || !wornfreecount)
@@ -3744,12 +3814,13 @@ retry:
           block = 0;
           for (i = 0; i < 8; )
             {
-              if (smart_get_wear_level(dev, block) < SMART_WEAR_FORCE_REORG_THRESHOLD)
+              if (smart_get_wear_level(dev, block) <
+                  SMART_WEAR_FORCE_REORG_THRESHOLD)
                 {
                   if (smart_relocate_block(dev, block) < 0)
                     {
-                      ferr("ERROR: Error relocating block while finding free "
-                           "phys sector\n");
+                      ferr("ERROR: Error relocating block while finding "
+                           "free phys sector\n");
                       return -1;
                     }
 
@@ -3872,7 +3943,8 @@ retry:
         {
           /* The FLASH may be not erased in the initial delivery state.
            * Just in case for the recovery of this fatal situation,
-           * after once erasing the sector, return the sector as a free sector.
+           * after once erasing the sector, return the sector as a free
+           * sector.
            */
 
           if (1 == dev->availsectperblk)
@@ -4098,7 +4170,8 @@ static int smart_write_wearstatus(struct smart_struct_s *dev)
           sizeof(struct smart_sect_header_s)))
         {
           towrite = dev->sectorsize -
-                    (SMARTFS_FMT_WEAR_POS + sizeof(struct smart_sect_header_s));
+                    (SMARTFS_FMT_WEAR_POS +
+                     sizeof(struct smart_sect_header_s));
         }
 
       /* Setup the sector write request (we are our own client) */
@@ -4130,7 +4203,8 @@ static int smart_write_wearstatus(struct smart_struct_s *dev)
             {
               /* Error, wear status bit too large! */
 
-              ferr("ERROR: Invalid geometry - wear level status too large\n");
+              ferr("ERROR: Invalid geometry "
+                   "- wear level status too large\n");
               ret = -EINVAL;
               goto errout;
             }
@@ -4216,16 +4290,18 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev)
           (SMARTFS_FMT_WEAR_POS + sizeof(struct smart_sect_header_s)))
         {
           toread = dev->sectorsize -
-                   (SMARTFS_FMT_WEAR_POS + sizeof(struct smart_sect_header_s));
+                   (SMARTFS_FMT_WEAR_POS +
+                    sizeof(struct smart_sect_header_s));
         }
 
       /* Setup the sector read request (we are our own client) */
 
       req.logsector = sector;
-      req.offset = SMARTFS_FMT_WEAR_POS;
-      req.count = toread;
-      req.buffer = &dev->wearstatus[(dev->geo.neraseblocks >> SMART_WEAR_BIT_DIVIDE) -
-                    remaining];
+      req.offset    = SMARTFS_FMT_WEAR_POS;
+      req.count     = toread;
+      req.buffer    =
+        &dev->wearstatus[(dev->geo.neraseblocks >> SMART_WEAR_BIT_DIVIDE) -
+                         remaining];
 
       /* Validate wear status sector has been allocated */
 
@@ -4241,7 +4317,8 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev)
           ret = smart_allocsector(dev, sector);
           if (ret != sector)
             {
-              ferr("ERROR: Unable to allocate wear level status sector %d\n", sector);
+              ferr("ERROR: Unable to allocate wear level status sector %d\n",
+                   sector);
               ret = -EINVAL;
               goto errout;
             }
@@ -4267,7 +4344,8 @@ static inline int smart_read_wearstatus(FAR struct smart_struct_s *dev)
             {
               /* Error, wear status bit too large! */
 
-              ferr("ERROR: Invalid geometry - wear level status too large\n");
+              ferr("ERROR: Invalid geometry "
+                   "- wear level status too large\n");
               ret = -EINVAL;
               goto errout;
             }
@@ -4476,15 +4554,18 @@ static int smart_writesector(FAR struct smart_struct_s *dev,
   /* Test if an adjustment to the wear levels is needed */
 
   if (dev->minwearlevel >= SMART_WEAR_MIN_LEVEL ||
-      (dev->minwearlevel > 0 && dev->maxwearlevel >= SMART_WEAR_REORG_THRESHOLD))
+      (dev->minwearlevel > 0 &&
+       dev->maxwearlevel >= SMART_WEAR_REORG_THRESHOLD))
     {
       /* Subtract dev->minwearlevel from all wear levels */
 
       offset = dev->minwearlevel;
       finfo("Reducing wear level bits by %d\n", offset);
+
       for (x = 0; x < dev->geo.neraseblocks; x++)
         {
-          smart_set_wear_level(dev, x, smart_get_wear_level(dev, x) - offset);
+          smart_set_wear_level(dev, x,
+                               smart_get_wear_level(dev, x) - offset);
         }
 
       dev->minwearlevel -= offset;
@@ -4557,7 +4638,8 @@ static int smart_writesector(FAR struct smart_struct_s *dev,
     {
       /* Test if the next byte can be written to the flash */
 
-      byte = dev->rwbuffer[sizeof(struct smart_sect_header_s) + req->offset + x];
+      byte = dev->rwbuffer[sizeof(struct smart_sect_header_s) +
+                           req->offset + x];
 #if CONFIG_SMARTFS_ERASEDSTATE == 0xff
       if (((byte ^ req->buffer[x]) | byte) != byte)
         {
@@ -4630,7 +4712,8 @@ static int smart_writesector(FAR struct smart_struct_s *dev,
 
   if (allocsector)
     {
-      smart_write_alloc_sector(dev, allocsector->logical, allocsector->physical);
+      smart_write_alloc_sector(dev, allocsector->logical,
+                               allocsector->physical);
 
       /* Remove allocsector from the list and free the memory */
 
@@ -4737,9 +4820,11 @@ static int smart_writesector(FAR struct smart_struct_s *dev,
       /* Release the old physical sector */
 
 #if CONFIG_SMARTFS_ERASEDSTATE == 0xff
-      byte = header->status & ~(SMART_STATUS_RELEASED | SMART_STATUS_COMMITTED);
+      byte = header->status & ~(SMART_STATUS_RELEASED |
+                                SMART_STATUS_COMMITTED);
 #else
-      byte = header->status | SMART_STATUS_RELEASED | SMART_STATUS_COMMITTED;
+      byte = header->status | SMART_STATUS_RELEASED |
+             SMART_STATUS_COMMITTED;
 #endif
       offset = mtdblock * dev->geo.blocksize +
           offsetof(struct smart_sect_header_s, status);
@@ -4752,7 +4837,8 @@ static int smart_writesector(FAR struct smart_struct_s *dev,
       block = oldphyssector / dev->sectorsperblk;
 #ifdef CONFIG_MTD_SMART_PACK_COUNTS
       smart_add_count(dev, dev->releasecount, block, 1);
-      smart_add_count(dev, dev->freecount, physsector / dev->sectorsperblk, -1);
+      smart_add_count(dev, dev->freecount, physsector / dev->sectorsperblk,
+                      -1);
 #else
       dev->releasecount[block]++;
       dev->freecount[physsector / dev->sectorsperblk]--;
@@ -4858,10 +4944,11 @@ static int smart_readsector(FAR struct smart_struct_s *dev,
 #endif
 
   finfo("Entry\n");
+
   req = (FAR struct smart_read_write_s *) arg;
   DEBUGASSERT(req->offset < dev->sectorsize);
-  DEBUGASSERT(req->offset + req->count + sizeof(struct smart_sect_header_s) <=
-              dev->sectorsize);
+  DEBUGASSERT(req->offset + req->count + sizeof(struct smart_sect_header_s)
+              <= dev->sectorsize);
 
   /* Ensure the logical sector has been allocated */
 
@@ -4923,7 +5010,8 @@ static int smart_readsector(FAR struct smart_struct_s *dev,
         {
           /* TODO: Mark the block bad */
 
-          ferr("ERROR: Error validating sector %d CRC during read\n", physsector);
+          ferr("ERROR: Error validating sector %d CRC during read\n",
+               physsector);
           ret = -EIO;
           goto errout;
         }
@@ -4939,8 +5027,9 @@ static int smart_readsector(FAR struct smart_struct_s *dev,
 
   /* Read the sector header data to validate as a sanity check */
 
-  ret = MTD_READ(dev->mtd, physsector * dev->mtdblkspersector * dev->geo.blocksize,
-          sizeof(struct smart_sect_header_s), (FAR uint8_t *) &header);
+  ret = MTD_READ(dev->mtd, physsector * dev->mtdblkspersector *
+                 dev->geo.blocksize, sizeof(struct smart_sect_header_s),
+                 (FAR uint8_t *)&header);
   if (ret != sizeof(struct smart_sect_header_s))
     {
       ferr("ERROR: Error reading sector %d header\n", physsector);
@@ -4964,8 +5053,9 @@ static int smart_readsector(FAR struct smart_struct_s *dev,
 
   /* Read the sector data into the buffer */
 
-  readaddr = (uint32_t) physsector * dev->mtdblkspersector * dev->geo.blocksize +
-    req->offset + sizeof(struct smart_sect_header_s);
+  readaddr = (uint32_t)physsector * dev->mtdblkspersector *
+             dev->geo.blocksize + req->offset +
+             sizeof(struct smart_sect_header_s);
 
   ret = MTD_READ(dev->mtd, readaddr, req->count, (FAR uint8_t *)
           req->buffer);
@@ -5173,24 +5263,26 @@ static inline int smart_allocsector(FAR struct smart_struct_s *dev,
    * our temporary allocsector list and we'll pick it up later.
    */
 
-  {
-    FAR struct smart_allocsector_s *allocsect = (FAR struct smart_allocsector_s *)
-      kmm_malloc(sizeof(struct smart_allocsector_s));
-    if (allocsect == NULL)
-      {
-        ferr("ERROR: Out of memory allocting sector\n");
-        return -ENOMEM;
-      }
+    {
+      FAR struct smart_allocsector_s *allocsect =
+        (FAR struct smart_allocsector_s *)
+        kmm_malloc(sizeof(struct smart_allocsector_s));
 
-    /* Fill in the struct and add to the list.  We are protected by the
-     * smartfs layer's mutex, so no locking is required.
-     */
+      if (allocsect == NULL)
+        {
+          ferr("ERROR: Out of memory allocting sector\n");
+          return -ENOMEM;
+        }
+
+      /* Fill in the struct and add to the list.  We are protected by the
+       * smartfs layer's mutex, so no locking is required.
+       */
 
-    allocsect->logical = logsector;
-    allocsect->physical = physicalsector;
-    allocsect->next = dev->allocsector;
-    dev->allocsector = allocsect;
-  }
+      allocsect->logical = logsector;
+      allocsect->physical = physicalsector;
+      allocsect->next = dev->allocsector;
+      dev->allocsector = allocsect;
+    }
 
 #else /* CONFIG_MTD_SMART_ENABLE_CRC */
 
@@ -5215,7 +5307,8 @@ static inline int smart_allocsector(FAR struct smart_struct_s *dev,
 #endif
 
 #ifdef CONFIG_MTD_SMART_PACK_COUNTS
-  smart_add_count(dev, dev->freecount, physicalsector / dev->sectorsperblk, -1);
+  smart_add_count(dev, dev->freecount,
+                  physicalsector / dev->sectorsperblk, -1);
 #else
   dev->freecount[physicalsector / dev->sectorsperblk]--;
 #endif
@@ -5254,10 +5347,12 @@ static inline int smart_freesector(FAR struct smart_struct_s *dev,
 #ifndef CONFIG_MTD_SMART_MINIMIZE_RAM
       if (dev->smap[logicalsector] == (uint16_t) -1)
 #else
-      if (!(dev->sbitmap[logicalsector >> 3] & (1 << (logicalsector & 0x07))))
+      if (!(dev->sbitmap[logicalsector >> 3] &
+            (1 << (logicalsector & 0x07))))
 #endif
         {
-          ferr("ERROR: Invalid release - sector %d not allocated\n", logicalsector);
+          ferr("ERROR: Invalid release - sector %d not allocated\n",
+               logicalsector);
           ret = -EINVAL;
           goto errout;
         }
@@ -5394,7 +5489,8 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
 
 #ifdef CONFIG_SMARTFS_MULTI_ROOT_DIRS
       ret = smart_getformat(dev, (FAR struct smart_format_s *) arg,
-        ((FAR struct smart_multiroot_device_s *)inode->i_private)->rootdirnum);
+                            ((FAR struct smart_multiroot_device_s *)
+                            inode->i_private)->rootdirnum);
 #else
       ret = smart_getformat(dev, (FAR struct smart_format_s *) arg);
 #endif
@@ -5533,7 +5629,8 @@ ok_out:
  ****************************************************************************/
 
 #ifdef CONFIG_MTD_SMART_FSCK_ENABLE_CRC
-static int smart_fsck_crc(FAR struct smart_struct_s *dev, uint16_t physsector)
+static int smart_fsck_crc(FAR struct smart_struct_s *dev,
+                          uint16_t physsector)
 {
   int ret;
 
@@ -5643,7 +5740,8 @@ static int smart_fsck_file(FAR struct smart_struct_s *dev,
            (CONFIG_SMARTFS_ERASEDSTATE & SMART_STATUS_RELEASED)))
         {
           ret = -ENOENT;
-          ferr("ERROR: status(%02x) phys sector %d\n", header->status, physsector);
+          ferr("ERROR: status(%02x) phys sector %d\n",
+               header->status, physsector);
           break;
         }
 
@@ -5706,7 +5804,8 @@ static int smart_fsck_directory(FAR struct smart_struct_s *dev,
   char                              entryname[dev->namesize + 1];
 #endif
 
-  if ((logsector < SMART_FIRST_DIR_SECTOR) || (logsector >= dev->totalsectors))
+  if ((logsector < SMART_FIRST_DIR_SECTOR) ||
+      (logsector >= dev->totalsectors))
     {
       ret = -EINVAL;
       ferr("ERROR: Invalid log sector %d\n", logsector);
@@ -5771,7 +5870,8 @@ static int smart_fsck_directory(FAR struct smart_struct_s *dev,
        (CONFIG_SMARTFS_ERASEDSTATE & SMART_STATUS_RELEASED)))
     {
       ret = -ENOENT;
-      ferr("ERROR: status(%02x) phys sector %d\n", header->status, physsector);
+      ferr("ERROR: status(%02x) phys sector %d\n",
+           header->status, physsector);
       goto errout;
     }
 
@@ -5850,13 +5950,16 @@ static int smart_fsck_directory(FAR struct smart_struct_s *dev,
 
       if (ret != OK)
         {
-          finfo("Remove entry (name=%s flags=%02x)\n", entryname, entry->flags);
+          finfo("Remove entry (name=%s flags=%02x)\n",
+                entryname, entry->flags);
+
           if ((cur + (2 * entrysize)) <= bottom)
             {
               /* Truncate the current entry and overwrite with next entries */
 
               memmove(cur, cur + entrysize, bottom - (cur + entrysize));
-              memset(bottom - entrysize, CONFIG_SMARTFS_ERASEDSTATE, entrysize);
+              memset(bottom - entrysize, CONFIG_SMARTFS_ERASEDSTATE,
+                     entrysize);
             }
           else
             {
@@ -5903,11 +6006,13 @@ static int smart_fsck_directory(FAR struct smart_struct_s *dev,
 #ifndef CONFIG_MTD_SMART_MINIMIZE_RAM
       dev->smap[*((FAR uint16_t *)header->logicalsector)] = newsector;
 #else
-      smart_update_cache(dev, *((FAR uint16_t *)header->logicalsector), newsector);
+      smart_update_cache(dev, *((FAR uint16_t *)header->logicalsector),
+                         newsector);
 #endif
 
 #ifdef CONFIG_MTD_SMART_PACK_COUNTS
-      smart_add_count(dev, dev->freecount, newsector / dev->sectorsperblk, -1);
+      smart_add_count(dev, dev->freecount,
+                      newsector / dev->sectorsperblk, -1);
 #else
       dev->freecount[newsector / dev->sectorsperblk]--;
 #endif
@@ -6018,7 +6123,8 @@ static int smart_fsck(FAR struct smart_struct_s *dev)
  *
  ****************************************************************************/
 
-int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, FAR const char *partname)
+int smart_initialize(int minor, FAR struct mtd_dev_s *mtd,
+                     FAR const char *partname)
 {
   FAR struct smart_struct_s *dev;
   int ret = -ENOMEM;
@@ -6038,8 +6144,8 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, FAR const char *partn
 
   /* Allocate a SMART device structure */
 
-  dev = (FAR struct smart_struct_s *)smart_zalloc(NULL, sizeof(struct smart_struct_s),
-          "Dev struct");
+  dev = (FAR struct smart_struct_s *)
+    smart_zalloc(NULL, sizeof(struct smart_struct_s), "Dev struct");
   if (dev)
     {
       /* Initialize the SMART device structure */
@@ -6053,7 +6159,8 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, FAR const char *partn
 
       /* Set these to zero in case the device doesn't support them */
 
-      ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY, (unsigned long)((uintptr_t)&dev->geo));
+      ret = MTD_IOCTL(mtd, MTDIOC_GEOMETRY,
+                      (unsigned long)((uintptr_t)&dev->geo));
       if (ret < 0)
         {
           ferr("ERROR: MTD ioctl(MTDIOC_GEOMETRY) failed: %d\n", ret);
@@ -6080,13 +6187,14 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, FAR const char *partn
         }
       else if (totalsectors == 65536)
         {
-          totalsectors -= 2;
+          totalsectors   -= 2;
         }
 
-      dev->totalsectors = (uint16_t)totalsectors;
-      dev->freesectors = (uint16_t)dev->availsectperblk * dev->geo.neraseblocks;
+      dev->totalsectors   = (uint16_t)totalsectors;
+      dev->freesectors    = (uint16_t)dev->availsectperblk *
+                            dev->geo.neraseblocks;
       dev->lastallocblock = 0;
-      dev->debuglevel = 0;
+      dev->debuglevel     = 0;
 
       /* Mark the device format status an unknown */
 
@@ -6283,8 +6391,8 @@ static int smart_loteardown(FAR const char *devname)
     }
 #endif
 
-  /* Open the block driver associated with devname so that we can get the inode
-   * reference.
+  /* Open the block driver associated with devname so that we can get the
+   * inode reference.
    */
 
   ret = open_blockdriver(devname, MS_RDONLY, &inode);
@@ -6324,7 +6432,8 @@ static int smart_loteardown(FAR const char *devname)
  ****************************************************************************/
 
 #ifdef CONFIG_SMART_DEV_LOOP
-static ssize_t smart_loop_read(FAR struct file *filep, FAR char *buffer, size_t len)
+static ssize_t smart_loop_read(FAR struct file *filep, FAR char *buffer,
+                               size_t len)
 {
   return 0; /* Return EOF */
 }
@@ -6347,7 +6456,8 @@ static ssize_t smart_loop_write(FAR struct file *filep,
  ****************************************************************************/
 
 #ifdef CONFIG_SMART_DEV_LOOP
-static int smart_loop_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+static int smart_loop_ioctl(FAR struct file *filep, int cmd,
+                            unsigned long arg)
 {
   int ret;
 
@@ -6370,14 +6480,16 @@ static int smart_loop_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
           }
         else
           {
-            ret = smart_losetup(setup->minor, setup->filename, setup->sectsize,
-                         setup->erasesize, setup->offset, setup->readonly);
+            ret = smart_losetup(setup->minor, setup->filename,
+                                setup->sectsize, setup->erasesize,
+                                setup->offset, setup->readonly);
           }
       }
       break;
 
     /* Command:      LOOPIOC_TEARDOWN
-     * Description:  Teardown a loop device previously setup vis LOOPIOC_SETUP
+     * Description:  Teardown a loop device previously setup via
+     *               LOOPIOC_SETUP
      * Argument:     A read-able pointer to the path of the device to be
      *               torn down
      * Dependencies: The loop device must be enabled (CONFIG_DEV_LOOP=y)
diff --git a/drivers/ramdisk.c b/drivers/ramdisk.c
index 21d2f41..4ca5ad6 100644
--- a/drivers/ramdisk.c
+++ b/drivers/ramdisk.c
@@ -414,7 +414,8 @@ int ramdisk_register(int minor, FAR uint8_t *buffer, uint32_t nsectors,
   char devname[16];
   int ret = -ENOMEM;
 
-  finfo("buffer: %p nsectors: %d sectsize: %d\n", buffer, nsectors, sectsize);
+  finfo("buffer: %p nsectors: %d sectsize: %d\n",
+        buffer, nsectors, sectsize);
 
   /* Sanity check */
 
diff --git a/drivers/usbhost/usbhost_storage.c b/drivers/usbhost/usbhost_storage.c
index 0d41ad7..db78ddc 100644
--- a/drivers/usbhost/usbhost_storage.c
+++ b/drivers/usbhost/usbhost_storage.c
@@ -76,6 +76,7 @@
 #endif
 
 /* Driver support ***********************************************************/
+
 /* This format is used to construct the /dev/sd[n] device driver path.  It
  * defined here so that it will be used consistently in all places.
  */
@@ -174,6 +175,7 @@ static inline void usbhost_readcbw (size_t startsector, uint16_t blocksize,
 static inline void usbhost_writecbw(size_t startsector, uint16_t blocksize,
                                     unsigned int nsectors,
                                     FAR struct usbmsc_cbw_s *cbw);
+
 /* Command helpers */
 
 static inline int usbhost_maxlunreq(FAR struct usbhost_state_s *priv);
@@ -189,7 +191,8 @@ static void usbhost_destroy(FAR void *arg);
 /* Helpers for usbhost_connect() */
 
 static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
-                                  FAR const uint8_t *configdesc, int desclen);
+                                  FAR const uint8_t *configdesc,
+                                  int desclen);
 static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv);
 
 /* (Little Endian) Data helpers */
@@ -207,7 +210,8 @@ static void usbhost_putbe32(uint8_t *dest, uint32_t val);
 
 static inline int usbhost_talloc(FAR struct usbhost_state_s *priv);
 static inline int usbhost_tfree(FAR struct usbhost_state_s *priv);
-static FAR struct usbmsc_cbw_s *usbhost_cbwalloc(FAR struct usbhost_state_s *priv);
+static FAR struct usbmsc_cbw_s *
+       usbhost_cbwalloc(FAR struct usbhost_state_s *priv);
 
 /* struct usbhost_registry_s methods */
 
@@ -225,11 +229,12 @@ static int usbhost_disconnected(FAR struct usbhost_class_s *usbclass);
 
 static int usbhost_open(FAR struct inode *inode);
 static int usbhost_close(FAR struct inode *inode);
-static ssize_t usbhost_read(FAR struct inode *inode, FAR unsigned char *buffer,
-                            size_t startsector, unsigned int nsectors);
+static ssize_t usbhost_read(FAR struct inode *inode,
+                            FAR unsigned char *buffer, size_t startsector,
+                            unsigned int nsectors);
 static ssize_t usbhost_write(FAR struct inode *inode,
-                             FAR const unsigned char *buffer, size_t startsector,
-                             unsigned int nsectors);
+                             FAR const unsigned char *buffer,
+                             size_t startsector, unsigned int nsectors);
 static int usbhost_geometry(FAR struct inode *inode,
                             FAR struct geometry *geometry);
 static int usbhost_ioctl(FAR struct inode *inode, int cmd,
@@ -247,8 +252,8 @@ static int usbhost_ioctl(FAR struct inode *inode, int cmd,
 static const struct usbhost_id_s g_id =
 {
   USB_CLASS_MASS_STORAGE, /* base     */
-  USBMSC_SUBCLASS_SCSI,  /* subclass */
-  USBMSC_PROTO_BULKONLY, /* proto    */
+  USBMSC_SUBCLASS_SCSI,   /* subclass */
+  USBMSC_PROTO_BULKONLY,  /* proto    */
   0,                      /* vid      */
   0                       /* pid      */
 };
@@ -361,7 +366,10 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
    */
 
   DEBUGASSERT(!up_interrupt_context());
-  priv = (FAR struct usbhost_state_s *)kmm_malloc(sizeof(struct usbhost_state_s));
+
+  priv = (FAR struct usbhost_state_s *)
+    kmm_malloc(sizeof(struct usbhost_state_s));
+
   uinfo("Allocated: %p\n", priv);
   return priv;
 }
@@ -384,7 +392,8 @@ static inline FAR struct usbhost_state_s *usbhost_allocclass(void)
 #if CONFIG_USBHOST_NPREALLOC > 0
 static inline void usbhost_freeclass(FAR struct usbhost_state_s *usbclass)
 {
-  FAR struct usbhost_freestate_s *entry = (FAR struct usbhost_freestate_s *)usbclass;
+  FAR struct usbhost_freestate_s *entry =
+    (FAR struct usbhost_freestate_s *)usbclass;
   irqstate_t flags;
   DEBUGASSERT(entry != NULL);
 
@@ -415,7 +424,8 @@ static inline void usbhost_freeclass(FAR struct usbhost_state_s *usbclass)
  * Name: Device name management
  *
  * Description:
- *   Some tiny functions to coordinate management of mass storage device names.
+ *   Some tiny functions to coordinate management of mass storage device
+ *   names.
  *
  ****************************************************************************/
 
@@ -453,7 +463,8 @@ static void usbhost_freedevno(FAR struct usbhost_state_s *priv)
     }
 }
 
-static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, char *devname)
+static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv,
+                                     FAR char *devname)
 {
   snprintf(devname, DEV_NAMELEN, DEV_FORMAT, priv->sdchar);
 }
@@ -489,8 +500,9 @@ static void usbhost_dumpcbw(FAR struct usbmsc_cbw_s *cbw)
   for (i = 0; i < cbw->cdblen; i += 8)
     {
       uinfo("  %02x %02x %02x %02x %02x %02x %02x %02x\n",
-            cbw->cdb[i],   cbw->cdb[i+1], cbw->cdb[i+2], cbw->cdb[i+3],
-            cbw->cdb[i+4], cbw->cdb[i+5], cbw->cdb[i+6], cbw->cdb[i+7]);
+            cbw->cdb[i],     cbw->cdb[i + 1], cbw->cdb[i + 2],
+            cbw->cdb[i + 3], cbw->cdb[i + 4], cbw->cdb[i + 5],
+            cbw->cdb[i + 6], cbw->cdb[i + 7]);
     }
 }
 
@@ -659,7 +671,8 @@ static inline int usbhost_maxlunreq(FAR struct usbhost_state_s *priv)
   uinfo("Request maximum logical unit number\n");
 
   memset(req, 0, sizeof(struct usb_ctrlreq_s));
-  req->type    = USB_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_RECIPIENT_INTERFACE;
+  req->type    = USB_DIR_IN | USB_REQ_TYPE_CLASS |
+                 USB_REQ_RECIPIENT_INTERFACE;
   req->req     = USBMSC_REQ_GETMAXLUN;
   usbhost_putle16(req->len, 1);
 
@@ -796,7 +809,8 @@ static inline int usbhost_readcapacity(FAR struct usbhost_state_s *priv)
         {
           /* Save the capacity information */
 
-          resp            = (FAR struct scsiresp_readcapacity10_s *)priv->tbuffer;
+          resp            = (FAR struct scsiresp_readcapacity10_s *)
+                            priv->tbuffer;
           priv->nblocks   = usbhost_getbe32(resp->lba) + 1;
           priv->blocksize = usbhost_getbe32(resp->blklen);
 
@@ -870,9 +884,9 @@ static inline int usbhost_inquiry(FAR struct usbhost_state_s *priv)
  * Name: usbhost_destroy
  *
  * Description:
- *   The USB mass storage device has been disconnected and the reference count
- *   on the USB host class instance has gone to 1.. Time to destroy the USB
- *   host class instance.
+ *   The USB mass storage device has been disconnected and the reference
+ *   count on the USB host class instance has gone to 1.. Time to destroy
+ *   the USB host class instance.
  *
  * Input Parameters:
  *   arg - A reference to the class instance to be destroyed.
@@ -952,8 +966,8 @@ static void usbhost_destroy(FAR void *arg)
  *   desclen - The length in bytes of the configuration descriptor.
  *
  * Returned Value:
- *   On success, zero (OK) is returned. On a failure, a negated errno value is
- *   returned indicating the nature of the failure
+ *   On success, zero (OK) is returned. On a failure, a negated errno value
+ *   is returned indicating the nature of the failure
  *
  * Assumptions:
  *   This function will *not* be called from an interrupt handler.
@@ -1015,7 +1029,8 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
 
         case USB_DESC_TYPE_INTERFACE:
           {
-            FAR struct usb_ifdesc_s *ifdesc = (FAR struct usb_ifdesc_s *)configdesc;
+            FAR struct usb_ifdesc_s *ifdesc =
+              (FAR struct usb_ifdesc_s *)configdesc;
 
             uinfo("Interface descriptor\n");
             DEBUGASSERT(remaining >= USB_SIZEOF_IFDESC);
@@ -1033,7 +1048,8 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
 
         case USB_DESC_TYPE_ENDPOINT:
           {
-            FAR struct usb_epdesc_s *epdesc = (FAR struct usb_epdesc_s *)configdesc;
+            FAR struct usb_epdesc_s *epdesc =
+              (FAR struct usb_epdesc_s *)configdesc;
 
             uinfo("Endpoint descriptor\n");
             DEBUGASSERT(remaining >= USB_SIZEOF_EPDESC);
@@ -1042,7 +1058,8 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
              * protocol so I suppose anything else should really be an error.
              */
 
-            if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) == USB_EP_ATTR_XFER_BULK)
+            if ((epdesc->attr & USB_EP_ATTR_XFERTYPE_MASK) ==
+                USB_EP_ATTR_XFER_BULK)
               {
                 /* Yes.. it is a bulk endpoint.  IN or OUT? */
 
@@ -1060,16 +1077,19 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
 
                         return -EINVAL;
                       }
+
                     found |= USBHOST_BOUTFOUND;
 
                     /* Save the bulk OUT endpoint information */
 
                     boutdesc.hport        = hport;
-                    boutdesc.addr         = epdesc->addr & USB_EP_ADDR_NUMBER_MASK;
+                    boutdesc.addr         = epdesc->addr &
+                                            USB_EP_ADDR_NUMBER_MASK;
                     boutdesc.in           = false;
                     boutdesc.xfrtype      = USB_EP_ATTR_XFER_BULK;
                     boutdesc.interval     = epdesc->interval;
-                    boutdesc.mxpacketsize = usbhost_getle16(epdesc->mxpacketsize);
+                    boutdesc.mxpacketsize =
+                      usbhost_getle16(epdesc->mxpacketsize);
 
                     uinfo("Bulk OUT EP addr:%d mxpacketsize:%d\n",
                           boutdesc.addr, boutdesc.mxpacketsize);
@@ -1088,16 +1108,20 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
 
                         return -EINVAL;
                       }
+
                     found |= USBHOST_BINFOUND;
 
                     /* Save the bulk IN endpoint information */
 
                     bindesc.hport        = hport;
-                    bindesc.addr         = epdesc->addr & USB_EP_ADDR_NUMBER_MASK;
+                    bindesc.addr         = epdesc->addr &
+                                           USB_EP_ADDR_NUMBER_MASK;
                     bindesc.in           = 1;
                     bindesc.xfrtype      = USB_EP_ATTR_XFER_BULK;
                     bindesc.interval     = epdesc->interval;
-                    bindesc.mxpacketsize = usbhost_getle16(epdesc->mxpacketsize);
+                    bindesc.mxpacketsize =
+                      usbhost_getle16(epdesc->mxpacketsize);
+
                     uinfo("Bulk IN EP addr:%d mxpacketsize:%d\n",
                           bindesc.addr, bindesc.mxpacketsize);
                   }
@@ -1126,8 +1150,9 @@ static inline int usbhost_cfgdesc(FAR struct usbhost_state_s *priv,
       remaining  -= desc->len;
     }
 
-  /* Sanity checking... did we find all of things that we need? Hmmm..  I wonder..
-   * can we work read-only or write-only if only one bulk endpoint found?
+  /* Sanity checking... did we find all of things that we need? Hmmm..
+   * I wonder.. can we work read-only or write-only if only one bulk
+   * endpoint found?
    */
 
   if (found != USBHOST_ALLFOUND)
@@ -1208,7 +1233,7 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv)
   uinfo("Get max LUN\n");
   ret = usbhost_maxlunreq(priv);
 
-  for (retries = 0; retries < USBHOST_MAX_RETRIES /* && ret >= 0 */; retries++)
+  for (retries = 0; retries < USBHOST_MAX_RETRIES; retries++)
     {
       uinfo("Test unit ready, retries=%d\n", retries);
 
@@ -1216,9 +1241,9 @@ static inline int usbhost_initvolume(FAR struct usbhost_state_s *priv)
 
       nxsig_usleep(USBHOST_RETRY_USEC);
 
-      /* Send TESTUNITREADY to see if the unit is ready.  The most likely error
-       * error that can occur here is a a stall which simply means that the
-       * the device is not yet able to respond.
+      /* Send TESTUNITREADY to see if the unit is ready.  The most likely
+       * error error that can occur here is a a stall which simply means
+       * that the the device is not yet able to respond.
        */
 
       ret = usbhost_testunitready(priv);
@@ -1455,7 +1480,8 @@ static inline uint32_t usbhost_getle32(const uint8_t *val)
 {
   /* Little endian means LS halfword first in byte stream */
 
-  return (uint32_t)usbhost_getle16(&val[2]) << 16 | (uint32_t)usbhost_getle16(val);
+  return (uint32_t)usbhost_getle16(&val[2]) << 16 |
+         (uint32_t)usbhost_getle16(val);
 }
 
 /****************************************************************************
@@ -1477,7 +1503,8 @@ static inline uint32_t usbhost_getbe32(const uint8_t *val)
 {
   /* Big endian means MS halfword first in byte stream */
 
-  return (uint32_t)usbhost_getbe16(val) << 16 | (uint32_t)usbhost_getbe16(&val[2]);
+  return (uint32_t)usbhost_getbe16(val) << 16 |
+         (uint32_t)usbhost_getbe16(&val[2]);
 }
 
 /****************************************************************************
@@ -1500,7 +1527,7 @@ static void usbhost_putle32(uint8_t *dest, uint32_t val)
   /* Little endian means LS halfword first in byte stream */
 
   usbhost_putle16(dest, (uint16_t)(val & 0xffff));
-  usbhost_putle16(dest+2, (uint16_t)(val >> 16));
+  usbhost_putle16(dest + 2, (uint16_t)(val >> 16));
 }
 
 /****************************************************************************
@@ -1523,7 +1550,7 @@ static void usbhost_putbe32(uint8_t *dest, uint32_t val)
   /* Big endian means MS halfword first in byte stream */
 
   usbhost_putbe16(dest, (uint16_t)(val >> 16));
-  usbhost_putbe16(dest+2, (uint16_t)(val & 0xffff));
+  usbhost_putbe16(dest + 2, (uint16_t)(val & 0xffff));
 }
 
 /****************************************************************************
@@ -1590,7 +1617,8 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv)
  *
  * Description:
  *   Initialize a CBW (re-using the allocated transfer buffer). Upon
- *   successful return, the CBW is cleared and has the CBW signature in place.
+ *   successful return, the CBW is cleared and has the CBW signature in
+ *   place.
  *
  * Input Parameters:
  *   priv - A reference to the class instance.
@@ -1600,7 +1628,8 @@ static inline int usbhost_tfree(FAR struct usbhost_state_s *priv)
  *
  ****************************************************************************/
 
-static FAR struct usbmsc_cbw_s *usbhost_cbwalloc(FAR struct usbhost_state_s *priv)
+static FAR struct usbmsc_cbw_s *
+  usbhost_cbwalloc(FAR struct usbhost_state_s *priv)
 {
   FAR struct usbmsc_cbw_s *cbw = NULL;
 
@@ -1615,19 +1644,16 @@ static FAR struct usbmsc_cbw_s *usbhost_cbwalloc(FAR struct usbhost_state_s *pri
 }
 
 /****************************************************************************
- * struct usbhost_registry_s methods
- ****************************************************************************/
-
-/****************************************************************************
  * Name: usbhost_create
  *
  * Description:
- *   This function implements the create() method of struct usbhost_registry_s.
- *   The create() method is a callback into the class implementation.  It is
- *   used to (1) create a new instance of the USB host class state and to (2)
- *   bind a USB host driver "session" to the class instance.  Use of this
- *   create() method will support environments where there may be multiple
- *   USB ports and multiple USB devices simultaneously connected.
+ *   This function implements the create() method of struct
+ *   usbhost_registry_s.  The create() method is a callback into the class
+ *   implementation.  It is used to (1) create a new instance of the USB host
+ *   class state and to (2) bind a USB host driver "session" to the class
+ *   instance.  Use of this create() method will support environments where
+ *   there may be multiple USB ports and multiple USB devices simultaneously
+ *   connected.
  *
  * Input Parameters:
  *   hport - The hub port that manages the new class instance.
@@ -1644,8 +1670,8 @@ static FAR struct usbmsc_cbw_s *usbhost_cbwalloc(FAR struct usbhost_state_s *pri
  ****************************************************************************/
 
 static FAR struct usbhost_class_s *
-usbhost_create(FAR struct usbhost_hubport_s *hport,
-               FAR const struct usbhost_id_s *id)
+  usbhost_create(FAR struct usbhost_hubport_s *hport,
+                 FAR const struct usbhost_id_s *id)
 {
   FAR struct usbhost_state_s *priv;
 
@@ -1662,13 +1688,15 @@ usbhost_create(FAR struct usbhost_hubport_s *hport,
 
       if (usbhost_allocdevno(priv) == OK)
         {
-         /* Initialize class method function pointers */
+          /* Initialize class method function pointers */
 
           priv->usbclass.hport        = hport;
           priv->usbclass.connect      = usbhost_connect;
           priv->usbclass.disconnected = usbhost_disconnected;
 
-          /* The initial reference count is 1... One reference is held by the driver */
+          /* The initial reference count is 1... One reference is held by
+           * the driver.
+           */
 
           priv->crefs = 1;
 
@@ -1676,7 +1704,9 @@ usbhost_create(FAR struct usbhost_hubport_s *hport,
 
           nxsem_init(&priv->exclsem, 0, 1);
 
-          /* NOTE: We do not yet know the geometry of the USB mass storage device */
+          /* NOTE: We do not yet know the geometry of the USB mass storage
+           * device.
+           */
 
           /* Return the instance of the USB mass storage class */
 
@@ -1695,9 +1725,6 @@ usbhost_create(FAR struct usbhost_hubport_s *hport,
 }
 
 /****************************************************************************
- * struct usbhost_class_s methods
- ****************************************************************************/
-/****************************************************************************
  * Name: usbhost_connect
  *
  * Description:
@@ -1714,11 +1741,11 @@ usbhost_create(FAR struct usbhost_hubport_s *hport,
  *   desclen - The length in bytes of the configuration descriptor.
  *
  * Returned Value:
- *   On success, zero (OK) is returned. On a failure, a negated errno value is
- *   returned indicating the nature of the failure
+ *   On success, zero (OK) is returned. On a failure, a negated errno value
+ *   is returned indicating the nature of the failure
  *
- *   NOTE that the class instance remains valid upon return with a failure.  It is
- *   the responsibility of the higher level enumeration logic to call
+ *   NOTE that the class instance remains valid upon return with a failure.
+ *   It is the responsibility of the higher level enumeration logic to call
  *   CLASS_DISCONNECTED to free up the class driver resources.
  *
  * Assumptions:
@@ -1788,8 +1815,8 @@ static int usbhost_disconnected(struct usbhost_class_s *usbclass)
 
   DEBUGASSERT(priv != NULL);
 
-  /* Set an indication to any users of the mass storage device that the device
-   * is no longer available.
+  /* Set an indication to any users of the mass storage device that the
+   * device is no longer available.
    */
 
   flags              = enter_critical_section();
@@ -1813,10 +1840,11 @@ static int usbhost_disconnected(struct usbhost_class_s *usbclass)
         {
           /* Destroy the instance on the worker thread. */
 
-          uinfo("Queuing destruction: worker %p->%p\n", priv->work.worker, usbhost_destroy);
+          uinfo("Queuing destruction: worker %p->%p\n",
+                priv->work.worker, usbhost_destroy);
           DEBUGASSERT(priv->work.worker == NULL);
           work_queue(HPWORK, &priv->work, usbhost_destroy, priv, 0);
-       }
+        }
       else
         {
           /* Do the work now */
@@ -1830,9 +1858,6 @@ static int usbhost_disconnected(struct usbhost_class_s *usbclass)
 }
 
 /****************************************************************************
- * struct block_operations methods
- ****************************************************************************/
-/****************************************************************************
  * Name: usbhost_open
  *
  * Description: Open the block device
@@ -1854,17 +1879,17 @@ static int usbhost_open(FAR struct inode *inode)
   DEBUGASSERT(priv->crefs > 0 && priv->crefs < USBHOST_MAX_CREFS);
   usbhost_takesem(&priv->exclsem);
 
-  /* Check if the mass storage device is still connected.  We need to disable
-   * interrupts momentarily to assure that there are no asynchronous disconnect
-   * events.
+  /* Check if the mass storage device is still connected.  We need to
+   * disable interrupts momentarily to assure that there are no asynchronous
+   * disconnect events.
    */
 
   flags = enter_critical_section();
   if (priv->disconnected)
     {
-      /* No... the block driver is no longer bound to the class.  That means that
-       * the USB storage device is no longer connected.  Refuse any further
-       * attempts to open the driver.
+      /* No... the block driver is no longer bound to the class.  That means
+       * that the USB storage device is no longer connected.  Refuse any
+       * further attempts to open the driver.
        */
 
       ret = -ENODEV;
@@ -1876,6 +1901,7 @@ static int usbhost_open(FAR struct inode *inode)
       priv->crefs++;
       ret = OK;
     }
+
   leave_critical_section(flags);
 
   usbhost_givesem(&priv->exclsem);
@@ -2012,7 +2038,8 @@ static ssize_t usbhost_read(FAR struct inode *inode, unsigned char *buffer,
                       /* Receive the CSW */
 
                       nbytes = DRVR_TRANSFER(hport->drvr, priv->bulkin,
-                                             priv->tbuffer, USBMSC_CSW_SIZEOF);
+                                             priv->tbuffer,
+                                             USBMSC_CSW_SIZEOF);
                       if (nbytes >= 0)
                         {
                           FAR struct usbmsc_csw_s *csw;
@@ -2022,7 +2049,8 @@ static ssize_t usbhost_read(FAR struct inode *inode, unsigned char *buffer,
                           csw = (FAR struct usbmsc_csw_s *)priv->tbuffer;
                           if (csw->status != 0)
                             {
-                              uerr("ERROR: CSW status error: %d\n", csw->status);
+                              uerr("ERROR: CSW status error: %d\n",
+                                   csw->status);
                               nbytes = -ENODEV;
                             }
                         }
@@ -2049,8 +2077,9 @@ static ssize_t usbhost_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffer,
-                           size_t startsector, unsigned int nsectors)
+static ssize_t usbhost_write(FAR struct inode *inode,
+                             FAR const unsigned char *buffer,
+                             size_t startsector, unsigned int nsectors)
 {
   FAR struct usbhost_state_s *priv;
   FAR struct usbhost_hubport_s *hport;
@@ -2081,7 +2110,7 @@ static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffe
 
       usbhost_takesem(&priv->exclsem);
 
-     /* Assume allocation failure */
+      /* Assume allocation failure */
 
       nbytes = -ENOMEM;
 
@@ -2104,7 +2133,8 @@ static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffe
               /* Send the user data */
 
               nbytes = DRVR_TRANSFER(hport->drvr, priv->bulkout,
-                                     (FAR uint8_t *)buffer, priv->blocksize * nsectors);
+                                     (FAR uint8_t *)buffer,
+                                     priv->blocksize * nsectors);
               if (nbytes >= 0)
                 {
                   /* Receive the CSW */
@@ -2143,7 +2173,8 @@ static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffe
  *
  ****************************************************************************/
 
-static int usbhost_geometry(FAR struct inode *inode, struct geometry *geometry)
+static int usbhost_geometry(FAR struct inode *inode,
+                            FAR struct geometry *geometry)
 {
   FAR struct usbhost_state_s *priv;
   int ret = -EINVAL;
@@ -2225,8 +2256,10 @@ static int usbhost_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
           ret = -ENOTTY;
           break;
         }
+
       usbhost_givesem(&priv->exclsem);
     }
+
   return ret;
 }
 
diff --git a/fs/driver/fs_blockpartition.c b/fs/driver/fs_blockpartition.c
index 3e662af..f42d7fc 100644
--- a/fs/driver/fs_blockpartition.c
+++ b/fs/driver/fs_blockpartition.c
@@ -68,13 +68,15 @@ struct part_struct_s
 
 static int     part_open(FAR struct inode *inode);
 static int     part_close(FAR struct inode *inode);
-static ssize_t part_read(FAR struct inode *inode, unsigned char *buffer,
-                         size_t start_sector, unsigned int nsectors);
-static ssize_t part_write(FAR struct inode *inode, const unsigned char *buffer,
-                          size_t start_sector, unsigned int nsectors);
-static int     part_geometry(FAR struct inode *inode, struct geometry *geometry);
-static int     part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg);
-
+static ssize_t part_read(FAR struct inode *inode, FAR unsigned char *buffer,
+                 size_t start_sector, unsigned int nsectors);
+static ssize_t part_write(FAR struct inode *inode,
+                 FAR const unsigned char *buffer, size_t start_sector,
+                 unsigned int nsectors);
+static int     part_geometry(FAR struct inode *inode,
+                 FAR struct geometry *geometry);
+static int     part_ioctl(FAR struct inode *inode, int cmd,
+                 unsigned long arg);
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
 static int     part_unlink(FAR struct inode *inode);
 #endif
@@ -174,8 +176,9 @@ static ssize_t part_read(FAR struct inode *inode, unsigned char *buffer,
  *
  ****************************************************************************/
 
-static ssize_t part_write(FAR struct inode *inode, const unsigned char *buffer,
-                        size_t start_sector, unsigned int nsectors)
+static ssize_t part_write(FAR struct inode *inode,
+                          FAR const unsigned char *buffer,
+                          size_t start_sector, unsigned int nsectors)
 {
   FAR struct part_struct_s *dev = inode->i_private;
   FAR struct inode *parent = dev->parent;
@@ -245,12 +248,14 @@ static int part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
               ret = parent->u.i_bops->geometry(parent, &geo);
               if (ret >= 0)
                 {
-                  *(FAR uint8_t *)base += dev->firstsector * geo.geo_sectorsize;
+                  *(FAR uint8_t *)base +=
+                    dev->firstsector * geo.geo_sectorsize;
                 }
             }
           else if (cmd == MTDIOC_GEOMETRY)
             {
-              FAR struct mtd_geometry_s *mgeo = (FAR struct mtd_geometry_s *)arg;
+              FAR struct mtd_geometry_s *mgeo =
+                (FAR struct mtd_geometry_s *)arg;
               uint32_t blkper = mgeo->erasesize / mgeo->blocksize;
 
               mgeo->neraseblocks = dev->nsectors / blkper;
diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c
index e6983b5..72950a1 100644
--- a/fs/vfs/fs_rename.c
+++ b/fs/vfs/fs_rename.c
@@ -488,8 +488,8 @@ int rename(FAR const char *oldpath, FAR const char *newpath)
   FAR struct inode *oldinode;
   int ret;
 
-  /* Ignore paths that are interpreted as the root directory which has no name
-   * and cannot be moved
+  /* Ignore paths that are interpreted as the root directory which has no
+   * name and cannot be moved
    */
 
   if (!oldpath || *oldpath == '\0' || oldpath[0] != '/' ||
diff --git a/fs/vfs/fs_rmdir.c b/fs/vfs/fs_rmdir.c
index 3c90b82..25afcf6 100644
--- a/fs/vfs/fs_rmdir.c
+++ b/fs/vfs/fs_rmdir.c
@@ -138,9 +138,9 @@ int rmdir(FAR const char *pathname)
         }
 
       /* Remove the inode.  NOTE: Because we hold a reference count on the
-       * inode, it will not be deleted now.  But probably when inode_release()
-       * is called below.  inode_remove should return -EBUSY to indicate that
-       * the inode was not deleted now.
+       * inode, it will not be deleted now.  But probably when
+       * inode_release() is called below.  inode_remove should return
+       * -EBUSY to indicate that the inode was not deleted now.
        */
 
       inode_semtake();
diff --git a/include/nuttx/drivers/ramdisk.h b/include/nuttx/drivers/ramdisk.h
index 63848be..ddffaa6 100644
--- a/include/nuttx/drivers/ramdisk.h
+++ b/include/nuttx/drivers/ramdisk.h
@@ -1,35 +1,20 @@
 /****************************************************************************
  * include/nuttx/drivers/ramdisk.h
  *
- *   Copyright (C) 2008-2009, 2012-2013, 2015-2016 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
diff --git a/libs/libc/stdlib/lib_mkstemp.c b/libs/libc/stdlib/lib_mkstemp.c
index ee996e5..5b6e5dd 100644
--- a/libs/libc/stdlib/lib_mkstemp.c
+++ b/libs/libc/stdlib/lib_mkstemp.c
@@ -157,14 +157,14 @@ static void get_base62(FAR uint8_t *ptr)
 static void copy_base62(FAR const uint8_t *src, FAR char *dest, int len)
 {
   if (len < MAX_XS)
-     {
-       src += MAX_XS - len;
-     }
-
-   for (; len > 0; len--)
-     {
-       *dest++ = base62_to_char(*src++);
-     }
+    {
+      src += MAX_XS - len;
+    }
+
+  for (; len > 0; len--)
+    {
+      *dest++ = base62_to_char(*src++);
+    }
 }
 
 /****************************************************************************


[incubator-nuttx] 09/12: fs/: Remove support for CONFIG_FS_READABLE

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 2b532ae4a8260a3b8d86e2235ca7f53a74deb58d
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sat Mar 21 10:58:46 2020 -0600

    fs/: Remove support for CONFIG_FS_READABLE
---
 fs/Kconfig          |  6 ------
 fs/binfs/Kconfig    |  1 -
 fs/cromfs/Kconfig   |  1 -
 fs/fat/Kconfig      |  1 -
 fs/hostfs/Kconfig   |  1 -
 fs/littlefs/Kconfig |  1 -
 fs/mount/fs_mount.c | 49 ++++++++++++-------------------------------------
 fs/nfs/Kconfig      |  1 -
 fs/nxffs/Kconfig    |  1 -
 fs/procfs/Kconfig   |  1 -
 fs/romfs/Kconfig    |  1 -
 fs/smartfs/Kconfig  |  1 -
 fs/spiffs/Kconfig   |  1 -
 fs/tmpfs/Kconfig    |  1 -
 14 files changed, 12 insertions(+), 55 deletions(-)

diff --git a/fs/Kconfig b/fs/Kconfig
index c5a516d..d0055ed 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -53,12 +53,6 @@ config PSEUDOFS_SOFTLINKS
 		to link a directory in the pseudo-file system, such as /bin, to
 		to a directory in a mounted volume, say /mnt/sdcard/bin.
 
-config FS_READABLE
-	bool
-	default n
-	---help---
-		Automatically selected if any readable file system is selected
-
 source fs/aio/Kconfig
 source fs/semaphore/Kconfig
 source fs/mqueue/Kconfig
diff --git a/fs/binfs/Kconfig b/fs/binfs/Kconfig
index 8e5da6a..47871f1 100644
--- a/fs/binfs/Kconfig
+++ b/fs/binfs/Kconfig
@@ -7,7 +7,6 @@ config FS_BINFS
 	bool "BINFS File System"
 	default n
 	depends on BUILTIN
-	select FS_READABLE
 	---help---
 		The BINFS file system is provides access to builtin applications through
 		the NuttX file system.  The BINFS may, for example, be mount at /bin.
diff --git a/fs/cromfs/Kconfig b/fs/cromfs/Kconfig
index c493208..25a9f5a 100644
--- a/fs/cromfs/Kconfig
+++ b/fs/cromfs/Kconfig
@@ -7,7 +7,6 @@ config FS_CROMFS
 	bool "CROMFS file system"
 	default n
 	depends on !DISABLE_MOUNTPOINT
-	select FS_READABLE
 	select LIBC_LZF
 	---help---
 		Enable Compessed Read-Only Filesystem (CROMFS) support
diff --git a/fs/fat/Kconfig b/fs/fat/Kconfig
index ebbaa97..fd3bd46 100644
--- a/fs/fat/Kconfig
+++ b/fs/fat/Kconfig
@@ -7,7 +7,6 @@ config FS_FAT
 	bool "FAT file system"
 	default n
 	depends on !DISABLE_MOUNTPOINT
-	select FS_READABLE
 	---help---
 		Enable FAT filesystem support
 
diff --git a/fs/hostfs/Kconfig b/fs/hostfs/Kconfig
index e514007..2d69006 100644
--- a/fs/hostfs/Kconfig
+++ b/fs/hostfs/Kconfig
@@ -7,7 +7,6 @@ config FS_HOSTFS
 	bool "Host File System"
 	default n
 	depends on !DISABLE_MOUNTPOINT
-	select FS_READABLE
 	---help---
 		The Host file system provides a mechanism to mount directories
 		from the host OS during simulation mode.  The host directory
diff --git a/fs/littlefs/Kconfig b/fs/littlefs/Kconfig
index df403ed..c581739 100644
--- a/fs/littlefs/Kconfig
+++ b/fs/littlefs/Kconfig
@@ -1,7 +1,6 @@
 config FS_LITTLEFS
 	bool "LITTLEFS File System"
 	default n
-	select FS_READABLE
 	depends on !DISABLE_MOUNTPOINT
 	---help---
 		Build the LITTLEFS file system. https://github.com/ARMmbed/littlefs.
diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c
index c6043af..18255eb 100644
--- a/fs/mount/fs_mount.c
+++ b/fs/mount/fs_mount.c
@@ -1,36 +1,20 @@
 /****************************************************************************
  * fs/mount/fs_mount.c
  *
- *   Copyright (C) 2007-2009, 2011-2013, 2015, 2017-2019 Gregory Nutt. All
- *     rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -52,14 +36,6 @@
 #include "inode/inode.h"
 #include "driver/driver.h"
 
-/* At least one filesystem must be defined, or this file will not compile.
- * It may be desire-able to make file systems dynamically registered at
- * some time in the future, but at present, this file needs to know about
- * every configured filesystem.
- */
-
-#ifdef CONFIG_FS_READABLE
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -540,4 +516,3 @@ errout:
 #endif /* BDFS_SUPPORT || MDFS_SUPPORT || NODFS_SUPPORT */
 }
 
-#endif /* CONFIG_FS_READABLE */
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index 580ba64..19a1a88 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -7,7 +7,6 @@ config NFS
 	bool "NFS client file system"
 	default n
 	depends on !DISABLE_MOUNTPOINT
-	select FS_READABLE
 	---help---
 		Enable network file system (NFS) client file system
 
diff --git a/fs/nxffs/Kconfig b/fs/nxffs/Kconfig
index 9232c52..ac3b762 100644
--- a/fs/nxffs/Kconfig
+++ b/fs/nxffs/Kconfig
@@ -7,7 +7,6 @@ config FS_NXFFS
 	bool "NXFFS file system"
 	default n
 	depends on !DISABLE_MOUNTPOINT
-	select FS_READABLE
 	---help---
 		Enable NuttX FLASH file system (NXFF) support.
 
diff --git a/fs/procfs/Kconfig b/fs/procfs/Kconfig
index 6e1289f..5ce77fc 100644
--- a/fs/procfs/Kconfig
+++ b/fs/procfs/Kconfig
@@ -6,7 +6,6 @@
 config FS_PROCFS
 	bool "PROCFS File System"
 	default n
-	select FS_READABLE
 	---help---
 		The PROCFS file system provides access to task status and other driver
 		status through the NuttX file system.  The PROCFS may, for example, be
diff --git a/fs/romfs/Kconfig b/fs/romfs/Kconfig
index 4014cf6..f52a48e 100644
--- a/fs/romfs/Kconfig
+++ b/fs/romfs/Kconfig
@@ -7,7 +7,6 @@ config FS_ROMFS
 	bool "ROMFS file system"
 	default n
 	depends on !DISABLE_MOUNTPOINT
-	select FS_READABLE
 	---help---
 		Enable ROMFS filesystem support
 
diff --git a/fs/smartfs/Kconfig b/fs/smartfs/Kconfig
index 53ece00..21abccc 100644
--- a/fs/smartfs/Kconfig
+++ b/fs/smartfs/Kconfig
@@ -7,7 +7,6 @@ config FS_SMARTFS
 	bool "SMART file system"
 	default n
 	depends on !DISABLE_MOUNTPOINT
-	select FS_READABLE
 	---help---
 		Enable NuttX SMART Flash file system (SMARTFS) support.
 
diff --git a/fs/spiffs/Kconfig b/fs/spiffs/Kconfig
index 030a572..75e125f 100644
--- a/fs/spiffs/Kconfig
+++ b/fs/spiffs/Kconfig
@@ -6,7 +6,6 @@
 config FS_SPIFFS
 	bool "SPIFFS File System"
 	default n
-	select FS_READABLE
 	depends on !DISABLE_MOUNTPOINT
 	---help---
 		Build the SPIFFS file system.  This is a port of version 0.3.7 of
diff --git a/fs/tmpfs/Kconfig b/fs/tmpfs/Kconfig
index d1a473b..f76755d 100644
--- a/fs/tmpfs/Kconfig
+++ b/fs/tmpfs/Kconfig
@@ -7,7 +7,6 @@ config FS_TMPFS
 	bool "TMPFS file system"
 	default n
 	depends on !DISABLE_MOUNTPOINT
-	select FS_READABLE
 	---help---
 		Enable TMPFS filesystem support