You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/09/09 02:42:40 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request, #7046: mtd/config: Remove MTD_CONFIG_ERASEDVALUE

xiaoxiang781216 opened a new pull request, #7046:
URL: https://github.com/apache/incubator-nuttx/pull/7046

   ## Summary
   since we can query this value by MTDIOC_ERASESTATE after: commit 30cb497fe125de6ae2e52a72758180437ec65974
   ···
   Author: Gustavo Henrique Nihei <gu...@espressif.com>
   Date:   Tue Jul 13 19:33:12 2021 -0300
   
       mtd: Add MTDIOC_ERASESTATE command for retrieving erase state value
   ···
   
   ## Impact
   
   ## Testing
   Pass CI
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko merged pull request #7046: mtd/config: Remove MTD_CONFIG_ERASEDVALUE

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged PR #7046:
URL: https://github.com/apache/incubator-nuttx/pull/7046


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #7046: mtd/config: Remove MTD_CONFIG_ERASEDVALUE

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7046:
URL: https://github.com/apache/incubator-nuttx/pull/7046#discussion_r967096459


##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)
 #else
 #  define CONFIGDATA_FORMAT_VERSION     2
+#  define MTD_ERASED_ID(dev)            ((dev->erasestate << 8) | dev->erasestate)

Review Comment:
   @pkarashchenko we don't need manually cast since compiler auto promote the smaller type to int or unsigned int.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7046: mtd/config: Remove MTD_CONFIG_ERASEDVALUE

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7046:
URL: https://github.com/apache/incubator-nuttx/pull/7046#discussion_r967104412


##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)
 #else
 #  define CONFIGDATA_FORMAT_VERSION     2
+#  define MTD_ERASED_ID(dev)            ((dev->erasestate << 8) | dev->erasestate)

Review Comment:
   Ok. That is minor comment just to have it explicit like in
   ```
   #  define __swap_uint16(n) \
       (uint16_t)(((((uint16_t)(n)) & 0x00ff) << 8) | \
                  ((((uint16_t)(n)) >> 8) & 0x00ff))
   ```
   I'm fine to keep the current version



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7046: mtd/config: Remove MTD_CONFIG_ERASEDVALUE

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7046:
URL: https://github.com/apache/incubator-nuttx/pull/7046#discussion_r966825698


##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)
 #else
 #  define CONFIGDATA_FORMAT_VERSION     2
+#  define MTD_ERASED_ID(dev)            ((dev->erasestate << 8) | dev->erasestate)

Review Comment:
   ```suggestion
   #  define MTD_ERASED_ID(dev)            (((uint16_t)dev->erasestate << 8) | dev->erasestate)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #7046: mtd/config: Remove MTD_CONFIG_ERASEDVALUE

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7046:
URL: https://github.com/apache/incubator-nuttx/pull/7046#discussion_r967209253


##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)

Review Comment:
   Done.



##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)
 #else
 #  define CONFIGDATA_FORMAT_VERSION     2
+#  define MTD_ERASED_ID(dev)            ((dev->erasestate << 8) | dev->erasestate)
 #endif
 #define CONFIGDATA_BLOCK_HDR_SIZE       3
-
-#define MTD_ERASED_ID     ((CONFIG_MTD_CONFIG_ERASEDVALUE << 8) | \
-                            CONFIG_MTD_CONFIG_ERASEDVALUE)
-
-#define MTD_ERASED_FLAGS  CONFIG_MTD_CONFIG_ERASEDVALUE
+#define MTD_ERASED_FLAGS(dev)           (dev->erasestate)

Review Comment:
   Done.



##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)
 #else
 #  define CONFIGDATA_FORMAT_VERSION     2
+#  define MTD_ERASED_ID(dev)            ((dev->erasestate << 8) | dev->erasestate)

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7046: mtd/config: Remove MTD_CONFIG_ERASEDVALUE

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7046:
URL: https://github.com/apache/incubator-nuttx/pull/7046#discussion_r967200928


##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)

Review Comment:
   ```suggestion
   #  define MTD_ERASED_ID(dev)            ((dev)->erasestate)
   ```



##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)
 #else
 #  define CONFIGDATA_FORMAT_VERSION     2
+#  define MTD_ERASED_ID(dev)            ((dev->erasestate << 8) | dev->erasestate)

Review Comment:
   ```suggestion
   #  define MTD_ERASED_ID(dev)            (((dev)->erasestate << 8) | (dev)->erasestate)
   ```



##########
drivers/mtd/mtd_config.c:
##########
@@ -57,15 +57,13 @@
 
 #ifdef CONFIG_MTD_CONFIG_NAMED
 #  define CONFIGDATA_FORMAT_VERSION     1
+#  define MTD_ERASED_ID(dev)            (dev->erasestate)
 #else
 #  define CONFIGDATA_FORMAT_VERSION     2
+#  define MTD_ERASED_ID(dev)            ((dev->erasestate << 8) | dev->erasestate)
 #endif
 #define CONFIGDATA_BLOCK_HDR_SIZE       3
-
-#define MTD_ERASED_ID     ((CONFIG_MTD_CONFIG_ERASEDVALUE << 8) | \
-                            CONFIG_MTD_CONFIG_ERASEDVALUE)
-
-#define MTD_ERASED_FLAGS  CONFIG_MTD_CONFIG_ERASEDVALUE
+#define MTD_ERASED_FLAGS(dev)           (dev->erasestate)

Review Comment:
   ```suggestion
   #define MTD_ERASED_FLAGS(dev)           ((dev)->erasestate)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org