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/01/06 13:47:59 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #5182: Move simulated drivers from sim to common place

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


   ## Summary
   Since it's good demo for driver writer:
   - arch/sim: Move the dummy foc driver to drivers/motor/foc
   - arch/sim: Move the dummy ioe driver to drivers/ioexpender
   
   ## Impact
   Minor
   
   ## 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 commented on a change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780217854



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       The case is that C89 compatibility in such cases cost a lot if there are similar function prototypes but there is a bug in initialization list. Like in drivers/sensors/as5048b.c from https://github.com/apache/incubator-nuttx/pull/5140




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780130847



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       But drivers/motor/foc/foc_dummy.c and many many other drivers use this. Should we fill an issue to clean-up all this and get back to C89?




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780217854



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       The case is that C89 compatibility in such cases cost a lot if there are similar function prototypes but there is a bug in initialization list. Like in drivers/sensors/as5048b.c from https://github.com/apache/incubator-nuttx/pull/5140
   We are lucky that currently CI catches inconsistency




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780157173



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       Done for FOC driver. arch driver can relax the requirement since widely used compiler support the new C version, but the common code is better to avoid C99 only feature. 




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780121558



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       ```suggestion
       .direction = ioe_dummy_direction,
   ```
   and same for others?

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       ```suggestion
     .direction = ioe_dummy_direction,
   ```
   and same for others?

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       But drivers/motor/foc/foc_dummy.c and many many other drivers use this. Should we fill an issue to clean-up all this and get back to C89?

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       The case is that C89 compatibility in such cases cost a lot if there are similar function prototypes but there is a bug in initialization list. Like in drivers/sensors/as5048b.c from https://github.com/apache/incubator-nuttx/pull/5140

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       The case is that C89 compatibility in such cases cost a lot if there are similar function prototypes but there is a bug in initialization list. Like in drivers/sensors/as5048b.c from https://github.com/apache/incubator-nuttx/pull/5140
   We are lucky that currently CI catches inconsistency

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,
+  ioe_dummy_option,
+  ioe_dummy_writepin,
+  ioe_dummy_readpin,
+  ioe_dummy_readpin
 #ifdef CONFIG_IOEXPANDER_MULTIPIN
-  , sim_multiwritepin
-  , sim_multireadpin
-  , sim_multireadpin
+  , ioe_dummy_multiwritepin

Review comment:
       Maybe switch to more traditional
   
   ```suggestion
     ioe_dummy_multiwritepin,
   ```
   Here and below? To align style with other files

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,
+  ioe_dummy_option,
+  ioe_dummy_writepin,
+  ioe_dummy_readpin,
+  ioe_dummy_readpin
 #ifdef CONFIG_IOEXPANDER_MULTIPIN
-  , sim_multiwritepin
-  , sim_multireadpin
-  , sim_multireadpin
+  , ioe_dummy_multiwritepin

Review comment:
       Maybe switch to more traditional
   
   ```suggestion
     ioe_dummy_multiwritepin,
   ```
   here and below? To align style with other files

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,
+  ioe_dummy_option,
+  ioe_dummy_writepin,
+  ioe_dummy_readpin,
+  ioe_dummy_readpin
 #ifdef CONFIG_IOEXPANDER_MULTIPIN
-  , sim_multiwritepin
-  , sim_multireadpin
-  , sim_multireadpin
+  , ioe_dummy_multiwritepin

Review comment:
       Not sure what style is preferable. I see both cases all over the code

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,
+  ioe_dummy_option,
+  ioe_dummy_writepin,
+  ioe_dummy_readpin,
+  ioe_dummy_readpin
 #ifdef CONFIG_IOEXPANDER_MULTIPIN
-  , sim_multiwritepin
-  , sim_multireadpin
-  , sim_multireadpin
+  , ioe_dummy_multiwritepin

