From a18dbfda6e4acf1d77d13cec1ea35fc628cd0e6d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 2 Jun 2016 10:44:13 -0600 Subject: [PATCH] Remove drivers/mtd/flash_eraseall.c. It is not used in the OS and is just a dumb wrapper around the MDIOC_BULKERASE IOCTL call. --- ChangeLog | 8 ++ ReleaseNotes | 3 +- .../stm3220g-eval/ide/nsh/iar/libdrivers.ewp | 3 - .../ide/nsh/uvision/libdrivers.uvproj | 5 - drivers/mtd/Make.defs | 2 +- drivers/mtd/flash_eraseall.c | 117 ------------------ fs/nxffs/Kconfig | 4 +- include/nuttx/mtd/mtd.h | 11 -- 8 files changed, 13 insertions(+), 140 deletions(-) delete mode 100644 drivers/mtd/flash_eraseall.c diff --git a/ChangeLog b/ChangeLog index ab23bf83e2..0df50e18fc 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11879,3 +11879,11 @@ mcan_txempty(). From Frank Benkert (2016-06-01). 7.17 2016-xx-xx Gregory Nutt + + * drivers/mtd/flash_eraseall.c: Removed. This is no longer used + in the OS and is simply a wrapper around the MDIOC_BULKERASE + IOCTL command. It used to be called (only) from + apps/system/flash_eraseall, but that has been removed because it + violated the OS/applicatin interface -- by calling flash_eraseall(). + The old code can be found in the Obsoleted' repository (2016-06-03). + diff --git a/ReleaseNotes b/ReleaseNotes index 71516d18af..c760fca737 100644 --- a/ReleaseNotes +++ b/ReleaseNotes @@ -5303,7 +5303,8 @@ Additional new features and extended functionality: can be re-enabled if needed via configuration option. - NXFFS: Make the start up scan of the media a configuration option. It just takes to long and is not really necessary! Those rare cases - where the scan was helpful can be fixed using flash_eraseall(). + where the scan was helpful can be fixed using MDIOC_BULKERASE IOCTL + command. * General Drivers: diff --git a/configs/stm3220g-eval/ide/nsh/iar/libdrivers.ewp b/configs/stm3220g-eval/ide/nsh/iar/libdrivers.ewp index b009ac58d0..0f2f399a3e 100644 --- a/configs/stm3220g-eval/ide/nsh/iar/libdrivers.ewp +++ b/configs/stm3220g-eval/ide/nsh/iar/libdrivers.ewp @@ -1991,9 +1991,6 @@ $PROJ_DIR$/../../../../../drivers/mtd/at45db.c - - $PROJ_DIR$/../../../../../drivers/mtd/flash_eraseall.c - $PROJ_DIR$/../../../../../drivers/mtd/ftl.c diff --git a/configs/stm3220g-eval/ide/nsh/uvision/libdrivers.uvproj b/configs/stm3220g-eval/ide/nsh/uvision/libdrivers.uvproj index f1343317b7..f31ea50bf8 100644 --- a/configs/stm3220g-eval/ide/nsh/uvision/libdrivers.uvproj +++ b/configs/stm3220g-eval/ide/nsh/uvision/libdrivers.uvproj @@ -383,11 +383,6 @@ 1 ../../../../../drivers/mtd/at45db.c - - flash_eraseall.c - 1 - ../../../../../drivers/mtd/flash_eraseall.c - ftl.c 1 diff --git a/drivers/mtd/Make.defs b/drivers/mtd/Make.defs index 1d1ba6d26b..dfc2781e95 100644 --- a/drivers/mtd/Make.defs +++ b/drivers/mtd/Make.defs @@ -39,7 +39,7 @@ ifeq ($(CONFIG_MTD),y) -CSRCS += at45db.c flash_eraseall.c ftl.c m25px.c ramtron.c mtd_config.c +CSRCS += at45db.c ftl.c m25px.c ramtron.c mtd_config.c ifeq ($(CONFIG_MTD_PARTITION),y) CSRCS += mtd_partition.c diff --git a/drivers/mtd/flash_eraseall.c b/drivers/mtd/flash_eraseall.c deleted file mode 100644 index 185da7695c..0000000000 --- a/drivers/mtd/flash_eraseall.c +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** - * drivers/mtd/flash_eraseall.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: flash_eraseall - * - * Description: - * Call a block driver with the MDIOC_BULKERASE ioctl command. This will - * cause the MTD driver to erase all of the flash. - * - ****************************************************************************/ - -int flash_eraseall(FAR const char *driver) -{ - FAR struct inode *inode; - FAR const struct block_operations *ops; - int ret; - - /* Open the block driver */ - - ret = open_blockdriver(driver, 0, &inode); - if (ret < 0) - { - fdbg("ERROR: Failed to open '%s': %d\n", driver, ret); - return ret; - } - - /* Get the block operations */ - - ops = inode->u.i_bops; - - /* Invoke the block driver ioctl method */ - - ret = -EPERM; - if (ops->ioctl) - { - ret = ops->ioctl(inode, MTDIOC_BULKERASE, 0); - if (ret < 0) - { - fdbg("ERROR: MTD ioctl(%04x) failed: %d\n", MTDIOC_BULKERASE, ret); - } - } - - /* Close the block driver */ - - close_blockdriver(inode); - return ret; -} diff --git a/fs/nxffs/Kconfig b/fs/nxffs/Kconfig index 3618b2cf64..f3dd6e1166 100644 --- a/fs/nxffs/Kconfig +++ b/fs/nxffs/Kconfig @@ -31,8 +31,8 @@ config NXFFS_SCAN_VOLUME The down side is that scanning the volume can adversely affect your start-up time. An option is to just erase the FLASH and - reboot in these cases. That can be done with - apps/system/flash_eraseall. + reboot in these cases. That can be done with MDIOC_BULKERASE + IOCTL command. config NXFFS_NAND bool "Enable NAND support" diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h index 8d1ee6db70..9ccefb1384 100644 --- a/include/nuttx/mtd/mtd.h +++ b/include/nuttx/mtd/mtd.h @@ -298,17 +298,6 @@ FAR struct mtd_dev_s *mtd_rwb_initialize(FAR struct mtd_dev_s *mtd); int ftl_initialize(int minor, FAR struct mtd_dev_s *mtd); -/**************************************************************************** - * Name: flash_eraseall - * - * Description: - * Call a block driver with the MTDIOC_BULKERASE ioctl command. This will - * cause the MTD driver to erase all of the flash. - * - ****************************************************************************/ - -int flash_eraseall(FAR const char *driver); - /**************************************************************************** * Name: smart_initialize *