Lines Matching +full:gpio +full:- +full:f
1 // SPDX-License-Identifier: GPL-2.0-only
3 * GPIO chardev test helper
20 #include <linux/gpio.h>
21 #include "../../../gpio/gpio-utils.h"
23 #define CONSUMER "gpio-selftest"
58 ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs)); in get_debugfs()
67 return -1; in get_debugfs()
75 FILE *f; in gpio_debugfs_get() local
84 f = fopen(debugfs, "r"); in gpio_debugfs_get()
85 if (!f) in gpio_debugfs_get()
86 err(EXIT_FAILURE, "read from gpio debugfs failed"); in gpio_debugfs_get()
89 * gpio-2 ( |gpio-selftest ) in lo in gpio_debugfs_get()
91 while (getline(&line, &len, f) != -1) { in gpio_debugfs_get()
118 fclose(f); in gpio_debugfs_get()
122 return -1; in gpio_debugfs_get()
144 *ret = -errno; in list_gpiochip()
151 if (check_prefix(ent->d_name, "gpiochip")) { in list_gpiochip()
152 *ret = asprintf(&chrdev_name, "/dev/%s", ent->d_name); in list_gpiochip()
157 if (fd == -1) { in list_gpiochip()
158 *ret = -errno; in list_gpiochip()
164 if (*ret == -1) { in list_gpiochip()
169 if (strcmp(current->label, gpiochip_name) == 0 in list_gpiochip()
170 || check_prefix(current->label, gpiochip_name)) { in list_gpiochip()
206 ret = gpiotools_request_linehandle(cinfo->name, lines, 1, flag, &data, in gpio_pin_test()
215 ret = -EINVAL; in gpio_pin_test()
220 errno = -EINVAL; in gpio_pin_test()
221 ret = -errno; in gpio_pin_test()
228 errno = -EINVAL; in gpio_pin_test()
229 ret = -errno; in gpio_pin_test()
236 err(EXIT_FAILURE, "gpio<%s> line<%d> test flag<0x%x> value<%d>", in gpio_pin_test()
237 cinfo->name, line, flag, value); in gpio_pin_test()
262 * ./gpio-mockup-chardev gpio_chip_name_prefix is_valid_gpio_chip
265 * gpio-mockup
295 ret = -EINVAL; in main()
299 ret = -EINVAL; in main()
305 gpio_pin_tests(current, current->lines - 1); in main()
306 gpio_pin_tests(current, random() % current->lines); in main()
314 fprintf(stderr, "gpio<%s> test failed\n", prefix); in main()