@@ -412,11 +412,6 @@ public:
*/
GPIOD_API const chip get_chip(void) const;
- /**
- * @brief Re-read the line info from the kernel.
- */
- GPIOD_API void update(void) const;
-
/**
* @brief Reset the state of this object.
*
@@ -278,18 +278,6 @@ const chip line::get_chip(void) const
return chip(this->_m_owner);
}
-void line::update(void) const
-{
- this->throw_if_null();
- line::chip_guard lock_chip(*this);
-
- int ret = ::gpiod_line_update(this->_m_line);
-
- if (ret < 0)
- throw ::std::system_error(errno, ::std::system_category(),
- "unable to update the line info");
-}
-
void line::reset(void)
{
this->_m_line = nullptr;
@@ -139,11 +139,6 @@ TEST_CASE("Line information can be correctly retrieved", "[line]")
REQUIRE(line.drive() == ::gpiod::line::DRIVE_PUSH_PULL);
REQUIRE(line.bias() == ::gpiod::line::BIAS_PULL_UP);
}
-
- SECTION("update line info")
- {
- REQUIRE_NOTHROW(line.update());
- }
}
TEST_CASE("Line values can be set and read", "[line]")
@@ -721,23 +721,6 @@ static PyObject *gpiod_Line_release(gpiod_LineObject *self,
return ret;
}
-PyDoc_STRVAR(gpiod_Line_update_doc,
-"update() -> None\n"
-"\n"
-"Re-read the line information from the kernel.");
-
-static PyObject *gpiod_Line_update(gpiod_LineObject *self,
- PyObject *Py_UNUSED(ignored))
-{
- int ret;
-
- ret = gpiod_line_update(self->line);
- if (ret)
- return PyErr_SetFromErrno(PyExc_OSError);
-
- Py_RETURN_NONE;
-}
-
PyDoc_STRVAR(gpiod_Line_event_wait_doc,
"event_wait([sec[ ,nsec]]) -> boolean\n"
"\n"
@@ -1008,12 +991,6 @@ static PyMethodDef gpiod_Line_methods[] = {
.ml_flags = METH_NOARGS,
.ml_doc = gpiod_Line_release_doc,
},
- {
- .ml_name = "update",
- .ml_meth = (PyCFunction)gpiod_Line_update,
- .ml_flags = METH_NOARGS,
- .ml_doc = gpiod_Line_update_doc,
- },
{
.ml_name = "event_wait",
.ml_meth = (PyCFunction)(void (*)(void))gpiod_Line_event_wait,
@@ -315,11 +315,6 @@ class LineInfo(MockupTestCase):
self.assertEqual(line.drive(), gpiod.Line.DRIVE_PUSH_PULL)
self.assertEqual(line.bias(), gpiod.Line.BIAS_PULL_UP)
- def test_update_line_info(self):
- with gpiod.Chip(mockup.chip_path(0)) as chip:
- line = chip.get_line(3)
- line.update()
-
class LineValues(MockupTestCase):
chip_sizes = ( 8, )
@@ -358,28 +358,6 @@ bool gpiod_line_is_used(struct gpiod_line *line) GPIOD_API;
*/
int gpiod_line_drive(struct gpiod_line *line) GPIOD_API;
-/**
- * @brief Re-read the line info.
- * @param line GPIO line object.
- * @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() 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 Get the handle to the GPIO chip controlling this line.
* @param line The GPIO line object.
@@ -373,6 +373,8 @@ unsigned int gpiod_chip_num_lines(struct gpiod_chip *chip)
return chip->num_lines;
}
+static int line_update(struct gpiod_line *line);
+
struct gpiod_line *
gpiod_chip_get_line(struct gpiod_chip *chip, unsigned int offset)
{
@@ -406,7 +408,7 @@ gpiod_chip_get_line(struct gpiod_chip *chip, unsigned int offset)
line = chip->lines[offset];
}
- rv = gpiod_line_update(line);
+ rv = line_update(line);
if (rv < 0)
return NULL;
@@ -535,7 +537,7 @@ static int line_info_v2_to_info_flags(struct gpio_v2_line_info *info)
return iflags;
}
-int gpiod_line_update(struct gpiod_line *line)
+static int line_update(struct gpiod_line *line)
{
struct gpio_v2_line_info info;
int rv;
@@ -766,7 +768,7 @@ static int line_request_values(struct gpiod_line_bulk *bulk,
req.config.attrs[0].attr.values, i);
line_set_fd(line, line_fd);
- rv = gpiod_line_update(line);
+ rv = line_update(line);
if (rv) {
gpiod_line_release_bulk(bulk);
return rv;
@@ -805,7 +807,7 @@ static int line_request_event_single(struct gpiod_line *line,
line->req_flags = config->flags;
line_set_fd(line, line_fd);
- rv = gpiod_line_update(line);
+ rv = line_update(line);
if (rv) {
gpiod_line_release(line);
return rv;
@@ -1036,7 +1038,7 @@ int gpiod_line_set_config_bulk(struct gpiod_line_bulk *bulk,
line->output_value = lines_bitmap_test_bit(
hcfg.attrs[0].attr.values, i);
- rv = gpiod_line_update(line);
+ rv = line_update(line);
if (rv < 0)
return rv;
}