This is an automated email from the ASF dual-hosted git repository.

davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 7183009  ioexpander/gpio: Remove the hardcode 100 limitation
7183009 is described below

commit 7183009400131d8764c3d9521b72c32369a04b15
Author: Xiang Xiao <[email protected]>
AuthorDate: Tue Oct 19 16:00:19 2021 +0800

    ioexpander/gpio: Remove the hardcode 100 limitation
    
    it's very easy to have more than 100 GPIOs on the modern SoC
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 drivers/ioexpander/gpio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/ioexpander/gpio.c b/drivers/ioexpander/gpio.c
index 7889e63..9f2d014 100644
--- a/drivers/ioexpander/gpio.c
+++ b/drivers/ioexpander/gpio.c
@@ -524,11 +524,10 @@ static int gpio_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
 int gpio_pin_register(FAR struct gpio_dev_s *dev, int minor)
 {
   FAR const char *fmt;
-  char devname[16];
+  char devname[32];
   int ret;
 
-  DEBUGASSERT(dev != NULL && dev->gp_ops != NULL &&
-              (unsigned int)minor < 100);
+  DEBUGASSERT(dev != NULL && dev->gp_ops != NULL);
 
   switch (dev->gp_pintype)
     {
@@ -619,7 +618,7 @@ void gpio_pin_unregister(FAR struct gpio_dev_s *dev, int 
minor)
         break;
     }
 
-  snprintf(devname, 16, fmt, (unsigned int)minor);
+  snprintf(devname, sizeof(devname), fmt, (unsigned int)minor);
   gpioinfo("Unregistering %s\n", devname);
 
   unregister_driver(devname);

Reply via email to