Commit Graph

58 Commits

Author SHA1 Message Date
Xiang Xiao
cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao
bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Xiang Xiao
80277d1630
Refine the preprocessor conditional guard style (#190) 2020-01-31 19:07:39 +01:00
Xiang Xiao
68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Alin Jerpelea
ecfdd6e056 smartfs improvements #66
Author: Alan Carvalho de Assis <acassis@gmail.com>

    Run nxstyle on all .c and .h and fix all issues

Author: Alin Jerpelea <alin.jerpelea@sony.com>

    drivers: mtd: smart: Add smartfs fsck feature

    Support fsck to check and repair the smartfs file system. If the power
    loss occurs during writing into the flash, the dead space are created
    in flash after the next power cycle. To avoid this problem, introduce
    fsck and keep the consistency of file system in initializing smartfs.

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

commit 60927c5fb6a353994341601f55071c618e97682b
Author: Alin Jerpelea <alin.jerpelea@sony.com>
Date:   Thu Dec 28 18:27:21 2017 +0900

    drivers: mtd: smart: Fix duplicate sector selection in SmartFS

    Add care for 16-bit sequence without CRC.

    drivers: mtd: smart: Check CRC of duplicate sectors

    In the illegal case by power-loss, when the multiple logical sectors are
    duplicated, we compare the sequence number of each sector and select the newer
    sector. Just in case, add CRC check for the newer sector. If the newer sector
    has CRC error, then we use the older sector.

    drivers: mtd: smart: SPI-Flash recovery from the initial error state

    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.

    drivers: mtd: smart: Fix error handling in smartfs mtd driver

    Add error handling in relocate sector.

    drivers: mtd: smart: Fix initialize sector sequence value in smartfs

    Fix initialization of sequence value into sector header and also avoid
    unaligned memory access when CONFIG_MTD_SMART_ENABLE_CRC=n.

    drivers: mtd: smart: Fix handling of duplicate sector in smartfs

    In smartfs scan, if duplicate logical sector is found on the device,
    then smartfs selects the winner sector by comparing sequence number,
    and the loser sector is soon released. Fix a bug this loser sector
    is registered into logical-to-physical sector mapping table.
2020-01-09 10:14:39 -03:00
Gregory Nutt
9d5d60fee1 Run all .c and .h files in last PR49 through nxstyle. 2020-01-07 09:54:35 -06:00
Alin Jerpelea
a8d63c0cec various fixes (#49)
* libs: libc: math: Fix tanh() math functions
* drivers: mtd: smart: Fix trivial debug message in smartfs
* binfmt: libelf: Fix fd not closed on error
* binfmt: Fix stack memory leak on error
* fs: romfs: Fix private data not free on error
* sched: group: Fix reference after free memory
* sched: clock: Fix clock sync

Fix clock sync when CONFIG_RTC_HIRES is enabled
2020-01-07 09:06:02 -06:00
Xiang Xiao
6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Simon Piriou
780d4d41e8 drivers/mtd/mx25rxx.c: add support for 512B sectors
- Fix for mx25rxx driver as it does not work properly
- Add mx25rxx memory chip & smartfs support in b-l475e-iot01a/nsh config
- Update smartfs smart_scan() function
2019-07-26 09:19:26 -06:00
Gregory Nutt
b49be4bb20 Squashed commit of the following:
arch/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    sched/ audio/ crypto/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    Documentation/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    fs/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    graphics/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    net/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    drivers/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    include/, syscall/, wireless/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    configs/:  Remove all references to CONFIG_DISABLE_POLL.  Standard POSIX poll can no longer be disabled.
2019-05-21 18:57:54 -06:00
Ken Pettit
c883c8a535 drivers/mtd/smart.c: Fix for the SmartFS MTD layer size mapping issue. With this patch, existing SmartFS drives should still mount and work properly, plus the larger sector sizes are now supported correctly. 2019-01-10 07:13:19 -06:00
Daniel P. Carvalho
30ddb909c0 drivers/mtd/smart.c: Fix smart_write_alloc_sector sector size calculation. 2018-12-29 17:03:00 -06:00
Gregory Nutt
0cd5a232ea Fix a few typos. 2018-12-27 08:45:26 -06:00
Gregory Nutt
c137c6ef1f Clean up typos in some comments. 2018-12-22 08:12:34 -06:00
EunBong Song
d33b0640fe Merged in ebsong/nuttx (pull request #712)
Pull request for cortex-r4 codes

* arm/armv7-r: Add general interrupt controller.

    This is based on armv7-a gic controller code.

    Signed-off-by: EunBong Song <eunb.song@samsung.com>

* arm/armv7-r: add invalidate dcache in arm_head.S

    Adding invalidate dcache as a comment in arm_head.S.

    Signed-off-by: EunBong Song <eunb.song@samsung.com>

* arm/armv7-r: Fix some wrong configuration of program status register.

    PSR_E_BIT bit should be set for big endian system.
    PSR_A_BIT bis is set automatically as arm cortex-r4 reference manual 3.7.4.
    So we don't need to set this bit.

    Signed-off-by: EunBong Song <eunb.song@samsung.com>

* arm/armv7-r: Fix some wrong MPU register definition.

    Change MPU_RBAR_ADDR_MASK and MPU_RACR_TEX_SHIFT mask as
    arm cortex-r4 reference manual.

    Region Base Address Register 0-4 bits are reserved.
    MPU Region Access control register type 3-5 bits.

    Signed-off-by: EunBong Song <eunb.song@samsung.com>

* driver/mtd: fix compilation error.

    This commit fixes below compilation errors.

    CC:  mtd/smart.c
    mtd/smart.c:182:22: error: 'gWearBitToLevelMap4' defined but not used [-Werror=unused-const-variable=]
     static const uint8_t gWearBitToLevelMap4[] =
                          ^~~~~~~~~~~~~~~~~~~
    mtd/smart.c:170:22: error: 'gWearLevelToBitMap4' defined but not used [-Werror=unused-const-variable=]
     static const uint8_t gWearLevelToBitMap4[] =
                          ^~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[1]: *** [smart.o] Error 1

    Signed-off-by: Junyeon LEE <junyeon2.lee@samsung.com>

Approved-by: GregoryN <gnutt@nuttx.org>
2018-08-29 01:50:41 +00:00
Gregory Nutt
987a8298f2 Fix some errors found in build testing + clean-up some issues with last changes to remove use of printf() from within the OS. 2018-03-03 15:51:27 -06:00
Gregory Nutt
b4f2b0dfc6 Remove all usage of printf() from the OS. That is not an acceptable context for the use of an application-oriented interface that depends on a task-specific file descriptor and C buffered I/O. 2018-03-03 15:20:21 -06:00
Gregory Nutt
d1b31d536a Eliminate a couple more uses of printf() within the OS. There are several more. 2018-03-03 12:59:48 -06:00
Jussi Kivilinna
4eaa136850 smart: fix wrong freeing of device structure and use-after-free issues on error paths 2017-06-28 07:20:07 -06:00
Jussi Kivilinna
c7fcdf968d mtd/smart: Fix use of uninitialized variable 2017-05-31 09:07:25 -06:00
Gregory Nutt
0de294a586 Fix lots of occurrences of 'the the', 'the there', 'the these', 'the then', 'the they. 2017-05-11 13:35:56 -06:00
Ken Pettit
fea2aaba05 SMART MTD layer: Fixes freesector logic error when sectorsPerBlk=256, adds DEBUGASSERT for invalid geometry and additional memory debug logic. Also fixes the dangling pointer on error bug. 2016-07-14 10:31:28 -06:00
Gregory Nutt
43eb04bb8f Without lowsyslog() *llinfo() is not useful. Eliminate and replace with *info(). 2016-06-20 11:59:15 -06:00
Gregory Nutt
0c8c7fecf0 Add _ to the beginning of all debug macros to avoid name collisions 2016-06-16 12:33:32 -06:00
Gregory Nutt
efb02f2ef1 drivers/: Change some nerr() ERRORS to nwarn() WARNINGS. Anomolous network evernts are not errors. 2016-06-12 08:31:22 -06:00
Gregory Nutt
a1469a3e95 Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err() 2016-06-11 15:50:49 -06:00
Gregory Nutt
1cdc746726 Rename CONFIG_DEBUG to CONFIG_DEBUG_FEATURES 2016-06-11 14:14:08 -06:00
Gregory Nutt
fc3540cffe Replace all occurrences of vdbg with vinfo 2016-06-11 11:59:51 -06:00
ziggurat29
d3fbd86657 bug in smart.c; return code of smart_scan not checked, can cause success result in failure case, leading to 'dev' pointer being invalid. 2016-04-27 19:33:45 -05:00
Ken Pettit
5821af1bbe drivers/mtd: Add support for /dev/smart loop device. From Ken Petit 2015-11-28 09:00:26 -06:00
Gregory Nutt
289b3e281f drivers/mtd/smart.c: Fix a compile error when CONFIG_MTD_SMART_MINIMIZE_RAM=y 2015-11-22 17:18:43 -06:00
Gregory Nutt
891589b307 drivers/mtd/smart.c: Add some run-time geometry tests 2015-11-22 17:10:42 -06:00
Gregory Nutt
54549ef082 Revert "Add option to specify logical sector size during low level format plus adds some run-time geometry tests. fs/smartfs: Remove the 'mksmartfs()' code from the kernel 'fs'"
This reverts commit 96faf0fa3251ca10a17daddc728d931be5a206e0.
2015-11-22 10:15:06 -06:00
Gregory Nutt
64e8f12e2b Add option to specify logical sector size during low level format plus adds some run-time geometry tests. fs/smartfs: Remove the 'mksmartfs()' code from the kernel 'fs'
directory and build.
2015-11-22 10:07:35 -06:00
Ken Pettit
7b590ec9a2 drivers/mtd/smart.c Fixed SmartFS wear level error that occurs when the logical sector size is too small to save all wear level status bytes in a single sector. Logical sectors 1 and 2 were simply not being allocated and then the read_sector and write_sector routines were failing. From Ken Petit 2015-11-18 18:12:06 -06:00
Ken Pettit
f0f7dd9956 drivers/mtd/smart.c: Fix a Smart wear-leveling bug. From Ken Petit 2015-11-18 07:01:13 -06:00
Gregory Nutt
9f3edd6373 MTD Smart: Remove checks for 64KB erase block size. erasesize was changed to 32-bits in struct mtd_geometry_s 2015-11-11 08:25:03 -06:00
Gregory Nutt
2ff1b173f2 SmartFS: Backout last change. It alters the behavior when it should not. Obviously there is something that I do not understand 2015-11-11 08:15:08 -06:00
Gregory Nutt
2ab0832c26 Smart MTD: fix some outdated logic: geometray erase size is now 32-bits 2015-11-09 09:35:14 -06:00
Gregory Nutt
bfeef77f1f SmartFS: Fix a compile error when FS debug enabled. Plus some changes needed by NuttX coding standard 2015-11-05 11:25:39 -06:00
Gregory Nutt
cf14f8d1b5 drivers/: Fixes to spacing and alignement 2015-10-10 10:41:00 -06:00
Gregory Nutt
e4d2822af8 Make some file section headers more consistent with standard 2015-04-08 07:15:32 -06:00
Gregory Nutt
cdc8fc52d1 SmartFS: Implements wear-leveling in the SmartFS. From Ken Pettit 2014-12-09 14:11:15 -06:00
Gregory Nutt
2994448d85 More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs. 2014-11-25 13:15:09 -06:00
Gregory Nutt
34a057334c Update SMART FS procfs support. From Ken Pettit 2014-09-22 11:19:49 -06:00
Gregory Nutt
1780810d3d Rename kmalloc to kmm_malloc for consistency 2014-08-31 17:26:36 -06:00
Gregory Nutt
54fa3b0b59 Rename kfree to kmm_free for consistency with other naming conventions 2014-08-31 17:04:02 -06:00
Gregory Nutt
ab1ab379dd Addition rwbuffer interfaces should not be enabled unless they are needed; if rwbuffer support is enabled, it should not be unconditionally enabled in SMART and FTL 2014-07-11 16:19:17 -06:00
Gregory Nutt
8516551e54 Add an MTD layer that will add read-ahead or write buffering to any MTD driver (incomplete) 2014-07-11 11:20:11 -06:00
Gregory Nutt
b36b29b4c3 SMARTFS: Increase some variables from uint16_t to uint32_t to handle larger device sizes. From Ken Pettit 2014-07-04 07:28:12 -06:00