aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2018-04-26 19:21:30 +0300
committerMatthias Welwarsky <matthias@welwarsky.de>2018-05-31 13:25:30 +0100
commitcdf1e826eb23c29de1019ce64125f644f01b0afe (patch)
tree94b50d4ff4ce5570452b53d57beb54e2b5b8906f
parent2ba27e2f3edd37e5dce4b2a231d2ae84c14cb59a (diff)
downloadriscv-openocd-cdf1e826eb23c29de1019ce64125f644f01b0afe.zip
riscv-openocd-cdf1e826eb23c29de1019ce64125f644f01b0afe.tar.gz
riscv-openocd-cdf1e826eb23c29de1019ce64125f644f01b0afe.tar.bz2
jtag: drivers: sysfsgpio: lift upper gpio number limit
Recent Linux maps GPIOs from 1023 downwards so do not limit the number to 1000. This should fix #183. Change-Id: I6d4f493b670be9ed9b82759f0fb686a9faddbbf5 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4502 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
-rw-r--r--src/jtag/drivers/sysfsgpio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jtag/drivers/sysfsgpio.c b/src/jtag/drivers/sysfsgpio.c
index 5a4651d..5535c71 100644
--- a/src/jtag/drivers/sysfsgpio.c
+++ b/src/jtag/drivers/sysfsgpio.c
@@ -58,11 +58,11 @@
/*
* Helper func to determine if gpio number valid
*
- * Assume here that there will be less than 1000 gpios on a system
+ * Assume here that there will be less than 10000 gpios on a system
*/
static int is_gpio_valid(int gpio)
{
- return gpio >= 0 && gpio < 1000;
+ return gpio >= 0 && gpio < 10000;
}
/*
@@ -89,7 +89,7 @@ static int open_write_close(const char *name, const char *valstr)
*/
static void unexport_sysfs_gpio(int gpio)
{
- char gpiostr[4];
+ char gpiostr[5];
if (!is_gpio_valid(gpio))
return;
@@ -113,7 +113,7 @@ static void unexport_sysfs_gpio(int gpio)
static int setup_sysfs_gpio(int gpio, int is_output, int init_high)
{
char buf[40];
- char gpiostr[4];
+ char gpiostr[5];
int ret;
if (!is_gpio_valid(gpio))