drivers/spi: Get QMSI shim driver following syntax rules

Even one liner if () should have get { ... }

Change-Id: I7f9d8d74398286e97549bed050e29d4d175e1b02
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2017-04-03 12:51:46 +02:00 committed by Anas Nashif
commit e9e78878d0

View file

@ -65,8 +65,9 @@ static void spi_control_cs(struct device *dev, bool active)
const struct spi_qmsi_config *config = dev->config->config_info; const struct spi_qmsi_config *config = dev->config->config_info;
struct device *gpio = context->gpio_cs; struct device *gpio = context->gpio_cs;
if (!gpio) if (!gpio) {
return; return;
}
gpio_pin_write(gpio, config->cs_pin, !active); gpio_pin_write(gpio, config->cs_pin, !active);
} }
@ -99,8 +100,9 @@ static void transfer_complete(void *data, int error, qm_spi_status_t status,
struct device *dev = pending->dev; struct device *dev = pending->dev;
struct spi_qmsi_runtime *context; struct spi_qmsi_runtime *context;
if (!dev) if (!dev) {
return; return;
}
context = dev->driver_data; context = dev->driver_data;
@ -121,12 +123,17 @@ static int spi_qmsi_slave_select(struct device *dev, u32_t slave)
static inline u8_t frame_size_to_dfs(qm_spi_frame_size_t frame_size) static inline u8_t frame_size_to_dfs(qm_spi_frame_size_t frame_size)
{ {
if (frame_size <= QM_SPI_FRAME_SIZE_8_BIT) if (frame_size <= QM_SPI_FRAME_SIZE_8_BIT) {
return 1; return 1;
if (frame_size <= QM_SPI_FRAME_SIZE_16_BIT) }
if (frame_size <= QM_SPI_FRAME_SIZE_16_BIT) {
return 2; return 2;
if (frame_size <= QM_SPI_FRAME_SIZE_32_BIT) }
if (frame_size <= QM_SPI_FRAME_SIZE_32_BIT) {
return 4; return 4;
}
/* This should never happen, it will crash later on. */ /* This should never happen, it will crash later on. */
return 0; return 0;
@ -166,19 +173,20 @@ static int spi_qmsi_transceive(struct device *dev,
xfer->callback_data = dev; xfer->callback_data = dev;
xfer->callback = transfer_complete; xfer->callback = transfer_complete;
if (tx_buf_len == 0) if (tx_buf_len == 0) {
cfg->transfer_mode = QM_SPI_TMOD_RX; cfg->transfer_mode = QM_SPI_TMOD_RX;
else if (rx_buf_len == 0) } else if (rx_buf_len == 0) {
cfg->transfer_mode = QM_SPI_TMOD_TX; cfg->transfer_mode = QM_SPI_TMOD_TX;
else { } else {
/* FIXME: QMSI expects rx_buf_len and tx_buf_len to /* FIXME: QMSI expects rx_buf_len and tx_buf_len to
* have the same size. * have the same size.
*/ */
cfg->transfer_mode = QM_SPI_TMOD_TX_RX; cfg->transfer_mode = QM_SPI_TMOD_TX_RX;
} }
if (context->loopback) if (context->loopback) {
QM_SPI[spi]->ctrlr0 |= BIT(11); QM_SPI[spi]->ctrlr0 |= BIT(11);
}
rc = qm_spi_set_config(spi, cfg); rc = qm_spi_set_config(spi, cfg);
if (rc != 0) { if (rc != 0) {
@ -211,12 +219,14 @@ static struct device *gpio_cs_init(const struct spi_qmsi_config *config)
{ {
struct device *gpio; struct device *gpio;
if (!config->cs_port) if (!config->cs_port) {
return NULL; return NULL;
}
gpio = device_get_binding(config->cs_port); gpio = device_get_binding(config->cs_port);
if (!gpio) if (!gpio) {
return NULL; return NULL;
}
if (gpio_pin_configure(gpio, config->cs_pin, GPIO_DIR_OUT) != 0) { if (gpio_pin_configure(gpio, config->cs_pin, GPIO_DIR_OUT) != 0) {
return NULL; return NULL;