Skip to content

Commit 6e5db35

Browse files
pabigotnashif
authored andcommitted
coccinelle: standardize k_sleep calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments to k_sleep to use the standard timeout macros. Signed-off-by: Peter Bigot <[email protected]>
1 parent f0c0b3b commit 6e5db35

File tree

130 files changed

+229
-229
lines changed

Some content is hidden

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

130 files changed

+229
-229
lines changed

boards/arm/nrf52_pca20020/board.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static int pwr_ctrl_init(struct device *dev)
3030
gpio_pin_configure(gpio, cfg->pin, GPIO_DIR_OUT);
3131
gpio_pin_write(gpio, cfg->pin, 1);
3232

33-
k_sleep(1); /* Wait for the rail to come up and stabilize */
33+
k_sleep(K_MSEC(1)); /* Wait for the rail to come up and stabilize */
3434

3535
return 0;
3636
}

boards/arm/nrf9160_pca10090/nrf52840_reset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int bt_hci_transport_setup(struct device *h4)
5555
* It is critical (!) to wait here, so that all bytes
5656
* on the lines are received and drained correctly.
5757
*/
58-
k_sleep(1);
58+
k_sleep(K_MSEC(1));
5959

6060
/* Drain bytes */
6161
while (uart_fifo_read(h4, &c, 1)) {

drivers/bluetooth/hci/h5.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,11 @@ static void tx_thread(void)
608608
switch (h5.link_state) {
609609
case UNINIT:
610610
/* FIXME: send sync */
611-
k_sleep(100);
611+
k_sleep(K_MSEC(100));
612612
break;
613613
case INIT:
614614
/* FIXME: send conf */
615-
k_sleep(100);
615+
k_sleep(K_MSEC(100));
616616
break;
617617
case ACTIVE:
618618
buf = net_buf_get(&h5.tx_queue, K_FOREVER);

drivers/bluetooth/hci/spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ static int bt_spi_send(struct net_buf *buf)
407407
if (!pending) {
408408
break;
409409
}
410-
k_sleep(1);
410+
k_sleep(K_MSEC(1));
411411
}
412412

413413
k_sem_take(&sem_busy, K_FOREVER);

drivers/display/display_ili9340.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct ili9340_data {
4242
static void ili9340_exit_sleep(struct ili9340_data *data)
4343
{
4444
ili9340_transmit(data, ILI9340_CMD_EXIT_SLEEP, NULL, 0);
45-
k_sleep(120);
45+
k_sleep(K_MSEC(120));
4646
}
4747

4848
static int ili9340_init(struct device *dev)
@@ -96,11 +96,11 @@ static int ili9340_init(struct device *dev)
9696
#ifdef DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_CONTROLLER
9797
LOG_DBG("Resetting display driver");
9898
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 1);
99-
k_sleep(1);
99+
k_sleep(K_MSEC(1));
100100
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 0);
101-
k_sleep(1);
101+
k_sleep(K_MSEC(1));
102102
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 1);
103-
k_sleep(5);
103+
k_sleep(K_MSEC(5));
104104
#endif
105105

106106
LOG_DBG("Initializing LCD");

drivers/display/display_ili9340_seeed_tftv2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void ili9340_lcd_init(struct ili9340_data *p_ili9340)
2222
cmd = ILI9340_CMD_SOFTWARE_RESET;
2323
ili9340_transmit(p_ili9340, cmd, NULL, 0);
2424

25-
k_sleep(5);
25+
k_sleep(K_MSEC(5));
2626

2727
cmd = ILI9341_CMD_POWER_CTRL_B;
2828
data[0] = 0x00U;
@@ -166,7 +166,7 @@ void ili9340_lcd_init(struct ili9340_data *p_ili9340)
166166
cmd = ILI9340_CMD_EXIT_SLEEP;
167167
ili9340_transmit(p_ili9340, cmd, NULL, 0);
168168

169-
k_sleep(120);
169+
k_sleep(K_MSEC(120));
170170

171171
/* Display Off */
172172
cmd = ILI9340_CMD_DISPLAY_OFF;

