From 399f3067441941072664bdbfa1bfec8ff35aa449 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 11 Mar 2017 08:57:34 -0600 Subject: [PATCH] A few cosmetic changes --- drivers/wireless/nrf24l01.c | 19 +++++++++++-------- sched/semaphore/sem_holder.c | 1 - 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c index a667227e036..c3ed88d17a7 100644 --- a/drivers/wireless/nrf24l01.c +++ b/drivers/wireless/nrf24l01.c @@ -42,7 +42,6 @@ * Todo: * - Add support for payloads in ACK packets (?) * - Add compatibility with nRF24L01 (not +) hardware (?) - * */ /**************************************************************************** @@ -116,11 +115,15 @@ #define FIFO_PIPENO_MASK 0xE0 /* 3 ms bits used to store pipe # */ #define FIFO_PIPENO_SHIFT 4 -#define FIFO_PKTLEN(dev) (((dev->rx_fifo[dev->nxt_read] & FIFO_PKTLEN_MASK) >> FIFO_PKTLEN_SHIFT) + 1) -#define FIFO_PIPENO(dev) (((dev->rx_fifo[dev->nxt_read] & FIFO_PIPENO_MASK) >> FIFO_PIPENO_SHIFT)) -#define FIFO_HEADER(pktlen,pipeno) ((pktlen - 1) | (pipeno << FIFO_PIPENO_SHIFT)) +#define FIFO_PKTLEN(dev) \ + (((dev->rx_fifo[dev->nxt_read] & FIFO_PKTLEN_MASK) >> FIFO_PKTLEN_SHIFT) + 1) +#define FIFO_PIPENO(dev) \ + (((dev->rx_fifo[dev->nxt_read] & FIFO_PIPENO_MASK) >> FIFO_PIPENO_SHIFT)) +#define FIFO_HEADER(pktlen,pipeno) \ + ((pktlen - 1) | (pipeno << FIFO_PIPENO_SHIFT)) -#define DEV_NAME "/dev/nrf24l01" +#define DEV_NAME "/dev/nrf24l01" +#define FL_AA_ENABLED (1 << 0) /**************************************************************************** * Private Data Types @@ -132,8 +135,6 @@ typedef enum MODE_WRITE } nrf24l01_access_mode_t; -#define FL_AA_ENABLED (1 << 0) - struct nrf24l01_dev_s { FAR struct spi_dev_s *spi; /* Reference to SPI bus device */ @@ -800,6 +801,7 @@ static void nrf24l01_tostate(struct nrf24l01_dev_s *dev, { case ST_UNKNOWN: /* Power down the module here... */ + case ST_POWER_DOWN: nrf24l01_chipenable(dev, false); nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PWR_UP, false); @@ -1928,7 +1930,8 @@ uint32_t nrf24l01_getradiofreq(FAR struct nrf24l01_dev_s *dev) int nrf24l01_setaddrwidth(FAR struct nrf24l01_dev_s *dev, uint32_t width) { - CHECK_ARGS(dev && width <= NRF24L01_MAX_ADDR_LEN && width >= NRF24L01_MIN_ADDR_LEN); + CHECK_ARGS(dev && width <= NRF24L01_MAX_ADDR_LEN && + width >= NRF24L01_MIN_ADDR_LEN); nrf24l01_lock(dev->spi); nrf24l01_writeregbyte(dev, NRF24L01_SETUP_AW, width-2); diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c index f14f9fe6798..b6a5e2c7880 100644 --- a/sched/semaphore/sem_holder.c +++ b/sched/semaphore/sem_holder.c @@ -322,7 +322,6 @@ static int sem_boostholderprio(FAR struct semholder_s *pholder, } #if CONFIG_SEM_NNESTPRIO > 0 - /* If the priority of the thread that is waiting for a count is greater * than the base priority of the thread holding a count, then we may need * to adjust the holder's priority now or later to that priority.