lkml.org 
[lkml]   [2019]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/8] staging: kpc2000: add line breaks
Date
To fix some checkpatch-warnings some lines of this module had to be
shortened so that they do not exceed 80 characters per line.
This refactoring makes the code more readable.

Signed-off-by: Fabian Krueger <fabian.krueger@fau.de>
Signed-off-by: Michael Scheiderer <michael.scheiderer@fau.de>
Cc: <linux-kernel@i4.cs.fau.de>
---
drivers/staging/kpc2000/kpc2000_spi.c | 77 ++++++++++++++++++++-------
1 file changed, 58 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index c3e5c1848f53..7ed0fb6b4abb 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -30,18 +30,46 @@
#include "kpc.h"

static struct mtd_partition p2kr0_spi0_parts[] = {
- { .name = "SLOT_0", .size = 7798784, .offset = 0, },
- { .name = "SLOT_1", .size = 7798784, .offset = MTDPART_OFS_NXTBLK},
- { .name = "SLOT_2", .size = 7798784, .offset = MTDPART_OFS_NXTBLK},
- { .name = "SLOT_3", .size = 7798784, .offset = MTDPART_OFS_NXTBLK},
- { .name = "CS0_EXTRA", .size = MTDPART_SIZ_FULL, .offset = MTDPART_OFS_NXTBLK},
+ {.name = "SLOT_0",
+ .size = 7798784,
+ .offset = 0,},
+
+ {.name = "SLOT_1",
+ .size = 7798784,
+ .offset = MTDPART_OFS_NXTBLK},
+
+ {.name = "SLOT_2",
+ .size = 7798784,
+ .offset = MTDPART_OFS_NXTBLK},
+
+ {.name = "SLOT_3",
+ .size = 7798784,
+ .offset = MTDPART_OFS_NXTBLK},
+
+ {.name = "CS0_EXTRA",
+ .size = MTDPART_SIZ_FULL,
+ .offset = MTDPART_OFS_NXTBLK},
};
static struct mtd_partition p2kr0_spi1_parts[] = {
- { .name = "SLOT_4", .size = 7798784, .offset = 0, },
- { .name = "SLOT_5", .size = 7798784, .offset = MTDPART_OFS_NXTBLK},
- { .name = "SLOT_6", .size = 7798784, .offset = MTDPART_OFS_NXTBLK},
- { .name = "SLOT_7", .size = 7798784, .offset = MTDPART_OFS_NXTBLK},
- { .name = "CS1_EXTRA", .size = MTDPART_SIZ_FULL, .offset = MTDPART_OFS_NXTBLK},
+ {.name = "SLOT_4",
+ .size = 7798784,
+ .offset = 0,},
+
+ {.name = "SLOT_5",
+ .size = 7798784,
+ .offset = MTDPART_OFS_NXTBLK},
+
+ {.name = "SLOT_6",
+ .size = 7798784,
+ .offset = MTDPART_OFS_NXTBLK},
+
+ {.name = "SLOT_7",
+ .size = 7798784,
+ .offset = MTDPART_OFS_NXTBLK},
+
+ {.name = "CS1_EXTRA",
+ .size = MTDPART_SIZ_FULL,
+ .offset = MTDPART_OFS_NXTBLK},
};

static struct flash_platform_data p2kr0_spi0_pdata = {
@@ -182,7 +210,8 @@ kp_spi_write_reg(struct kp_spi_controller_state *cs, int idx, u64 val)
}

static int
-kp_spi_wait_for_reg_bit(struct kp_spi_controller_state *cs, int idx, unsigned long bit)
+kp_spi_wait_for_reg_bit(struct kp_spi_controller_state *cs, int idx,
+ unsigned long bit)
{
unsigned long timeout;
timeout = jiffies + msecs_to_jiffies(1000);
@@ -215,7 +244,9 @@ kp_spi_txrx_pio(struct spi_device *spidev, struct spi_transfer *transfer)
for (i = 0 ; i < c ; i++) {
char val = *tx++;

- if (kp_spi_wait_for_reg_bit(cs, KP_SPI_REG_STATUS, KP_SPI_REG_STATUS_TXS) < 0) {
+ if (kp_spi_wait_for_reg_bit(cs, KP_SPI_REG_STATUS,
+ KP_SPI_REG_STATUS_TXS)
+ < 0) {
goto out;
}

@@ -229,7 +260,9 @@ kp_spi_txrx_pio(struct spi_device *spidev, struct spi_transfer *transfer)

kp_spi_write_reg(cs, KP_SPI_REG_TXDATA, 0x00);

- if (kp_spi_wait_for_reg_bit(cs, KP_SPI_REG_STATUS, KP_SPI_REG_STATUS_RXS) < 0) {
+ if (kp_spi_wait_for_reg_bit(cs, KP_SPI_REG_STATUS,
+ KP_SPI_REG_STATUS_RXS)
+ < 0) {
goto out;
}

@@ -239,8 +272,10 @@ kp_spi_txrx_pio(struct spi_device *spidev, struct spi_transfer *transfer)
}
}

- if (kp_spi_wait_for_reg_bit(cs, KP_SPI_REG_STATUS, KP_SPI_REG_STATUS_EOT) < 0) {
- //TODO: Figure out how to abort transaction?? This has never happened in practice though...
+ if (kp_spi_wait_for_reg_bit(cs, KP_SPI_REG_STATUS,
+ KP_SPI_REG_STATUS_EOT) < 0) {
+ //TODO: Figure out how to abort transaction??
+ //Ths has never happened in practice though...
}

out:
@@ -307,7 +342,8 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
void *rx_buf = transfer->rx_buf;
unsigned len = transfer->len;

- if (transfer->speed_hz > KP_SPI_CLK || (len && !(rx_buf || tx_buf))) {
+ if (transfer->speed_hz > KP_SPI_CLK ||
+ (len && !(rx_buf || tx_buf))) {
dev_dbg(kpspi->dev, " transfer: %d Hz, %d %s%s, %d bpw\n",
transfer->speed_hz,
len,
@@ -317,7 +353,8 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
dev_dbg(kpspi->dev, " transfer -EINVAL\n");
return -EINVAL;
}
- if (transfer->speed_hz && (transfer->speed_hz < (KP_SPI_CLK >> 15))) {
+ if (transfer->speed_hz && (transfer->speed_hz <
+ (KP_SPI_CLK >> 15))) {
dev_dbg(kpspi->dev, "speed_hz %d below minimum %d Hz\n",
transfer->speed_hz,
KP_SPI_CLK >> 15);
@@ -332,14 +369,16 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
kp_spi_write_reg(cs, KP_SPI_REG_CONFIG, sc.reg);

/* work */
- if (kp_spi_wait_for_reg_bit(cs, KP_SPI_REG_STATUS, KP_SPI_REG_STATUS_EOT) < 0) {
+ if (kp_spi_wait_for_reg_bit(cs, KP_SPI_REG_STATUS,
+ KP_SPI_REG_STATUS_EOT) < 0) {
dev_info(kpspi->dev, "EOT timed out\n");
goto out;
}

/* do the transfers for this message */
list_for_each_entry(transfer, &m->transfers, transfer_list) {
- if (transfer->tx_buf == NULL && transfer->rx_buf == NULL && transfer->len) {
+ if (!transfer->tx_buf && !transfer->rx_buf &&
+ transfer->len) {
status = -EINVAL;
goto error;
}
--
2.17.1
\
 
 \ /
  Last update: 2019-06-25 13:36    [W:0.090 / U:15.320 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site