drivers/display/display_st7789v.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,22 @@ void st7789v_transmit(struct st7789v_data *data, u8_t cmd,
8181
static void st7789v_exit_sleep(struct st7789v_data *data)
8282
{
8383
st7789v_transmit(data, ST7789V_CMD_SLEEP_OUT, NULL, 0);
84-
k_sleep(120);
84+
k_sleep(K_MSEC(120));
8585
}
8686

8787
static void st7789v_reset_display(struct st7789v_data *data)
8888
{
8989
LOG_DBG("Resetting display");
9090
#ifdef DT_INST_0_SITRONIX_ST7789V_RESET_GPIOS_CONTROLLER
9191
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 1);
92-
k_sleep(1);
92+
k_sleep(K_MSEC(1));
9393
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 0);
94-
k_sleep(6);
94+
k_sleep(K_MSEC(6));
9595
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 1);
96-
k_sleep(20);
96+
k_sleep(K_MSEC(20));
9797
#else
9898
st7789v_transmit(p_st7789v, ST7789V_CMD_SW_RESET, NULL, 0);
99-
k_sleep(5);
99+
k_sleep(K_MSEC(5));
100100
#endif
101101
}
102102

drivers/ethernet/eth_enc424j600.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ static int enc424j600_tx(struct device *dev, struct net_pkt *pkt)
325325
enc424j600_write_sbc(dev, ENC424J600_1BC_SETTXRTS);
326326

327327
do {
328-
k_sleep(1);
328+
k_sleep(K_MSEC(1));
329329
enc424j600_read_sfru(dev, ENC424J600_SFRX_ECON1L, &tmp);
330330
} while (tmp & ENC424J600_ECON1_TXRTS);
331331

@@ -545,12 +545,12 @@ static int enc424j600_stop_device(struct device *dev)
545545
ENC424J600_ECON1_RXEN);
546546

547547
do {
548-
k_sleep(10U);
548+
k_sleep(K_MSEC(10U));
549549
enc424j600_read_sfru(dev, ENC424J600_SFRX_ESTATL, &tmp);
550550
} while (tmp & ENC424J600_ESTAT_RXBUSY);
551551

552552
do {
553-
k_sleep(10U);
553+
k_sleep(K_MSEC(10U));
554554
enc424j600_read_sfru(dev, ENC424J600_SFRX_ECON1L, &tmp);
555555
} while (tmp & ENC424J600_ECON1_TXRTS);
556556

drivers/ethernet/eth_smsc911x.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ int smsc_phy_regread(u8_t regoffset, u32_t *data)
106106

107107
val = 0U;
108108
do {
109-
k_sleep(1);
109+
k_sleep(K_MSEC(1));
110110
time_out--;
111111
if (smsc_mac_regread(SMSC9220_MAC_MII_ACC, &val)) {
112112
return -1;
@@ -152,7 +152,7 @@ int smsc_phy_regwrite(u8_t regoffset, u32_t data)
152152
}
153153

154154
do {
155-
k_sleep(1);
155+
k_sleep(K_MSEC(1));
156156
time_out--;
157157
if (smsc_mac_regread(SMSC9220_MAC_MII_ACC, &phycmd)) {
158158
return -1;
@@ -222,7 +222,7 @@ static int smsc_soft_reset(void)
222222
SMSC9220->HW_CFG |= HW_CFG_SRST;
223223

224224
do {
225-
k_sleep(1);
225+
k_sleep(K_MSEC(1));
226226
time_out--;
227227
} while (time_out != 0U && (SMSC9220->HW_CFG & HW_CFG_SRST));
228228

@@ -402,7 +402,7 @@ int smsc_init(void)
402402
SMSC9220->FIFO_INT &= ~(0xFF); /* Clear 2 bottom nibbles */
403403

404404
/* This sleep is compulsory otherwise txmit/receive will fail. */
405-
k_sleep(2000);
405+
k_sleep(K_MSEC(2000));
406406

407407
return 0;
408408
}

drivers/ethernet/eth_stm32_hal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static inline void disable_mcast_filter(ETH_HandleTypeDef *heth)
8787
* at least four TX_CLK/RX_CLK clock cycles
8888
*/
8989
tmp = heth->Instance->MACFFR;
90-
k_sleep(1);
90+
k_sleep(K_MSEC(1));
9191
heth->Instance->MACFFR = tmp;
9292
}
9393

0 commit comments

Comments
 (0)