Skip to content

Commit bea75bb

Browse files
maass-hamburgkartben
authored andcommitted
drivers: spi: remove spi_cs_is_gpio checks
remove spi_cs_is_gpio checks before spi_context_cs_control, as it is also done inside and we don't need to check two times. Signed-off-by: Fin Maaß <[email protected]>
1 parent 3f4f896 commit bea75bb

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

drivers/spi/spi_b91.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,17 +398,13 @@ static int spi_b91_transceive(const struct device *dev,
398398
spi_context_buffers_setup(&data->ctx, tx_bufs, rx_bufs, 1);
399399

400400
/* if cs is defined: software cs control, set active true */
401-
if (spi_cs_is_gpio(config)) {
402-
spi_context_cs_control(&data->ctx, true);
403-
}
401+
spi_context_cs_control(&data->ctx, true);
404402

405403
/* transceive data */
406404
spi_b91_txrx(dev, txrx_len);
407405

408406
/* if cs is defined: software cs control, set active false */
409-
if (spi_cs_is_gpio(config)) {
410-
spi_context_cs_control(&data->ctx, false);
411-
}
407+
spi_context_cs_control(&data->ctx, false);
412408

413409
/* release context */
414410
status = spi_context_wait_for_completion(&data->ctx);

drivers/spi/spi_numaker.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,7 @@ static int spi_numaker_transceive(const struct device *dev, const struct spi_con
251251
spi_context_buffers_setup(&data->ctx, tx_bufs, rx_bufs, spi_dfs);
252252

253253
/* if cs is defined: software cs control, set active true */
254-
if (spi_cs_is_gpio(config)) {
255-
spi_context_cs_control(&data->ctx, true);
256-
}
254+
spi_context_cs_control(&data->ctx, true);
257255

258256
/* transceive tx/rx data */
259257
do {
@@ -264,9 +262,7 @@ static int spi_numaker_transceive(const struct device *dev, const struct spi_con
264262
} while (spi_numaker_remain_words(data));
265263

266264
/* if cs is defined: software cs control, set active false */
267-
if (spi_cs_is_gpio(config)) {
268-
spi_context_cs_control(&data->ctx, false);
269-
}
265+
spi_context_cs_control(&data->ctx, false);
270266
SPI_DISABLE(dev_cfg->spi);
271267

272268
done:

0 commit comments

Comments
 (0)