* [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release
@ 2025-08-12 12:10 Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 01/10] bindings: rust: make Buffer::read_edge_events() lifetimes more explicit Bartosz Golaszewski
` (10 more replies)
0 siblings, 11 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
The libgpiod rust bindings interface has stayed quite stable over the
last months so it's time for it to stop being a v0.x release and become
officially carved in stone. Bump dependencies and rust version to the
most recent versions available, fix some issues and then bump versions
of the crates ahead of the official release.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Bartosz Golaszewski (10):
bindings: rust: make Buffer::read_edge_events() lifetimes more explicit
bindings: rust: add missing unsafe block ahead of rust version bump
bindings: rust: update bindgen dependency
bindings: rust: update errno dependency
bindings: rust: update cc dependency
bindings: rust: update system-deps dependency
bindings: rust: update thiserror dependency
bindings: rust: update intmap dependency
bindings: rust: update rust version
bindings: rust: update crate versions to v1.0.0
bindings/rust/gpiosim-sys/Cargo.toml | 8 ++++----
bindings/rust/gpiosim-sys/build.rs | 2 +-
bindings/rust/libgpiod-sys/Cargo.toml | 10 +++++-----
bindings/rust/libgpiod-sys/build.rs | 6 +++---
bindings/rust/libgpiod/Cargo.toml | 14 +++++++-------
bindings/rust/libgpiod/src/event_buffer.rs | 2 +-
bindings/rust/libgpiod/src/lib.rs | 4 ++--
bindings/rust/libgpiod/src/line_config.rs | 2 +-
bindings/rust/libgpiod/src/line_info.rs | 2 +-
bindings/rust/libgpiod/src/line_request.rs | 4 ++--
10 files changed, 27 insertions(+), 27 deletions(-)
---
base-commit: cd32f27dd550753488bff4918aef4e230ce01512
change-id: 20250811-rust-1-0-0-release-65342607040e
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH libgpiod 01/10] bindings: rust: make Buffer::read_edge_events() lifetimes more explicit
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 02/10] bindings: rust: add missing unsafe block ahead of rust version bump Bartosz Golaszewski
` (9 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fix an issue pointed out by newer rustc version in the Buffer struct.
struct Events stores a reference to the buffer so tie the lifetime of the
latter to it explicitly.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/libgpiod/src/event_buffer.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bindings/rust/libgpiod/src/event_buffer.rs b/bindings/rust/libgpiod/src/event_buffer.rs
index 13fa7ba2c8870e0a325e251c073d6d73bb8c4374..059de1adabb858ba211446b27312c60429c6cc07 100644
--- a/bindings/rust/libgpiod/src/event_buffer.rs
+++ b/bindings/rust/libgpiod/src/event_buffer.rs
@@ -108,7 +108,7 @@ impl Buffer {
/// Get edge events from a line request.
///
/// This function will block if no event was queued for the line.
- pub fn read_edge_events(&mut self, request: &Request) -> Result<Events> {
+ pub fn read_edge_events<'a>(&'a mut self, request: &Request) -> Result<Events<'a>> {
for i in 0..self.events.len() {
self.events[i] = ptr::null_mut();
}
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 02/10] bindings: rust: add missing unsafe block ahead of rust version bump
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 01/10] bindings: rust: make Buffer::read_edge_events() lifetimes more explicit Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 03/10] bindings: rust: update bindgen dependency Bartosz Golaszewski
` (8 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Rust edition 2024 changed the semantics of the unsafe keyword used as
function modifier[1]. Unsafe operations inside unsafe functions must
still be wrapped in an unsafe {} block. Update the code ahead of the
rust version bump.
[1] https://rust-lang.github.io/rfcs/2585-unsafe-block-in-unsafe-fn.html
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/libgpiod/src/line_info.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bindings/rust/libgpiod/src/line_info.rs b/bindings/rust/libgpiod/src/line_info.rs
index bd290f6e1369a3968a39178c5bcfb9f6aaf26239..8def1ab4e52962fffa6911976e64204c3d02df6f 100644
--- a/bindings/rust/libgpiod/src/line_info.rs
+++ b/bindings/rust/libgpiod/src/line_info.rs
@@ -51,7 +51,7 @@ impl InfoRef {
/// owned by the thread invoking this method. The owning object may not be
/// moved to another thread for the entire lifetime 'a.
pub(crate) unsafe fn from_raw<'a>(info: *mut gpiod::gpiod_line_info) -> &'a InfoRef {
- &*(info as *mut _)
+ unsafe { &*(info as *mut _) }
}
fn as_raw_ptr(&self) -> *mut gpiod::gpiod_line_info {
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 03/10] bindings: rust: update bindgen dependency
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 01/10] bindings: rust: make Buffer::read_edge_events() lifetimes more explicit Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 02/10] bindings: rust: add missing unsafe block ahead of rust version bump Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 04/10] bindings: rust: update errno dependency Bartosz Golaszewski
` (7 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bump bindgen dependency in both gpiosim-sys and libgpiod-sys to the most
recent version. We now need to call CargoCallbacks::new() when boxing
the ParseCallbacks trait.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/gpiosim-sys/Cargo.toml | 2 +-
bindings/rust/gpiosim-sys/build.rs | 2 +-
bindings/rust/libgpiod-sys/Cargo.toml | 2 +-
bindings/rust/libgpiod-sys/build.rs | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bindings/rust/gpiosim-sys/Cargo.toml b/bindings/rust/gpiosim-sys/Cargo.toml
index 1f44a312563f21181b4b3ff79f1fa3b70ededc5d..7099abe41226236b9cba70a36643b921021952ee 100644
--- a/bindings/rust/gpiosim-sys/Cargo.toml
+++ b/bindings/rust/gpiosim-sys/Cargo.toml
@@ -19,5 +19,5 @@ errno = "0.2.8"
libgpiod = { path = "../libgpiod" }
[build-dependencies]
-bindgen = "0.63"
+bindgen = "0.72"
cc = "1.0.46"
diff --git a/bindings/rust/gpiosim-sys/build.rs b/bindings/rust/gpiosim-sys/build.rs
index c31fccb096841c248706089be7d8b9d232073265..81127e8ba2de336ec20ba2051fa8403b6d86eb06 100644
--- a/bindings/rust/gpiosim-sys/build.rs
+++ b/bindings/rust/gpiosim-sys/build.rs
@@ -20,7 +20,7 @@ fn generate_bindings() {
.header("../../../tests/gpiosim/gpiosim.h")
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
- .parse_callbacks(Box::new(bindgen::CargoCallbacks))
+ .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
// Finish the builder and generate the bindings.
.generate()
// Unwrap the Result and panic on failure.
diff --git a/bindings/rust/libgpiod-sys/Cargo.toml b/bindings/rust/libgpiod-sys/Cargo.toml
index eb600a9ee087638e1a3ea5013dec6ccbbaa29d1e..269d69bff9d62c07dcceb573ccc705cfbe2a4cdf 100644
--- a/bindings/rust/libgpiod-sys/Cargo.toml
+++ b/bindings/rust/libgpiod-sys/Cargo.toml
@@ -24,7 +24,7 @@ v2_1 = []
[dependencies]
[build-dependencies]
-bindgen = "0.63"
+bindgen = "0.72"
system-deps = "2.0"
[package.metadata.system-deps.libgpiod]
diff --git a/bindings/rust/libgpiod-sys/build.rs b/bindings/rust/libgpiod-sys/build.rs
index 9e6a93c04324b419f157fcb20fe2bedf98b6fd91..ab5b11308c92579a5b16883d47ec5a616c2db78c 100644
--- a/bindings/rust/libgpiod-sys/build.rs
+++ b/bindings/rust/libgpiod-sys/build.rs
@@ -24,7 +24,7 @@ fn main() {
.header("wrapper.h")
// Tell cargo to invalidate the built crate whenever any of the
// included header files changed.
- .parse_callbacks(Box::new(bindgen::CargoCallbacks));
+ .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()));
// Inform bindgen about the include paths identified by system_deps.
for (_name, lib) in libs {
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 04/10] bindings: rust: update errno dependency
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
` (2 preceding siblings ...)
2025-08-12 12:10 ` [PATCH libgpiod 03/10] bindings: rust: update bindgen dependency Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-13 6:56 ` Erik Schilling
2025-08-12 12:10 ` [PATCH libgpiod 05/10] bindings: rust: update cc dependency Bartosz Golaszewski
` (6 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bump the errno dependency for gpiosim-sys and libgpiod crates to the
most recent version. No code changes required.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/gpiosim-sys/Cargo.toml | 2 +-
bindings/rust/libgpiod/Cargo.toml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/bindings/rust/gpiosim-sys/Cargo.toml b/bindings/rust/gpiosim-sys/Cargo.toml
index 7099abe41226236b9cba70a36643b921021952ee..52ed43410ef5154a57a15e362344347a2b2cee57 100644
--- a/bindings/rust/gpiosim-sys/Cargo.toml
+++ b/bindings/rust/gpiosim-sys/Cargo.toml
@@ -15,7 +15,7 @@ license = "Apache-2.0 OR BSD-3-Clause"
edition = "2021"
[dependencies]
-errno = "0.2.8"
+errno = "0.3.13"
libgpiod = { path = "../libgpiod" }
[build-dependencies]
diff --git a/bindings/rust/libgpiod/Cargo.toml b/bindings/rust/libgpiod/Cargo.toml
index 23c34799715339be02f769a6b4b7de8ae5c1639f..7c285592777fd6399591691076e0bb301ebabcc0 100644
--- a/bindings/rust/libgpiod/Cargo.toml
+++ b/bindings/rust/libgpiod/Cargo.toml
@@ -23,7 +23,7 @@ v2_1 = ["libgpiod-sys/v2_1"]
vnext = ["v2_1"]
[dependencies]
-errno = "0.2.8"
+errno = "0.3.13"
intmap = "2.0.0"
libc = "0.2.39"
libgpiod-sys = { version = "0.1", path = "../libgpiod-sys" }
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 05/10] bindings: rust: update cc dependency
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
` (3 preceding siblings ...)
2025-08-12 12:10 ` [PATCH libgpiod 04/10] bindings: rust: update errno dependency Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 06/10] bindings: rust: update system-deps dependency Bartosz Golaszewski
` (5 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bump the cc dependency for gpiosim-sys to the most recent version. No
code changes required.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/gpiosim-sys/Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bindings/rust/gpiosim-sys/Cargo.toml b/bindings/rust/gpiosim-sys/Cargo.toml
index 52ed43410ef5154a57a15e362344347a2b2cee57..7c092db1a4ff30f28a55bd35573cb9cc11393661 100644
--- a/bindings/rust/gpiosim-sys/Cargo.toml
+++ b/bindings/rust/gpiosim-sys/Cargo.toml
@@ -20,4 +20,4 @@ libgpiod = { path = "../libgpiod" }
[build-dependencies]
bindgen = "0.72"
-cc = "1.0.46"
+cc = "1.2.32"
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 06/10] bindings: rust: update system-deps dependency
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
` (4 preceding siblings ...)
2025-08-12 12:10 ` [PATCH libgpiod 05/10] bindings: rust: update cc dependency Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 07/10] bindings: rust: update thiserror dependency Bartosz Golaszewski
` (4 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bump the system-deps dependency for libgpiod-sys to the most recent
version. The way we iterate over libs has changed, we now need to
convert it explicitly to an iterable.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/libgpiod-sys/Cargo.toml | 2 +-
bindings/rust/libgpiod-sys/build.rs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bindings/rust/libgpiod-sys/Cargo.toml b/bindings/rust/libgpiod-sys/Cargo.toml
index 269d69bff9d62c07dcceb573ccc705cfbe2a4cdf..7fb5c174ec8186b6ef8cd64e1e6f25a13bd0dcd3 100644
--- a/bindings/rust/libgpiod-sys/Cargo.toml
+++ b/bindings/rust/libgpiod-sys/Cargo.toml
@@ -25,7 +25,7 @@ v2_1 = []
[build-dependencies]
bindgen = "0.72"
-system-deps = "2.0"
+system-deps = "7.0"
[package.metadata.system-deps.libgpiod]
name = "libgpiod"
diff --git a/bindings/rust/libgpiod-sys/build.rs b/bindings/rust/libgpiod-sys/build.rs
index ab5b11308c92579a5b16883d47ec5a616c2db78c..14fd0b011bd6077b0c9be1905b8faaa1a5a39e0d 100644
--- a/bindings/rust/libgpiod-sys/build.rs
+++ b/bindings/rust/libgpiod-sys/build.rs
@@ -27,8 +27,8 @@ fn main() {
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()));
// Inform bindgen about the include paths identified by system_deps.
- for (_name, lib) in libs {
- for include_path in lib.include_paths {
+ for (_name, lib) in libs.iter() {
+ for include_path in &lib.include_paths {
builder = builder.clang_arg("-I").clang_arg(
include_path
.to_str()
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 07/10] bindings: rust: update thiserror dependency
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
` (5 preceding siblings ...)
2025-08-12 12:10 ` [PATCH libgpiod 06/10] bindings: rust: update system-deps dependency Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 08/10] bindings: rust: update intmap dependency Bartosz Golaszewski
` (3 subsequent siblings)
10 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bump the thiserror dependency for libgpiod to the most recent version.
No code changes required.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/libgpiod/Cargo.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bindings/rust/libgpiod/Cargo.toml b/bindings/rust/libgpiod/Cargo.toml
index 7c285592777fd6399591691076e0bb301ebabcc0..8b719b7647910269ca2c91fee685da7fcc67feb7 100644
--- a/bindings/rust/libgpiod/Cargo.toml
+++ b/bindings/rust/libgpiod/Cargo.toml
@@ -27,7 +27,7 @@ errno = "0.3.13"
intmap = "2.0.0"
libc = "0.2.39"
libgpiod-sys = { version = "0.1", path = "../libgpiod-sys" }
-thiserror = "1.0"
+thiserror = "2.0"
[dev-dependencies]
gpiosim-sys = { path = "../gpiosim-sys" }
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 08/10] bindings: rust: update intmap dependency
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
` (6 preceding siblings ...)
2025-08-12 12:10 ` [PATCH libgpiod 07/10] bindings: rust: update thiserror dependency Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-13 6:57 ` Erik Schilling
2025-08-12 12:10 ` [PATCH libgpiod 09/10] bindings: rust: update rust version Bartosz Golaszewski
` (2 subsequent siblings)
10 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bump the intmap dependency for libgpiod to the most recent version. The
IntMap type now takes two explicit type arguments for the key and value
so adjust the code accordingly.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/libgpiod/Cargo.toml | 2 +-
bindings/rust/libgpiod/src/lib.rs | 4 ++--
bindings/rust/libgpiod/src/line_config.rs | 2 +-
bindings/rust/libgpiod/src/line_request.rs | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/bindings/rust/libgpiod/Cargo.toml b/bindings/rust/libgpiod/Cargo.toml
index 8b719b7647910269ca2c91fee685da7fcc67feb7..d7fbe7b3669750880b815832a2e5d7c975ed4d7e 100644
--- a/bindings/rust/libgpiod/Cargo.toml
+++ b/bindings/rust/libgpiod/Cargo.toml
@@ -24,7 +24,7 @@ vnext = ["v2_1"]
[dependencies]
errno = "0.3.13"
-intmap = "2.0.0"
+intmap = "3.1.2"
libc = "0.2.39"
libgpiod-sys = { version = "0.1", path = "../libgpiod-sys" }
thiserror = "2.0"
diff --git a/bindings/rust/libgpiod/src/lib.rs b/bindings/rust/libgpiod/src/lib.rs
index f4e511d535b70fbc01f91fa059921545b405656a..76a2c1b76f3cf365866797742011b780ee5795d8 100644
--- a/bindings/rust/libgpiod/src/lib.rs
+++ b/bindings/rust/libgpiod/src/lib.rs
@@ -178,10 +178,10 @@ pub mod line {
}
/// Maps offset to Value.
- pub type ValueMap = IntMap<Value>;
+ pub type ValueMap = IntMap<Offset, Value>;
/// Maps offsets to Settings
- pub type SettingsMap = IntMap<Settings>;
+ pub type SettingsMap = IntMap<Offset, Settings>;
impl Value {
pub fn new(val: gpiod::gpiod_line_value) -> Result<Self> {
diff --git a/bindings/rust/libgpiod/src/line_config.rs b/bindings/rust/libgpiod/src/line_config.rs
index 34b6c227b0c8e156ea1bac396cc19ea4f182012c..5850b9da3cba0d75f475246592796c2c52570e8e 100644
--- a/bindings/rust/libgpiod/src/line_config.rs
+++ b/bindings/rust/libgpiod/src/line_config.rs
@@ -139,7 +139,7 @@ impl Config {
// We no longer use the pointer for any other purpose.
let settings = unsafe { Settings::from_raw(settings) };
- map.insert(*offset as u64, settings);
+ map.insert(*offset as Offset, settings);
}
Ok(map)
diff --git a/bindings/rust/libgpiod/src/line_request.rs b/bindings/rust/libgpiod/src/line_request.rs
index 49fe56542ab876bd2360b5e846e18ced0de51fbd..48d8d1a3a6fb5110ef295971cf44bcc70ff68c58 100644
--- a/bindings/rust/libgpiod/src/line_request.rs
+++ b/bindings/rust/libgpiod/src/line_request.rs
@@ -110,7 +110,7 @@ impl Request {
let mut map = ValueMap::new();
for (i, val) in values.iter().enumerate() {
- map.insert(offsets[i].into(), Value::new(*val)?);
+ map.insert(offsets[i], Value::new(*val)?);
}
Ok(map)
@@ -144,7 +144,7 @@ impl Request {
let mut values = Vec::new();
for (offset, value) in map {
- offsets.push(offset as u32);
+ offsets.push(offset);
values.push(value.value());
}
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 09/10] bindings: rust: update rust version
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
` (7 preceding siblings ...)
2025-08-12 12:10 ` [PATCH libgpiod 08/10] bindings: rust: update intmap dependency Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-13 6:57 ` Erik Schilling
2025-08-12 12:10 ` [PATCH libgpiod 10/10] bindings: rust: update crate versions to v1.0.0 Bartosz Golaszewski
2025-08-13 3:27 ` [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Viresh Kumar
10 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
With all previous fixes to rust bindings, we can now update the rust
version and required edition to 2024.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/libgpiod-sys/Cargo.toml | 4 ++--
bindings/rust/libgpiod/Cargo.toml | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bindings/rust/libgpiod-sys/Cargo.toml b/bindings/rust/libgpiod-sys/Cargo.toml
index 7fb5c174ec8186b6ef8cd64e1e6f25a13bd0dcd3..ab86ff8ecf871bfc3f931f8ea08490c4eb40eee6 100644
--- a/bindings/rust/libgpiod-sys/Cargo.toml
+++ b/bindings/rust/libgpiod-sys/Cargo.toml
@@ -9,10 +9,10 @@ authors = ["Viresh Kumar <viresh.kumar@linaro.org>"]
description = "libgpiod public header bindings"
repository = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
categories = ["external-ffi-bindings", "os::linux-apis"]
-rust-version = "1.60"
+rust-version = "1.86"
keywords = ["libgpiod", "gpio"]
license = "Apache-2.0 OR BSD-3-Clause"
-edition = "2021"
+edition = "2024"
exclude = [
"Makefile.am",
diff --git a/bindings/rust/libgpiod/Cargo.toml b/bindings/rust/libgpiod/Cargo.toml
index d7fbe7b3669750880b815832a2e5d7c975ed4d7e..c81680de1bdea76986c4a2fbb421bc452f92ff3c 100644
--- a/bindings/rust/libgpiod/Cargo.toml
+++ b/bindings/rust/libgpiod/Cargo.toml
@@ -9,10 +9,10 @@ authors = ["Viresh Kumar <viresh.kumar@linaro.org>"]
description = "libgpiod wrappers"
repository = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
categories = ["api-bindings", "hardware-support", "embedded", "os::linux-apis"]
-rust-version = "1.60"
+rust-version = "1.86"
keywords = ["libgpiod", "gpio"]
license = "Apache-2.0 OR BSD-3-Clause"
-edition = "2021"
+edition = "2024"
exclude = [
"Makefile.am",
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH libgpiod 10/10] bindings: rust: update crate versions to v1.0.0
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
` (8 preceding siblings ...)
2025-08-12 12:10 ` [PATCH libgpiod 09/10] bindings: rust: update rust version Bartosz Golaszewski
@ 2025-08-12 12:10 ` Bartosz Golaszewski
2025-08-13 3:27 ` [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Viresh Kumar
10 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-12 12:10 UTC (permalink / raw)
To: Viresh Kumar, Linus Walleij, Erik Wierich; +Cc: linux-gpio, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Ahead of the first stable release, update versions for all libgpiod
crates to v1.0.0.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
bindings/rust/gpiosim-sys/Cargo.toml | 2 +-
bindings/rust/libgpiod-sys/Cargo.toml | 2 +-
bindings/rust/libgpiod/Cargo.toml | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bindings/rust/gpiosim-sys/Cargo.toml b/bindings/rust/gpiosim-sys/Cargo.toml
index 7c092db1a4ff30f28a55bd35573cb9cc11393661..1e642f3d4be21f648317ea2d36dfacd191dfe32c 100644
--- a/bindings/rust/gpiosim-sys/Cargo.toml
+++ b/bindings/rust/gpiosim-sys/Cargo.toml
@@ -4,7 +4,7 @@
[package]
name = "gpiosim-sys"
-version = "0.1.0"
+version = "1.0.0"
authors = ["Viresh Kumar <viresh.kumar@linaro.org>"]
description = "gpiosim header bindings"
repository = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
diff --git a/bindings/rust/libgpiod-sys/Cargo.toml b/bindings/rust/libgpiod-sys/Cargo.toml
index ab86ff8ecf871bfc3f931f8ea08490c4eb40eee6..dea834a13ad619abb507e073c3e15ff3f668f909 100644
--- a/bindings/rust/libgpiod-sys/Cargo.toml
+++ b/bindings/rust/libgpiod-sys/Cargo.toml
@@ -4,7 +4,7 @@
[package]
name = "libgpiod-sys"
-version = "0.1.1"
+version = "1.0.0"
authors = ["Viresh Kumar <viresh.kumar@linaro.org>"]
description = "libgpiod public header bindings"
repository = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
diff --git a/bindings/rust/libgpiod/Cargo.toml b/bindings/rust/libgpiod/Cargo.toml
index c81680de1bdea76986c4a2fbb421bc452f92ff3c..bbe974f5d8652ca6e1db4b6285d4b651a1bf6799 100644
--- a/bindings/rust/libgpiod/Cargo.toml
+++ b/bindings/rust/libgpiod/Cargo.toml
@@ -4,7 +4,7 @@
[package]
name = "libgpiod"
-version = "0.2.2"
+version = "1.0.0"
authors = ["Viresh Kumar <viresh.kumar@linaro.org>"]
description = "libgpiod wrappers"
repository = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
@@ -26,7 +26,7 @@ vnext = ["v2_1"]
errno = "0.3.13"
intmap = "3.1.2"
libc = "0.2.39"
-libgpiod-sys = { version = "0.1", path = "../libgpiod-sys" }
+libgpiod-sys = { version = "1.0", path = "../libgpiod-sys" }
thiserror = "2.0"
[dev-dependencies]
--
2.48.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
` (9 preceding siblings ...)
2025-08-12 12:10 ` [PATCH libgpiod 10/10] bindings: rust: update crate versions to v1.0.0 Bartosz Golaszewski
@ 2025-08-13 3:27 ` Viresh Kumar
10 siblings, 0 replies; 22+ messages in thread
From: Viresh Kumar @ 2025-08-13 3:27 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Linus Walleij, Erik Wierich, linux-gpio, Bartosz Golaszewski
On 12-08-25, 14:10, Bartosz Golaszewski wrote:
> The libgpiod rust bindings interface has stayed quite stable over the
> last months so it's time for it to stop being a v0.x release and become
> officially carved in stone. Bump dependencies and rust version to the
> most recent versions available, fix some issues and then bump versions
> of the crates ahead of the official release.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> Bartosz Golaszewski (10):
> bindings: rust: make Buffer::read_edge_events() lifetimes more explicit
> bindings: rust: add missing unsafe block ahead of rust version bump
> bindings: rust: update bindgen dependency
> bindings: rust: update errno dependency
> bindings: rust: update cc dependency
> bindings: rust: update system-deps dependency
> bindings: rust: update thiserror dependency
> bindings: rust: update intmap dependency
> bindings: rust: update rust version
> bindings: rust: update crate versions to v1.0.0
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 04/10] bindings: rust: update errno dependency
2025-08-12 12:10 ` [PATCH libgpiod 04/10] bindings: rust: update errno dependency Bartosz Golaszewski
@ 2025-08-13 6:56 ` Erik Schilling
2025-08-13 7:18 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Erik Schilling @ 2025-08-13 6:56 UTC (permalink / raw)
To: Bartosz Golaszewski, Viresh Kumar, Linus Walleij
Cc: linux-gpio, Bartosz Golaszewski
On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Bump the errno dependency for gpiosim-sys and libgpiod crates to the
> most recent version. No code changes required.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> bindings/rust/gpiosim-sys/Cargo.toml | 2 +-
> bindings/rust/libgpiod/Cargo.toml | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/bindings/rust/gpiosim-sys/Cargo.toml b/bindings/rust/gpiosim-sys/Cargo.toml
> index 7099abe41226236b9cba70a36643b921021952ee..52ed43410ef5154a57a15e362344347a2b2cee57 100644
> --- a/bindings/rust/gpiosim-sys/Cargo.toml
> +++ b/bindings/rust/gpiosim-sys/Cargo.toml
> @@ -15,7 +15,7 @@ license = "Apache-2.0 OR BSD-3-Clause"
> edition = "2021"
>
> [dependencies]
> -errno = "0.2.8"
> +errno = "0.3.13"
> libgpiod = { path = "../libgpiod" }
>
> [build-dependencies]
Hm. Given that we expose types of `errno` as part of our `Error` struct,
one could reason that 0.3.13 is setting a bit arbitrary version floor
and 0.3 (^0.3.0) would allow uses a little bit more flexibility...
But that really only becomes a problem if someone pins this dependency
to a specific version, which seems unlikely. So I guess this is fine.
- Erik
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 08/10] bindings: rust: update intmap dependency
2025-08-12 12:10 ` [PATCH libgpiod 08/10] bindings: rust: update intmap dependency Bartosz Golaszewski
@ 2025-08-13 6:57 ` Erik Schilling
2025-08-13 7:18 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Erik Schilling @ 2025-08-13 6:57 UTC (permalink / raw)
To: Bartosz Golaszewski, Viresh Kumar, Linus Walleij
Cc: linux-gpio, Bartosz Golaszewski
On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Bump the intmap dependency for libgpiod to the most recent version. The
> IntMap type now takes two explicit type arguments for the key and value
> so adjust the code accordingly.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> bindings/rust/libgpiod/Cargo.toml | 2 +-
> bindings/rust/libgpiod/src/lib.rs | 4 ++--
> bindings/rust/libgpiod/src/line_config.rs | 2 +-
> bindings/rust/libgpiod/src/line_request.rs | 4 ++--
> 4 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/bindings/rust/libgpiod/Cargo.toml b/bindings/rust/libgpiod/Cargo.toml
> index 8b719b7647910269ca2c91fee685da7fcc67feb7..d7fbe7b3669750880b815832a2e5d7c975ed4d7e 100644
> --- a/bindings/rust/libgpiod/Cargo.toml
> +++ b/bindings/rust/libgpiod/Cargo.toml
> @@ -24,7 +24,7 @@ vnext = ["v2_1"]
>
> [dependencies]
> errno = "0.3.13"
> -intmap = "2.0.0"
> +intmap = "3.1.2"
> libc = "0.2.39"
> libgpiod-sys = { version = "0.1", path = "../libgpiod-sys" }
> thiserror = "2.0"
This lib we also expose types through our public contract. But the
explcit 3.1.2 floor does not seem to bring any transient bumps of
rust-version or other libs. So it seems reasonably low-risk.
- Erik
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 09/10] bindings: rust: update rust version
2025-08-12 12:10 ` [PATCH libgpiod 09/10] bindings: rust: update rust version Bartosz Golaszewski
@ 2025-08-13 6:57 ` Erik Schilling
2025-08-13 7:12 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Erik Schilling @ 2025-08-13 6:57 UTC (permalink / raw)
To: Bartosz Golaszewski, Viresh Kumar, Linus Walleij
Cc: linux-gpio, Bartosz Golaszewski
On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> With all previous fixes to rust bindings, we can now update the rust
> version and required edition to 2024.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
> bindings/rust/libgpiod-sys/Cargo.toml | 4 ++--
> bindings/rust/libgpiod/Cargo.toml | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/bindings/rust/libgpiod-sys/Cargo.toml b/bindings/rust/libgpiod-sys/Cargo.toml
> index 7fb5c174ec8186b6ef8cd64e1e6f25a13bd0dcd3..ab86ff8ecf871bfc3f931f8ea08490c4eb40eee6 100644
> --- a/bindings/rust/libgpiod-sys/Cargo.toml
> +++ b/bindings/rust/libgpiod-sys/Cargo.toml
> @@ -9,10 +9,10 @@ authors = ["Viresh Kumar <viresh.kumar@linaro.org>"]
> description = "libgpiod public header bindings"
> repository = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
> categories = ["external-ffi-bindings", "os::linux-apis"]
> -rust-version = "1.60"
> +rust-version = "1.86"
> keywords = ["libgpiod", "gpio"]
> license = "Apache-2.0 OR BSD-3-Clause"
> -edition = "2021"
> +edition = "2024"
>
> exclude = [
> "Makefile.am",
Is there a particular reason to to pick this specific rust-version? This
essentially sets the floor of the MSRV (Minimum Supported Rust Version)
of this lib.
That means that it won't build with any older Rust version, which may
impact users of the lib that are still lagging slightly behind?
I would only bump this if our libs start to require it (or we use new
features ourselves). So I think we should spell out which libs/features
mandate this bump in the commit message and only update as high as we
need to.
- Erik
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 09/10] bindings: rust: update rust version
2025-08-13 6:57 ` Erik Schilling
@ 2025-08-13 7:12 ` Bartosz Golaszewski
2025-08-13 8:24 ` Erik Schilling
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-13 7:12 UTC (permalink / raw)
To: Erik Schilling
Cc: Viresh Kumar, Linus Walleij, linux-gpio, Bartosz Golaszewski
On Wed, Aug 13, 2025 at 8:57 AM Erik Schilling <erik@riscstar.com> wrote:
>
> On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > With all previous fixes to rust bindings, we can now update the rust
> > version and required edition to 2024.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
> > bindings/rust/libgpiod-sys/Cargo.toml | 4 ++--
> > bindings/rust/libgpiod/Cargo.toml | 4 ++--
> > 2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/bindings/rust/libgpiod-sys/Cargo.toml b/bindings/rust/libgpiod-sys/Cargo.toml
> > index 7fb5c174ec8186b6ef8cd64e1e6f25a13bd0dcd3..ab86ff8ecf871bfc3f931f8ea08490c4eb40eee6 100644
> > --- a/bindings/rust/libgpiod-sys/Cargo.toml
> > +++ b/bindings/rust/libgpiod-sys/Cargo.toml
> > @@ -9,10 +9,10 @@ authors = ["Viresh Kumar <viresh.kumar@linaro.org>"]
> > description = "libgpiod public header bindings"
> > repository = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
> > categories = ["external-ffi-bindings", "os::linux-apis"]
> > -rust-version = "1.60"
> > +rust-version = "1.86"
> > keywords = ["libgpiod", "gpio"]
> > license = "Apache-2.0 OR BSD-3-Clause"
> > -edition = "2021"
> > +edition = "2024"
> >
> > exclude = [
> > "Makefile.am",
>
> Is there a particular reason to to pick this specific rust-version? This
> essentially sets the floor of the MSRV (Minimum Supported Rust Version)
> of this lib.
>
> That means that it won't build with any older Rust version, which may
> impact users of the lib that are still lagging slightly behind?
>
I'm probably talking nonsense right from the top of Mount Stupid[1]
here but is this bad in rust? With the ease of updating everything via
cargo, I figured requiring the most recent version makes sense? I'll
defer to you as you have way more knowledge on this subject, so tell
me if I should drop this.
> I would only bump this if our libs start to require it (or we use new
> features ourselves). So I think we should spell out which libs/features
> mandate this bump in the commit message and only update as high as we
> need to.
>
Nobody requires it AFAICT.
Bart
[1] https://commons.wikimedia.org/wiki/File:Dunning%E2%80%93Kruger_Effect_01.svg
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 04/10] bindings: rust: update errno dependency
2025-08-13 6:56 ` Erik Schilling
@ 2025-08-13 7:18 ` Bartosz Golaszewski
2025-08-13 8:24 ` Erik Schilling
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-13 7:18 UTC (permalink / raw)
To: Erik Schilling
Cc: Viresh Kumar, Linus Walleij, linux-gpio, Bartosz Golaszewski
On Wed, Aug 13, 2025 at 8:56 AM Erik Schilling <erik@riscstar.com> wrote:
>
> On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Bump the errno dependency for gpiosim-sys and libgpiod crates to the
> > most recent version. No code changes required.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
> > bindings/rust/gpiosim-sys/Cargo.toml | 2 +-
> > bindings/rust/libgpiod/Cargo.toml | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/bindings/rust/gpiosim-sys/Cargo.toml b/bindings/rust/gpiosim-sys/Cargo.toml
> > index 7099abe41226236b9cba70a36643b921021952ee..52ed43410ef5154a57a15e362344347a2b2cee57 100644
> > --- a/bindings/rust/gpiosim-sys/Cargo.toml
> > +++ b/bindings/rust/gpiosim-sys/Cargo.toml
> > @@ -15,7 +15,7 @@ license = "Apache-2.0 OR BSD-3-Clause"
> > edition = "2021"
> >
> > [dependencies]
> > -errno = "0.2.8"
> > +errno = "0.3.13"
> > libgpiod = { path = "../libgpiod" }
> >
> > [build-dependencies]
>
> Hm. Given that we expose types of `errno` as part of our `Error` struct,
Oh, we do? Is this correct? My habit from writing C libraries is to
hide all symbols coming in from external dependencies.
> one could reason that 0.3.13 is setting a bit arbitrary version floor
> and 0.3 (^0.3.0) would allow uses a little bit more flexibility...
>
Yeah, that's another thing that I wanted to clarify: shouldn't we in
general use just the major version for stable crates (example: version
= "1" for a full version 1.2.3) and minor version for unstable crates
(example: version = "0.3" for a full version 0.3.2) and let cargo pick
up the most recent bugfix release? That assumes that stable crates
don't break interfaces across minor version and unstable ones don't do
this across bugfix releases.
> But that really only becomes a problem if someone pins this dependency
> to a specific version, which seems unlikely. So I guess this is fine.
>
I'm not getting this one, could you give an example?
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 08/10] bindings: rust: update intmap dependency
2025-08-13 6:57 ` Erik Schilling
@ 2025-08-13 7:18 ` Bartosz Golaszewski
2025-08-13 8:24 ` Erik Schilling
0 siblings, 1 reply; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-13 7:18 UTC (permalink / raw)
To: Erik Schilling
Cc: Viresh Kumar, Linus Walleij, linux-gpio, Bartosz Golaszewski
On Wed, Aug 13, 2025 at 8:57 AM Erik Schilling <erik@riscstar.com> wrote:
>
> On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Bump the intmap dependency for libgpiod to the most recent version. The
> > IntMap type now takes two explicit type arguments for the key and value
> > so adjust the code accordingly.
> >
> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > ---
> > bindings/rust/libgpiod/Cargo.toml | 2 +-
> > bindings/rust/libgpiod/src/lib.rs | 4 ++--
> > bindings/rust/libgpiod/src/line_config.rs | 2 +-
> > bindings/rust/libgpiod/src/line_request.rs | 4 ++--
> > 4 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/bindings/rust/libgpiod/Cargo.toml b/bindings/rust/libgpiod/Cargo.toml
> > index 8b719b7647910269ca2c91fee685da7fcc67feb7..d7fbe7b3669750880b815832a2e5d7c975ed4d7e 100644
> > --- a/bindings/rust/libgpiod/Cargo.toml
> > +++ b/bindings/rust/libgpiod/Cargo.toml
> > @@ -24,7 +24,7 @@ vnext = ["v2_1"]
> >
> > [dependencies]
> > errno = "0.3.13"
> > -intmap = "2.0.0"
> > +intmap = "3.1.2"
> > libc = "0.2.39"
> > libgpiod-sys = { version = "0.1", path = "../libgpiod-sys" }
> > thiserror = "2.0"
>
> This lib we also expose types through our public contract. But the
> explcit 3.1.2 floor does not seem to bring any transient bumps of
> rust-version or other libs. So it seems reasonably low-risk.
>
So just: intmap = "3" make sense?
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 04/10] bindings: rust: update errno dependency
2025-08-13 7:18 ` Bartosz Golaszewski
@ 2025-08-13 8:24 ` Erik Schilling
2025-08-13 8:33 ` Bartosz Golaszewski
0 siblings, 1 reply; 22+ messages in thread
From: Erik Schilling @ 2025-08-13 8:24 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Viresh Kumar, Linus Walleij, linux-gpio, Bartosz Golaszewski
On Wed Aug 13, 2025 at 9:18 AM CEST, Bartosz Golaszewski wrote:
> On Wed, Aug 13, 2025 at 8:56 AM Erik Schilling <erik@riscstar.com> wrote:
>>
>> On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
>> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>> >
>> > Bump the errno dependency for gpiosim-sys and libgpiod crates to the
>> > most recent version. No code changes required.
>> >
>> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>> > ---
>> > bindings/rust/gpiosim-sys/Cargo.toml | 2 +-
>> > bindings/rust/libgpiod/Cargo.toml | 2 +-
>> > 2 files changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/bindings/rust/gpiosim-sys/Cargo.toml b/bindings/rust/gpiosim-sys/Cargo.toml
>> > index 7099abe41226236b9cba70a36643b921021952ee..52ed43410ef5154a57a15e362344347a2b2cee57 100644
>> > --- a/bindings/rust/gpiosim-sys/Cargo.toml
>> > +++ b/bindings/rust/gpiosim-sys/Cargo.toml
>> > @@ -15,7 +15,7 @@ license = "Apache-2.0 OR BSD-3-Clause"
>> > edition = "2021"
>> >
>> > [dependencies]
>> > -errno = "0.2.8"
>> > +errno = "0.3.13"
>> > libgpiod = { path = "../libgpiod" }
>> >
>> > [build-dependencies]
>>
>> Hm. Given that we expose types of `errno` as part of our `Error` struct,
>
> Oh, we do? Is this correct? My habit from writing C libraries is to
> hide all symbols coming in from external dependencies.
Apparently we do through:
#[error("Operation {0} Failed: {1}")]
OperationFailed(OperationType, errno::Errno),
Not sure if I am a huge fan of it either. I wonder if we could simply
use the std::io::Error::last_os_error() API instead? [1]
[1] https://doc.rust-lang.org/std/io/struct.Error.html#method.last_os_error
>> one could reason that 0.3.13 is setting a bit arbitrary version floor
>> and 0.3 (^0.3.0) would allow uses a little bit more flexibility...
>>
>
> Yeah, that's another thing that I wanted to clarify: shouldn't we in
> general use just the major version for stable crates (example: version
> = "1" for a full version 1.2.3) and minor version for unstable crates
> (example: version = "0.3" for a full version 0.3.2) and let cargo pick
> up the most recent bugfix release? That assumes that stable crates
> don't break interfaces across minor version and unstable ones don't do
> this across bugfix releases.
Yes, that gives consumers of libgpiod most flexibility.
>
>> But that really only becomes a problem if someone pins this dependency
>> to a specific version, which seems unlikely. So I guess this is fine.
>>
>
> I'm not getting this one, could you give an example?
If someone (for whatever reason) would specify a `errno = "=0.3.10"` or
a `errno = "<0.3.10"`, then our `errno = "^0.3.13"` would break their
dependency chain (if they also handle this particular Error enum
variant).
Not a super likely scenario. But I think a wide "0.3" is better if we
do not require any specific patch release.
- Erik
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 08/10] bindings: rust: update intmap dependency
2025-08-13 7:18 ` Bartosz Golaszewski
@ 2025-08-13 8:24 ` Erik Schilling
0 siblings, 0 replies; 22+ messages in thread
From: Erik Schilling @ 2025-08-13 8:24 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Viresh Kumar, Linus Walleij, linux-gpio, Bartosz Golaszewski
On Wed Aug 13, 2025 at 9:18 AM CEST, Bartosz Golaszewski wrote:
> On Wed, Aug 13, 2025 at 8:57 AM Erik Schilling <erik@riscstar.com> wrote:
>>
>> On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
>> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>> >
>> > Bump the intmap dependency for libgpiod to the most recent version. The
>> > IntMap type now takes two explicit type arguments for the key and value
>> > so adjust the code accordingly.
>> >
>> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>> > ---
>> > bindings/rust/libgpiod/Cargo.toml | 2 +-
>> > bindings/rust/libgpiod/src/lib.rs | 4 ++--
>> > bindings/rust/libgpiod/src/line_config.rs | 2 +-
>> > bindings/rust/libgpiod/src/line_request.rs | 4 ++--
>> > 4 files changed, 6 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/bindings/rust/libgpiod/Cargo.toml b/bindings/rust/libgpiod/Cargo.toml
>> > index 8b719b7647910269ca2c91fee685da7fcc67feb7..d7fbe7b3669750880b815832a2e5d7c975ed4d7e 100644
>> > --- a/bindings/rust/libgpiod/Cargo.toml
>> > +++ b/bindings/rust/libgpiod/Cargo.toml
>> > @@ -24,7 +24,7 @@ vnext = ["v2_1"]
>> >
>> > [dependencies]
>> > errno = "0.3.13"
>> > -intmap = "2.0.0"
>> > +intmap = "3.1.2"
>> > libc = "0.2.39"
>> > libgpiod-sys = { version = "0.1", path = "../libgpiod-sys" }
>> > thiserror = "2.0"
>>
>> This lib we also expose types through our public contract. But the
>> explcit 3.1.2 floor does not seem to bring any transient bumps of
>> rust-version or other libs. So it seems reasonably low-risk.
>>
>
> So just: intmap = "3" make sense?
Yes!
- Erik
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 09/10] bindings: rust: update rust version
2025-08-13 7:12 ` Bartosz Golaszewski
@ 2025-08-13 8:24 ` Erik Schilling
0 siblings, 0 replies; 22+ messages in thread
From: Erik Schilling @ 2025-08-13 8:24 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Viresh Kumar, Linus Walleij, linux-gpio, Bartosz Golaszewski
On Wed Aug 13, 2025 at 9:12 AM CEST, Bartosz Golaszewski wrote:
> On Wed, Aug 13, 2025 at 8:57 AM Erik Schilling <erik@riscstar.com> wrote:
>>
>> On Tue Aug 12, 2025 at 2:10 PM CEST, Bartosz Golaszewski wrote:
>> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>> >
>> > With all previous fixes to rust bindings, we can now update the rust
>> > version and required edition to 2024.
>> >
>> > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>> > ---
>> > bindings/rust/libgpiod-sys/Cargo.toml | 4 ++--
>> > bindings/rust/libgpiod/Cargo.toml | 4 ++--
>> > 2 files changed, 4 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/bindings/rust/libgpiod-sys/Cargo.toml b/bindings/rust/libgpiod-sys/Cargo.toml
>> > index 7fb5c174ec8186b6ef8cd64e1e6f25a13bd0dcd3..ab86ff8ecf871bfc3f931f8ea08490c4eb40eee6 100644
>> > --- a/bindings/rust/libgpiod-sys/Cargo.toml
>> > +++ b/bindings/rust/libgpiod-sys/Cargo.toml
>> > @@ -9,10 +9,10 @@ authors = ["Viresh Kumar <viresh.kumar@linaro.org>"]
>> > description = "libgpiod public header bindings"
>> > repository = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git"
>> > categories = ["external-ffi-bindings", "os::linux-apis"]
>> > -rust-version = "1.60"
>> > +rust-version = "1.86"
>> > keywords = ["libgpiod", "gpio"]
>> > license = "Apache-2.0 OR BSD-3-Clause"
>> > -edition = "2021"
>> > +edition = "2024"
>> >
>> > exclude = [
>> > "Makefile.am",
>>
>> Is there a particular reason to to pick this specific rust-version? This
>> essentially sets the floor of the MSRV (Minimum Supported Rust Version)
>> of this lib.
>>
>> That means that it won't build with any older Rust version, which may
>> impact users of the lib that are still lagging slightly behind?
>>
>
> I'm probably talking nonsense right from the top of Mount Stupid[1]
> here but is this bad in rust? With the ease of updating everything via
> cargo, I figured requiring the most recent version makes sense? I'll
> defer to you as you have way more knowledge on this subject, so tell
> me if I should drop this.
It certainly is a lot less of a problem with Rust. But projects may
still be lagging behind a few versions if they have some dependency
problems. Rust through rustup is also not the only option of consuming
Rust. One could also work with a Rust toolchain from Yocto and be stuck
with an older Yocto version.
>> I would only bump this if our libs start to require it (or we use new
>> features ourselves). So I think we should spell out which libs/features
>> mandate this bump in the commit message and only update as high as we
>> need to.
>>
>
> Nobody requires it AFAICT.
If we still build and `cargo test` fine with 1.60, then I would keep
that version :). Once our dependencies start demanding newer versions
we can update (to the lowest version that the union of our dependencies
still supports).
Or phrased differently: No need to make our work harder by sticking to
old dependencies. But no need to prematurely raise the version floor
too.
- Erik
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH libgpiod 04/10] bindings: rust: update errno dependency
2025-08-13 8:24 ` Erik Schilling
@ 2025-08-13 8:33 ` Bartosz Golaszewski
0 siblings, 0 replies; 22+ messages in thread
From: Bartosz Golaszewski @ 2025-08-13 8:33 UTC (permalink / raw)
To: Erik Schilling
Cc: Viresh Kumar, Linus Walleij, linux-gpio, Bartosz Golaszewski
On Wed, Aug 13, 2025 at 10:24 AM Erik Schilling <erik@riscstar.com> wrote:
>
> >>
> >> Hm. Given that we expose types of `errno` as part of our `Error` struct,
> >
> > Oh, we do? Is this correct? My habit from writing C libraries is to
> > hide all symbols coming in from external dependencies.
>
> Apparently we do through:
>
> #[error("Operation {0} Failed: {1}")]
> OperationFailed(OperationType, errno::Errno),
>
> Not sure if I am a huge fan of it either. I wonder if we could simply
> use the std::io::Error::last_os_error() API instead? [1]
>
> [1] https://doc.rust-lang.org/std/io/struct.Error.html#method.last_os_error
>
Errnos are something I can probably live with. At least in libgpiod C
API, errno symbols are implicitly shown to user over the errno
variable we officially use to pass error numbers from libgpiod
functions. I just hope that the errno crate is just as stable as the
errno.h defines.
Bartosz
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2025-08-13 8:33 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 12:10 [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 01/10] bindings: rust: make Buffer::read_edge_events() lifetimes more explicit Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 02/10] bindings: rust: add missing unsafe block ahead of rust version bump Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 03/10] bindings: rust: update bindgen dependency Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 04/10] bindings: rust: update errno dependency Bartosz Golaszewski
2025-08-13 6:56 ` Erik Schilling
2025-08-13 7:18 ` Bartosz Golaszewski
2025-08-13 8:24 ` Erik Schilling
2025-08-13 8:33 ` Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 05/10] bindings: rust: update cc dependency Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 06/10] bindings: rust: update system-deps dependency Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 07/10] bindings: rust: update thiserror dependency Bartosz Golaszewski
2025-08-12 12:10 ` [PATCH libgpiod 08/10] bindings: rust: update intmap dependency Bartosz Golaszewski
2025-08-13 6:57 ` Erik Schilling
2025-08-13 7:18 ` Bartosz Golaszewski
2025-08-13 8:24 ` Erik Schilling
2025-08-12 12:10 ` [PATCH libgpiod 09/10] bindings: rust: update rust version Bartosz Golaszewski
2025-08-13 6:57 ` Erik Schilling
2025-08-13 7:12 ` Bartosz Golaszewski
2025-08-13 8:24 ` Erik Schilling
2025-08-12 12:10 ` [PATCH libgpiod 10/10] bindings: rust: update crate versions to v1.0.0 Bartosz Golaszewski
2025-08-13 3:27 ` [PATCH libgpiod 00/10] bindings: rust: prepare v1.0.0 release Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).