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/06/07 09:23:56 UTC

[GitHub] [incubator-nuttx] CV-Bowen commented on a diff in pull request #6379: arm/tlsr82: gpio driver bug fix and optimize.

CV-Bowen commented on code in PR #6379:
URL: https://github.com/apache/incubator-nuttx/pull/6379#discussion_r890986814


##########
boards/arm/tlsr82/tlsr8278adk80d/src/tlsr8278_gpio.c:
##########
@@ -269,22 +295,33 @@ static int tlsr82_go_setpintype(struct gpio_dev_s *dev,
 int tlsr82_gpio_initialize(void)
 {
   int i;
+  int ret = OK;
+  struct tlsr82gpio_dev_s *tlsr82gpio;
 
-  tlsr82_gpioirqconfig(g_gpios[3], NULL, NULL);
+  tlsr82_gpioirqinitialize();
 
   for (i = 0; i < BOARD_NGPIO; i++)
     {
-      g_gpdevs[i].gpio.gp_pintype = g_init_pintype[i];
-      g_gpdevs[i].gpio.gp_ops     = &gpio_ops;
-      g_gpdevs[i].id              = i;
-      gpio_pin_register(&g_gpdevs[i].gpio, i);
-
-      /* Configure the pin that will be used as input */
+      tlsr82gpio = &g_gpdevs[i];
+      tlsr82gpio->gpio.gp_pintype = tlsr82gpio->init_pintype;
+      tlsr82gpio->gpio.gp_ops     = &gpio_ops;
+      tlsr82gpio->id              = i;
+
+      ret = tlsr82_go_setpintype(&tlsr82gpio->gpio,
+                                 tlsr82gpio->init_pintype);
+      if (ret < 0)
+        {
+          goto errout;
+        }
 
-      tlsr82_gpioconfig(g_gpios[i]);
+      gpio_pin_register(&tlsr82gpio->gpio, i);
     }
 
-  return 0;
+  return OK;
+
+errout:
+
+  return ret;

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