Skip to content

Commit 3dd5ed1

Browse files
geertubroonie
authored andcommitted
spi: sh-msiof: Use bool for boolean flags
Use bools instead of integers for boolean flags, which allows us to remove the "!!" idiom from several expressions. Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://patch.msgid.link/35cd51bdfb3c810911a5be757e0ce5bb29dcc755.1747401908.git.geert+renesas@glider.be Signed-off-by: Mark Brown <[email protected]>
1 parent 74df74e commit 3dd5ed1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/spi/spi-sh-msiof.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,11 @@ static u32 sh_msiof_spi_get_dtdl_and_syncdl(struct sh_msiof_spi_priv *p)
348348
}
349349

350350
static void sh_msiof_spi_set_pin_regs(struct sh_msiof_spi_priv *p, u32 ss,
351-
u32 cpol, u32 cpha,
352-
u32 tx_hi_z, u32 lsb_first, u32 cs_high)
351+
bool cpol, bool cpha, bool tx_hi_z,
352+
bool lsb_first, bool cs_high)
353353
{
354+
bool edge;
354355
u32 tmp;
355-
int edge;
356356

357357
/*
358358
* CPOL CPHA TSCKIZ RSCKIZ TEDG REDG
@@ -587,20 +587,20 @@ static int sh_msiof_prepare_message(struct spi_controller *ctlr,
587587
{
588588
struct sh_msiof_spi_priv *p = spi_controller_get_devdata(ctlr);
589589
const struct spi_device *spi = msg->spi;
590-
u32 ss, cs_high;
590+
bool cs_high;
591+
u32 ss;
591592

592593
/* Configure pins before asserting CS */
593594
if (spi_get_csgpiod(spi, 0)) {
594595
ss = ctlr->unused_native_cs;
595596
cs_high = p->native_cs_high;
596597
} else {
597598
ss = spi_get_chipselect(spi, 0);
598-
cs_high = !!(spi->mode & SPI_CS_HIGH);
599+
cs_high = spi->mode & SPI_CS_HIGH;
599600
}
600-
sh_msiof_spi_set_pin_regs(p, ss, !!(spi->mode & SPI_CPOL),
601-
!!(spi->mode & SPI_CPHA),
602-
!!(spi->mode & SPI_3WIRE),
603-
!!(spi->mode & SPI_LSB_FIRST), cs_high);
601+
sh_msiof_spi_set_pin_regs(p, ss, spi->mode & SPI_CPOL,
602+
spi->mode & SPI_CPHA, spi->mode & SPI_3WIRE,
603+
spi->mode & SPI_LSB_FIRST, cs_high);
604604
return 0;
605605
}
606606

0 commit comments

Comments
 (0)