Browse Source

drivers: coding style, use {} for empty while loops

master
smlng 6 years ago
parent
commit
a7b049f98a
  1. 2
      drivers/at86rf2xx/at86rf2xx_getset.c
  2. 5
      drivers/at86rf2xx/at86rf2xx_internal.c
  3. 3
      drivers/cc110x/cc110x-rxtx.c
  4. 8
      drivers/dht/dht.c
  5. 4
      drivers/enc28j60/enc28j60.c
  6. 6
      drivers/encx24j600/encx24j600.c

2
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;

5
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) {}
}

3
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)

8
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:

4
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)

6
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;

Loading…
Cancel
Save