drivers/spi: Apply syntax rules on DW drivers
One liners if/for/while statements still need {} (and line break are cheap for clarity). Aligning parameters properly. Also, removing __func__ usage from SYS_LOG_* as these macros already put it internally. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
96def63f10
commit
18991a2781
2 changed files with 21 additions and 12 deletions
|
@ -69,15 +69,18 @@ static void completed(struct device *dev, int error)
|
|||
* 3. spi_read - need rx_buf_len zero.
|
||||
*/
|
||||
if (spi->tx_buf && spi->rx_buf) {
|
||||
if (!spi->last_tx || spi->rx_buf_len)
|
||||
if (!spi->last_tx || spi->rx_buf_len) {
|
||||
return;
|
||||
}
|
||||
} else if (spi->tx_buf) {
|
||||
if (!spi->last_tx)
|
||||
if (!spi->last_tx) {
|
||||
return;
|
||||
}
|
||||
} else { /* or, spi->rx_buf!=0 */
|
||||
if (spi->rx_buf_len)
|
||||
if (spi->rx_buf_len) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
/* need to give time for FIFOs to drain before issuing more commands */
|
||||
|
@ -116,10 +119,12 @@ static void push_data(struct device *dev)
|
|||
} else {
|
||||
f_tx = DW_SPI_FIFO_DEPTH - read_txflr(info->regs);
|
||||
}
|
||||
|
||||
if (f_tx && (spi->tx_buf_len == 0)) {
|
||||
/* room in fifo, yet nothing to send */
|
||||
spi->last_tx = 1; /* setting last_tx indicates TX is done */
|
||||
}
|
||||
|
||||
while (f_tx) {
|
||||
if (spi->tx_buf && spi->tx_buf_len > 0) {
|
||||
switch (spi->dfs) {
|
||||
|
@ -226,11 +231,11 @@ static int spi_dw_configure(struct device *dev,
|
|||
u32_t ctrlr0 = 0;
|
||||
u32_t mode;
|
||||
|
||||
SYS_LOG_DBG("%s: %p (0x%x), %p", __func__, dev, info->regs, config);
|
||||
SYS_LOG_DBG("%p (0x%x), %p", dev, info->regs, config);
|
||||
|
||||
/* Check status */
|
||||
if (!_spi_dw_is_controller_ready(dev)) {
|
||||
SYS_LOG_DBG("%s: Controller is busy", __func__);
|
||||
SYS_LOG_DBG("Controller is busy");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
@ -280,7 +285,7 @@ static int spi_dw_slave_select(struct device *dev, u32_t slave)
|
|||
{
|
||||
struct spi_dw_data *spi = dev->driver_data;
|
||||
|
||||
SYS_LOG_DBG("%s: %p %d", __func__, dev, slave);
|
||||
SYS_LOG_DBG("%p %d", dev, slave);
|
||||
|
||||
if (slave == 0 || slave > 16) {
|
||||
return -EINVAL;
|
||||
|
@ -300,12 +305,12 @@ static int spi_dw_transceive(struct device *dev,
|
|||
u32_t rx_thsld = DW_SPI_RXFTLR_DFLT;
|
||||
u32_t imask;
|
||||
|
||||
SYS_LOG_DBG("%s: %p, %p, %u, %p, %u",
|
||||
__func__, dev, tx_buf, tx_buf_len, rx_buf, rx_buf_len);
|
||||
SYS_LOG_DBG("%p, %p, %u, %p, %u",
|
||||
dev, tx_buf, tx_buf_len, rx_buf, rx_buf_len);
|
||||
|
||||
/* Check status */
|
||||
if (!_spi_dw_is_controller_ready(dev)) {
|
||||
SYS_LOG_DBG("%s: Controller is busy", __func__);
|
||||
SYS_LOG_DBG("Controller is busy");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,10 @@ struct spi_config {
|
|||
u32_t max_sys_freq;
|
||||
};
|
||||
|
||||
struct spi_buf {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef spi_api_configure
|
||||
* @brief Callback API upon configuring the const controller
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue