[PATCH 2/6] staging: pi433: pi433_if.c: fix else if/else statements coding style issues

Chase Metzger chasemetzger15 at gmail.com
Thu Nov 16 00:35:49 UTC 2017


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 at 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



More information about the devel mailing list