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.

This commit is contained in:
Gregory Nutt 2016-06-02 10:44:13 -06:00
parent 2b47473778
commit a18dbfda6e
8 changed files with 13 additions and 140 deletions

View File

@ -11879,3 +11879,11 @@
mcan_txempty(). From Frank Benkert (2016-06-01).
7.17 2016-xx-xx Gregory Nutt <gnutt@nuttx.org>
* 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).

View File

@ -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:

View File

@ -1991,9 +1991,6 @@
<file>
<name>$PROJ_DIR$/../../../../../drivers/mtd/at45db.c</name>
</file>
<file>
<name>$PROJ_DIR$/../../../../../drivers/mtd/flash_eraseall.c</name>
</file>
<file>
<name>$PROJ_DIR$/../../../../../drivers/mtd/ftl.c</name>
</file>

View File

@ -383,11 +383,6 @@
<FileType>1</FileType>
<FilePath>../../../../../drivers/mtd/at45db.c</FilePath>
</File>
<File>
<FileName>flash_eraseall.c</FileName>
<FileType>1</FileType>
<FilePath>../../../../../drivers/mtd/flash_eraseall.c</FilePath>
</File>
<File>
<FileName>ftl.c</FileName>
<FileType>1</FileType>

View File

@ -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

View File

@ -1,117 +0,0 @@
/****************************************************************************
* drivers/mtd/flash_eraseall.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/mtd/mtd.h>
/****************************************************************************
* 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;
}

View File

@ -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"

View File

@ -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
*