Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools: gpio: remove uAPI v1 code no longer used by selftests

gpio-mockup-chardev helper has been obsoleted and removed, so also remove
the tools/gpio code that it, and nothing else, was using.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

authored by

Kent Gibson and committed by
Bartosz Golaszewski
ef0d6d97 999e71c3

-95
-89
tools/gpio/gpio-utils.c
··· 32 32 * following api will request gpio lines, do the operation and then 33 33 * release these lines. 34 34 */ 35 - /** 36 - * gpiotools_request_linehandle() - request gpio lines in a gpiochip 37 - * @device_name: The name of gpiochip without prefix "/dev/", 38 - * such as "gpiochip0" 39 - * @lines: An array desired lines, specified by offset 40 - * index for the associated GPIO device. 41 - * @num_lines: The number of lines to request. 42 - * @flag: The new flag for requsted gpio. Reference 43 - * "linux/gpio.h" for the meaning of flag. 44 - * @data: Default value will be set to gpio when flag is 45 - * GPIOHANDLE_REQUEST_OUTPUT. 46 - * @consumer_label: The name of consumer, such as "sysfs", 47 - * "powerkey". This is useful for other users to 48 - * know who is using. 49 - * 50 - * Request gpio lines through the ioctl provided by chardev. User 51 - * could call gpiotools_set_values() and gpiotools_get_values() to 52 - * read and write respectively through the returned fd. Call 53 - * gpiotools_release_linehandle() to release these lines after that. 54 - * 55 - * Return: On success return the fd; 56 - * On failure return the errno. 57 - */ 58 - int gpiotools_request_linehandle(const char *device_name, unsigned int *lines, 59 - unsigned int num_lines, unsigned int flag, 60 - struct gpiohandle_data *data, 61 - const char *consumer_label) 62 - { 63 - struct gpiohandle_request req; 64 - char *chrdev_name; 65 - int fd; 66 - int i; 67 - int ret; 68 - 69 - ret = asprintf(&chrdev_name, "/dev/%s", device_name); 70 - if (ret < 0) 71 - return -ENOMEM; 72 - 73 - fd = open(chrdev_name, 0); 74 - if (fd == -1) { 75 - ret = -errno; 76 - fprintf(stderr, "Failed to open %s, %s\n", 77 - chrdev_name, strerror(errno)); 78 - goto exit_free_name; 79 - } 80 - 81 - for (i = 0; i < num_lines; i++) 82 - req.lineoffsets[i] = lines[i]; 83 - 84 - req.flags = flag; 85 - strcpy(req.consumer_label, consumer_label); 86 - req.lines = num_lines; 87 - if (flag & GPIOHANDLE_REQUEST_OUTPUT) 88 - memcpy(req.default_values, data, sizeof(req.default_values)); 89 - 90 - ret = ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, &req); 91 - if (ret == -1) { 92 - ret = -errno; 93 - fprintf(stderr, "Failed to issue %s (%d), %s\n", 94 - "GPIO_GET_LINEHANDLE_IOCTL", ret, strerror(errno)); 95 - } 96 - 97 - if (close(fd) == -1) 98 - perror("Failed to close GPIO character device file"); 99 - exit_free_name: 100 - free(chrdev_name); 101 - return ret < 0 ? ret : req.fd; 102 - } 103 35 104 36 /** 105 37 * gpiotools_request_line() - request gpio lines in a gpiochip ··· 142 210 fprintf(stderr, "Failed to issue %s (%d), %s\n", 143 211 "GPIOHANDLE_GET_LINE_VALUES_IOCTL", ret, 144 212 strerror(errno)); 145 - } 146 - 147 - return ret; 148 - } 149 - 150 - /** 151 - * gpiotools_release_linehandle(): Release the line(s) of gpiochip 152 - * @fd: The fd returned by 153 - * gpiotools_request_linehandle(). 154 - * 155 - * Return: On success return 0; 156 - * On failure return the errno. 157 - */ 158 - int gpiotools_release_linehandle(const int fd) 159 - { 160 - int ret; 161 - 162 - ret = close(fd); 163 - if (ret == -1) { 164 - perror("Failed to close GPIO LINEHANDLE device file"); 165 - ret = -errno; 166 213 } 167 214 168 215 return ret;
-6
tools/gpio/gpio-utils.h
··· 24 24 strncmp(str, prefix, strlen(prefix)) == 0; 25 25 } 26 26 27 - int gpiotools_request_linehandle(const char *device_name, unsigned int *lines, 28 - unsigned int num_lines, unsigned int flag, 29 - struct gpiohandle_data *data, 30 - const char *consumer_label); 31 - int gpiotools_release_linehandle(const int fd); 32 - 33 27 int gpiotools_request_line(const char *device_name, 34 28 unsigned int *lines, 35 29 unsigned int num_lines,