Review comment:
       Not sure what style is preferable. I see both cases all over the code

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       I really believe that we should use designated initializers here and in other places of common code. NuttX code is far away from C89 already and I do not see way back. Otherwise we need to clean-up all the `inline`, `<stdbool.h>`, `<inttypes.h>`, `__VA_ARGS__` and other C99 features from the code. I do not think that it is doable and we need to try keeping C89 compliance.

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       I really believe that we should use designated initializers here and in other places of common code. NuttX code is far away from C89 already and I do not see way back. Otherwise we need to clean-up all the `inline` functions, `<stdbool.h>`, `<inttypes.h>`, `__VA_ARGS__` and other C99 features from the code. I do not think that it is doable and we need to try keeping C89 compliance.




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780557491



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,
+  ioe_dummy_option,
+  ioe_dummy_writepin,
+  ioe_dummy_readpin,
+  ioe_dummy_readpin
 #ifdef CONFIG_IOEXPANDER_MULTIPIN
-  , sim_multiwritepin
-  , sim_multireadpin
-  , sim_multireadpin
+  , ioe_dummy_multiwritepin

Review comment:
       Not sure what style is preferable. I see both cases all over the code




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780265031



##########
File path: drivers/motor/foc/foc_dummy.c
##########
@@ -93,64 +94,64 @@ struct sim_foc_data_s
 
 /* Lower-half FOC operations */
 
-static int sim_foc_configure(FAR struct foc_dev_s *dev,
-                             FAR struct foc_cfg_s *cfg);
-static int sim_foc_setup(FAR struct foc_dev_s *dev);
-static int sim_foc_shutdown(FAR struct foc_dev_s *dev);
-static int sim_foc_start(FAR struct foc_dev_s *dev, bool state);
-static int sim_foc_pwm_duty_set(FAR struct foc_dev_s *dev,
-                                FAR foc_duty_t *duty);
-static int sim_foc_ioctl(FAR struct foc_dev_s *dev, int cmd,
-                         unsigned long arg);
-static int sim_foc_bind(FAR struct foc_dev_s *dev,
-                        FAR struct foc_callbacks_s *cb);
-static int sim_foc_fault_clear(FAR struct foc_dev_s *dev);
+static int foc_dummy_configure(FAR struct foc_dev_s *dev,
+                               FAR struct foc_cfg_s *cfg);
+static int foc_dummy_setup(FAR struct foc_dev_s *dev);
+static int foc_dummy_shutdown(FAR struct foc_dev_s *dev);
+static int foc_dummy_start(FAR struct foc_dev_s *dev, bool state);
+static int foc_dummy_pwm_duty_set(FAR struct foc_dev_s *dev,
+                                  FAR foc_duty_t *duty);
+static int foc_dummy_ioctl(FAR struct foc_dev_s *dev, int cmd,
+                           unsigned long arg);
+static int foc_dummy_bind(FAR struct foc_dev_s *dev,
+                          FAR struct foc_callbacks_s *cb);
+static int foc_dummy_fault_clear(FAR struct foc_dev_s *dev);
 #ifdef CONFIG_MOTOR_FOC_TRACE
-static void sim_foc_trace(FAR struct foc_dev_s *dev, int type, bool state);
+static void foc_dummy_trace(FAR struct foc_dev_s *dev, int type, bool state);
 #endif
 
 /* Handlers */
 
-static int sim_foc_notifier_handler(FAR struct foc_dev_s *dev);
+static void foc_dummy_notifier_handler(FAR struct foc_dev_s *dev);
 
 /* Helpers */
 
-static void sim_foc_hw_config_get(FAR struct foc_dev_s *dev);
-static int sim_foc_notifier_cfg(FAR struct foc_dev_s *dev, uint32_t freq);
-static int sim_foc_pwm_setup(FAR struct foc_dev_s *dev, uint32_t freq);
-static int sim_foc_pwm_start(FAR struct foc_dev_s *dev, bool state);
-static int sim_foc_adc_setup(FAR struct foc_dev_s *dev);
-static int sim_foc_adc_start(FAR struct foc_dev_s *dev, bool state);
+static void foc_dummy_hw_config_get(FAR struct foc_dev_s *dev);
+static int foc_dummy_notifier_cfg(FAR struct foc_dev_s *dev, uint32_t freq);
+static int foc_dummy_pwm_setup(FAR struct foc_dev_s *dev, uint32_t freq);
+static int foc_dummy_pwm_start(FAR struct foc_dev_s *dev, bool state);
+static int foc_dummy_adc_setup(FAR struct foc_dev_s *dev);
+static int foc_dummy_adc_start(FAR struct foc_dev_s *dev, bool state);
 
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
 /* SIM FOC specific data */
 
