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

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

commit 6b6c11f0ad6f0fba3a4714db3d9a3f1120eac3a1
Author: Xiang Xiao <[email protected]>
AuthorDate: Wed Aug 11 15:46:01 2021 +0800

    mtd: Replace MTDIOC_XIPBASE with BIOC_XIPBASE
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 Documentation/components/drivers/special/mtd.rst |  2 --
 arch/arm/src/lc823450/lc823450_mtd.c             |  4 ++--
 arch/arm/src/tiva/common/tiva_flash.c            |  2 +-
 drivers/mtd/ftl.c                                | 26 +-----------------------
 drivers/mtd/mtd_partition.c                      |  4 ++--
 drivers/mtd/mtd_progmem.c                        |  2 +-
 drivers/mtd/rammtd.c                             |  2 +-
 drivers/mtd/skeleton.c                           |  2 +-
 drivers/mtd/smart.c                              | 21 -------------------
 drivers/mtd/sst39vf.c                            |  2 +-
 fs/driver/fs_blockpartition.c                    |  2 +-
 fs/romfs/fs_romfsutil.c                          |  2 +-
 include/nuttx/mtd/mtd.h                          |  8 ++------
 13 files changed, 14 insertions(+), 65 deletions(-)

diff --git a/Documentation/components/drivers/special/mtd.rst 
b/Documentation/components/drivers/special/mtd.rst
index 5e6e556..646b39f 100644
--- a/Documentation/components/drivers/special/mtd.rst
+++ b/Documentation/components/drivers/special/mtd.rst
@@ -28,8 +28,6 @@ Memory Technology Device Drivers
    Support other, less frequently used commands:
 
    -  ``MTDIOC_GEOMETRY``: Get MTD geometry
