From a7b049f98a908a09a3e59d8ff3718265f379867f Mon Sep 17 00:00:00 2001 From: smlng Date: Sun, 11 Jun 2017 20:08:10 +0200 Subject: [PATCH] drivers: coding style, use {} for empty while loops --- drivers/at86rf2xx/at86rf2xx_getset.c | 2 +- drivers/at86rf2xx/at86rf2xx_internal.c | 5 ++--- drivers/cc110x/cc110x-rxtx.c | 3 +-- drivers/dht/dht.c | 8 ++++---- drivers/enc28j60/enc28j60.c | 4 ++-- drivers/encx24j600/encx24j600.c | 6 +++--- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/at86rf2xx/at86rf2xx_getset.c b/drivers/at86rf2xx/at86rf2xx_getset.c index 761f978252..8f5265095e 100644 --- a/drivers/at86rf2xx/at86rf2xx_getset.c +++ b/drivers/at86rf2xx/at86rf2xx_getset.c @@ -438,7 +438,7 @@ static inline void _set_state(at86rf2xx_t *dev, uint8_t state, uint8_t cmd) * in https://github.com/RIOT-OS/RIOT/pull/5244 */ if (state != AT86RF2XX_STATE_RX_AACK_ON) { - while (at86rf2xx_get_status(dev) != state); + while (at86rf2xx_get_status(dev) != state) {} } dev->state = state; diff --git a/drivers/at86rf2xx/at86rf2xx_internal.c b/drivers/at86rf2xx/at86rf2xx_internal.c index 0265ef6f54..660b691b6c 100644 --- a/drivers/at86rf2xx/at86rf2xx_internal.c +++ b/drivers/at86rf2xx/at86rf2xx_internal.c @@ -224,8 +224,7 @@ void at86rf2xx_get_random(at86rf2xx_t *dev, uint8_t *data, const size_t len) void at86rf2xx_force_trx_off(const at86rf2xx_t *dev) { - at86rf2xx_reg_write(dev, - AT86RF2XX_REG__TRX_STATE, + at86rf2xx_reg_write(dev, AT86RF2XX_REG__TRX_STATE, AT86RF2XX_TRX_STATE__FORCE_TRX_OFF); - while (at86rf2xx_get_status(dev) != AT86RF2XX_STATE_TRX_OFF); + while (at86rf2xx_get_status(dev) != AT86RF2XX_STATE_TRX_OFF) {} } diff --git a/drivers/cc110x/cc110x-rxtx.c b/drivers/cc110x/cc110x-rxtx.c index 1238687aaa..bbe216d292 100644 --- a/drivers/cc110x/cc110x-rxtx.c +++ b/drivers/cc110x/cc110x-rxtx.c @@ -152,8 +152,7 @@ static void _rx_continue(cc110x_t *dev, void(*callback)(void*), void*arg) do { _rx_read_data(dev, callback, arg); - } - while (gpio_read(dev->params.gdo2)); + } while (gpio_read(dev->params.gdo2)); } static void _tx_abort(cc110x_t *dev) diff --git a/drivers/dht/dht.c b/drivers/dht/dht.c index f8595b3c05..358f6d8c06 100644 --- a/drivers/dht/dht.c +++ b/drivers/dht/dht.c @@ -49,9 +49,9 @@ static uint16_t read(gpio_t pin, int bits) res <<= 1; /* measure the length between the next rising and falling flanks (the * time the pin is high - smoke up :-) */ - while (!gpio_read(pin)); + while (!gpio_read(pin)) {} start = xtimer_now_usec(); - while (gpio_read(pin)); + while (gpio_read(pin)) {} end = xtimer_now_usec(); /* if the high phase was more than 40us, we got a 1 */ if ((end - start) > PULSE_WIDTH_THRESHOLD) { @@ -95,8 +95,8 @@ int dht_read(dht_t *dev, int16_t *temp, int16_t *hum) /* sync on device */ gpio_init(dev->pin, dev->in_mode); - while (!gpio_read(dev->pin)) ; - while (gpio_read(dev->pin)) ; + while (!gpio_read(dev->pin)) {} + while (gpio_read(dev->pin)) {} /* * data is read in sequentially, highest bit first: diff --git a/drivers/enc28j60/enc28j60.c b/drivers/enc28j60/enc28j60.c index 7965de9882..d3d01f5d80 100644 --- a/drivers/enc28j60/enc28j60.c +++ b/drivers/enc28j60/enc28j60.c @@ -177,7 +177,7 @@ static uint16_t cmd_r_phy(enc28j60_t *dev, uint8_t reg) /* trigger register read and wait for results */ cmd_wcr(dev, REG_B2_MICMD, 2, MICMD_MIIRD); cmd_wcr(dev, REG_B2_MICMD, 2, 0x00); - while (cmd_rcr_miimac(dev, REG_B3_MISTAT, 3) & MISTAT_BUSY); + while (cmd_rcr_miimac(dev, REG_B3_MISTAT, 3) & MISTAT_BUSY) {} /* results */ uint8_t low = cmd_rcr_miimac(dev, REG_B2_MIRDL, 2); uint8_t high = cmd_rcr_miimac(dev, REG_B2_MIRDH, 2); @@ -191,7 +191,7 @@ static void cmd_w_phy(enc28j60_t *dev, uint8_t reg, uint16_t val) cmd_wcr(dev, REG_B2_MIWRL, 2, (val & 0xff)); cmd_wcr(dev, REG_B2_MIWRH, 2, (val >> 8)); /* wait until the transaction is finished */ - while (cmd_rcr_miimac(dev, REG_B3_MISTAT, 3) & MISTAT_BUSY); + while (cmd_rcr_miimac(dev, REG_B3_MISTAT, 3) & MISTAT_BUSY) {} } static void cmd_rbm(enc28j60_t *dev, uint8_t *data, size_t len) diff --git a/drivers/encx24j600/encx24j600.c b/drivers/encx24j600/encx24j600.c index 1cb3fd286e..942c47957f 100644 --- a/drivers/encx24j600/encx24j600.c +++ b/drivers/encx24j600/encx24j600.c @@ -255,7 +255,7 @@ static int _init(netdev_t *encdev) xtimer_usleep(ENCX24J600_INIT_DELAY); } while (reg_get(dev, ENC_EUDAST) != 0x1234); - while (!(reg_get(dev, ENC_ESTAT) & ENC_CLKRDY)); + while (!(reg_get(dev, ENC_ESTAT) & ENC_CLKRDY)) {} /* issue System Reset */ cmd(dev, ENC_SETETHRST); @@ -296,7 +296,7 @@ static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { lock(dev); /* wait until previous packet has been sent */ - while ((reg_get(dev, ENC_ECON1) & ENC_TXRTS)); + while ((reg_get(dev, ENC_ECON1) & ENC_TXRTS)) {} /* copy packet to SRAM */ size_t len = 0; @@ -315,7 +315,7 @@ static int _send(netdev_t *netdev, const struct iovec *vector, unsigned count) { /* wait for sending to complete */ /* (not sure if it is needed, keeping the line uncommented) */ - /*while ((reg_get(dev, ENC_ECON1) & ENC_TXRTS));*/ + /*while ((reg_get(dev, ENC_ECON1) & ENC_TXRTS)) {}*/ #ifdef MODULE_NETSTATS_L2 netdev->stats.tx_bytes += len;