Skip to content

Commit ab91eef

Browse files
pabigotgalak
authored andcommitted
coccinelle: standardize kernel API timeout arguments
Use the int_literal_to_timeout Coccinelle script to convert literal integer arguments for kernel API timeout parameters to the standard timeout value representations. Signed-off-by: Peter Bigot <[email protected]>
1 parent 0e53293 commit ab91eef

File tree

48 files changed

+160
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+160
-133
lines changed

drivers/adc/adc_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static inline void adc_context_enable_timer(struct adc_context *ctx)
9595
u32_t interval_us = ctx->options.interval_us;
9696
u32_t interval_ms = ceiling_fraction(interval_us, 1000UL);
9797

98-
k_timer_start(&ctx->timer, 0, interval_ms);
98+
k_timer_start(&ctx->timer, K_NO_WAIT, interval_ms);
9999
}
100100

101101
static inline void adc_context_disable_timer(struct adc_context *ctx)

drivers/ieee802154/ieee802154_cc1200.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,10 @@ static int cc1200_tx(struct device *dev,
635635
}
636636

637637
/* Wait for SYNC to be sent */
638-
k_sem_take(&cc1200->tx_sync, 100);
638+
k_sem_take(&cc1200->tx_sync, K_MSEC(100));
639639
if (atomic_get(&cc1200->tx_start) == 1) {
640640
/* Now wait for the packet to be fully sent */
641-
k_sem_take(&cc1200->tx_sync, 100);
641+
k_sem_take(&cc1200->tx_sync, K_MSEC(100));
642642
}
643643

644644
out:

drivers/ieee802154/ieee802154_cc2520.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ static int cc2520_tx(struct device *dev,
839839
goto error;
840840
}
841841

842-
k_sem_take(&cc2520->tx_sync, 10);
842+
k_sem_take(&cc2520->tx_sync, K_MSEC(10));
843843

844844
retry--;
845845
status = verify_tx_done(cc2520);

drivers/led/ht16k33.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ static int ht16k33_init(struct device *dev)
442442

443443
/* Setup timer for polling key data */
444444
k_timer_init(&data->timer, ht16k33_timer_callback, NULL);
445-
k_timer_start(&data->timer, 0,
445+
k_timer_start(&data->timer, K_NO_WAIT,
446446
CONFIG_HT16K33_KEYSCAN_POLL_MSEC);
447447
}
448448

drivers/sensor/hp206c/hp206c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static int hp206c_wait_dev_ready(struct device *dev, u32_t timeout_ms)
168168
struct hp206c_device_data *hp206c = dev->driver_data;
169169
u8_t int_src;
170170

171-
k_timer_start(&hp206c->tmr, timeout_ms, 0);
171+
k_timer_start(&hp206c->tmr, timeout_ms, K_NO_WAIT);
172172
k_timer_status_sync(&hp206c->tmr);
173173

174174
if (hp206c_read_reg(dev, HP206C_REG_INT_SRC, &int_src) < 0) {

drivers/serial/uart_nrfx_uarte.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,8 @@ static int uarte_nrfx_tx(struct device *dev, const u8_t *buf, size_t len,
485485
nrf_uarte_tx_buffer_set(uarte, buf, len);
486486
nrf_uarte_task_trigger(uarte, NRF_UARTE_TASK_STARTTX);
487487
if (data->uart_config.flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS) {
488-
k_timer_start(&data->async->tx_timeout_timer, timeout, 0);
488+
k_timer_start(&data->async->tx_timeout_timer, timeout,
489+
K_NO_WAIT);
489490
}
490491
return 0;
491492
}

drivers/usb/device/usb_dc_kinetis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data * const cfg)
361361
(void)memset(&bdt[idx_even], 0, sizeof(struct buf_descriptor));
362362
(void)memset(&bdt[idx_odd], 0, sizeof(struct buf_descriptor));
363363

364-
if (k_mem_pool_alloc(&ep_buf_pool, block, cfg->ep_mps * 2U, 10) == 0) {
364+
if (k_mem_pool_alloc(&ep_buf_pool, block, cfg->ep_mps * 2U, K_MSEC(10)) == 0) {
365365
(void)memset(block->data, 0, cfg->ep_mps * 2U);
366366
} else {
367367
LOG_ERR("Memory allocation time-out");

drivers/usb/device/usb_dc_mcux_ehci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int usb_dc_ep_configure(const struct usb_dc_ep_cfg_data *const cfg)
160160
block->data = NULL;
161161
}
162162

163-
if (k_mem_pool_alloc(&ep_buf_pool, block, cfg->ep_mps, 10) == 0) {
163+
if (k_mem_pool_alloc(&ep_buf_pool, block, cfg->ep_mps, K_MSEC(10)) == 0) {
164164
memset(block->data, 0, cfg->ep_mps);
165165
} else {
166166
LOG_ERR("Memory allocation time-out");

drivers/wifi/eswifi/eswifi_offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ static int eswifi_off_get(sa_family_t family,
433433
k_sem_init(&socket->accept_sem, 1, 1);
434434

435435
k_delayed_work_submit_to_queue(&eswifi->work_q, &socket->read_work,
436-
500);
436+
K_MSEC(500));
437437

438438
unlock:
439439
eswifi_unlock(eswifi);

drivers/wifi/eswifi/eswifi_socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static void eswifi_off_read_work(struct k_work *work)
141141
done:
142142
err = k_delayed_work_submit_to_queue(&eswifi->work_q,
143143
&socket->read_work,
144-
500);
144+
K_MSEC(500));
145145
if (err) {
146146
LOG_ERR("Rescheduling socket read error");
147147
}

0 commit comments

Comments
 (0)