-static struct sim_foc_data_s  g_sim_foc_data[CONFIG_MOTOR_FOC_INST];
-static struct sim_foc_board_s g_sim_foc_board[CONFIG_MOTOR_FOC_INST];
+static struct foc_dummy_data_s  g_foc_dummy_data[CONFIG_MOTOR_FOC_INST];
+static struct foc_dummy_board_s g_foc_dummy_board[CONFIG_MOTOR_FOC_INST];
 
 /* SIM specific FOC ops */
 
-static struct foc_lower_ops_s g_sim_foc_ops =
+static struct foc_lower_ops_s g_foc_dummy_ops =
 {
-  .configure      = sim_foc_configure,
-  .setup          = sim_foc_setup,
-  .shutdown       = sim_foc_shutdown,
-  .start          = sim_foc_start,
-  .pwm_duty_set   = sim_foc_pwm_duty_set,
-  .ioctl          = sim_foc_ioctl,
-  .bind           = sim_foc_bind,
-  .fault_clear    = sim_foc_fault_clear,
+  foc_dummy_configure,
+  foc_dummy_setup,
+  foc_dummy_shutdown,
+  foc_dummy_start,
+  foc_dummy_pwm_duty_set,
+  foc_dummy_ioctl,

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] xiaoxiang781216 commented on a change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780127247



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       No, since C89 doesn't support .field = xxx.




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780127247



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       No, since C89 doesn't support .field = xxx.

##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       Done for FOC driver. arch driver can relax the requirement since widely used compiler support the new C version, but the common code is better to avoid C99 only feature. 

##########
File path: drivers/motor/foc/foc_dummy.c
##########
@@ -93,64 +94,64 @@ struct sim_foc_data_s
 
 /* Lower-half FOC operations */
 
-static int sim_foc_configure(FAR struct foc_dev_s *dev,
-                             FAR struct foc_cfg_s *cfg);
-static int sim_foc_setup(FAR struct foc_dev_s *dev);
-static int sim_foc_shutdown(FAR struct foc_dev_s *dev);
-static int sim_foc_start(FAR struct foc_dev_s *dev, bool state);
-static int sim_foc_pwm_duty_set(FAR struct foc_dev_s *dev,
-                                FAR foc_duty_t *duty);
-static int sim_foc_ioctl(FAR struct foc_dev_s *dev, int cmd,
-                         unsigned long arg);
-static int sim_foc_bind(FAR struct foc_dev_s *dev,
-                        FAR struct foc_callbacks_s *cb);
-static int sim_foc_fault_clear(FAR struct foc_dev_s *dev);
+static int foc_dummy_configure(FAR struct foc_dev_s *dev,
+                               FAR struct foc_cfg_s *cfg);
+static int foc_dummy_setup(FAR struct foc_dev_s *dev);
+static int foc_dummy_shutdown(FAR struct foc_dev_s *dev);
+static int foc_dummy_start(FAR struct foc_dev_s *dev, bool state);
+static int foc_dummy_pwm_duty_set(FAR struct foc_dev_s *dev,
+                                  FAR foc_duty_t *duty);
+static int foc_dummy_ioctl(FAR struct foc_dev_s *dev, int cmd,
+                           unsigned long arg);
+static int foc_dummy_bind(FAR struct foc_dev_s *dev,
+                          FAR struct foc_callbacks_s *cb);
+static int foc_dummy_fault_clear(FAR struct foc_dev_s *dev);
 #ifdef CONFIG_MOTOR_FOC_TRACE
