Skip to content

Commit f046ab3

Browse files
committed
drivers/: update to the new ring_buffer api
Move to use new ring_buffer api. Signed-off-by: Måns Ansgariusson <[email protected]>
1 parent 389f89b commit f046ab3

File tree

12 files changed

+26
-31
lines changed

12 files changed

+26
-31
lines changed

drivers/console/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ config IPM_CONSOLE_SENDER
173173

174174
config IPM_CONSOLE_RECEIVER
175175
bool "Inter-processor Mailbox console receiver"
176-
select RING_BUFFER
177176
help
178177
Enable the receiving side of IPM console
179178

drivers/entropy/Kconfig.cc13xx_cc26xx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ config ENTROPY_CC13XX_CC26XX_RNG
88
default y
99
depends on DT_HAS_TI_CC13XX_CC26XX_TRNG_ENABLED
1010
select ENTROPY_HAS_DRIVER
11-
select RING_BUFFER
1211
help
1312
This option enables the driver for the True Random Number Generator (TRNG)
1413
for TI SimpleLink CC13xx / CC26xx SoCs.

drivers/entropy/entropy_cc13xx_cc26xx.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static int entropy_cc13xx_cc26xx_get_entropy(const struct device *dev,
111111

112112
while (len) {
113113
k_sem_take(&data->lock, K_FOREVER);
114-
cnt = ring_buf_get(&data->pool, buf, len);
114+
cnt = ring_buffer_read(&data->pool, buf, len);
115115
k_sem_give(&data->lock);
116116

117117
if (cnt) {
@@ -140,7 +140,7 @@ static void entropy_cc13xx_cc26xx_isr(const struct device *dev)
140140
num[1] = TRNGNumberGet(TRNG_HI_WORD);
141141
num[0] = TRNGNumberGet(TRNG_LOW_WORD);
142142

143-
cnt = ring_buf_put(&data->pool, (uint8_t *)num, sizeof(num));
143+
cnt = ring_buffer_write(&data->pool, (uint8_t *)num, sizeof(num));
144144

145145
/* When pool is full disable interrupt and stop reading numbers */
146146
if (cnt != sizeof(num)) {
@@ -178,7 +178,7 @@ static int entropy_cc13xx_cc26xx_get_entropy_isr(const struct device *dev,
178178
unsigned int key;
179179

180180
key = irq_lock();
181-
cnt = ring_buf_get(&data->pool, buf, len);
181+
cnt = ring_buffer_read(&data->pool, buf, len);
182182
irq_unlock(key);
183183

184184
if ((cnt == len) || ((flags & ENTROPY_BUSYWAIT) == 0U)) {
@@ -200,7 +200,7 @@ static int entropy_cc13xx_cc26xx_get_entropy_isr(const struct device *dev,
200200
num[1] = TRNGNumberGet(TRNG_HI_WORD);
201201
num[0] = TRNGNumberGet(TRNG_LOW_WORD);
202202

203-
ring_buf_put(&data->pool, (uint8_t *)num,
203+
ring_buffer_write(&data->pool, (uint8_t *)num,
204204
sizeof(num));
205205
}
206206

@@ -209,7 +209,7 @@ static int entropy_cc13xx_cc26xx_get_entropy_isr(const struct device *dev,
209209
* would allow us to pick up anything that has been put
210210
* in by the ISR as well.
211211
*/
212-
cnt = ring_buf_get(&data->pool, buf, len);
212+
cnt = ring_buffer_read(&data->pool, buf, len);
213213

214214
if (src & TRNG_FRO_SHUTDOWN) {
215215
handle_shutdown_ovf();
@@ -286,7 +286,7 @@ static int entropy_cc13xx_cc26xx_init(const struct device *dev)
286286
struct entropy_cc13xx_cc26xx_data *data = dev->data;
287287

288288
/* Initialize driver data */
289-
ring_buf_init(&data->pool, sizeof(data->data), data->data);
289+
ring_buffer_init(&data->pool, data->data, sizeof(data->data));
290290

291291
#if defined(CONFIG_PM)
292292
Power_setDependency(PowerCC26XX_PERIPH_TRNG);

drivers/espi/Kconfig.npcx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ config ESPI_NPCX_BYPASS_CH_ENABLE_FATAL_ERROR
4747
config ESPI_NPCX_PERIPHERAL_DEBUG_PORT_80_MULTI_BYTE
4848
bool "Host can write 1/2/4 bytes of Port80 data in a eSPI transaction"
4949
depends on (SOC_SERIES_NPCX9 || SOC_SERIES_NPCX4) && ESPI_PERIPHERAL_DEBUG_PORT_80
50-
select RING_BUFFER
5150
help
5251
EC can accept 1/2/4 bytes of Port 80 data written from the Host in an
5352
eSPI transaction.

drivers/espi/host_subs_npcx.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,14 @@ static void host_port80_work_handler(struct k_work *item)
510510
(ESPI_PERIPHERAL_INDEX_0 << 16) | ESPI_PERIPHERAL_DEBUG_PORT80,
511511
ESPI_PERIPHERAL_NODATA};
512512

513-
while (!ring_buf_is_empty(rbuf)) {
513+
while (!ring_buffer_empty(rbuf)) {
514514
struct npcx_dp80_buf dp80_buf;
515515
uint8_t offset;
516516

517-
ring_buf_get(rbuf, &dp80_buf.offset_code[0], sizeof(dp80_buf.offset_code));
517+
ring_buffer_read(rbuf, &dp80_buf.offset_code[0], sizeof(dp80_buf.offset_code));
518518
offset = dp80_buf.offset_code[1];
519519
code |= dp80_buf.offset_code[0] << (8 * offset);
520-
if (ring_buf_is_empty(rbuf)) {
520+
if (ring_buffer_empty(rbuf)) {
521521
evt.evt_data = code;
522522
espi_send_callbacks(host_sub_data.callbacks, host_sub_data.host_bus_dev,
523523
evt);
@@ -553,7 +553,7 @@ static void host_port80_isr(const void *arg)
553553
struct npcx_dp80_buf dp80_buf;
554554

555555
dp80_buf.offset_code_16 = inst_shm->DP80BUF;
556-
ring_buf_put(rbuf, &dp80_buf.offset_code[0], sizeof(dp80_buf.offset_code));
556+
ring_buffer_write(rbuf, &dp80_buf.offset_code[0], sizeof(dp80_buf.offset_code));
557557
}
558558
k_work_submit(&host_sub_data.work);
559559
#else
@@ -1156,8 +1156,9 @@ int npcx_host_init_subs_core_domain(const struct device *host_bus_dev,
11561156
#if defined(CONFIG_ESPI_PERIPHERAL_DEBUG_PORT_80)
11571157
host_port80_init();
11581158
#if defined(CONFIG_ESPI_NPCX_PERIPHERAL_DEBUG_PORT_80_MULTI_BYTE)
1159-
ring_buf_init(&host_sub_data.port80_ring_buf, sizeof(host_sub_data.port80_data),
1160-
host_sub_data.port80_data);
1159+
ring_buffer_init(&host_sub_data.port80_ring_buf,
1160+
host_sub_data.port80_data,
1161+
sizeof(host_sub_data.port80_data));
11611162
k_work_init(&host_sub_data.work, host_port80_work_handler);
11621163
#endif
11631164
#endif

drivers/hdlc_rcp_if/hdlc_rcp_if_uart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static int hdlc_send(const uint8_t *frame, uint16_t length)
175175
return -EIO;
176176
}
177177

178-
ret = ring_buf_put(ot_uart.tx_ringbuf, frame, length);
178+
ret = ring_buffer_write(ot_uart.tx_ringbuf, frame, length);
179179
uart_irq_tx_enable(ot_uart.dev);
180180

181181
if (ret < length) {
@@ -191,8 +191,8 @@ static int hdlc_deinit(void)
191191
uart_irq_tx_disable(ot_uart.dev);
192192
uart_irq_rx_disable(ot_uart.dev);
193193

194-
ring_buf_reset(ot_uart.rx_ringbuf);
195-
ring_buf_reset(ot_uart.tx_ringbuf);
194+
ring_buffer_reset(ot_uart.rx_ringbuf);
195+
ring_buffer_reset(ot_uart.tx_ringbuf);
196196

197197
return 0;
198198
}

drivers/input/Kconfig.tsc_keys

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ config INPUT_STM32_TSC_KEYS
55
bool "STM32 TSC touch library"
66
default y
77
depends on DT_HAS_ST_STM32_TSC_ENABLED
8-
select RING_BUFFER
98
help
109
Enable support for STM32 TSC touch library.
1110

drivers/input/input_tsc_keys.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ static void input_tsc_callback_handler(uint32_t count_value, void *user_data)
376376
uint32_t oldest_point;
377377
int32_t slope;
378378

379-
(void)ring_buf_get(&data->rb, (uint8_t *)&oldest_point, sizeof(oldest_point));
379+
(void)ring_buffer_read(&data->rb, (uint8_t *)&oldest_point, sizeof(oldest_point));
380380

381381
slope = count_value - oldest_point;
382382
if (slope < -config->noise_threshold && !data->expect_release) {
@@ -388,7 +388,7 @@ static void input_tsc_callback_handler(uint32_t count_value, void *user_data)
388388
}
389389
}
390390

391-
(void)ring_buf_put(&data->rb, (uint8_t *)&count_value, sizeof(count_value));
391+
(void)ring_buffer_write(&data->rb, (uint8_t *)&count_value, sizeof(count_value));
392392
}
393393

394394
static int input_tsc_keys_init(const struct device *dev)

drivers/net/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ menuconfig NET_PPP
1313
bool "Point-to-point (PPP) UART based driver"
1414
depends on NET_L2_PPP
1515
depends on NET_NATIVE
16-
select RING_BUFFER
1716
select CRC
1817

1918
if NET_PPP

drivers/net/ppp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static void uart_callback(const struct device *dev,
176176

177177
LOG_DBG("Received data %d bytes", len);
178178

179-
ret = ring_buf_put(&context->rx_ringbuf, p, len);
179+
ret = ring_buffer_write(&context->rx_ringbuf, p, len);
180180
if (ret < evt->data.rx.len) {
181181
LOG_WRN("Rx buffer doesn't have enough space. "
182182
"Bytes pending: %d, written only: %d. "
@@ -193,7 +193,7 @@ static void uart_callback(const struct device *dev,
193193
}
194194
}
195195

196-
space_left = ring_buf_space_get(&context->rx_ringbuf);
196+
space_left = ring_buffer_space(&context->rx_ringbuf);
197197
if (!rx_retry_pending && space_left < (sizeof(context->rx_buf) / 8)) {
198198
/* Not much room left in buffer after a write to ring buffer.
199199
* We submit a work, but enable flow ctrl also
@@ -277,7 +277,7 @@ static void uart_recovery(struct k_work *work)
277277
CONTAINER_OF(dwork, struct ppp_driver_context, uart_recovery_work);
278278
int ret;
279279

280-
ret = ring_buf_space_get(&ppp->rx_ringbuf);
280+
ret = ring_buffer_space(&ppp->rx_ringbuf);
281281
if (ret >= (sizeof(ppp->rx_buf) / 2)) {
282282
ret = ppp_async_uart_rx_enable(ppp);
283283
if (ret) {
@@ -954,7 +954,7 @@ static int ppp_driver_init(const struct device *dev)
954954
LOG_DBG("[%p] dev %p", ppp, dev);
955955

956956
#if !defined(CONFIG_NET_TEST)
957-
ring_buf_init(&ppp->rx_ringbuf, sizeof(ppp->rx_buf), ppp->rx_buf);
957+
ring_buffer_init(&ppp->rx_ringbuf, ppp->rx_buf, sizeof(ppp->rx_buf));
958958
k_work_init(&ppp->cb_work, ppp_isr_cb_work);
959959

960960
k_work_queue_start(&ppp->cb_workq, ppp_workq,
@@ -1077,7 +1077,7 @@ static void ppp_uart_isr(const struct device *uart, void *user_data)
10771077
continue;
10781078
}
10791079

1080-
ret = ring_buf_put(&context->rx_ringbuf, context->buf, rx);
1080+
ret = ring_buffer_write(&context->rx_ringbuf, context->buf, rx);
10811081
if (ret < rx) {
10821082
LOG_ERR("Rx buffer doesn't have enough space. "
10831083
"Bytes pending: %d, written: %d",

0 commit comments

Comments
 (0)