summaryrefslogtreecommitdiff
path: root/tools/gpio/gpio-utils.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-02-22 10:00:46 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2021-02-22 10:00:46 -0800
commit882d6edfc45cd2b6e33cf973eab9a1ae1dbad5d1 (patch)
tree034ebc487adeb29cef2c546b5e0b61d70a3bc339 /tools/gpio/gpio-utils.c
parent0328b5f2ef4af8ba060e64baa928c94037e7308f (diff)
parenta8002a35935aaefcd6a42ad3289f62bab947f2ca (diff)
Merge tag 'gpio-updates-for-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio updates from Bartosz Golaszewski: "It's been a relatively calm release cycle and we're actually removing more code than we're adding. Summary: - new driver for the Toshiba Visconti platform - rework of interrupt handling in gpio-tegra - updates for GPIO selftests: we're now using the character device to perform the subsystem checks - support for a new rcar variant + some code refactoring - refactoring of gpio-ep93xx - SPDX License identifier has been updated in the uapi header so that userspace programs bundling it can become fully REUSE-compliant - improvements to pwm handling in gpio-mvebu - support for interrupt handling and power management for gpio-xilinx as well as some code refactoring - support for a new chip variant in gpio-pca953x - removal of drivers: zte xs & intel-mid and removal of leftovers from intel-msic - impovements to intel drivers pulled from Andy Shevchenko - improvements to the gpio-aggregator virtual GPIO driver - and several minor tweaks and fixes to code and documentation all over the place" * tag 'gpio-updates-for-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (71 commits) gpio: pcf857x: Fix missing first interrupt gpio: ep93xx: refactor base IRQ number gpio: ep93xx: refactor ep93xx_gpio_add_bank gpio: ep93xx: Fix typo s/hierarchial/hierarchical gpio: ep93xx: drop to_irq binding gpio: ep93xx: Fix wrong irq numbers in port F gpio: uapi: use the preferred SPDX license identifier gpio: gpio-xilinx: Add check if width exceeds 32 gpio: gpio-xilinx: Add support for suspend and resume gpio: gpio-xilinx: Add interrupt support gpio: gpio-xilinx: Reduce spinlock array to array gpio: gpio-xilinx: Simplify with dev_err_probe() gpio: msic: Drop driver from Makefile gpio: wcove: Split out to_ireg() helper and deduplicate the code gpio: wcove: Switch to use regmap_set_bits(), regmap_clear_bits() gpio: wcove: Get rid of error prone casting in IRQ handler gpio: intel-mid: Remove driver for deprecated platform gpio: msic: Remove driver for deprecated platform gpio: aggregator: Remove trailing comma in terminator entries gpio: aggregator: Use compound literal from the header ...
Diffstat (limited to 'tools/gpio/gpio-utils.c')
-rw-r--r--tools/gpio/gpio-utils.c89
1 files changed, 0 insertions, 89 deletions
diff --git a/tools/gpio/gpio-utils.c b/tools/gpio/gpio-utils.c
index 37187e056c8b..1639b4d832cd 100644
--- a/tools/gpio/gpio-utils.c
+++ b/tools/gpio/gpio-utils.c
@@ -32,74 +32,6 @@
* following api will request gpio lines, do the operation and then
* release these lines.
*/
-/**
- * gpiotools_request_linehandle() - request gpio lines in a gpiochip
- * @device_name: The name of gpiochip without prefix "/dev/",
- * such as "gpiochip0"
- * @lines: An array desired lines, specified by offset
- * index for the associated GPIO device.
- * @num_lines: The number of lines to request.
- * @flag: The new flag for requsted gpio. Reference
- * "linux/gpio.h" for the meaning of flag.
- * @data: Default value will be set to gpio when flag is
- * GPIOHANDLE_REQUEST_OUTPUT.
- * @consumer_label: The name of consumer, such as "sysfs",
- * "powerkey". This is useful for other users to
- * know who is using.
- *
- * Request gpio lines through the ioctl provided by chardev. User
- * could call gpiotools_set_values() and gpiotools_get_values() to
- * read and write respectively through the returned fd. Call
- * gpiotools_release_linehandle() to release these lines after that.
- *
- * Return: On success return the fd;
- * On failure return the errno.
- */
-int gpiotools_request_linehandle(const char *device_name, unsigned int *lines,
- unsigned int num_lines, unsigned int flag,
- struct gpiohandle_data *data,
- const char *consumer_label)
-{
- struct gpiohandle_request req;
- char *chrdev_name;
- int fd;
- int i;
- int ret;
-
- ret = asprintf(&chrdev_name, "/dev/%s", device_name);
- if (ret < 0)
- return -ENOMEM;
-
- fd = open(chrdev_name, 0);
- if (fd == -1) {
- ret = -errno;
- fprintf(stderr, "Failed to open %s, %s\n",
- chrdev_name, strerror(errno));
- goto exit_free_name;
- }
-
- for (i = 0; i < num_lines; i++)
- req.lineoffsets[i] = lines[i];
-
- req.flags = flag;
- strcpy(req.consumer_label, consumer_label);
- req.lines = num_lines;
- if (flag & GPIOHANDLE_REQUEST_OUTPUT)
- memcpy(req.default_values, data, sizeof(req.default_values));
-
- ret = ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, &req);
- if (ret == -1) {
- ret = -errno;
- fprintf(stderr, "Failed to issue %s (%d), %s\n",
- "GPIO_GET_LINEHANDLE_IOCTL", ret, strerror(errno));
- }
-
- if (close(fd) == -1)
- perror("Failed to close GPIO character device file");
-exit_free_name:
- free(chrdev_name);
- return ret < 0 ? ret : req.fd;
-}
/**
* gpiotools_request_line() - request gpio lines in a gpiochip
@@ -216,27 +148,6 @@ int gpiotools_get_values(const int fd, struct gpio_v2_line_values *values)
}
/**
- * gpiotools_release_linehandle(): Release the line(s) of gpiochip
- * @fd: The fd returned by
- * gpiotools_request_linehandle().
- *
- * Return: On success return 0;
- * On failure return the errno.
- */
-int gpiotools_release_linehandle(const int fd)
-{
- int ret;
-
- ret = close(fd);
- if (ret == -1) {
- perror("Failed to close GPIO LINEHANDLE device file");
- ret = -errno;
- }
-
- return ret;
-}
-
-/**
* gpiotools_release_line(): Release the line(s) of gpiochip
* @fd: The fd returned by
* gpiotools_request_line().