Skip to content

coccinelle: final pass standardizing integer timeout parameters #19650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/arm/nrf52_pca20020/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int pwr_ctrl_init(struct device *dev)
gpio_pin_configure(gpio, cfg->pin, GPIO_DIR_OUT);
gpio_pin_write(gpio, cfg->pin, 1);

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

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion boards/arm/nrf9160_pca10090/nrf52840_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ int bt_hci_transport_setup(struct device *h4)
* It is critical (!) to wait here, so that all bytes
* on the lines are received and drained correctly.
*/
k_sleep(1);
k_sleep(K_MSEC(1));

/* Drain bytes */
while (uart_fifo_read(h4, &c, 1)) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/bluetooth/hci/h5.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,11 @@ static void tx_thread(void)
switch (h5.link_state) {
case UNINIT:
/* FIXME: send sync */
k_sleep(100);
k_sleep(K_MSEC(100));
break;
case INIT:
/* FIXME: send conf */
k_sleep(100);
k_sleep(K_MSEC(100));
break;
case ACTIVE:
buf = net_buf_get(&h5.tx_queue, K_FOREVER);
Expand Down
2 changes: 1 addition & 1 deletion drivers/bluetooth/hci/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ static int bt_spi_send(struct net_buf *buf)
if (!pending) {
break;
}
k_sleep(1);
k_sleep(K_MSEC(1));
}

k_sem_take(&sem_busy, K_FOREVER);
Expand Down
8 changes: 4 additions & 4 deletions drivers/display/display_ili9340.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct ili9340_data {
static void ili9340_exit_sleep(struct ili9340_data *data)
{
ili9340_transmit(data, ILI9340_CMD_EXIT_SLEEP, NULL, 0);
k_sleep(120);
k_sleep(K_MSEC(120));
}

static int ili9340_init(struct device *dev)
Expand Down Expand Up @@ -96,11 +96,11 @@ static int ili9340_init(struct device *dev)
#ifdef DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_CONTROLLER
LOG_DBG("Resetting display driver");
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 1);
k_sleep(1);
k_sleep(K_MSEC(1));
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 0);
k_sleep(1);
k_sleep(K_MSEC(1));
gpio_pin_write(data->reset_gpio, DT_INST_0_ILITEK_ILI9340_RESET_GPIOS_PIN, 1);
k_sleep(5);
k_sleep(K_MSEC(5));
#endif

LOG_DBG("Initializing LCD");
Expand Down
4 changes: 2 additions & 2 deletions drivers/display/display_ili9340_seeed_tftv2.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void ili9340_lcd_init(struct ili9340_data *p_ili9340)
cmd = ILI9340_CMD_SOFTWARE_RESET;
ili9340_transmit(p_ili9340, cmd, NULL, 0);

k_sleep(5);
k_sleep(K_MSEC(5));

cmd = ILI9341_CMD_POWER_CTRL_B;
data[0] = 0x00U;
Expand Down Expand Up @@ -166,7 +166,7 @@ void ili9340_lcd_init(struct ili9340_data *p_ili9340)
cmd = ILI9340_CMD_EXIT_SLEEP;
ili9340_transmit(p_ili9340, cmd, NULL, 0);

k_sleep(120);
k_sleep(K_MSEC(120));

/* Display Off */
cmd = ILI9340_CMD_DISPLAY_OFF;
Expand Down
10 changes: 5 additions & 5 deletions drivers/display/display_st7789v.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ void st7789v_transmit(struct st7789v_data *data, u8_t cmd,
static void st7789v_exit_sleep(struct st7789v_data *data)
{
st7789v_transmit(data, ST7789V_CMD_SLEEP_OUT, NULL, 0);
k_sleep(120);
k_sleep(K_MSEC(120));
}

static void st7789v_reset_display(struct st7789v_data *data)
{
LOG_DBG("Resetting display");
#ifdef DT_INST_0_SITRONIX_ST7789V_RESET_GPIOS_CONTROLLER
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 1);
k_sleep(1);
k_sleep(K_MSEC(1));
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 0);
k_sleep(6);
k_sleep(K_MSEC(6));
gpio_pin_write(data->reset_gpio, ST7789V_RESET_PIN, 1);
k_sleep(20);
k_sleep(K_MSEC(20));
#else
st7789v_transmit(p_st7789v, ST7789V_CMD_SW_RESET, NULL, 0);
k_sleep(5);
k_sleep(K_MSEC(5));
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/ethernet/eth_enc424j600.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ static int enc424j600_tx(struct device *dev, struct net_pkt *pkt)
enc424j600_write_sbc(dev, ENC424J600_1BC_SETTXRTS);

do {
k_sleep(1);
k_sleep(K_MSEC(1));
enc424j600_read_sfru(dev, ENC424J600_SFRX_ECON1L, &tmp);
} while (tmp & ENC424J600_ECON1_TXRTS);

Expand Down Expand Up @@ -545,12 +545,12 @@ static int enc424j600_stop_device(struct device *dev)
ENC424J600_ECON1_RXEN);