-static void sim_foc_trace(FAR struct foc_dev_s *dev, int type, bool state);
+static void foc_dummy_trace(FAR struct foc_dev_s *dev, int type, bool state);
 #endif
 
 /* Handlers */
 
-static int sim_foc_notifier_handler(FAR struct foc_dev_s *dev);
+static void foc_dummy_notifier_handler(FAR struct foc_dev_s *dev);
 
 /* Helpers */
 
-static void sim_foc_hw_config_get(FAR struct foc_dev_s *dev);
-static int sim_foc_notifier_cfg(FAR struct foc_dev_s *dev, uint32_t freq);
-static int sim_foc_pwm_setup(FAR struct foc_dev_s *dev, uint32_t freq);
-static int sim_foc_pwm_start(FAR struct foc_dev_s *dev, bool state);
-static int sim_foc_adc_setup(FAR struct foc_dev_s *dev);
-static int sim_foc_adc_start(FAR struct foc_dev_s *dev, bool state);
+static void foc_dummy_hw_config_get(FAR struct foc_dev_s *dev);
+static int foc_dummy_notifier_cfg(FAR struct foc_dev_s *dev, uint32_t freq);
+static int foc_dummy_pwm_setup(FAR struct foc_dev_s *dev, uint32_t freq);
+static int foc_dummy_pwm_start(FAR struct foc_dev_s *dev, bool state);
+static int foc_dummy_adc_setup(FAR struct foc_dev_s *dev);
+static int foc_dummy_adc_start(FAR struct foc_dev_s *dev, bool state);
 
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
 /* SIM FOC specific data */
 
-static struct sim_foc_data_s  g_sim_foc_data[CONFIG_MOTOR_FOC_INST];
-static struct sim_foc_board_s g_sim_foc_board[CONFIG_MOTOR_FOC_INST];
+static struct foc_dummy_data_s  g_foc_dummy_data[CONFIG_MOTOR_FOC_INST];
+static struct foc_dummy_board_s g_foc_dummy_board[CONFIG_MOTOR_FOC_INST];
 
 /* SIM specific FOC ops */
 
-static struct foc_lower_ops_s g_sim_foc_ops =
+static struct foc_lower_ops_s g_foc_dummy_ops =
 {
-  .configure      = sim_foc_configure,
-  .setup          = sim_foc_setup,
-  .shutdown       = sim_foc_shutdown,
-  .start          = sim_foc_start,
-  .pwm_duty_set   = sim_foc_pwm_duty_set,
-  .ioctl          = sim_foc_ioctl,
-  .bind           = sim_foc_bind,
-  .fault_clear    = sim_foc_fault_clear,
+  foc_dummy_configure,
+  foc_dummy_setup,
+  foc_dummy_shutdown,
+  foc_dummy_start,
+  foc_dummy_pwm_duty_set,
+  foc_dummy_ioctl,

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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780557282



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,
+  ioe_dummy_option,
+  ioe_dummy_writepin,
+  ioe_dummy_readpin,
+  ioe_dummy_readpin
 #ifdef CONFIG_IOEXPANDER_MULTIPIN
-  , sim_multiwritepin
-  , sim_multireadpin
-  , sim_multireadpin
+  , ioe_dummy_multiwritepin

Review comment:
       Not sure what style is preferable. I see both cases all over the code




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780121558



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       ```suggestion
       .direction = ioe_dummy_direction,
   ```
   and same for others?




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780436831



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,
+  ioe_dummy_option,
+  ioe_dummy_writepin,
+  ioe_dummy_readpin,
+  ioe_dummy_readpin
 #ifdef CONFIG_IOEXPANDER_MULTIPIN
-  , sim_multiwritepin
-  , sim_multireadpin
-  , sim_multireadpin
+  , ioe_dummy_multiwritepin

Review comment:
       Maybe switch to more traditional
   
   ```suggestion
     ioe_dummy_multiwritepin,
   ```
   here and below? To align style with other files




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780566773



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       I really believe that we should use designated initializers here and in other places of common code. NuttX code is far away from C89 already and I do not see way back. Otherwise we need to clean-up all the `inline` functions, `<stdbool.h>`, `<inttypes.h>`, `__VA_ARGS__` and other C99 features from the code. I do not think that it is doable and we need to try keeping C89 compliance.




-- 
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 merged pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182


   


-- 
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] raiden00pl commented on a change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
raiden00pl commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780214828



