diff for duplicates of <20260801112254.313381-1-work@onurozkan.dev> diff --git a/a/1.txt b/N1/1.txt index 2e58c87..2e87893 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,89 +1,94 @@ -On Mon, 06 Jul 2026 11:37:14 -0300\r -Daniel Almeida <daniel.almeida@collabora.com> wrote:\r -\r -> The clk API allows fine-grained control, but some drivers might be\r -> more interested in a "set and forget" API.\r -> \r -> Expand the current API to support this. The clock will automatically be\r -> disabled, unprepared and freed when the device is unbound from the bus\r -> without further intervention by the driver.\r -> \r -> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>\r -> ---\r -> rust/kernel/clk.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++++\r -> 1 file changed, 46 insertions(+)\r -> \r -> diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs\r -> index dd5fd656271e..b9a44f83843a 100644\r -> --- a/rust/kernel/clk.rs\r -> +++ b/rust/kernel/clk.rs\r -> @@ -96,6 +96,52 @@ impl Sealed for super::Prepared {}\r -> impl Sealed for super::Enabled {}\r -> }\r -> \r -> + /// Obtains and enables a [`devres`]-managed [`Clk`] for a bound device.\r -> + ///\r -> + /// [`devres`]: crate::devres::Devres\r -> + #[inline]\r -> + pub fn devm_enable(dev: &Device<Bound>, name: Option<&CStr>) -> Result {\r -> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\r -> +\r -> + // SAFETY: It is safe to call [`devm_clk_get_enabled`] with a valid\r -\r -Intra-doc links won't work in regular comments.\r -\r -> + // device pointer.\r -> + from_err_ptr(unsafe { bindings::devm_clk_get_enabled(dev.as_raw(), name) })?;\r -> + Ok(())\r -> + }\r -> +\r -> + /// Obtains and enables a [`devres`]-managed [`Clk`] for a bound device.\r -> + ///\r -> + /// This does not print any error messages if the clock is not found.\r -> + ///\r -> + /// [`devres`]: crate::devres::Devres\r -> + #[inline]\r -> + pub fn devm_enable_optional(dev: &Device<Bound>, name: Option<&CStr>) -> Result {\r -> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\r -> +\r -> + // SAFETY: It is safe to call [`devm_clk_get_optional_enabled`] with a\r -> + // valid device pointer.\r -> + from_err_ptr(unsafe { bindings::devm_clk_get_optional_enabled(dev.as_raw(), name) })?;\r -> + Ok(())\r -> + }\r -> +\r -> + /// Same as [`devm_enable_optional`], but also sets the rate.\r -> + #[inline]\r -> + pub fn devm_enable_optional_with_rate(\r -> + dev: &Device<Bound>,\r -> + name: Option<&CStr>,\r -> + rate: Hertz,\r -> + ) -> Result {\r -> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\r -> +\r -> + // SAFETY: It is safe to call\r -> + // [`devm_clk_get_optional_enabled_with_rate`] with a valid device\r -> + // pointer.\r -> + from_err_ptr(unsafe {\r -> + bindings::devm_clk_get_optional_enabled_with_rate(dev.as_raw(), name, rate.as_hz())\r -> + })?;\r -\r -Just fyi, there's currently a bug in the C implementation of\r -devm_clk_get_optional_enabled_with_rate() which I caught while reviewing your\r -series. The fix patch is already on the list [1]. Other than that, this LGTM.\r -\r -[1]: https://lore.kernel.org/all/20260801111637.304590-1-work@onurozkan.dev\r -\r -Regards,\r -Onur\r -\r -> + Ok(())\r -> + }\r -> +\r -> /// A trait representing the different states that a [`Clk`] can be in.\r -> pub trait ClkState: private::Sealed {\r -> /// Whether the clock is enabled in this state.\r -> \r -> -- \r -> 2.54.0\r -> +On Mon, 06 Jul 2026 11:37:14 -0300 +Daniel Almeida <daniel.almeida@collabora.com> wrote: + +> The clk API allows fine-grained control, but some drivers might be +> more interested in a "set and forget" API. +> +> Expand the current API to support this. The clock will automatically be +> disabled, unprepared and freed when the device is unbound from the bus +> without further intervention by the driver. +> +> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com> +> --- +> rust/kernel/clk.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ +> 1 file changed, 46 insertions(+) +> +> diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs +> index dd5fd656271e..b9a44f83843a 100644 +> --- a/rust/kernel/clk.rs +> +++ b/rust/kernel/clk.rs +> @@ -96,6 +96,52 @@ impl Sealed for super::Prepared {} +> impl Sealed for super::Enabled {} +> } +> +> + /// Obtains and enables a [`devres`]-managed [`Clk`] for a bound device. +> + /// +> + /// [`devres`]: crate::devres::Devres +> + #[inline] +> + pub fn devm_enable(dev: &Device<Bound>, name: Option<&CStr>) -> Result { +> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr()); +> + +> + // SAFETY: It is safe to call [`devm_clk_get_enabled`] with a valid + +Intra-doc links won't work in regular comments. + +> + // device pointer. +> + from_err_ptr(unsafe { bindings::devm_clk_get_enabled(dev.as_raw(), name) })?; +> + Ok(()) +> + } +> + +> + /// Obtains and enables a [`devres`]-managed [`Clk`] for a bound device. +> + /// +> + /// This does not print any error messages if the clock is not found. +> + /// +> + /// [`devres`]: crate::devres::Devres +> + #[inline] +> + pub fn devm_enable_optional(dev: &Device<Bound>, name: Option<&CStr>) -> Result { +> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr()); +> + +> + // SAFETY: It is safe to call [`devm_clk_get_optional_enabled`] with a +> + // valid device pointer. +> + from_err_ptr(unsafe { bindings::devm_clk_get_optional_enabled(dev.as_raw(), name) })?; +> + Ok(()) +> + } +> + +> + /// Same as [`devm_enable_optional`], but also sets the rate. +> + #[inline] +> + pub fn devm_enable_optional_with_rate( +> + dev: &Device<Bound>, +> + name: Option<&CStr>, +> + rate: Hertz, +> + ) -> Result { +> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr()); +> + +> + // SAFETY: It is safe to call +> + // [`devm_clk_get_optional_enabled_with_rate`] with a valid device +> + // pointer. +> + from_err_ptr(unsafe { +> + bindings::devm_clk_get_optional_enabled_with_rate(dev.as_raw(), name, rate.as_hz()) +> + })?; + +Just fyi, there's currently a bug in the C implementation of +devm_clk_get_optional_enabled_with_rate() which I caught while reviewing your +series. The fix patch is already on the list [1]. Other than that, this LGTM. + +[1]: https://lore.kernel.org/all/20260801111637.304590-1-work@onurozkan.dev + +Regards, +Onur + +> + Ok(()) +> + } +> + +> /// A trait representing the different states that a [`Clk`] can be in. +> pub trait ClkState: private::Sealed { +> /// Whether the clock is enabled in this state. +> +> -- +> 2.54.0 +> + +_______________________________________________ +linux-riscv mailing list +linux-riscv@lists.infradead.org +http://lists.infradead.org/mailman/listinfo/linux-riscv diff --git a/a/content_digest b/N1/content_digest index 2703041..fb2c80d 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -38,94 +38,99 @@ " Maurice <mhi@mailbox.org>\0" "\00:1\0" "b\0" - "On Mon, 06 Jul 2026 11:37:14 -0300\r\n" - "Daniel Almeida <daniel.almeida@collabora.com> wrote:\r\n" - "\r\n" - "> The clk API allows fine-grained control, but some drivers might be\r\n" - "> more interested in a \"set and forget\" API.\r\n" - "> \r\n" - "> Expand the current API to support this. The clock will automatically be\r\n" - "> disabled, unprepared and freed when the device is unbound from the bus\r\n" - "> without further intervention by the driver.\r\n" - "> \r\n" - "> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>\r\n" - "> ---\r\n" - "> rust/kernel/clk.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++++\r\n" - "> 1 file changed, 46 insertions(+)\r\n" - "> \r\n" - "> diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs\r\n" - "> index dd5fd656271e..b9a44f83843a 100644\r\n" - "> --- a/rust/kernel/clk.rs\r\n" - "> +++ b/rust/kernel/clk.rs\r\n" - "> @@ -96,6 +96,52 @@ impl Sealed for super::Prepared {}\r\n" - "> impl Sealed for super::Enabled {}\r\n" - "> }\r\n" - "> \r\n" - "> + /// Obtains and enables a [`devres`]-managed [`Clk`] for a bound device.\r\n" - "> + ///\r\n" - "> + /// [`devres`]: crate::devres::Devres\r\n" - "> + #[inline]\r\n" - "> + pub fn devm_enable(dev: &Device<Bound>, name: Option<&CStr>) -> Result {\r\n" - "> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\r\n" - "> +\r\n" - "> + // SAFETY: It is safe to call [`devm_clk_get_enabled`] with a valid\r\n" - "\r\n" - "Intra-doc links won't work in regular comments.\r\n" - "\r\n" - "> + // device pointer.\r\n" - "> + from_err_ptr(unsafe { bindings::devm_clk_get_enabled(dev.as_raw(), name) })?;\r\n" - "> + Ok(())\r\n" - "> + }\r\n" - "> +\r\n" - "> + /// Obtains and enables a [`devres`]-managed [`Clk`] for a bound device.\r\n" - "> + ///\r\n" - "> + /// This does not print any error messages if the clock is not found.\r\n" - "> + ///\r\n" - "> + /// [`devres`]: crate::devres::Devres\r\n" - "> + #[inline]\r\n" - "> + pub fn devm_enable_optional(dev: &Device<Bound>, name: Option<&CStr>) -> Result {\r\n" - "> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\r\n" - "> +\r\n" - "> + // SAFETY: It is safe to call [`devm_clk_get_optional_enabled`] with a\r\n" - "> + // valid device pointer.\r\n" - "> + from_err_ptr(unsafe { bindings::devm_clk_get_optional_enabled(dev.as_raw(), name) })?;\r\n" - "> + Ok(())\r\n" - "> + }\r\n" - "> +\r\n" - "> + /// Same as [`devm_enable_optional`], but also sets the rate.\r\n" - "> + #[inline]\r\n" - "> + pub fn devm_enable_optional_with_rate(\r\n" - "> + dev: &Device<Bound>,\r\n" - "> + name: Option<&CStr>,\r\n" - "> + rate: Hertz,\r\n" - "> + ) -> Result {\r\n" - "> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\r\n" - "> +\r\n" - "> + // SAFETY: It is safe to call\r\n" - "> + // [`devm_clk_get_optional_enabled_with_rate`] with a valid device\r\n" - "> + // pointer.\r\n" - "> + from_err_ptr(unsafe {\r\n" - "> + bindings::devm_clk_get_optional_enabled_with_rate(dev.as_raw(), name, rate.as_hz())\r\n" - "> + })?;\r\n" - "\r\n" - "Just fyi, there's currently a bug in the C implementation of\r\n" - "devm_clk_get_optional_enabled_with_rate() which I caught while reviewing your\r\n" - "series. The fix patch is already on the list [1]. Other than that, this LGTM.\r\n" - "\r\n" - "[1]: https://lore.kernel.org/all/20260801111637.304590-1-work@onurozkan.dev\r\n" - "\r\n" - "Regards,\r\n" - "Onur\r\n" - "\r\n" - "> + Ok(())\r\n" - "> + }\r\n" - "> +\r\n" - "> /// A trait representing the different states that a [`Clk`] can be in.\r\n" - "> pub trait ClkState: private::Sealed {\r\n" - "> /// Whether the clock is enabled in this state.\r\n" - "> \r\n" - "> -- \r\n" - "> 2.54.0\r\n" - > + "On Mon, 06 Jul 2026 11:37:14 -0300\n" + "Daniel Almeida <daniel.almeida@collabora.com> wrote:\n" + "\n" + "> The clk API allows fine-grained control, but some drivers might be\n" + "> more interested in a \"set and forget\" API.\n" + "> \n" + "> Expand the current API to support this. The clock will automatically be\n" + "> disabled, unprepared and freed when the device is unbound from the bus\n" + "> without further intervention by the driver.\n" + "> \n" + "> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>\n" + "> ---\n" + "> rust/kernel/clk.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++++\n" + "> 1 file changed, 46 insertions(+)\n" + "> \n" + "> diff --git a/rust/kernel/clk.rs b/rust/kernel/clk.rs\n" + "> index dd5fd656271e..b9a44f83843a 100644\n" + "> --- a/rust/kernel/clk.rs\n" + "> +++ b/rust/kernel/clk.rs\n" + "> @@ -96,6 +96,52 @@ impl Sealed for super::Prepared {}\n" + "> impl Sealed for super::Enabled {}\n" + "> }\n" + "> \n" + "> + /// Obtains and enables a [`devres`]-managed [`Clk`] for a bound device.\n" + "> + ///\n" + "> + /// [`devres`]: crate::devres::Devres\n" + "> + #[inline]\n" + "> + pub fn devm_enable(dev: &Device<Bound>, name: Option<&CStr>) -> Result {\n" + "> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\n" + "> +\n" + "> + // SAFETY: It is safe to call [`devm_clk_get_enabled`] with a valid\n" + "\n" + "Intra-doc links won't work in regular comments.\n" + "\n" + "> + // device pointer.\n" + "> + from_err_ptr(unsafe { bindings::devm_clk_get_enabled(dev.as_raw(), name) })?;\n" + "> + Ok(())\n" + "> + }\n" + "> +\n" + "> + /// Obtains and enables a [`devres`]-managed [`Clk`] for a bound device.\n" + "> + ///\n" + "> + /// This does not print any error messages if the clock is not found.\n" + "> + ///\n" + "> + /// [`devres`]: crate::devres::Devres\n" + "> + #[inline]\n" + "> + pub fn devm_enable_optional(dev: &Device<Bound>, name: Option<&CStr>) -> Result {\n" + "> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\n" + "> +\n" + "> + // SAFETY: It is safe to call [`devm_clk_get_optional_enabled`] with a\n" + "> + // valid device pointer.\n" + "> + from_err_ptr(unsafe { bindings::devm_clk_get_optional_enabled(dev.as_raw(), name) })?;\n" + "> + Ok(())\n" + "> + }\n" + "> +\n" + "> + /// Same as [`devm_enable_optional`], but also sets the rate.\n" + "> + #[inline]\n" + "> + pub fn devm_enable_optional_with_rate(\n" + "> + dev: &Device<Bound>,\n" + "> + name: Option<&CStr>,\n" + "> + rate: Hertz,\n" + "> + ) -> Result {\n" + "> + let name = name.map_or(ptr::null(), |n| n.as_char_ptr());\n" + "> +\n" + "> + // SAFETY: It is safe to call\n" + "> + // [`devm_clk_get_optional_enabled_with_rate`] with a valid device\n" + "> + // pointer.\n" + "> + from_err_ptr(unsafe {\n" + "> + bindings::devm_clk_get_optional_enabled_with_rate(dev.as_raw(), name, rate.as_hz())\n" + "> + })?;\n" + "\n" + "Just fyi, there's currently a bug in the C implementation of\n" + "devm_clk_get_optional_enabled_with_rate() which I caught while reviewing your\n" + "series. The fix patch is already on the list [1]. Other than that, this LGTM.\n" + "\n" + "[1]: https://lore.kernel.org/all/20260801111637.304590-1-work@onurozkan.dev\n" + "\n" + "Regards,\n" + "Onur\n" + "\n" + "> + Ok(())\n" + "> + }\n" + "> +\n" + "> /// A trait representing the different states that a [`Clk`] can be in.\n" + "> pub trait ClkState: private::Sealed {\n" + "> /// Whether the clock is enabled in this state.\n" + "> \n" + "> -- \n" + "> 2.54.0\n" + "> \n" + "\n" + "_______________________________________________\n" + "linux-riscv mailing list\n" + "linux-riscv@lists.infradead.org\n" + http://lists.infradead.org/mailman/listinfo/linux-riscv -f171e0ad5d5f34a099e11521959edefa0b7fe728e14346c73dd0c5d193c22632 +84f6faf5b3a71841f27ac7a1e1936a3b1a48f008ef15c37adabffb3aef197c12
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.