do {
k_sleep(10U);
k_sleep(K_MSEC(10U));
enc424j600_read_sfru(dev, ENC424J600_SFRX_ESTATL, &tmp);
} while (tmp & ENC424J600_ESTAT_RXBUSY);

do {
k_sleep(10U);
k_sleep(K_MSEC(10U));
enc424j600_read_sfru(dev, ENC424J600_SFRX_ECON1L, &tmp);
} while (tmp & ENC424J600_ECON1_TXRTS);

Expand Down
8 changes: 4 additions & 4 deletions drivers/ethernet/eth_smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int smsc_phy_regread(u8_t regoffset, u32_t *data)

val = 0U;
do {
k_sleep(1);
k_sleep(K_MSEC(1));
time_out--;
if (smsc_mac_regread(SMSC9220_MAC_MII_ACC, &val)) {
return -1;
Expand Down Expand Up @@ -152,7 +152,7 @@ int smsc_phy_regwrite(u8_t regoffset, u32_t data)
}

do {
k_sleep(1);
k_sleep(K_MSEC(1));
time_out--;
if (smsc_mac_regread(SMSC9220_MAC_MII_ACC, &phycmd)) {
return -1;
Expand Down Expand Up @@ -222,7 +222,7 @@ static int smsc_soft_reset(void)
SMSC9220->HW_CFG |= HW_CFG_SRST;

do {
k_sleep(1);
k_sleep(K_MSEC(1));
time_out--;
} while (time_out != 0U && (SMSC9220->HW_CFG & HW_CFG_SRST));

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

/* This sleep is compulsory otherwise txmit/receive will fail. */
k_sleep(2000);
k_sleep(K_MSEC(2000));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/eth_stm32_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static inline void disable_mcast_filter(ETH_HandleTypeDef *heth)
* at least four TX_CLK/RX_CLK clock cycles
*/
tmp = heth->Instance->MACFFR;
k_sleep(1);
k_sleep(K_MSEC(1));
heth->Instance->MACFFR = tmp;
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/ethernet/phy_sam_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int mdio_bus_wait(Gmac *gmac)
return -ETIMEDOUT;
}

k_sleep(10);
k_sleep(K_MSEC(10));
}

return 0;
Expand Down Expand Up @@ -127,7 +127,7 @@ static int phy_soft_reset(const struct phy_sam_gmac_dev *phy)
return -ETIMEDOUT;
}

k_sleep(50);
k_sleep(K_MSEC(50));

retval = phy_read(phy, MII_BMCR, &phy_reg);
if (retval < 0) {
Expand Down Expand Up @@ -228,7 +228,7 @@ int phy_sam_gmac_auto_negotiate(const struct phy_sam_gmac_dev *phy,
goto auto_negotiate_exit;
}

k_sleep(100);
k_sleep(K_MSEC(100));

retval = phy_read(phy, MII_BMSR, &val);
if (retval < 0) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/i2s/i2s_ll_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ static int i2s_stm32_set_clock(struct device *dev, u32_t bit_clk_freq)
}

/* wait 1 ms */
k_sleep(1);
k_sleep(K_MSEC(1));
}
LOG_DBG("PLLI2S is locked");

Expand Down
2 changes: 1 addition & 1 deletion drivers/led/lp5562.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ static inline int lp5562_set_engine_exec_state(struct device *dev,
* Delay between consecutive I2C writes to
* ENABLE register (00h) need to be longer than 488μs (typ.).
*/
k_sleep(1);
k_sleep(K_MSEC(1));

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/pwm/pwm_imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int imx_pwm_pin_set(struct device *dev, u32_t pwm,
} else {
PWM_PWMCR_REG(base) = PWM_PWMCR_SWR(1);
do {
k_sleep(1);
k_sleep(K_MSEC(1));
cr = PWM_PWMCR_REG(base);
} while ((PWM_PWMCR_SWR(cr)) &&
(++wait_count < CONFIG_PWM_PWMSWR_LOOP));
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/adt7420/adt7420_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ int adt7420_init_interrupt(struct device *dev)
CONFIG_ADT7420_THREAD_STACK_SIZE,
(k_thread_entry_t)adt7420_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_ADT7420_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_ADT7420_TRIGGER_GLOBAL_THREAD)
drv_data->work.handler = adt7420_work_cb;
drv_data->dev = dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/adxl362/adxl362.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ static int adxl362_init(struct device *dev)
return -ENODEV;
}

k_sleep(5);
k_sleep(K_MSEC(5));

