* [PATCH 1/6] staging: pi433: pi433_if.c: fix opening curly brace coding style issues
2017-11-16 0:35 [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Chase Metzger
@ 2017-11-16 0:35 ` Chase Metzger
2017-11-28 13:08 ` Greg KH
2017-11-16 0:35 ` [PATCH 2/6] staging: pi433: pi433_if.c: fix else if/else statements " Chase Metzger
` (5 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Chase Metzger @ 2017-11-16 0:35 UTC (permalink / raw)
To: gregkh
Cc: Chase Metzger, Marcus Wolf, Joseph Wright, Haneen Mohammed,
Cihangir Akturk, Srishti Sharma, Colin Ian King, Al Viro,
Derek Robson, devel, linux-kernel
Put opening curly braces for if/else/else if statements and for/while loops
on the same line as the statements or loops to comply with the kernel
coding style.
Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 110 ++++++++++++++-------------------------
1 file changed, 38 insertions(+), 72 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index ff86db1c6cbd..76d70345229a 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -153,12 +153,10 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
{
struct pi433_device *device = dev_id;
- if (device->irq_state[DIO1] == DIO_FifoNotEmpty_DIO1)
- {
+ if (device->irq_state[DIO1] == DIO_FifoNotEmpty_DIO1) {
device->free_in_fifo = FIFO_SIZE;
}
- else if (device->irq_state[DIO1] == DIO_FifoLevel)
- {
+ else if (device->irq_state[DIO1] == DIO_FifoLevel) {
if (device->rx_active) device->free_in_fifo = FIFO_THRESHOLD - 1;
else device->free_in_fifo = FIFO_SIZE - FIFO_THRESHOLD - 1;
}
@@ -193,12 +191,10 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
/* packet config */
/* enable */
SET_CHECKED(rf69_set_sync_enable(dev->spi, rx_cfg->enable_sync));
- if (rx_cfg->enable_sync == optionOn)
- {
+ if (rx_cfg->enable_sync == optionOn) {
SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, afterSyncInterrupt));
}
- else
- {
+ else {
SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always));
}
if (rx_cfg->enable_length_byte == optionOn) {
@@ -215,29 +211,24 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
/* lengths */
SET_CHECKED(rf69_set_sync_size(dev->spi, rx_cfg->sync_length));
- if (rx_cfg->enable_length_byte == optionOn)
- {
+ if (rx_cfg->enable_length_byte == optionOn) {
SET_CHECKED(rf69_set_payload_length(dev->spi, 0xff));
}
- else if (rx_cfg->fixed_message_length != 0)
- {
+ else if (rx_cfg->fixed_message_length != 0) {
payload_length = rx_cfg->fixed_message_length;
if (rx_cfg->enable_length_byte == optionOn) payload_length++;
if (rx_cfg->enable_address_filtering != filteringOff) payload_length++;
SET_CHECKED(rf69_set_payload_length(dev->spi, payload_length));
}
- else
- {
+ else {
SET_CHECKED(rf69_set_payload_length(dev->spi, 0));
}
/* values */
- if (rx_cfg->enable_sync == optionOn)
- {
+ if (rx_cfg->enable_sync == optionOn) {
SET_CHECKED(rf69_set_sync_values(dev->spi, rx_cfg->sync_pattern));
}
- if (rx_cfg->enable_address_filtering != filteringOff)
- {
+ if (rx_cfg->enable_address_filtering != filteringOff) {
SET_CHECKED(rf69_set_node_address (dev->spi, rx_cfg->node_address));
SET_CHECKED(rf69_set_broadcast_address(dev->spi, rx_cfg->broadcast_address));
}
@@ -259,12 +250,10 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
SET_CHECKED(rf69_set_tx_start_condition(dev->spi, tx_cfg->tx_start_condition));
/* packet format enable */
- if (tx_cfg->enable_preamble == optionOn)
- {
+ if (tx_cfg->enable_preamble == optionOn) {
SET_CHECKED(rf69_set_preamble_length(dev->spi, tx_cfg->preamble_length));
}
- else
- {
+ else {
SET_CHECKED(rf69_set_preamble_length(dev->spi, 0));
}
SET_CHECKED(rf69_set_sync_enable (dev->spi, tx_cfg->enable_sync));
@@ -336,8 +325,7 @@ pi433_receive(void *data)
/* wait for any tx to finish */
dev_dbg(dev->dev,"rx: going to wait for any tx to finish");
retval = wait_event_interruptible(dev->rx_wait_queue, !dev->tx_active);
- if(retval) /* wait was interrupted */
- {
+ if(retval) { /* wait was interrupted */
dev->interrupt_rx_allowed = true;
wake_up_interruptible(&dev->tx_wait_queue);
return retval;
@@ -354,8 +342,7 @@ pi433_receive(void *data)
return retval;
/* now check RSSI, if low wait for getting high (RSSI interrupt) */
- while ( !rf69_get_flag(dev->spi, rssiExceededThreshold) )
- {
+ while ( !rf69_get_flag(dev->spi, rssiExceededThreshold) ) {
/* allow tx to interrupt us while waiting for high RSSI */
dev->interrupt_rx_allowed = true;
wake_up_interruptible(&dev->tx_wait_queue);
@@ -378,25 +365,21 @@ pi433_receive(void *data)
irq_set_irq_type(dev->irq_num[DIO0], IRQ_TYPE_EDGE_RISING);
/* fixed or unlimited length? */
- if (dev->rx_cfg.fixed_message_length != 0)
- {
- if (dev->rx_cfg.fixed_message_length > dev->rx_buffer_size)
- {
+ if (dev->rx_cfg.fixed_message_length != 0) {
+ if (dev->rx_cfg.fixed_message_length > dev->rx_buffer_size) {
retval = -1;
goto abort;
}
bytes_total = dev->rx_cfg.fixed_message_length;
dev_dbg(dev->dev,"rx: msg len set to %d by fixed length", bytes_total);
}
- else
- {
+ else {
bytes_total = dev->rx_buffer_size;
dev_dbg(dev->dev, "rx: msg len set to %d as requested by read", bytes_total);
}
/* length byte enabled? */
- if (dev->rx_cfg.enable_length_byte == optionOn)
- {
+ if (dev->rx_cfg.enable_length_byte == optionOn) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
dev->free_in_fifo < FIFO_SIZE);
if (retval) goto abort; /* wait was interrupted */
@@ -411,8 +394,7 @@ pi433_receive(void *data)
}
/* address byte enabled? */
- if (dev->rx_cfg.enable_address_filtering != filteringOff)
- {
+ if (dev->rx_cfg.enable_address_filtering != filteringOff) {
u8 dummy;
bytes_total--;
@@ -427,10 +409,8 @@ pi433_receive(void *data)
}
/* get payload */
- while (dev->rx_position < bytes_total)
- {
- if ( !rf69_get_flag(dev->spi, payloadReady) )
- {
+ while (dev->rx_position < bytes_total) {
+ if ( !rf69_get_flag(dev->spi, payloadReady) ) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
dev->free_in_fifo < FIFO_SIZE);
if (retval) goto abort; /* wait was interrupted */
@@ -484,8 +464,7 @@ pi433_tx_thread(void *data)
int position, repetitions;
int retval;
- while (1)
- {
+ while (1) {
/* wait for fifo to be populated or for request to terminate*/
dev_dbg(device->dev, "thread: going to wait for new messages");
wait_event_interruptible(device->tx_wait_queue,
@@ -560,8 +539,7 @@ pi433_tx_thread(void *data)
disable_irq(device->irq_num[DIO0]);
device->tx_active = true;
- if (device->rx_active && rx_interrupted == false)
- {
+ if (device->rx_active && rx_interrupted == false) {
/* rx is currently waiting for a telegram;
* we need to set the radio module to standby
*/
@@ -572,12 +550,10 @@ pi433_tx_thread(void *data)
/* clear fifo, set fifo threshold, set payload length */
SET_CHECKED(rf69_set_mode(spi, standby)); /* this clears the fifo */
SET_CHECKED(rf69_set_fifo_threshold(spi, FIFO_THRESHOLD));
- if (tx_cfg.enable_length_byte == optionOn)
- {
+ if (tx_cfg.enable_length_byte == optionOn) {
SET_CHECKED(rf69_set_payload_length(spi, size * tx_cfg.repetitions));
}
- else
- {
+ else {
SET_CHECKED(rf69_set_payload_length(spi, 0));
}
@@ -602,10 +578,9 @@ pi433_tx_thread(void *data)
device->free_in_fifo = FIFO_SIZE;
position = 0;
repetitions = tx_cfg.repetitions;
- while( (repetitions > 0) && (size > position) )
- {
- if ( (size - position) > device->free_in_fifo)
- { /* msg to big for fifo - take a part */
+ while( (repetitions > 0) && (size > position) ) {
+ if ( (size - position) > device->free_in_fifo) {
+ /* msg to big for fifo - take a part */
int temp = device->free_in_fifo;
device->free_in_fifo = 0;
rf69_write_fifo(spi,
@@ -613,8 +588,8 @@ pi433_tx_thread(void *data)
temp);
position +=temp;
}
- else
- { /* msg fits into fifo - take all */
+ else {
+ /* msg fits into fifo - take all */
device->free_in_fifo -= size;
repetitions--;
rf69_write_fifo(spi,
@@ -643,8 +618,7 @@ pi433_tx_thread(void *data)
/* everything sent? */
if (kfifo_is_empty(&device->tx_fifo)) {
abort:
- if (rx_interrupted)
- {
+ if (rx_interrupted) {
rx_interrupted = false;
pi433_start_rx(device);
}
@@ -673,13 +647,11 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos)
/* just one read request at a time */
mutex_lock(&device->rx_lock);
- if (device->rx_active)
- {
+ if (device->rx_active) {
mutex_unlock(&device->rx_lock);
return -EAGAIN;
}
- else
- {
+ else {
device->rx_active = true;
mutex_unlock(&device->rx_lock);
}
@@ -904,8 +876,7 @@ static int setup_GPIOs(struct pi433_device *device)
DIO1_irq_handler
};
- for (i=0; i<NUM_DIO; i++)
- {
+ for (i=0; i<NUM_DIO; i++) {
/* "construct" name and get the gpio descriptor */
snprintf(name, sizeof(name), "DIO%d", i);
device->gpiod[i] = gpiod_get(&device->spi->dev, name, 0 /*GPIOD_IN*/);
@@ -918,12 +889,10 @@ static int setup_GPIOs(struct pi433_device *device)
if (device->gpiod[i] == ERR_PTR(-EBUSY))
dev_dbg(&device->spi->dev, "%s is busy.", name);
- if ( IS_ERR(device->gpiod[i]) )
- {
+ if ( IS_ERR(device->gpiod[i]) ) {
retval = PTR_ERR(device->gpiod[i]);
/* release already allocated gpios */
- for (i--; i>=0; i--)
- {
+ for (i--; i>=0; i--) {
free_irq(device->irq_num[i], device);
gpiod_put(device->gpiod[i]);
}
@@ -962,8 +931,7 @@ static void free_GPIOs(struct pi433_device *device)
{
int i;
- for (i=0; i<NUM_DIO; i++)
- {
+ for (i=0; i<NUM_DIO; i++) {
/* check if gpiod is valid */
if ( IS_ERR(device->gpiod[i]) )
continue;
@@ -1027,13 +995,11 @@ static int pi433_probe(struct spi_device *spi)
/* spi->max_speed_hz = 10000000; 1MHz already set by device tree overlay */
retval = spi_setup(spi);
- if (retval)
- {
+ if (retval) {
dev_dbg(&spi->dev, "configuration of SPI interface failed!\n");
return retval;
}
- else
- {
+ else {
dev_dbg(&spi->dev,
"spi interface setup: mode 0x%2x, %d bits per word, %dhz max speed",
spi->mode, spi->bits_per_word, spi->max_speed_hz);
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] staging: pi433: pi433_if.c: fix opening curly brace coding style issues
2017-11-16 0:35 ` [PATCH 1/6] staging: pi433: pi433_if.c: fix opening curly brace coding style issues Chase Metzger
@ 2017-11-28 13:08 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2017-11-28 13:08 UTC (permalink / raw)
To: Chase Metzger
Cc: Marcus Wolf, Joseph Wright, Haneen Mohammed, Cihangir Akturk,
Srishti Sharma, Colin Ian King, Al Viro, Derek Robson, devel,
linux-kernel
On Wed, Nov 15, 2017 at 04:35:48PM -0800, Chase Metzger wrote:
> Put opening curly braces for if/else/else if statements and for/while loops
> on the same line as the statements or loops to comply with the kernel
> coding style.
>
> Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
> ---
> drivers/staging/pi433/pi433_if.c | 110 ++++++++++++++-------------------------
> 1 file changed, 38 insertions(+), 72 deletions(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index ff86db1c6cbd..76d70345229a 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -153,12 +153,10 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
> {
> struct pi433_device *device = dev_id;
>
> - if (device->irq_state[DIO1] == DIO_FifoNotEmpty_DIO1)
> - {
> + if (device->irq_state[DIO1] == DIO_FifoNotEmpty_DIO1) {
Again, fix up the space issue here at the same time please.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/6] staging: pi433: pi433_if.c: fix else if/else statements coding style issues
2017-11-16 0:35 [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Chase Metzger
2017-11-16 0:35 ` [PATCH 1/6] staging: pi433: pi433_if.c: fix opening curly brace coding style issues Chase Metzger
@ 2017-11-16 0:35 ` Chase Metzger
2017-11-16 0:35 ` [PATCH 3/6] staging: pi433: pi433_if.c: fix trailing statement " Chase Metzger
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Chase Metzger @ 2017-11-16 0:35 UTC (permalink / raw)
To: gregkh
Cc: Chase Metzger, Marcus Wolf, Joseph Wright, Colin Ian King,
Srishti Sharma, Al Viro, Haneen Mohammed, Derek Robson, devel,
linux-kernel
Put else if/else statements on same line as if/else if statements
closing curly brace to comply with the kernel coding style.
Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 33 +++++++++++----------------------
1 file changed, 11 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 76d70345229a..cd1430a04928 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -155,8 +155,7 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
if (device->irq_state[DIO1] == DIO_FifoNotEmpty_DIO1) {
device->free_in_fifo = FIFO_SIZE;
- }
- else if (device->irq_state[DIO1] == DIO_FifoLevel) {
+ } else if (device->irq_state[DIO1] == DIO_FifoLevel) {
if (device->rx_active) device->free_in_fifo = FIFO_THRESHOLD - 1;
else device->free_in_fifo = FIFO_SIZE - FIFO_THRESHOLD - 1;
}
@@ -193,8 +192,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
SET_CHECKED(rf69_set_sync_enable(dev->spi, rx_cfg->enable_sync));
if (rx_cfg->enable_sync == optionOn) {
SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, afterSyncInterrupt));
- }
- else {
+ } else {
SET_CHECKED(rf69_set_fifo_fill_condition(dev->spi, always));
}
if (rx_cfg->enable_length_byte == optionOn) {
@@ -213,14 +211,12 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
SET_CHECKED(rf69_set_sync_size(dev->spi, rx_cfg->sync_length));
if (rx_cfg->enable_length_byte == optionOn) {
SET_CHECKED(rf69_set_payload_length(dev->spi, 0xff));
- }
- else if (rx_cfg->fixed_message_length != 0) {
+ } else if (rx_cfg->fixed_message_length != 0) {
payload_length = rx_cfg->fixed_message_length;
if (rx_cfg->enable_length_byte == optionOn) payload_length++;
if (rx_cfg->enable_address_filtering != filteringOff) payload_length++;
SET_CHECKED(rf69_set_payload_length(dev->spi, payload_length));
- }
- else {
+ } else {
SET_CHECKED(rf69_set_payload_length(dev->spi, 0));
}
@@ -252,8 +248,7 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
/* packet format enable */
if (tx_cfg->enable_preamble == optionOn) {
SET_CHECKED(rf69_set_preamble_length(dev->spi, tx_cfg->preamble_length));
- }
- else {
+ } else {
SET_CHECKED(rf69_set_preamble_length(dev->spi, 0));
}
SET_CHECKED(rf69_set_sync_enable (dev->spi, tx_cfg->enable_sync));
@@ -372,8 +367,7 @@ pi433_receive(void *data)
}
bytes_total = dev->rx_cfg.fixed_message_length;
dev_dbg(dev->dev,"rx: msg len set to %d by fixed length", bytes_total);
- }
- else {
+ } else {
bytes_total = dev->rx_buffer_size;
dev_dbg(dev->dev, "rx: msg len set to %d as requested by read", bytes_total);
}
@@ -552,8 +546,7 @@ pi433_tx_thread(void *data)
SET_CHECKED(rf69_set_fifo_threshold(spi, FIFO_THRESHOLD));
if (tx_cfg.enable_length_byte == optionOn) {
SET_CHECKED(rf69_set_payload_length(spi, size * tx_cfg.repetitions));
- }
- else {
+ } else {
SET_CHECKED(rf69_set_payload_length(spi, 0));
}
@@ -587,8 +580,7 @@ pi433_tx_thread(void *data)
&buffer[position],
temp);
position +=temp;
- }
- else {
+ } else {
/* msg fits into fifo - take all */
device->free_in_fifo -= size;
repetitions--;
@@ -650,8 +642,7 @@ pi433_read(struct file *filp, char __user *buf, size_t size, loff_t *f_pos)
if (device->rx_active) {
mutex_unlock(&device->rx_lock);
return -EAGAIN;
- }
- else {
+ } else {
device->rx_active = true;
mutex_unlock(&device->rx_lock);
}
@@ -998,8 +989,7 @@ static int pi433_probe(struct spi_device *spi)
if (retval) {
dev_dbg(&spi->dev, "configuration of SPI interface failed!\n");
return retval;
- }
- else {
+ } else {
dev_dbg(&spi->dev,
"spi interface setup: mode 0x%2x, %d bits per word, %dhz max speed",
spi->mode, spi->bits_per_word, spi->max_speed_hz);
@@ -1085,8 +1075,7 @@ static int pi433_probe(struct spi_device *spi)
pr_err("pi433: device register failed\n");
retval = PTR_ERR(device->dev);
goto device_create_failed;
- }
- else {
+ } else {
dev_dbg(device->dev,
"created device for major %d, minor %d\n",
MAJOR(pi433_dev),
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/6] staging: pi433: pi433_if.c: fix trailing statement coding style issues
2017-11-16 0:35 [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Chase Metzger
2017-11-16 0:35 ` [PATCH 1/6] staging: pi433: pi433_if.c: fix opening curly brace coding style issues Chase Metzger
2017-11-16 0:35 ` [PATCH 2/6] staging: pi433: pi433_if.c: fix else if/else statements " Chase Metzger
@ 2017-11-16 0:35 ` Chase Metzger
2017-11-16 0:35 ` [PATCH 4/6] staging: pi433: pi433_if.c: fix space prohibited " Chase Metzger
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Chase Metzger @ 2017-11-16 0:35 UTC (permalink / raw)
To: gregkh
Cc: Chase Metzger, Marcus Wolf, Joseph Wright, Arnd Bergmann,
Al Viro, Xiangyang Zhang, Srishti Sharma, Derek Robson, devel,
linux-kernel
Put trailing statement after if/else statements on new line to comply
with the kernel coding style.
Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 44 +++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index cd1430a04928..3c5d8a05e976 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -156,8 +156,10 @@ static irqreturn_t DIO1_irq_handler(int irq, void *dev_id)
if (device->irq_state[DIO1] == DIO_FifoNotEmpty_DIO1) {
device->free_in_fifo = FIFO_SIZE;
} else if (device->irq_state[DIO1] == DIO_FifoLevel) {
- if (device->rx_active) device->free_in_fifo = FIFO_THRESHOLD - 1;
- else device->free_in_fifo = FIFO_SIZE - FIFO_THRESHOLD - 1;
+ if (device->rx_active)
+ device->free_in_fifo = FIFO_THRESHOLD - 1;
+ else
+ device->free_in_fifo = FIFO_SIZE - FIFO_THRESHOLD - 1;
}
dev_dbg(device->dev,
"DIO1 irq: %d bytes free in fifo\n", device->free_in_fifo);
@@ -213,8 +215,10 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
SET_CHECKED(rf69_set_payload_length(dev->spi, 0xff));
} else if (rx_cfg->fixed_message_length != 0) {
payload_length = rx_cfg->fixed_message_length;
- if (rx_cfg->enable_length_byte == optionOn) payload_length++;
- if (rx_cfg->enable_address_filtering != filteringOff) payload_length++;
+ if (rx_cfg->enable_length_byte == optionOn)
+ payload_length++;
+ if (rx_cfg->enable_address_filtering != filteringOff)
+ payload_length++;
SET_CHECKED(rf69_set_payload_length(dev->spi, payload_length));
} else {
SET_CHECKED(rf69_set_payload_length(dev->spi, 0));
@@ -285,7 +289,8 @@ pi433_start_rx(struct pi433_device *dev)
/* setup for receiving */
retval = rf69_set_rx_cfg(dev, &dev->rx_cfg);
- if (retval) return retval;
+ if (retval)
+ return retval;
/* setup rssi irq */
SET_CHECKED(rf69_set_dio_mapping(dev->spi, DIO0, DIO_Rssi_DIO0));
@@ -347,11 +352,13 @@ pi433_receive(void *data)
retval = wait_event_interruptible(dev->rx_wait_queue,
rf69_get_flag(dev->spi,
rssiExceededThreshold));
- if (retval) goto abort; /* wait was interrupted */
+ if (retval) /* wait was interrupted */
+ goto abort;
dev->interrupt_rx_allowed = false;
/* cross check for ongoing tx */
- if (!dev->tx_active) break;
+ if (!dev->tx_active)
+ break;
}
/* configure payload ready irq */
@@ -376,7 +383,8 @@ pi433_receive(void *data)
if (dev->rx_cfg.enable_length_byte == optionOn) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
dev->free_in_fifo < FIFO_SIZE);
- if (retval) goto abort; /* wait was interrupted */
+ if (retval) /* wait was interrupted */
+ goto abort;
rf69_read_fifo(spi, (u8 *)&bytes_total, 1);
if (bytes_total > dev->rx_buffer_size) {
@@ -395,7 +403,8 @@ pi433_receive(void *data)
retval = wait_event_interruptible(dev->fifo_wait_queue,
dev->free_in_fifo < FIFO_SIZE);
- if (retval) goto abort; /* wait was interrupted */
+ if (retval) /* wait was interrupted */
+ goto abort;
rf69_read_fifo(spi, &dummy, 1);
dev->free_in_fifo++;
@@ -407,7 +416,8 @@ pi433_receive(void *data)
if ( !rf69_get_flag(dev->spi, payloadReady) ) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
dev->free_in_fifo < FIFO_SIZE);
- if (retval) goto abort; /* wait was interrupted */
+ if (retval) /* wait was interrupted */
+ goto abort;
}
/* need to drop bytes or acquire? */
@@ -423,7 +433,8 @@ pi433_receive(void *data)
retval = rf69_read_fifo(spi,
&dev->rx_buffer[dev->rx_position],
bytes_to_read);
- if (retval) goto abort; /* read failed */
+ if (retval) /* read failed */
+ goto abort;
dev->free_in_fifo += bytes_to_read;
/* adjust status vars */
@@ -592,7 +603,10 @@ pi433_tx_thread(void *data)
retval = wait_event_interruptible(device->fifo_wait_queue,
device->free_in_fifo > 0);
- if (retval) { printk("ABORT\n"); goto abort; }
+ if (retval) {
+ printk("ABORT\n");
+ goto abort;
+ }
}
/* we are done. Wait for packet to get sent */
@@ -600,7 +614,8 @@ pi433_tx_thread(void *data)
wait_event_interruptible(device->fifo_wait_queue,
device->free_in_fifo == FIFO_SIZE ||
kthread_should_stop() );
- if ( kthread_should_stop() ) printk("ABORT\n");
+ if ( kthread_should_stop() )
+ printk("ABORT\n");
/* STOP_TRANSMISSION */
@@ -894,7 +909,8 @@ static int setup_GPIOs(struct pi433_device *device)
/* configure the pin */
gpiod_unexport(device->gpiod[i]);
retval = gpiod_direction_input(device->gpiod[i]);
- if (retval) return retval;
+ if (retval)
+ return retval;
/* configure irq */
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/6] staging: pi433: pi433_if.c: fix space prohibited coding style issues
2017-11-16 0:35 [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Chase Metzger
` (2 preceding siblings ...)
2017-11-16 0:35 ` [PATCH 3/6] staging: pi433: pi433_if.c: fix trailing statement " Chase Metzger
@ 2017-11-16 0:35 ` Chase Metzger
2017-11-28 13:09 ` Greg KH
2017-11-16 0:35 ` [PATCH 5/6] staging: pi433: pi433_if.c: fix space(s) required " Chase Metzger
` (2 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Chase Metzger @ 2017-11-16 0:35 UTC (permalink / raw)
To: gregkh
Cc: Chase Metzger, Marcus Wolf, Joseph Wright, Elia Geretto,
dan.carpenter, Harsha Sharma, Al Viro, Srishti Sharma,
Derek Robson, devel, linux-kernel
Remove unnecessary spaces before and after parenthesis' to comply
with the kernel coding style.
Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 3c5d8a05e976..ad89504655af 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -342,7 +342,7 @@ pi433_receive(void *data)
return retval;
/* now check RSSI, if low wait for getting high (RSSI interrupt) */
- while ( !rf69_get_flag(dev->spi, rssiExceededThreshold) ) {
+ while (!rf69_get_flag(dev->spi, rssiExceededThreshold)) {
/* allow tx to interrupt us while waiting for high RSSI */
dev->interrupt_rx_allowed = true;
wake_up_interruptible(&dev->tx_wait_queue);
@@ -413,7 +413,7 @@ pi433_receive(void *data)
/* get payload */
while (dev->rx_position < bytes_total) {
- if ( !rf69_get_flag(dev->spi, payloadReady) ) {
+ if (!rf69_get_flag(dev->spi, payloadReady)) {
retval = wait_event_interruptible(dev->fifo_wait_queue,
dev->free_in_fifo < FIFO_SIZE);
if (retval) /* wait was interrupted */
@@ -473,9 +473,9 @@ pi433_tx_thread(void *data)
/* wait for fifo to be populated or for request to terminate*/
dev_dbg(device->dev, "thread: going to wait for new messages");
wait_event_interruptible(device->tx_wait_queue,
- ( !kfifo_is_empty(&device->tx_fifo) ||
- kthread_should_stop() ));
- if ( kthread_should_stop() )
+ (!kfifo_is_empty(&device->tx_fifo) ||
+ kthread_should_stop()));
+ if (kthread_should_stop())
return 0;
/* get data from fifo in the following order:
@@ -487,14 +487,14 @@ pi433_tx_thread(void *data)
retval = kfifo_out(&device->tx_fifo, &tx_cfg, sizeof(tx_cfg));
if (retval != sizeof(tx_cfg)) {
- dev_dbg(device->dev, "reading tx_cfg from fifo failed: got %d byte(s), expected %d", retval, (unsigned int)sizeof(tx_cfg) );
+ dev_dbg(device->dev, "reading tx_cfg from fifo failed: got %d byte(s), expected %d", retval, (unsigned int)sizeof(tx_cfg));
mutex_unlock(&device->tx_fifo_lock);
continue;
}
retval = kfifo_out(&device->tx_fifo, &size, sizeof(size_t));
if (retval != sizeof(size_t)) {
- dev_dbg(device->dev, "reading msg size from fifo failed: got %d, expected %d", retval, (unsigned int)sizeof(size_t) );
+ dev_dbg(device->dev, "reading msg size from fifo failed: got %d, expected %d", retval, (unsigned int)sizeof(size_t));
mutex_unlock(&device->tx_fifo_lock);
continue;
}
@@ -524,7 +524,7 @@ pi433_tx_thread(void *data)
buffer[position++] = tx_cfg.address_byte;
/* finally get message data from fifo */
- retval = kfifo_out(&device->tx_fifo, &buffer[position], sizeof(buffer)-position );
+ retval = kfifo_out(&device->tx_fifo, &buffer[position], sizeof(buffer)-position);
dev_dbg(device->dev, "read %d message byte(s) from fifo queue.", retval);
mutex_unlock(&device->tx_fifo_lock);
@@ -582,8 +582,8 @@ pi433_tx_thread(void *data)
device->free_in_fifo = FIFO_SIZE;
position = 0;
repetitions = tx_cfg.repetitions;
- while( (repetitions > 0) && (size > position) ) {
- if ( (size - position) > device->free_in_fifo) {
+ while((repetitions > 0) && (size > position)) {
+ if ((size - position) > device->free_in_fifo) {
/* msg to big for fifo - take a part */
int temp = device->free_in_fifo;
device->free_in_fifo = 0;
@@ -597,7 +597,7 @@ pi433_tx_thread(void *data)
repetitions--;
rf69_write_fifo(spi,
&buffer[position],
- (size - position) );
+ (size - position));
position = 0; /* reset for next repetition */
}
@@ -613,8 +613,8 @@ pi433_tx_thread(void *data)
dev_dbg(device->dev, "thread: wait for packet to get sent/fifo to be empty");
wait_event_interruptible(device->fifo_wait_queue,
device->free_in_fifo == FIFO_SIZE ||
- kthread_should_stop() );
- if ( kthread_should_stop() )
+ kthread_should_stop());
+ if (kthread_should_stop())
printk("ABORT\n");
@@ -705,11 +705,11 @@ pi433_write(struct file *filp, const char __user *buf,
*/
mutex_lock(&device->tx_fifo_lock);
retval = kfifo_in(&device->tx_fifo, &instance->tx_cfg, sizeof(instance->tx_cfg));
- if ( retval != sizeof(instance->tx_cfg) )
+ if (retval != sizeof(instance->tx_cfg))
goto abort;
retval = kfifo_in (&device->tx_fifo, &count, sizeof(size_t));
- if ( retval != sizeof(size_t) )
+ if (retval != sizeof(size_t))
goto abort;
retval = kfifo_from_user(&device->tx_fifo, buf, count, &copied);
@@ -895,7 +895,7 @@ static int setup_GPIOs(struct pi433_device *device)
if (device->gpiod[i] == ERR_PTR(-EBUSY))
dev_dbg(&device->spi->dev, "%s is busy.", name);
- if ( IS_ERR(device->gpiod[i]) ) {
+ if (IS_ERR(device->gpiod[i])) {
retval = PTR_ERR(device->gpiod[i]);
/* release already allocated gpios */
for (i--; i>=0; i--) {
@@ -940,7 +940,7 @@ static void free_GPIOs(struct pi433_device *device)
for (i=0; i<NUM_DIO; i++) {
/* check if gpiod is valid */
- if ( IS_ERR(device->gpiod[i]) )
+ if (IS_ERR(device->gpiod[i]))
continue;
free_irq(device->irq_num[i], device);
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 4/6] staging: pi433: pi433_if.c: fix space prohibited coding style issues
2017-11-16 0:35 ` [PATCH 4/6] staging: pi433: pi433_if.c: fix space prohibited " Chase Metzger
@ 2017-11-28 13:09 ` Greg KH
0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2017-11-28 13:09 UTC (permalink / raw)
To: Chase Metzger
Cc: Marcus Wolf, Joseph Wright, Elia Geretto, dan.carpenter,
Harsha Sharma, Al Viro, Srishti Sharma, Derek Robson, devel,
linux-kernel
On Wed, Nov 15, 2017 at 04:35:51PM -0800, Chase Metzger wrote:
> Remove unnecessary spaces before and after parenthesis' to comply
> with the kernel coding style.
>
> Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
> ---
> drivers/staging/pi433/pi433_if.c | 34 +++++++++++++++++-----------------
> 1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index 3c5d8a05e976..ad89504655af 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -342,7 +342,7 @@ pi433_receive(void *data)
> return retval;
>
> /* now check RSSI, if low wait for getting high (RSSI interrupt) */
> - while ( !rf69_get_flag(dev->spi, rssiExceededThreshold) ) {
> + while (!rf69_get_flag(dev->spi, rssiExceededThreshold)) {
> /* allow tx to interrupt us while waiting for high RSSI */
> dev->interrupt_rx_allowed = true;
> wake_up_interruptible(&dev->tx_wait_queue);
> @@ -413,7 +413,7 @@ pi433_receive(void *data)
>
> /* get payload */
> while (dev->rx_position < bytes_total) {
> - if ( !rf69_get_flag(dev->spi, payloadReady) ) {
> + if (!rf69_get_flag(dev->spi, payloadReady)) {
> retval = wait_event_interruptible(dev->fifo_wait_queue,
> dev->free_in_fifo < FIFO_SIZE);
> if (retval) /* wait was interrupted */
> @@ -473,9 +473,9 @@ pi433_tx_thread(void *data)
> /* wait for fifo to be populated or for request to terminate*/
> dev_dbg(device->dev, "thread: going to wait for new messages");
> wait_event_interruptible(device->tx_wait_queue,
> - ( !kfifo_is_empty(&device->tx_fifo) ||
> - kthread_should_stop() ));
> - if ( kthread_should_stop() )
> + (!kfifo_is_empty(&device->tx_fifo) ||
> + kthread_should_stop()));
Indent this properly too if you are touching it.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/6] staging: pi433: pi433_if.c: fix space(s) required coding style issues
2017-11-16 0:35 [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Chase Metzger
` (3 preceding siblings ...)
2017-11-16 0:35 ` [PATCH 4/6] staging: pi433: pi433_if.c: fix space prohibited " Chase Metzger
@ 2017-11-16 0:35 ` Chase Metzger
2017-11-16 0:35 ` [PATCH 6/6] staging: pi433: pi433_if.c: use tabs instead of spaces Chase Metzger
2017-11-28 13:10 ` [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Greg KH
6 siblings, 0 replies; 10+ messages in thread
From: Chase Metzger @ 2017-11-16 0:35 UTC (permalink / raw)
To: gregkh
Cc: Chase Metzger, Marcus Wolf, Joseph Wright, Julia Lawall, Al Viro,
Elia Geretto, Colin Ian King, Srishti Sharma, Derek Robson,
devel, linux-kernel
Put space(s) in required spots to comply with the kernel coding style.
Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index ad89504655af..ad99f6527bd6 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -323,9 +323,9 @@ pi433_receive(void *data)
dev->interrupt_rx_allowed = false;
/* wait for any tx to finish */
- dev_dbg(dev->dev,"rx: going to wait for any tx to finish");
+ dev_dbg(dev->dev, "rx: going to wait for any tx to finish");
retval = wait_event_interruptible(dev->rx_wait_queue, !dev->tx_active);
- if(retval) { /* wait was interrupted */
+ if (retval) { /* wait was interrupted */
dev->interrupt_rx_allowed = true;
wake_up_interruptible(&dev->tx_wait_queue);
return retval;
@@ -373,7 +373,7 @@ pi433_receive(void *data)
goto abort;
}
bytes_total = dev->rx_cfg.fixed_message_length;
- dev_dbg(dev->dev,"rx: msg len set to %d by fixed length", bytes_total);
+ dev_dbg(dev->dev, "rx: msg len set to %d by fixed length", bytes_total);
} else {
bytes_total = dev->rx_buffer_size;
dev_dbg(dev->dev, "rx: msg len set to %d as requested by read", bytes_total);
@@ -582,7 +582,7 @@ pi433_tx_thread(void *data)
device->free_in_fifo = FIFO_SIZE;
position = 0;
repetitions = tx_cfg.repetitions;
- while((repetitions > 0) && (size > position)) {
+ while ((repetitions > 0) && (size > position)) {
if ((size - position) > device->free_in_fifo) {
/* msg to big for fifo - take a part */
int temp = device->free_in_fifo;
@@ -590,7 +590,7 @@ pi433_tx_thread(void *data)
rf69_write_fifo(spi,
&buffer[position],
temp);
- position +=temp;
+ position += temp;
} else {
/* msg fits into fifo - take all */
device->free_in_fifo -= size;
@@ -882,7 +882,7 @@ static int setup_GPIOs(struct pi433_device *device)
DIO1_irq_handler
};
- for (i=0; i<NUM_DIO; i++) {
+ for (i = 0; i < NUM_DIO; i++) {
/* "construct" name and get the gpio descriptor */
snprintf(name, sizeof(name), "DIO%d", i);
device->gpiod[i] = gpiod_get(&device->spi->dev, name, 0 /*GPIOD_IN*/);
@@ -898,7 +898,7 @@ static int setup_GPIOs(struct pi433_device *device)
if (IS_ERR(device->gpiod[i])) {
retval = PTR_ERR(device->gpiod[i]);
/* release already allocated gpios */
- for (i--; i>=0; i--) {
+ for (i--; i >= 0; i--) {
free_irq(device->irq_num[i], device);
gpiod_put(device->gpiod[i]);
}
@@ -938,7 +938,7 @@ static void free_GPIOs(struct pi433_device *device)
{
int i;
- for (i=0; i<NUM_DIO; i++) {
+ for (i = 0; i < NUM_DIO; i++) {
/* check if gpiod is valid */
if (IS_ERR(device->gpiod[i]))
continue;
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/6] staging: pi433: pi433_if.c: use tabs instead of spaces
2017-11-16 0:35 [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Chase Metzger
` (4 preceding siblings ...)
2017-11-16 0:35 ` [PATCH 5/6] staging: pi433: pi433_if.c: fix space(s) required " Chase Metzger
@ 2017-11-16 0:35 ` Chase Metzger
2017-11-28 13:10 ` [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Greg KH
6 siblings, 0 replies; 10+ messages in thread
From: Chase Metzger @ 2017-11-16 0:35 UTC (permalink / raw)
To: gregkh
Cc: Chase Metzger, Marcus Wolf, Joseph Wright, Arnd Bergmann,
Srishti Sharma, Cihangir Akturk, Haneen Mohammed, Al Viro,
Derek Robson, devel, linux-kernel
Replace spaces with tabs where possible to comply with the kernel
coding style.
Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index ad99f6527bd6..ad625a7cc76e 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -350,8 +350,8 @@ pi433_receive(void *data)
/* wait for RSSI level to become high */
dev_dbg(dev->dev, "rx: going to wait for high RSSI level");
retval = wait_event_interruptible(dev->rx_wait_queue,
- rf69_get_flag(dev->spi,
- rssiExceededThreshold));
+ rf69_get_flag(dev->spi,
+ rssiExceededThreshold));
if (retval) /* wait was interrupted */
goto abort;
dev->interrupt_rx_allowed = false;
@@ -588,8 +588,8 @@ pi433_tx_thread(void *data)
int temp = device->free_in_fifo;
device->free_in_fifo = 0;
rf69_write_fifo(spi,
- &buffer[position],
- temp);
+ &buffer[position],
+ temp);
position += temp;
} else {
/* msg fits into fifo - take all */
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes
2017-11-16 0:35 [PATCH 0/6] staging: pi433: pi433_if.c: coding style fixes Chase Metzger
` (5 preceding siblings ...)
2017-11-16 0:35 ` [PATCH 6/6] staging: pi433: pi433_if.c: use tabs instead of spaces Chase Metzger
@ 2017-11-28 13:10 ` Greg KH
6 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2017-11-28 13:10 UTC (permalink / raw)
To: Chase Metzger
Cc: Marcus Wolf, Joseph Wright, Al Viro, Srishti Sharma, devel, linux-kernel
On Wed, Nov 15, 2017 at 04:35:47PM -0800, Chase Metzger wrote:
> Fixes some of the coding style violations to comply with the kernel
> coding style.
>
> Chase Metzger (6):
> staging: pi433: pi433_if.c: fix opening curly brace coding style
> issues
> staging: pi433: pi433_if.c: fix else if/else statements coding style
> issues
> staging: pi433: pi433_if.c: fix trailing statement coding style issues
> staging: pi433: pi433_if.c: fix space prohibited coding style issues
> staging: pi433: pi433_if.c: fix space(s) required coding style issues
> staging: pi433: pi433_if.c: use tabs instead of spaces
>
> drivers/staging/pi433/pi433_if.c | 203 +++++++++++++++++----------------------
> 1 file changed, 87 insertions(+), 116 deletions(-)
Please rebase and resend this series based on the review comments.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 10+ messages in thread