##########
File path: drivers/motor/foc/foc_dummy.c
##########
@@ -93,64 +94,64 @@ struct sim_foc_data_s
 
 /* Lower-half FOC operations */
 
-static int sim_foc_configure(FAR struct foc_dev_s *dev,
-                             FAR struct foc_cfg_s *cfg);
-static int sim_foc_setup(FAR struct foc_dev_s *dev);
-static int sim_foc_shutdown(FAR struct foc_dev_s *dev);
-static int sim_foc_start(FAR struct foc_dev_s *dev, bool state);
-static int sim_foc_pwm_duty_set(FAR struct foc_dev_s *dev,
-                                FAR foc_duty_t *duty);
-static int sim_foc_ioctl(FAR struct foc_dev_s *dev, int cmd,
-                         unsigned long arg);
-static int sim_foc_bind(FAR struct foc_dev_s *dev,
-                        FAR struct foc_callbacks_s *cb);
-static int sim_foc_fault_clear(FAR struct foc_dev_s *dev);
+static int foc_dummy_configure(FAR struct foc_dev_s *dev,
+                               FAR struct foc_cfg_s *cfg);
+static int foc_dummy_setup(FAR struct foc_dev_s *dev);
+static int foc_dummy_shutdown(FAR struct foc_dev_s *dev);
+static int foc_dummy_start(FAR struct foc_dev_s *dev, bool state);
+static int foc_dummy_pwm_duty_set(FAR struct foc_dev_s *dev,
+                                  FAR foc_duty_t *duty);
+static int foc_dummy_ioctl(FAR struct foc_dev_s *dev, int cmd,
+                           unsigned long arg);
+static int foc_dummy_bind(FAR struct foc_dev_s *dev,
+                          FAR struct foc_callbacks_s *cb);
+static int foc_dummy_fault_clear(FAR struct foc_dev_s *dev);
 #ifdef CONFIG_MOTOR_FOC_TRACE
-static void sim_foc_trace(FAR struct foc_dev_s *dev, int type, bool state);
+static void foc_dummy_trace(FAR struct foc_dev_s *dev, int type, bool state);
 #endif
 
 /* Handlers */
 
-static int sim_foc_notifier_handler(FAR struct foc_dev_s *dev);
+static void foc_dummy_notifier_handler(FAR struct foc_dev_s *dev);
 
 /* Helpers */
 
-static void sim_foc_hw_config_get(FAR struct foc_dev_s *dev);
-static int sim_foc_notifier_cfg(FAR struct foc_dev_s *dev, uint32_t freq);
-static int sim_foc_pwm_setup(FAR struct foc_dev_s *dev, uint32_t freq);
-static int sim_foc_pwm_start(FAR struct foc_dev_s *dev, bool state);
-static int sim_foc_adc_setup(FAR struct foc_dev_s *dev);
-static int sim_foc_adc_start(FAR struct foc_dev_s *dev, bool state);
+static void foc_dummy_hw_config_get(FAR struct foc_dev_s *dev);
+static int foc_dummy_notifier_cfg(FAR struct foc_dev_s *dev, uint32_t freq);
+static int foc_dummy_pwm_setup(FAR struct foc_dev_s *dev, uint32_t freq);
+static int foc_dummy_pwm_start(FAR struct foc_dev_s *dev, bool state);
+static int foc_dummy_adc_setup(FAR struct foc_dev_s *dev);
+static int foc_dummy_adc_start(FAR struct foc_dev_s *dev, bool state);
 
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
 /* SIM FOC specific data */
 
