File locking refactored (#631)
Remove FileMutex and wire locking into driver subsystems.
This commit is contained in:
committed by
GitHub
parent
92ca046681
commit
020aa471e2
@@ -22,6 +22,22 @@ error_t spi_controller_unlock(Device* device) {
|
||||
return SPI_DRIVER_API(driver)->unlock(device);
|
||||
}
|
||||
|
||||
error_t spi_controller_lock_bus_of(Device* device) {
|
||||
Device* parent = device_get_parent(device);
|
||||
if (parent == nullptr || device_get_type(parent) != &SPI_CONTROLLER_TYPE) {
|
||||
return ERROR_NONE;
|
||||
}
|
||||
return spi_controller_lock(parent);
|
||||
}
|
||||
|
||||
void spi_controller_unlock_bus_of(Device* device) {
|
||||
Device* parent = device_get_parent(device);
|
||||
if (parent == nullptr || device_get_type(parent) != &SPI_CONTROLLER_TYPE) {
|
||||
return;
|
||||
}
|
||||
spi_controller_unlock(parent);
|
||||
}
|
||||
|
||||
const DeviceType SPI_CONTROLLER_TYPE {
|
||||
.name = "spi-controller"
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user