Skip to content

Commit 962d6b1

Browse files
FRASTMcarlescufi
authored andcommitted
drivers: serial: uart_stm32 converted to use the new kwork API.
The structure is now k_work_delayable. The init function is now k_work_init_delayable. The submit function is now the k_work_reschedule. The cancel function is now the k_work_cancel_delayable. Signed-off-by: Francois Ramu <[email protected]>
1 parent cc21ff5 commit 962d6b1

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

drivers/serial/uart_stm32.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -756,13 +756,13 @@ static inline void async_evt_rx_buf_release(struct uart_stm32_data *data)
756756
async_user_callback(data, &evt);
757757
}
758758

759-
static inline void async_timer_start(struct k_delayed_work *work,
759+
static inline void async_timer_start(struct k_work_delayable *work,
760760
int32_t timeout)
761761
{
762762
if ((timeout != SYS_FOREVER_MS) && (timeout != 0)) {
763763
/* start timer */
764764
LOG_DBG("async timer started for %d ms", timeout);
765-
k_delayed_work_submit(work, K_MSEC(timeout));
765+
k_work_reschedule(work, K_MSEC(timeout));
766766
}
767767
}
768768

@@ -896,7 +896,7 @@ static int uart_stm32_async_rx_disable(const struct device *dev)
896896

897897
uart_stm32_dma_rx_disable(dev);
898898

899-
k_delayed_work_cancel(&data->dma_rx.timeout_work);
899+
(void)k_work_cancel_delayable(&data->dma_rx.timeout_work);
900900

901901
dma_stop(data->dma_rx.dma_dev, data->dma_rx.dma_channel);
902902

@@ -921,7 +921,7 @@ void uart_stm32_dma_tx_cb(const struct device *dma_dev, void *user_data,
921921
/* Disable TX */
922922
uart_stm32_dma_tx_disable(uart_dev);
923923

924-
k_delayed_work_cancel(&data->dma_tx.timeout_work);
924+
(void)k_work_cancel_delayable(&data->dma_tx.timeout_work);
925925

926926
data->dma_tx.buffer_length = 0;
927927

@@ -977,7 +977,7 @@ void uart_stm32_dma_rx_cb(const struct device *dma_dev, void *user_data,
977977
return;
978978
}
979979

980-
k_delayed_work_cancel(&data->dma_rx.timeout_work);
980+
(void)k_work_cancel_delayable(&data->dma_rx.timeout_work);
981981

982982
/* true since this functions occurs when buffer if full */
983983
data->dma_rx.counter = data->dma_rx.buffer_length;
@@ -999,7 +999,7 @@ void uart_stm32_dma_rx_cb(const struct device *dma_dev, void *user_data,
999999
* called in ISR context. So force the RX timeout
10001000
* to minimum value and let the RX timeout to do the job.
10011001
*/
1002-
k_delayed_work_submit(&data->dma_rx.timeout_work, K_TICKS(1));
1002+
k_work_reschedule(&data->dma_rx.timeout_work, K_TICKS(1));
10031003
}
10041004
}
10051005

@@ -1126,7 +1126,7 @@ static int uart_stm32_async_tx_abort(const struct device *dev)
11261126
return -EFAULT;
11271127
}
11281128

1129-
k_delayed_work_cancel(&data->dma_tx.timeout_work);
1129+
(void)k_work_cancel_delayable(&data->dma_tx.timeout_work);
11301130
if (!dma_get_status(data->dma_tx.dma_dev,
11311131
data->dma_tx.dma_channel, &stat)) {
11321132
data->dma_tx.counter = tx_buffer_length - stat.pending_length;
@@ -1203,9 +1203,9 @@ static int uart_stm32_async_init(const struct device *dev)
12031203
uart_stm32_dma_rx_disable(dev);
12041204
uart_stm32_dma_tx_disable(dev);
12051205

1206-
k_delayed_work_init(&data->dma_rx.timeout_work,
1206+
k_work_init_delayable(&data->dma_rx.timeout_work,
12071207
uart_stm32_async_rx_timeout);
1208-
k_delayed_work_init(&data->dma_tx.timeout_work,
1208+
k_work_init_delayable(&data->dma_tx.timeout_work,
12091209
uart_stm32_async_tx_timeout);
12101210

12111211
/* Configure dma rx config */

drivers/serial/uart_stm32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct uart_dma_stream {
4242
size_t offset;
4343
volatile size_t counter;
4444
int32_t timeout;
45-
struct k_delayed_work timeout_work;
45+
struct k_work_delayable timeout_work;
4646
bool enabled;
4747
};
4848
#endif

0 commit comments

Comments
 (0)