-   -  ``MTDIOC_XIPBASE:``: Convert block to physical address for
-      eXecute-In-Place
    -  ``MTDIOC_BULKERASE``: Erase the entire device
 
    is provided via a single ``ioctl`` method (see
diff --git a/arch/arm/src/lc823450/lc823450_mtd.c 
b/arch/arm/src/lc823450/lc823450_mtd.c
index 30289c7..f5a92fc 100644
--- a/arch/arm/src/lc823450/lc823450_mtd.c
+++ b/arch/arm/src/lc823450/lc823450_mtd.c
@@ -349,8 +349,8 @@ static int lc823450_ioctl(FAR struct mtd_dev_s *dev, int 
cmd,
               geo->erasesize, geo->neraseblocks);
         break;
 
-      case MTDIOC_XIPBASE:
-        finfo("MTDIOC_XIPBASE\n");
+      case BIOC_XIPBASE:
+        finfo("BIOC_XIPBASE\n");
         ppv = (FAR void**)arg;
         if (ppv)
           {
diff --git a/arch/arm/src/tiva/common/tiva_flash.c 
b/arch/arm/src/tiva/common/tiva_flash.c
index 75956be..5b4e2e9 100644
--- a/arch/arm/src/tiva/common/tiva_flash.c
+++ b/arch/arm/src/tiva/common/tiva_flash.c
@@ -394,7 +394,7 @@ static int tiva_ioctl(FAR struct mtd_dev_s *dev, int cmd, 
unsigned long arg)
         }
         break;
 
-      case MTDIOC_XIPBASE:
+      case BIOC_XIPBASE:
         {
           FAR void **ppv = (FAR void**)arg;
 
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 664b9df..0b02393 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -506,31 +506,7 @@ static int ftl_ioctl(FAR struct inode *inode, int cmd, 
unsigned long arg)
 
   dev = (struct ftl_struct_s *)inode->i_private;
 
-  /* Only one block driver ioctl command is supported by this driver (and
-   * that command is just passed on to the MTD driver in a slightly
-   * different form).
-   */
-
-  if (cmd == BIOC_XIPBASE)
-    {
-      /* The argument accompanying the BIOC_XIPBASE should be non-NULL.  If
-       * DEBUG is enabled, we will catch it here instead of in the MTD
-       * driver.
-       */
-
-#ifdef CONFIG_DEBUG_FEATURES
-      if (arg == 0)
-        {
-          ferr("ERROR: BIOC_XIPBASE argument is NULL\n");
-          return -EINVAL;
-        }
-#endif
-
-      /* Change the BIOC_XIPBASE command to the MTDIOC_XIPBASE command. */
-
-      cmd = MTDIOC_XIPBASE;
-    }
-  else if (cmd == BIOC_FLUSH)
+  if (cmd == BIOC_FLUSH)
     {
 #ifdef CONFIG_FTL_WRITEBUFFER
       rwb_flush(&dev->rwb);
diff --git a/drivers/mtd/mtd_partition.c b/drivers/mtd/mtd_partition.c
index b71722d..bc5588a 100644
--- a/drivers/mtd/mtd_partition.c
+++ b/drivers/mtd/mtd_partition.c
@@ -432,7 +432,7 @@ static int part_ioctl(FAR struct mtd_dev_s *dev, int cmd, 
unsigned long arg)
         }
         break;
 
-      case MTDIOC_XIPBASE:
+      case BIOC_XIPBASE:
         {
           FAR void **ppv = (FAR void**)arg;
           unsigned long base;
@@ -441,7 +441,7 @@ static int part_ioctl(FAR struct mtd_dev_s *dev, int cmd, 
unsigned long arg)
             {
               /* Get the XIP base of the entire FLASH */
 
-              ret = priv->parent->ioctl(priv->parent, MTDIOC_XIPBASE,
+              ret = priv->parent->ioctl(priv->parent, BIOC_XIPBASE,
                                         (unsigned long)((uintptr_t)&base));
               if (ret == OK)
                 {
diff --git a/drivers/mtd/mtd_progmem.c b/drivers/mtd/mtd_progmem.c
index 9ce8c3a..4c9ed0d 100644
--- a/drivers/mtd/mtd_progmem.c
+++ b/drivers/mtd/mtd_progmem.c
@@ -326,7 +326,7 @@ static int progmem_ioctl(FAR struct mtd_dev_s *dev, int cmd,
         }
         break;
 
-      case MTDIOC_XIPBASE:
+      case BIOC_XIPBASE:
         {
           FAR void **ppv = (FAR void**)arg;
 
diff --git a/drivers/mtd/rammtd.c b/drivers/mtd/rammtd.c
index 47c80ab..a123d2d 100644
--- a/drivers/mtd/rammtd.c
+++ b/drivers/mtd/rammtd.c
@@ -386,7 +386,7 @@ static int ram_ioctl(FAR struct mtd_dev_s *dev, int cmd, 
unsigned long arg)
         }
         break;
 
-      case MTDIOC_XIPBASE:
+      case BIOC_XIPBASE:
         {
           FAR void **ppv = (FAR void**)((uintptr_t)arg);
           if (ppv)
diff --git a/drivers/mtd/skeleton.c b/drivers/mtd/skeleton.c
index 60adf05..ad8d211 100644
--- a/drivers/mtd/skeleton.c
+++ b/drivers/mtd/skeleton.c
@@ -259,7 +259,7 @@ static int skel_ioctl(FAR struct mtd_dev_s *dev, int cmd, 
unsigned long arg)
         }
         break;
 
-      case MTDIOC_XIPBASE:
+      case BIOC_XIPBASE:
         {
           FAR void **ppv = (FAR void**)arg;
 
diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c
index 5b02586..5a41423 100644
--- a/drivers/mtd/smart.c
+++ b/drivers/mtd/smart.c
@@ -5467,27 +5467,6 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, 
unsigned long arg)
 
   switch (cmd)
     {
-    case BIOC_XIPBASE:
-      /* The argument accompanying the BIOC_XIPBASE should be non-NULL.  If
-       * DEBUG is enabled, we will catch it here instead of in the MTD
-       * driver.
-       */
-
-#ifdef CONFIG_DEBUG_FEATURES
-      if (arg == 0)
-        {
-          ferr("ERROR: BIOC_XIPBASE argument is NULL\n");
-          return -EINVAL;
-        }
-#endif
-
-      /* Just change the BIOC_XIPBASE command to the MTDIOC_XIPBASE
-       * command.
-       */
-
-      cmd = MTDIOC_XIPBASE;
-      break;
-
     case BIOC_GETFORMAT:
 
       /* Return the format information for the device */
diff --git a/drivers/mtd/sst39vf.c b/drivers/mtd/sst39vf.c
index 3028918..a1114a8 100644
--- a/drivers/mtd/sst39vf.c
+++ b/drivers/mtd/sst39vf.c
@@ -723,7 +723,7 @@ static int sst39vf_ioctl(FAR struct mtd_dev_s *dev,
         }
         break;
 
-      case MTDIOC_XIPBASE:
+      case BIOC_XIPBASE:
         {
           FAR void **ppv = (FAR void **)arg;
           if (ppv)
diff --git a/fs/driver/fs_blockpartition.c b/fs/driver/fs_blockpartition.c
index b277c6f..dd34f89 100644
--- a/fs/driver/fs_blockpartition.c
+++ b/fs/driver/fs_blockpartition.c
@@ -227,7 +227,7 @@ static int part_ioctl(FAR struct inode *inode, int cmd, 
unsigned long arg)
       ret = parent->u.i_bops->ioctl(parent, cmd, arg);
       if (ret >= 0)
         {
-          if (cmd == BIOC_XIPBASE || cmd == MTDIOC_XIPBASE)
+          if (cmd == BIOC_XIPBASE)
             {
               FAR void **base = (FAR void **)ptr_arg;
               struct geometry geo;
diff --git a/fs/romfs/fs_romfsutil.c b/fs/romfs/fs_romfsutil.c
index a606bbc..a82b976 100644
--- a/fs/romfs/fs_romfsutil.c
+++ b/fs/romfs/fs_romfsutil.c
@@ -530,7 +530,7 @@ int romfs_hwconfigure(struct romfs_mountpt_s *rm)
 
   if (INODE_IS_MTD(inode))
     {
-      ret = MTD_IOCTL(inode->u.i_mtd, MTDIOC_XIPBASE,
+      ret = MTD_IOCTL(inode->u.i_mtd, BIOC_XIPBASE,
                       (unsigned long)&rm->rm_xipbase);
     }
   else if (inode->u.i_bops->ioctl != NULL)
diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h
index fe4bf05..1a54a54 100644
--- a/include/nuttx/mtd/mtd.h
+++ b/include/nuttx/mtd/mtd.h
@@ -41,10 +41,11 @@
 /* Ioctl commands */
 
 /* Note, the following ioctl existed in the past and was removed:
+ * #define MTDIOC_XIPBASE    _MTDIOC(0x0002)
  * #define MTDIOC_FLUSH      _MTDIOC(0x0009)
  * #define MTDIOC_PARTINFO   _MTDIOC(0x000b)
  * try to avoid adding a new ioctl with the same ioctl number and
- * replace with BIOC_FLUSH and BIOC_PARTINFO instead.
+ * replace with BIOC_XIPBASE, BIOC_FLUSH and BIOC_PARTINFO instead.
  */
 
 #define MTDIOC_GEOMETRY   _MTDIOC(0x0001) /* IN:  Pointer to write-able struct
@@ -52,11 +53,6 @@
                                            *      receive geometry data (see 
mtd.h)
                                            * OUT: Geometry structure is 
populated
                                            *      with data for the MTD */
-#define MTDIOC_XIPBASE    _MTDIOC(0x0002) /* IN:  Pointer to pointer to void in
-                                           *      which to received the XIP 
base.
-                                           * OUT: If media is directly 
accessible,
-                                           *      return (void *) base address
-                                           *      of device memory */
 #define MTDIOC_BULKERASE  _MTDIOC(0x0003) /* IN:  None
                                            * OUT: None */
 #define MTDIOC_PROTECT    _MTDIOC(0x0004) /* IN:  Pointer to read-able struct

Reply via email to