adxl362_get_reg(dev, &value, ADXL362_REG_PARTID, 1);
if (value != ADXL362_PART_ID) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/adxl362/adxl362_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ int adxl362_init_interrupt(struct device *dev)
CONFIG_ADXL362_THREAD_STACK_SIZE,
(k_thread_entry_t)adxl362_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_ADXL362_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_ADXL362_TRIGGER_GLOBAL_THREAD)
drv_data->work.handler = adxl362_work_cb;
drv_data->dev = dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/adxl372/adxl372.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static int adxl372_reset(struct device *dev)
}
/* Writing code 0x52 resets the device */
ret = adxl372_reg_write(dev, ADXL372_RESET, ADXL372_RESET_CODE);
k_sleep(1000);
k_sleep(K_MSEC(1000));

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/adxl372/adxl372_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ int adxl372_init_interrupt(struct device *dev)
CONFIG_ADXL372_THREAD_STACK_SIZE,
(k_thread_entry_t)adxl372_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_ADXL372_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_ADXL372_TRIGGER_GLOBAL_THREAD)
drv_data->work.handler = adxl372_work_cb;
drv_data->dev = dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/amg88xx/amg88xx_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ int amg88xx_init_interrupt(struct device *dev)
CONFIG_AMG88XX_THREAD_STACK_SIZE,
(k_thread_entry_t)amg88xx_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_AMG88XX_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_AMG88XX_TRIGGER_GLOBAL_THREAD)
drv_data->work.handler = amg88xx_work_cb;
drv_data->dev = dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/ams_iAQcore/iAQcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static int iaqcore_sample_fetch(struct device *dev, enum sensor_channel chan)
return 0;
}

k_sleep(100);
k_sleep(K_MSEC(100));
}

if (drv_data->status == 0x01) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/apds9960/apds9960.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static int apds9960_init(struct device *dev)
struct apds9960_data *data = dev->driver_data;

/* Initialize time 5.7ms */
k_sleep(6);
k_sleep(K_MSEC(6));
data->i2c = device_get_binding(config->i2c_name);

if (data->i2c == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/bma280/bma280_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ int bma280_init_interrupt(struct device *dev)
CONFIG_BMA280_THREAD_STACK_SIZE,
(k_thread_entry_t)bma280_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_BMA280_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_BMA280_TRIGGER_GLOBAL_THREAD)
drv_data->work.handler = bma280_work_cb;
drv_data->dev = dev;
Expand Down
6 changes: 3 additions & 3 deletions drivers/sensor/ccs811/ccs811.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static int ccs811_sample_fetch(struct device *dev, enum sensor_channel chan)
break;
}

k_sleep(100);
k_sleep(K_MSEC(100));
}

if (!(status & CCS811_STATUS_DATA_READY)) {
Expand Down Expand Up @@ -180,7 +180,7 @@ int ccs811_init(struct device *dev)
GPIO_DIR_OUT);
gpio_pin_write(drv_data->gpio, CONFIG_CCS811_GPIO_RESET_PIN_NUM, 1);

k_sleep(1);
k_sleep(K_MSEC(1));
#endif

/*
Expand All @@ -192,7 +192,7 @@ int ccs811_init(struct device *dev)
GPIO_DIR_OUT);
gpio_pin_write(drv_data->gpio, CONFIG_CCS811_GPIO_WAKEUP_PIN_NUM, 0);

k_sleep(1);
k_sleep(K_MSEC(1));
#endif

/* Switch device to application mode */
Expand Down
4 changes: 2 additions & 2 deletions drivers/sensor/ens210/ens210.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ static int ens210_wait_boot(struct device *i2c_dev)
(u8_t *)&sys_stat);

if (ret < 0) {
k_sleep(1);
k_sleep(K_MSEC(1));
continue;
}

Expand All @@ -176,7 +176,7 @@ static int ens210_wait_boot(struct device *i2c_dev)

ens210_sys_enable(i2c_dev);

k_sleep(2);
k_sleep(K_MSEC(2));
}

if (ret < 0) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/hmc5883l/hmc5883l_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int hmc5883l_init_interrupt(struct device *dev)
CONFIG_HMC5883L_THREAD_STACK_SIZE,
(k_thread_entry_t)hmc5883l_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_HMC5883L_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_HMC5883L_TRIGGER_GLOBAL_THREAD)
drv_data->work.handler = hmc5883l_work_cb;
drv_data->dev = dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/hts221/hts221.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int hts221_init(struct device *dev)
* the device requires about 2.2 ms to download the flash content
* into the volatile mem
*/
k_sleep(3);
k_sleep(K_MSEC(3));

if (hts221_read_conversion_data(drv_data) < 0) {
LOG_ERR("Failed to read conversion data.");
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/hts221/hts221_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int hts221_init_interrupt(struct device *dev)
CONFIG_HTS221_THREAD_STACK_SIZE,
(k_thread_entry_t)hts221_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_HTS221_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_HTS221_TRIGGER_GLOBAL_THREAD)
drv_data->work.handler = hts221_work_cb;
drv_data->dev = dev;
Expand Down
2 changes: 1 addition & 1 deletion drivers/sensor/isl29035/isl29035_trigger.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ int isl29035_init_interrupt(struct device *dev)
CONFIG_ISL29035_THREAD_STACK_SIZE,
(k_thread_entry_t)isl29035_thread, dev,
0, NULL, K_PRIO_COOP(CONFIG_ISL29035_THREAD_PRIORITY),
0, 0);
0, K_NO_WAIT);
#elif defined(CONFIG_ISL29035_TRIGGER_GLOBAL_THREAD)
drv_data->work.handler = isl29035_work_cb;
drv_data->dev = dev;
Expand Down
Loading