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/02/07 08:06:26 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #5433: serial/pty: Reorder the register driver to simplify the error handling

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


   ## Summary
   Very simple change
   
   ## Impact
   No
   
   ## 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] xiaoxiang781216 commented on a change in pull request #5433: serial/pty: Reorder the register driver to simplify the error handling

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



##########
File path: drivers/serial/pty.c
##########
@@ -223,22 +223,22 @@ static void pty_destroy(FAR struct pty_devpair_s *devpair)
 {
   char devname[16];
 
-  /* Un-register the slave device */
-
-#ifdef CONFIG_PSEUDOTERM_BSD
-  snprintf(devname, 16, "/dev/ttyp%d", devpair->pp_minor);
-#else
-  snprintf(devname, 16, "/dev/pts/%d", devpair->pp_minor);
-#endif
-  unregister_driver(devname);
-
   /* Un-register the master device (/dev/ptyN may have already been
    * unlinked).
    */
 
   snprintf(devname, 16, "/dev/pty%d", (int)devpair->pp_minor);

Review comment:
       Done, remove the unnecessary cast.




-- 
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 #5433: serial/pty: Reorder the register driver to simplify the error handling

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



##########
File path: drivers/serial/pty.c
##########
@@ -1139,50 +1139,46 @@ int pty_register(int minor)
       goto errout_with_pipea;
     }
 
-  /* Register the slave device
+  /* Register the master device
    *
-   * BSD style (deprecated): /dev/ttypN
-   * SUSv1 style:  /dev/pts/N
+   * BSD style (deprecated):  /dev/ptyN

Review comment:
       ```suggestion
      * BSD style (deprecated): /dev/ptyN
   ```

##########
File path: drivers/serial/pty.c
##########
@@ -1139,50 +1139,46 @@ int pty_register(int minor)
       goto errout_with_pipea;
     }
 
-  /* Register the slave device
+  /* Register the master device
    *
-   * BSD style (deprecated): /dev/ttypN
-   * SUSv1 style:  /dev/pts/N
+   * BSD style (deprecated):  /dev/ptyN
+   * SUSv1 style: Master: /dev/ptmx (multiplexor, see ptmx.c)
    *
    * Where N is the minor number
    */
 
-#ifdef CONFIG_PSEUDOTERM_BSD
-  snprintf(devname, 16, "/dev/ttyp%d", minor);
-#else
-  snprintf(devname, 16, "/dev/pts/%d", minor);
-#endif
+  snprintf(devname, 16, "/dev/pty%d", minor);
 
-  ret = register_driver(devname, &g_pty_fops, 0666, &devpair->pp_slave);
+  ret = register_driver(devname, &g_pty_fops, 0666, &devpair->pp_master);
   if (ret < 0)
     {
       goto errout_with_pipeb;
     }
 
-  /* Register the master device
+  /* Register the slave device
    *
-   * BSD style (deprecated):  /dev/ptyN
-   * SUSv1 style: Master: /dev/ptmx (multiplexor, see ptmx.c)
+   * BSD style (deprecated): /dev/ttypN
+   * SUSv1 style:  /dev/pts/N

Review comment:
       ```suggestion
      * SUSv1 style: /dev/pts/N
   ```




-- 
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 #5433: serial/pty: Reorder the register driver to simplify the error handling

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



##########
File path: drivers/serial/pty.c
##########
@@ -1139,50 +1139,46 @@ int pty_register(int minor)
       goto errout_with_pipea;
     }
 
-  /* Register the slave device
+  /* Register the master device
    *
-   * BSD style (deprecated): /dev/ttypN
-   * SUSv1 style:  /dev/pts/N
+   * BSD style (deprecated):  /dev/ptyN

Review comment:
       Done.

##########
File path: drivers/serial/pty.c
##########
@@ -1139,50 +1139,46 @@ int pty_register(int minor)
       goto errout_with_pipea;
     }
 
-  /* Register the slave device
+  /* Register the master device
    *
-   * BSD style (deprecated): /dev/ttypN
-   * SUSv1 style:  /dev/pts/N
+   * BSD style (deprecated):  /dev/ptyN
+   * SUSv1 style: Master: /dev/ptmx (multiplexor, see ptmx.c)
    *
    * Where N is the minor number
    */
 
-#ifdef CONFIG_PSEUDOTERM_BSD
-  snprintf(devname, 16, "/dev/ttyp%d", minor);
-#else
-  snprintf(devname, 16, "/dev/pts/%d", minor);
-#endif
+  snprintf(devname, 16, "/dev/pty%d", minor);
 
-  ret = register_driver(devname, &g_pty_fops, 0666, &devpair->pp_slave);
+  ret = register_driver(devname, &g_pty_fops, 0666, &devpair->pp_master);
   if (ret < 0)
     {
       goto errout_with_pipeb;
     }
 
-  /* Register the master device
+  /* Register the slave device
    *
-   * BSD style (deprecated):  /dev/ptyN
-   * SUSv1 style: Master: /dev/ptmx (multiplexor, see ptmx.c)
+   * BSD style (deprecated): /dev/ttypN
+   * SUSv1 style:  /dev/pts/N

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 merged pull request #5433: serial/pty: Reorder the register driver to simplify the error handling

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


   


-- 
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 #5433: serial/pty: Reorder the register driver to simplify the error handling

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



##########
File path: drivers/serial/pty.c
##########
@@ -223,22 +223,22 @@ static void pty_destroy(FAR struct pty_devpair_s *devpair)
 {
   char devname[16];
 
-  /* Un-register the slave device */
-
-#ifdef CONFIG_PSEUDOTERM_BSD
-  snprintf(devname, 16, "/dev/ttyp%d", devpair->pp_minor);
-#else
-  snprintf(devname, 16, "/dev/pts/%d", devpair->pp_minor);
-#endif
-  unregister_driver(devname);
-
   /* Un-register the master device (/dev/ptyN may have already been
    * unlinked).
    */
 
   snprintf(devname, 16, "/dev/pty%d", (int)devpair->pp_minor);

Review comment:
       why do we need typecast here, but not below?




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