rust: pci: require Send for Driver trait implementers
Subsystems (4)
Danilo Krummrich
maintainerPATCH 1/2 rust: pci: require Send for Driver trait implementers
The instance of Self, returned and created by Driver::probe() is dropped in the bus' remove() callback.
Request implementers of the Driver trait to implement Send, since the remove() callback is not guaranteed to run from the same thread as probe().
--- rust/kernel/pci.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/pci.rs +1 -1
@@ -222,7 +222,7 @@ macro_rules! pci_device_table {///``` /// Drivers must implement this trait in order to get a PCI driver registered. Please refer to the /// `Adapter` documentation for an example. -pub trait Driver { +pub trait Driver :Send {/// The type holding information about each device id supported by the driver. /// /// TODO: Use associated_type_defaults once stabilized:
Signature · 1 line
2.48.1
Danilo Krummrich
maintainerPATCH 2/2 rust: platform: require Send for Driver trait implementers
The instance of Self, returned and created by Driver::probe() is dropped in the bus' remove() callback.
Request implementers of the Driver trait to implement Send, since the remove() callback is not guaranteed to run from the same thread as probe().
--- rust/kernel/platform.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/platform.rs +1 -1
@@ -149,7 +149,7 @@ macro_rules! module_platform_driver {/// } /// } ///``` -pub trait Driver { +pub trait Driver :Send {/// The type holding driver private data about each device id supported by the driver. /// /// TODO: Use associated_type_defaults once stabilized:
Signature · 1 line
2.48.1
Re: [PATCH 2/2] rust: platform: require Send for Driver trait implementers
Quoted 11 lines · Danilo Krummrich
The instance of Self, returned and created by
Driver::probe()is dropped in the bus'remove()callback.Request implementers of the Driver trait to implement Send, since the
remove()callback is not guaranteed to run from the same thread asprobe().Fixes 683a63befc73 ("rust: platform: add basic platform device / driver abstractions")Reported-by Alice Ryhl <[email protected]>Signed-off-by Danilo Krummrich <[email protected]>
Good catch Alice!
---
Cheers,
Benno
Quoted 17 lines
--- rust/kernel/platform.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)rust/kernel/platform.rs +1
-1@@ -149,7 +149,7 @@ macro_rules! module_platform_driver {/// } /// } ///``` -pub trait Driver { +pub trait Driver :Send {/// The type holding driver private data about each device id supported by the driver. /// /// TODO: Use associated_type_defaults once stabilized:
Quoted 11 lines · Danilo Krummrich
The instance of Self, returned and created by
Driver::probe()is dropped in the bus'remove()callback.Request implementers of the Driver trait to implement Send, since the
remove()callback is not guaranteed to run from the same thread asprobe().Fixes 1bd8b6b2c5d3 ("rust: pci: add basic PCI device / driver abstractions")Reported-by Alice Ryhl <[email protected]>Signed-off-by Danilo Krummrich <[email protected]>
---
Cheers,
Benno
Quoted 17 lines
--- rust/kernel/pci.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)rust/kernel/pci.rs +1
-1@@ -222,7 +222,7 @@ macro_rules! pci_device_table {///``` /// Drivers must implement this trait in order to get a PCI driver registered. Please refer to the /// `Adapter` documentation for an example. -pub trait Driver { +pub trait Driver :Send {/// The type holding information about each device id supported by the driver. /// /// TODO: Use associated_type_defaults once stabilized:
Greg KH
maintainerQuoted 7 lines · Danilo Krummrich
The instance of Self, returned and created by
Driver::probe()is dropped in the bus'remove()callback.Request implementers of the Driver trait to implement Send, since the
remove()callback is not guaranteed to run from the same thread asprobe().
Quoted 7 lines
Fixes 1bd8b6b2c5d3 ("rust: pci: add basic PCI device / driver abstractions")Reported-by Alice Ryhl <[email protected]>Signed-off-by Danilo Krummrich <[email protected]>--- rust/kernel/pci.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
As there's no in-kernel users of these, any objection for me to take them for 6.15-rc1, or should they go now to Linus for 6.14-final?
thanks,
greg k-h
Danilo Krummrich
maintainerQuoted 16 lines · Greg KH
Quoted 7 lines · Danilo Krummrich
The instance of Self, returned and created by
Driver::probe()is dropped in the bus'remove()callback.Request implementers of the Driver trait to implement Send, since the
remove()callback is not guaranteed to run from the same thread asprobe().Quoted 7 lines
Fixes 1bd8b6b2c5d3 ("rust: pci: add basic PCI device / driver abstractions")Reported-by Alice Ryhl <[email protected]>Signed-off-by Danilo Krummrich <[email protected]>--- rust/kernel/pci.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 2 lines
As there's no in-kernel users of these, any objection for me to take them for 6.15-rc1, or should they go now to Linus for 6.14-final?
I think it's fine to take them for 6.15-rc1 only.
--
Note that, while those patches can be taken "as is" to stable trees, they require
rust: platform: impl Send + Sync for platform::Device
rust: pci: impl Send + Sync for pci::Device
as well, if
7b948a2af6b5 ("rust: pci: fix unrestricted &mut pci::Device")
4d320e30ee04 ("rust: platform: fix unrestricted &mut platform::Device")are in the same tree.
Greg KH
maintainerQuoted 30 lines · Danilo Krummrich
Quoted 16 lines · Greg KH
Quoted 7 lines · Danilo Krummrich
The instance of Self, returned and created by
Driver::probe()is dropped in the bus'remove()callback.Request implementers of the Driver trait to implement Send, since the
remove()callback is not guaranteed to run from the same thread asprobe().Quoted 7 lines
Fixes 1bd8b6b2c5d3 ("rust: pci: add basic PCI device / driver abstractions")Reported-by Alice Ryhl <[email protected]>Signed-off-by Danilo Krummrich <[email protected]>--- rust/kernel/pci.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 2 lines
As there's no in-kernel users of these, any objection for me to take them for 6.15-rc1, or should they go now to Linus for 6.14-final?
I think it's fine to take them for 6.15-rc1 only.
--
Note that, while those patches can be taken "as is" to stable trees, they require
rust: platform: impl Send + Sync for
platform::Device
rust: pci: impl Send + Sync forpci::Device
Quoted 6 lines
as well, if
7b948a2af6b5 ("rust: pci: fix unrestricted &mut pci::Device") 4d320e30ee04 ("rust: platform: fix unrestricted &mut platform::Device")are in the same tree.
Cool, I'll deal with that in a few weeks when -rc1 is out, thanks for the warning.
greg k-h