core: remove gpiod_chip_get_fd()
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 6 Jan 2017 10:01:25 +0000 (11:01 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 6 Jan 2017 10:01:25 +0000 (11:01 +0100)
With current functionality offered by the library, there's no need for
the user to directly access the gpiochip file descriptor.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
core.c
gpiod.h

diff --git a/core.c b/core.c
index f6019cdd1d2149b43aab71813165fc20ab1bbad7..a66c052348ac18c0a0f8c5e76e81fc35f12901c5 100644 (file)
--- a/core.c
+++ b/core.c
@@ -220,7 +220,7 @@ int gpiod_line_update(struct gpiod_line *line)
        line->info.flags = 0;
 
        chip = gpiod_line_get_chip(line);
-       fd = gpiod_chip_get_fd(chip);
+       fd = chip->fd;
 
        status = gpio_ioctl(fd, GPIO_GET_LINEINFO_IOCTL, &line->info);
        if (status < 0)
@@ -301,7 +301,7 @@ int gpiod_line_request_bulk(struct gpiod_line_bulk *line_bulk,
                sizeof(req->consumer_label) - 1);
 
        chip = gpiod_line_get_chip(line_bulk->lines[0]);
-       fd = gpiod_chip_get_fd(chip);
+       fd = chip->fd;
 
        status = gpio_ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, req);
        if (status < 0)
@@ -479,7 +479,7 @@ int gpiod_line_event_request(struct gpiod_line *line,
                req->eventflags |= GPIOEVENT_REQUEST_BOTH_EDGES;
 
        chip = gpiod_line_get_chip(line);
-       fd = gpiod_chip_get_fd(chip);
+       fd = chip->fd;
 
        status = gpio_ioctl(fd, GPIO_GET_LINEEVENT_IOCTL, req);
        if (status < 0)
@@ -703,11 +703,6 @@ gpiod_chip_get_line(struct gpiod_chip *chip, unsigned int offset)
        return line;
 }
 
-int gpiod_chip_get_fd(struct gpiod_chip *chip)
-{
-       return chip->fd;
-}
-
 struct gpiod_chip * gpiod_line_get_chip(struct gpiod_line *line)
 {
        return line->chip;
diff --git a/gpiod.h b/gpiod.h
index 5b6d922e051a456c86ad2a78478cd61392eeaaad..ec191c70a82b878b33aa2d82e4a2657c12d20df6 100644 (file)
--- a/gpiod.h
+++ b/gpiod.h
@@ -593,9 +593,6 @@ unsigned int gpiod_chip_num_lines(struct gpiod_chip *chip) GPIOD_API;
 struct gpiod_line *
 gpiod_chip_get_line(struct gpiod_chip *chip, unsigned int offset) GPIOD_API;
 
-/* FIXME This shouldn't be needed. Make it private maybe? */
-int gpiod_chip_get_fd(struct gpiod_chip *chip) GPIOD_API;
-
 /**
  * @}
  *