From 6d32ad04ddad5e4423b2e8ba6669ee7c9abbc034 Mon Sep 17 00:00:00 2001 From: Subhra Sankha Sarkar Date: Sat, 7 Nov 2020 11:52:03 +0530 Subject: [PATCH] Minor fixes & NuttX coding standards compliance --- include/nuttx/mtd/mtd.h | 62 ++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h index 24728a039a..b11ca9881f 100644 --- a/include/nuttx/mtd/mtd.h +++ b/include/nuttx/mtd/mtd.h @@ -108,7 +108,7 @@ struct qspi_dev_s; /* Forward reference */ /* The following defines the geometry for the device. It treats the device - * as though it where just an array of fixed size blocks. That is most likely + * as though it were just an array of fixed size blocks. That is most likely * not true, but the client will expect the device logic to do whatever is * necessary to make it appear so. */ @@ -117,7 +117,7 @@ struct mtd_geometry_s { uint32_t blocksize; /* Size of one read/write block. */ uint32_t erasesize; /* Size of one erase blocks -- must be a multiple - * of blocksize.*/ + * of blocksize. */ uint32_t neraseblocks; /* Number of erase blocks */ }; @@ -162,15 +162,15 @@ struct mtd_dev_s /* Read/write from the specified read/write blocks */ - ssize_t (*bread)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, - FAR uint8_t *buffer); - ssize_t (*bwrite)(FAR struct mtd_dev_s *dev, off_t startblock, size_t nblocks, - FAR const uint8_t *buffer); + ssize_t (*bread)(FAR struct mtd_dev_s *dev, off_t startblock, + size_t nblocks, FAR uint8_t *buffer); + ssize_t (*bwrite)(FAR struct mtd_dev_s *dev, off_t startblock, + size_t nblocks, FAR const uint8_t *buffer); - /* Some devices may support byte oriented reads (optional). Most MTD devices - * are inherently block oriented so byte-oriented writing is not supported. It - * is recommended that low-level drivers not support read() if it requires - * buffering. + /* Some devices may support byte oriented reads (optional). Most MTD + * devices are inherently block oriented so byte-oriented writing is not + * supported. It is recommended that low-level drivers not support read() + * if it requires buffering. */ ssize_t (*read)(FAR struct mtd_dev_s *dev, off_t offset, size_t nbytes, @@ -182,7 +182,8 @@ struct mtd_dev_s /* Support other, less frequently used commands: * - MTDIOC_GEOMETRY: Get MTD geometry - * - MTDIOC_XIPBASE: Convert block to physical address for eXecute-In-Place + * - MTDIOC_XIPBASE: Convert block to physical address for + * eXecute-In-Place * - MTDIOC_BULKERASE: Erase the entire device * (see include/nuttx/fs/ioctl.h) */ @@ -221,7 +222,7 @@ extern "C" * Given an instance of an MTD driver, create a flash partition, ie., * another MTD driver instance that only operates with a sub-region of * FLASH media. That sub-region is defined by a sector offset and a - * sector count (where the size of a sector is provided the by parent MTD + * sector count (where the size of a sector is provided by the parent MTD * driver). * * NOTE: Since there may be a number of MTD partition drivers operating on @@ -256,19 +257,19 @@ FAR struct mtd_dev_s *mtd_partition(FAR struct mtd_dev_s *mtd, int mtd_setpartitionname(FAR struct mtd_dev_s *mtd, FAR const char *name); #endif -/************************************************************************************ +/**************************************************************************** * Name: mtd_rwb_initialize * * Description: - * Create an initialized MTD device instance. This MTD driver contains another - * MTD driver and converts a larger sector size to a standard 512 byte sector - * size. + * Create an initialized MTD device instance. This MTD driver contains + * another MTD driver and converts a larger sector size to a standard 512 + * byte sector size. * - * MTD devices are not registered in the file system, but are created as instances - * that can be bound to other functions (such as a block or character driver front - * end). + * MTD devices are not registered in the file system, but are created as + * instances that can be bound to other functions (such as a block or + * character driver front end). * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_MTD_WRBUFFER) || defined(CONFIG_MTD_READAHEAD) FAR struct mtd_dev_s *mtd_rwb_initialize(FAR struct mtd_dev_s *mtd); @@ -384,14 +385,15 @@ FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev, FAR struct mtd_dev_s *at24c_initialize(FAR struct i2c_master_s *dev); #endif -/************************************************************************************ +/**************************************************************************** * Name: at24c_uninitialize * * Description: - * Release resources held by an allocated MTD device instance. Resources are only - * allocated for the case where multiple AT24xx devices are support. + * Release resources held by an allocated MTD device instance. Resources + * are only allocated for the case where multiple AT24xx devices are + * supported. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_AT24XX_MULTI void at24c_uninitialize(FAR struct mtd_dev_s *mtd); @@ -599,8 +601,8 @@ FAR struct mtd_dev_s *n25qxxx_initialize(FAR struct qspi_dev_s *qspi, * Name: w25qxxxjv_initialize * * Description: - * Create an initialized MTD device instance for the QuadSPI-based W25QxxxJV - * FLASH part from Winbond. + * Create an initialized MTD device instance for the QuadSPI-based + * W25QxxxJV FLASH part from Winbond. * ****************************************************************************/ @@ -618,8 +620,9 @@ FAR struct mtd_dev_s *w25qxxxjv_initialize(FAR struct qspi_dev_s *qspi, * ****************************************************************************/ -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); /**************************************************************************** @@ -647,7 +650,8 @@ void blockmtd_teardown(FAR struct mtd_dev_s *dev); ****************************************************************************/ FAR struct mtd_dev_s *filemtd_initialize(FAR const char *path, size_t offset, - int16_t sectsize, int32_t erasesize); + int16_t sectsize, + int32_t erasesize); /**************************************************************************** * Name: filemtd_teardown