-static struct sim_foc_data_s  g_sim_foc_data[CONFIG_MOTOR_FOC_INST];
-static struct sim_foc_board_s g_sim_foc_board[CONFIG_MOTOR_FOC_INST];
+static struct foc_dummy_data_s  g_foc_dummy_data[CONFIG_MOTOR_FOC_INST];
+static struct foc_dummy_board_s g_foc_dummy_board[CONFIG_MOTOR_FOC_INST];
 
 /* SIM specific FOC ops */
 
-static struct foc_lower_ops_s g_sim_foc_ops =
+static struct foc_lower_ops_s g_foc_dummy_ops =
 {
-  .configure      = sim_foc_configure,
-  .setup          = sim_foc_setup,
-  .shutdown       = sim_foc_shutdown,
-  .start          = sim_foc_start,
-  .pwm_duty_set   = sim_foc_pwm_duty_set,
-  .ioctl          = sim_foc_ioctl,
-  .bind           = sim_foc_bind,
-  .fault_clear    = sim_foc_fault_clear,
+  foc_dummy_configure,
+  foc_dummy_setup,
+  foc_dummy_shutdown,
+  foc_dummy_start,
+  foc_dummy_pwm_duty_set,
+  foc_dummy_ioctl,

Review comment:
       ```suggestion
     foc_dummy_pwm_duty_set,
     foc_dummy_start,
     foc_dummy_ioctl,
   ```




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780566773



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       I really believe that we should use designated initializers here and in other places of common code. NuttX code is far away from C89 already and I do not see way back. Otherwise we need to clean-up all the `inline`, `<stdbool.h>`, `<inttypes.h>`, `__VA_ARGS__` and other C99 features from the code. I do not think that it is doable and we need to try keeping C89 compliance.




-- 
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 pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#issuecomment-1008113757


   LGTM!


-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780121558



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,

Review comment:
       ```suggestion
     .direction = ioe_dummy_direction,
   ```
   and same for others?




-- 
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] raiden00pl commented on a change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
raiden00pl commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780214828



##########
File path: drivers/motor/foc/foc_dummy.c
##########
@@ -93,64 +94,64 @@ struct sim_foc_data_s
 
 /* Lower-half FOC operations */
 
-static int sim_foc_configure(FAR struct foc_dev_s *dev,
-                             FAR struct foc_cfg_s *cfg);
-static int sim_foc_setup(FAR struct foc_dev_s *dev);
-static int sim_foc_shutdown(FAR struct foc_dev_s *dev);
-static int sim_foc_start(FAR struct foc_dev_s *dev, bool state);
-static int sim_foc_pwm_duty_set(FAR struct foc_dev_s *dev,
-                                FAR foc_duty_t *duty);
-static int sim_foc_ioctl(FAR struct foc_dev_s *dev, int cmd,
-                         unsigned long arg);
-static int sim_foc_bind(FAR struct foc_dev_s *dev,
-                        FAR struct foc_callbacks_s *cb);
-static int sim_foc_fault_clear(FAR struct foc_dev_s *dev);
+static int foc_dummy_configure(FAR struct foc_dev_s *dev,
+                               FAR struct foc_cfg_s *cfg);
+static int foc_dummy_setup(FAR struct foc_dev_s *dev);
+static int foc_dummy_shutdown(FAR struct foc_dev_s *dev);
+static int foc_dummy_start(FAR struct foc_dev_s *dev, bool state);
+static int foc_dummy_pwm_duty_set(FAR struct foc_dev_s *dev,
+                                  FAR foc_duty_t *duty);
+static int foc_dummy_ioctl(FAR struct foc_dev_s *dev, int cmd,
+                           unsigned long arg);
+static int foc_dummy_bind(FAR struct foc_dev_s *dev,
+                          FAR struct foc_callbacks_s *cb);
+static int foc_dummy_fault_clear(FAR struct foc_dev_s *dev);
 #ifdef CONFIG_MOTOR_FOC_TRACE
-static void sim_foc_trace(FAR struct foc_dev_s *dev, int type, bool state);
+static void foc_dummy_trace(FAR struct foc_dev_s *dev, int type, bool state);
 #endif
 
 /* Handlers */
 
