staging: kpc2000: fix brace issues in kpc2000_spi.c
authorSimon Sandström <simon@nikanor.nu>
Mon, 1 Jul 2019 09:18:19 +0000 (11:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jul 2019 16:32:09 +0000 (18:32 +0200)
Fixes issues found by checkpatch:

- "WARNING: braces {} are not necessary for single statement blocks"
- "WARNING: braces {} are not necessary for any arm of this statement"

Signed-off-by: Simon Sandström <simon@nikanor.nu>
Link: https://lore.kernel.org/r/20190701091819.18528-1-simon@nikanor.nu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/kpc2000/kpc2000_spi.c

index 021cc859feedaaa81720b6b4b65b10dadfb8aed6..009dec2f46419308e45dd65f3d00f81ac488d159 100644 (file)
@@ -165,9 +165,9 @@ kp_spi_read_reg(struct kp_spi_controller_state *cs, int idx)
        u64 val;
 
        addr += idx;
-       if ((idx == KP_SPI_REG_CONFIG) && (cs->conf_cache >= 0)) {
+       if ((idx == KP_SPI_REG_CONFIG) && (cs->conf_cache >= 0))
                return cs->conf_cache;
-       }
+
        val = readq(addr);
        return val;
 }
@@ -192,11 +192,10 @@ kp_spi_wait_for_reg_bit(struct kp_spi_controller_state *cs, int idx,
        timeout = jiffies + msecs_to_jiffies(1000);
        while (!(kp_spi_read_reg(cs, idx) & bit)) {
                if (time_after(jiffies, timeout)) {
-                       if (!(kp_spi_read_reg(cs, idx) & bit)) {
+                       if (!(kp_spi_read_reg(cs, idx) & bit))
                                return -ETIMEDOUT;
-                       } else {
+                       else
                                return 0;
-                       }
                }
                cpu_relax();
        }
@@ -269,9 +268,8 @@ kp_spi_setup(struct spi_device *spidev)
        cs = spidev->controller_state;
        if (!cs) {
                cs = kzalloc(sizeof(*cs), GFP_KERNEL);
-               if (!cs) {
+               if (!cs)
                        return -ENOMEM;
-               }
                cs->base = kpspi->base;
                cs->conf_cache = -1;
                spidev->controller_state = cs;
@@ -305,9 +303,8 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
        cs = spidev->controller_state;
 
        /* reject invalid messages and transfers */
-       if (list_empty(&m->transfers)) {
+       if (list_empty(&m->transfers))
                return -EINVAL;
-       }
 
        /* validate input */
        list_for_each_entry(transfer, &m->transfers, transfer_list) {
@@ -365,17 +362,14 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
                        sc.reg = kp_spi_read_reg(cs, KP_SPI_REG_CONFIG);
 
                        /* ...direction */
-                       if (transfer->tx_buf) {
+                       if (transfer->tx_buf)
                                sc.bitfield.trm = KP_SPI_REG_CONFIG_TRM_TX;
-                       }
-                       else if (transfer->rx_buf) {
+                       else if (transfer->rx_buf)
                                sc.bitfield.trm = KP_SPI_REG_CONFIG_TRM_RX;
-                       }
 
                        /* ...word length */
-                       if (transfer->bits_per_word) {
+                       if (transfer->bits_per_word)
                                word_len = transfer->bits_per_word;
-                       }
                        sc.bitfield.wl = word_len - 1;
 
                        /* ...chip select */
@@ -394,9 +388,8 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
                        }
                }
 
-               if (transfer->delay_usecs) {
+               if (transfer->delay_usecs)
                        udelay(transfer->delay_usecs);
-               }
        }
 
        /* de-assert chip select to end the sequence */
@@ -419,9 +412,8 @@ kp_spi_cleanup(struct spi_device *spidev)
 {
        struct kp_spi_controller_state *cs = spidev->controller_state;
 
-       if (cs) {
+       if (cs)
                kfree(cs);
-       }
 }
 
 /******************
@@ -464,9 +456,8 @@ kp_spi_probe(struct platform_device *pldev)
        kpspi->dev = &pldev->dev;
 
        master->num_chipselect = 4;
-       if (pldev->id != -1) {
+       if (pldev->id != -1)
                master->bus_num = pldev->id;
-       }
 
        r = platform_get_resource(pldev, IORESOURCE_MEM, 0);
        if (r == NULL) {