From 913cc52a986749f56b1addae7fff448f1e9c89c6 Mon Sep 17 00:00:00 2001 From: Yucai Liu Date: Mon, 13 Oct 2025 09:56:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=AD=A3=E7=A1=AE=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit style: format code with clang-format [skip ci] --- components/fal/src/fal_flash.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/components/fal/src/fal_flash.c b/components/fal/src/fal_flash.c index d4fba4e3420..27a31e52e97 100644 --- a/components/fal/src/fal_flash.c +++ b/components/fal/src/fal_flash.c @@ -35,11 +35,11 @@ static rt_uint8_t init_ok = 0; */ int fal_flash_init(void) { - rt_size_t i, j, offset; + rt_size_t i, j, offset; - if (init_ok) + if (init_ok) { - return 0; + return 0; } for (i = 0; i < device_table_len; i++) @@ -53,25 +53,25 @@ int fal_flash_init(void) device_table[i]->ops.init(); } LOG_D("Flash device | %*.*s | addr: 0x%08lx | len: 0x%08x | blk_size: 0x%08x |initialized finish.", - FAL_DEV_NAME_MAX, FAL_DEV_NAME_MAX, device_table[i]->name, device_table[i]->addr, device_table[i]->len, - device_table[i]->blk_size); + FAL_DEV_NAME_MAX, FAL_DEV_NAME_MAX, device_table[i]->name, device_table[i]->addr, device_table[i]->len, + device_table[i]->blk_size); offset = 0; - for (j = 0; j < FAL_DEV_BLK_MAX; j ++) + for (j = 0; j < FAL_DEV_BLK_MAX; j++) { const struct flash_blk *blk = &device_table[i]->blocks[j]; rt_size_t blk_len = blk->count * blk->size; if (blk->count == 0 || blk->size == 0) break; - if(offset > device_table[i]->len) + if (offset > device_table[i]->len) { LOG_I("Flash device %*.*s: add block failed, offset %d > len %d.", - FAL_DEV_NAME_MAX, FAL_DEV_NAME_MAX, device_table[i]->name, device_table[i]->addr, offset, device_table[i]->len); + FAL_DEV_NAME_MAX, FAL_DEV_NAME_MAX, device_table[i]->name, device_table[i]->addr, offset, device_table[i]->len); break; } LOG_D(" blk%2d | addr: 0x%08lx | len: 0x%08x | blk_size: 0x%08x |initialized finish.", - j, device_table[i]->addr + offset, blk_len, blk->size); + j, device_table[i]->addr + offset, blk_len, blk->size); offset += blk_len; } } @@ -97,7 +97,8 @@ const struct fal_flash_dev *fal_flash_device_find(const char *name) for (i = 0; i < device_table_len; i++) { - if (!strncmp(name, device_table[i]->name, FAL_DEV_NAME_MAX)) { + if (!strncmp(name, device_table[i]->name, FAL_DEV_NAME_MAX)) + { return device_table[i]; } } From 8078f12d1ef5d0c82a08cd9433dfa35c12abe5d1 Mon Sep 17 00:00:00 2001 From: "ari.liu" <1486344514@qq.com> Date: Mon, 23 Mar 2026 17:33:20 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=AD=A3=E7=A1=AE=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/fal/src/fal.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/fal/src/fal.c b/components/fal/src/fal.c index 52c7ed728d8..266273a31be 100644 --- a/components/fal/src/fal.c +++ b/components/fal/src/fal.c @@ -19,7 +19,7 @@ #endif #include -static rt_uint8_t init_ok = 0; +static rt_uint8_t init_ok = 0; /** * FAL (Flash Abstraction Layer) initialization. @@ -27,7 +27,8 @@ static rt_uint8_t init_ok = 0; * * @return >= 0: partitions total number */ -int fal_init(void) +int fal_init( void) + { extern int fal_flash_init(void); extern int fal_partition_init(void); @@ -35,7 +36,8 @@ int fal_init(void) int result; /* initialize all flash device on FAL flash table */ - result = fal_flash_init(); + result = + fal_flash_init(); if (result < 0) { goto __exit; From 804248f262383811535522cfc13103f7a4c8c8b8 Mon Sep 17 00:00:00 2001 From: "ari.liu" <1486344514@qq.com> Date: Mon, 23 Mar 2026 17:42:25 +0800 Subject: [PATCH 3/4] 11 --- components/fal/src/fal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/fal/src/fal.c b/components/fal/src/fal.c index 266273a31be..186cb69832b 100644 --- a/components/fal/src/fal.c +++ b/components/fal/src/fal.c @@ -48,7 +48,9 @@ int fal_init( void) __exit: - if ((result > 0) && (!init_ok)) + if + ((result > 0) + && (!init_ok)) { init_ok = 1; LOG_I("RT-Thread Flash Abstraction Layer initialize success."); From ed159394db41b83d959e9ba8ac17a29d22664f95 Mon Sep 17 00:00:00 2001 From: illustriousness Date: Mon, 23 Mar 2026 10:03:47 +0000 Subject: [PATCH 4/4] style: format code with clang-format [skip ci] --- components/fal/src/fal.c | 17 ++++++++--------- components/fal/src/fal_flash.c | 6 +++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/components/fal/src/fal.c b/components/fal/src/fal.c index 186cb69832b..b6c16983216 100644 --- a/components/fal/src/fal.c +++ b/components/fal/src/fal.c @@ -19,7 +19,7 @@ #endif #include -static rt_uint8_t init_ok = 0; +static rt_uint8_t init_ok = 0; /** * FAL (Flash Abstraction Layer) initialization. @@ -27,7 +27,7 @@ static rt_uint8_t init_ok = 0; * * @return >= 0: partitions total number */ -int fal_init( void) +int fal_init(void) { extern int fal_flash_init(void); @@ -36,10 +36,11 @@ int fal_init( void) int result; /* initialize all flash device on FAL flash table */ - result = - fal_flash_init(); + result = + fal_flash_init(); - if (result < 0) { + if (result < 0) + { goto __exit; } @@ -48,14 +49,12 @@ int fal_init( void) __exit: - if - ((result > 0) - && (!init_ok)) + if ((result > 0) && (!init_ok)) { init_ok = 1; LOG_I("RT-Thread Flash Abstraction Layer initialize success."); } - else if(result <= 0) + else if (result <= 0) { init_ok = 0; LOG_E("RT-Thread Flash Abstraction Layer initialize failed."); diff --git a/components/fal/src/fal_flash.c b/components/fal/src/fal_flash.c index 27a31e52e97..c87a55b4f0d 100644 --- a/components/fal/src/fal_flash.c +++ b/components/fal/src/fal_flash.c @@ -35,11 +35,11 @@ static rt_uint8_t init_ok = 0; */ int fal_flash_init(void) { - rt_size_t i, j, offset; + rt_size_t i, j, offset; - if (init_ok) + if (init_ok) { - return 0; + return 0; } for (i = 0; i < device_table_len; i++)