mirror of
https://github.com/openocd-org/openocd.git
synced 2025-10-14 02:58:23 +08:00
jtag: linuxgpiod: replace gpiod_chip_open_by_number()
Preparing for libgpiod v2, replace v1 specific function gpiod_chip_open_by_number() with the common v1 & v2 function gpiod_chip_open(). Change-Id: I5f0f9bef739f4097fb74f78b5b6e2fe823c1ab87 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8201 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
@@ -275,12 +275,15 @@ static int linuxgpiod_quit(void)
|
|||||||
|
|
||||||
static int helper_get_line(enum adapter_gpio_config_index idx)
|
static int helper_get_line(enum adapter_gpio_config_index idx)
|
||||||
{
|
{
|
||||||
|
char chip_path[24];
|
||||||
|
|
||||||
if (!is_gpio_config_valid(idx))
|
if (!is_gpio_config_valid(idx))
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
||||||
int dir = GPIOD_LINE_REQUEST_DIRECTION_INPUT, flags = 0, val = 0, retval;
|
int dir = GPIOD_LINE_REQUEST_DIRECTION_INPUT, flags = 0, val = 0, retval;
|
||||||
|
|
||||||
gpiod_chip[idx] = gpiod_chip_open_by_number(adapter_gpio_config[idx].chip_num);
|
snprintf(chip_path, sizeof(chip_path), "/dev/gpiochip%u", adapter_gpio_config[idx].chip_num);
|
||||||
|
gpiod_chip[idx] = gpiod_chip_open(chip_path);
|
||||||
if (!gpiod_chip[idx]) {
|
if (!gpiod_chip[idx]) {
|
||||||
LOG_ERROR("Cannot open LinuxGPIOD chip %d for %s", adapter_gpio_config[idx].chip_num,
|
LOG_ERROR("Cannot open LinuxGPIOD chip %d for %s", adapter_gpio_config[idx].chip_num,
|
||||||
adapter_gpio_get_name(idx));
|
adapter_gpio_get_name(idx));
|
||||||
|
Reference in New Issue
Block a user