File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 3
3
4
4
use crate :: pci;
5
5
6
+ /// PciDeviceDriver takes ownership of a PCI device.
7
+ ///
8
+ pub type PciDeviceDriver = fn ( device : pci:: Device ) ;
9
+
6
10
/// device_supported is a callback called by the PCI module
7
11
/// for each PCI device discovered. If the device is supported
8
12
/// by a device driver, device_supported returns true and
9
13
/// the device is passed to register_device, so the driver
10
14
/// can take ownership.
11
15
///
12
- pub fn device_supported ( device : & pci:: Device ) -> bool {
13
- // TODO: once we have device drivers, ask them here.
14
- false
15
- }
16
+ pub fn device_supported ( _device : & pci:: Device ) -> Option < PciDeviceDriver > {
17
+ // TODO: once we have device drivers, ask them here,
18
+ // returning their driver if so.
16
19
17
- /// register_device is a callback called by the PCI module
18
- /// for each PCI device discovered. If the device can be
19
- /// identified as a supported device, the corresponding
20
- /// driver is used to initialise the device.
21
- ///
22
- pub fn register_device ( device : pci:: Device ) {
23
- // TODO: once we have device drivers, initialise them here.
20
+ None
24
21
}
Original file line number Diff line number Diff line change @@ -216,8 +216,8 @@ fn scan_slot(bus: u8, slot: u8) {
216
216
devtype,
217
217
} ;
218
218
219
- if drivers:: device_supported ( & dev) {
220
- drivers :: register_device ( dev) ;
219
+ if let Some ( driver ) = drivers:: device_supported ( & dev) {
220
+ driver ( dev) ;
221
221
} else {
222
222
UNKNOWN_DEVICES . lock ( ) . push ( dev) ;
223
223
}
You can’t perform that action at this time.
0 commit comments