-static int sim_foc_notifier_handler(FAR struct foc_dev_s *dev);
+static void foc_dummy_notifier_handler(FAR struct foc_dev_s *dev);
 
 /* Helpers */
 
-static void sim_foc_hw_config_get(FAR struct foc_dev_s *dev);
-static int sim_foc_notifier_cfg(FAR struct foc_dev_s *dev, uint32_t freq);
-static int sim_foc_pwm_setup(FAR struct foc_dev_s *dev, uint32_t freq);
-static int sim_foc_pwm_start(FAR struct foc_dev_s *dev, bool state);
-static int sim_foc_adc_setup(FAR struct foc_dev_s *dev);
-static int sim_foc_adc_start(FAR struct foc_dev_s *dev, bool state);
+static void foc_dummy_hw_config_get(FAR struct foc_dev_s *dev);
+static int foc_dummy_notifier_cfg(FAR struct foc_dev_s *dev, uint32_t freq);
+static int foc_dummy_pwm_setup(FAR struct foc_dev_s *dev, uint32_t freq);
+static int foc_dummy_pwm_start(FAR struct foc_dev_s *dev, bool state);
+static int foc_dummy_adc_setup(FAR struct foc_dev_s *dev);
+static int foc_dummy_adc_start(FAR struct foc_dev_s *dev, bool state);
 
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
 /* SIM FOC specific data */
 
-static struct sim_foc_data_s  g_sim_foc_data[CONFIG_MOTOR_FOC_INST];
-static struct sim_foc_board_s g_sim_foc_board[CONFIG_MOTOR_FOC_INST];
+static struct foc_dummy_data_s  g_foc_dummy_data[CONFIG_MOTOR_FOC_INST];
+static struct foc_dummy_board_s g_foc_dummy_board[CONFIG_MOTOR_FOC_INST];
 
 /* SIM specific FOC ops */
 
-static struct foc_lower_ops_s g_sim_foc_ops =
+static struct foc_lower_ops_s g_foc_dummy_ops =
 {
-  .configure      = sim_foc_configure,
-  .setup          = sim_foc_setup,
-  .shutdown       = sim_foc_shutdown,
-  .start          = sim_foc_start,
-  .pwm_duty_set   = sim_foc_pwm_duty_set,
-  .ioctl          = sim_foc_ioctl,
-  .bind           = sim_foc_bind,
-  .fault_clear    = sim_foc_fault_clear,
+  foc_dummy_configure,
+  foc_dummy_setup,
+  foc_dummy_shutdown,
+  foc_dummy_start,
+  foc_dummy_pwm_duty_set,
+  foc_dummy_ioctl,

Review comment:
       ```suggestion
     foc_dummy_pwm_duty_set,
     foc_dummy_start,
     foc_dummy_ioctl,
   ```




-- 
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 change in pull request #5182: Move simulated drivers from sim to common place

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5182:
URL: https://github.com/apache/incubator-nuttx/pull/5182#discussion_r780436831



##########
File path: drivers/ioexpander/ioe_dummy.c
##########
@@ -139,32 +142,32 @@ static void sim_interrupt(wdparm_t arg);
  * well be pre-allocated.
  */
 
-static struct sim_dev_s g_ioexpander;
+static struct ioe_dummy_dev_s g_ioexpander;
 
 /* I/O expander vtable */
 
-static const struct ioexpander_ops_s g_sim_ops =
+static const struct ioexpander_ops_s g_ioe_dummy_ops =
 {
-  sim_direction,
-  sim_option,
-  sim_writepin,
-  sim_readpin,
-  sim_readpin
+  ioe_dummy_direction,
+  ioe_dummy_option,
+  ioe_dummy_writepin,
+  ioe_dummy_readpin,
+  ioe_dummy_readpin
 #ifdef CONFIG_IOEXPANDER_MULTIPIN
-  , sim_multiwritepin
-  , sim_multireadpin
-  , sim_multireadpin
+  , ioe_dummy_multiwritepin

Review comment:
       Maybe switch to more traditional
   
   ```suggestion
     ioe_dummy_multiwritepin,
   ```
   Here and below? To align style with other files




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