Skip to content

Commit 2ae7821

Browse files
committed
zephyr: device: uart: Remove redundant 'device' field
With the 'Uart' encapsulated within the `UartIrq`, having a separate field for device is redundant with the one inside of `Uart`. Remove this redundant field, and change the references to it to use the one inside the Uart. Signed-off-by: David Brown <[email protected]>
1 parent 6213961 commit 2ae7821

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

zephyr/src/device/uart.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,10 @@ impl WriteSlice {
205205

206206
/// This is the irq-driven interface.
207207
pub struct UartIrq {
208-
/// The raw device.
209-
device: *const raw::device,
210-
/// Critical section protected data.
211-
data: Arc<IrqOuterData>,
212208
/// Interior wrapped device, to be able to hand out lifetime managed references to it.
213209
uart: Uart,
210+
/// Critical section protected data.
211+
data: Arc<IrqOuterData>,
214212
}
215213

216214
// UartIrq is also Send, !Sync, for the same reasons as for Uart.
@@ -243,7 +241,6 @@ impl UartIrq {
243241
raw::uart_irq_rx_enable(uart.device);
244242
}
245243
Ok(UartIrq {
246-
device: uart.device,
247244
data,
248245
uart,
249246
})
@@ -299,7 +296,7 @@ impl UartIrq {
299296
len: buf.len(),
300297
});
301298

302-
unsafe { raw::uart_irq_tx_enable(self.device) };
299+
unsafe { raw::uart_irq_tx_enable(self.uart.device) };
303300
}
304301

305302
// Wait for the transmission to complete. This shouldn't be racy, as the irq shouldn't be
@@ -314,7 +311,7 @@ impl UartIrq {
314311

315312
if let Some(write) = inner.write.take() {
316313
// First, make sure that no more interrupts will come in.
317-
unsafe { raw::uart_irq_tx_disable(self.device) };
314+
unsafe { raw::uart_irq_tx_disable(self.uart.device) };
318315

319316
// The write did not complete, and this represents remaining data to write.
320317
buf.len() - write.len

0 commit comments

Comments
 (0)