diff options
author | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2019-11-22 11:35:12 +0100 |
---|---|---|
committer | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2019-11-23 15:48:56 +0100 |
commit | 296444104b8bff2667a8c9093cb4a0e98641fa10 (patch) | |
tree | 350013c8b8477deee2eff85850b1b2d48e024129 /include | |
parent | bb3dc9eb2e223d099add4e21c6d3e3db5519032f (diff) | |
download | external_libgpiod-296444104b8bff2667a8c9093cb4a0e98641fa10.tar.gz external_libgpiod-296444104b8bff2667a8c9093cb4a0e98641fa10.tar.bz2 external_libgpiod-296444104b8bff2667a8c9093cb4a0e98641fa10.zip |
core: deprecate gpiod_needs_update()
This function and the logic behind have been introduced in an early
version of libgpiod for reasons that have been long forgotten.
When updating the line info after a line request fails, just propagate
the error out of the request function instead of setting the internal
needs_update variable. Drop the entire logic behind gpiod_needs_update(),
make this routine always return false and mark it as deprecated in the
header.
Suggested-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/gpiod.h | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/include/gpiod.h b/include/gpiod.h index 6dfa18a..3fc1c0c 100644 --- a/include/gpiod.h +++ b/include/gpiod.h @@ -725,37 +725,32 @@ bool gpiod_line_is_open_source(struct gpiod_line *line) GPIOD_API; /** * @brief Re-read the line info. * @param line GPIO line object. - * @return 0 is the operation succeeds. In case of an error this routine + * @return 0 if the operation succeeds. In case of an error this routine * returns -1 and sets the last error number. * * The line info is initially retrieved from the kernel by - * gpiod_chip_get_line(). Users can use this line to manually re-read the line - * info. + * gpiod_chip_get_line() and is later re-read after every successful request. + * Users can use this function to manually re-read the line info when needed. + * + * We currently have no mechanism provided by the kernel for keeping the line + * info synchronized and for the sake of speed and simplicity of this low-level + * library we don't want to re-read the line info automatically everytime + * a property is retrieved. Any daemon using this library must track the state + * of lines on its own and call this routine if needed. + * + * The state of requested lines is kept synchronized (or rather cannot be + * changed by external agents while the ownership of the line is taken) so + * there's no need to call this function in that case. */ int gpiod_line_update(struct gpiod_line *line) GPIOD_API; /** * @brief Check if the line info needs to be updated. * @param line GPIO line object. - * @return Returns false if the line is up-to-date. True otherwise. - * - * The line is updated by calling gpiod_line_update() from within - * gpiod_chip_get_line() and on every line request/release. However: an error - * returned from gpiod_line_update() only breaks the execution of the former. - * The request/release routines only set the internal needs_update flag to true - * and continue their execution. This routine allows to check if a line info - * update failed at some point and we should call gpiod_line_update() - * explicitly. - * - * This routine will not indicate any potential changes introduced by external - * actors (such as a different process requesting the line). We currently have - * no mechanism provided by the kernel for that and for the sake of speed and - * simplicity of this low-level library we don't want to re-read the line info - * automatically everytime a property is retrieved. Any daemon using this - * library must track the state of lines on its own and call - * ::gpiod_line_update if needed. - */ -bool gpiod_line_needs_update(struct gpiod_line *line) GPIOD_API; + * @return Deprecated and no longer functional - always returns false. + */ +bool +gpiod_line_needs_update(struct gpiod_line *line) GPIOD_API GPIOD_DEPRECATED; /** * @} |