From: Bartosz Golaszewski Date: Fri, 6 Jan 2017 09:54:20 +0000 (+0100) Subject: core: move struct definitions to the top of core.c X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a606e9713e5c1494a269a6ff07ffc7e5b4182da6;p=qemu-gpiodev%2Flibgpiod.git core: move struct definitions to the top of core.c We will need to access the chip data from the line-related code. Signed-off-by: Bartosz Golaszewski --- diff --git a/core.c b/core.c index a5a201b..f6019cd 100644 --- a/core.c +++ b/core.c @@ -22,6 +22,29 @@ #include #include +struct gpiod_chip +{ + int fd; + struct gpiochip_info cinfo; + struct gpiod_line *lines; +}; + +struct gpiod_line { + bool reserved; + bool event_configured; + bool up_to_date; + struct gpiod_chip *chip; + struct gpioline_info info; + struct gpiohandle_request *req; + struct gpioevent_request event; +}; + +struct gpiod_chip_iter +{ + DIR *dir; + struct gpiod_chip *current; +}; + static const char dev_dir[] = "/dev/"; static const char cdev_prefix[] = "gpiochip"; static const char libgpiod_consumer[] = "libgpiod"; @@ -134,16 +157,6 @@ int gpiod_simple_get_value(const char *device, unsigned int offset) return value; } -struct gpiod_line { - bool reserved; - bool event_configured; - bool up_to_date; - struct gpiod_chip *chip; - struct gpioline_info info; - struct gpiohandle_request *req; - struct gpioevent_request event; -}; - static void line_set_offset(struct gpiod_line *line, unsigned int offset) { line->info.line_offset = offset; @@ -556,13 +569,6 @@ int gpiod_line_event_get_fd(struct gpiod_line *line) return line->event_configured ? line->event.fd : -1; } -struct gpiod_chip -{ - int fd; - struct gpiochip_info cinfo; - struct gpiod_line *lines; -}; - struct gpiod_chip * gpiod_chip_open(const char *path) { struct gpiod_chip *chip; @@ -707,12 +713,6 @@ struct gpiod_chip * gpiod_line_get_chip(struct gpiod_line *line) return line->chip; } -struct gpiod_chip_iter -{ - DIR *dir; - struct gpiod_chip *current; -}; - struct gpiod_chip_iter * gpiod_chip_iter_new(void) { struct gpiod_chip_iter *new;