Skip to content

Commit 5c842e5

Browse files
Mason Zhangbroonie
authored andcommitted
spi: mediatek: fix build warnning in set cs timing
this patch fixed the build warnning in set cs timing. Signed-off-by: Mason Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent d05aaa6 commit 5c842e5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/spi/spi-mt65xx.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static int mtk_spi_set_hw_cs_timing(struct spi_device *spi)
214214
struct spi_delay *cs_setup = &spi->cs_setup;
215215
struct spi_delay *cs_hold = &spi->cs_hold;
216216
struct spi_delay *cs_inactive = &spi->cs_inactive;
217-
u16 setup, hold, inactive;
217+
u32 setup, hold, inactive;
218218
u32 reg_val;
219219
int delay;
220220

@@ -239,17 +239,17 @@ static int mtk_spi_set_hw_cs_timing(struct spi_device *spi)
239239

240240
reg_val = readl(mdata->base + SPI_CFG0_REG);
241241
if (mdata->dev_comp->enhance_timing) {
242-
hold = min(hold, 0xffff);
243-
setup = min(setup, 0xffff);
242+
hold = min_t(u32, hold, 0x10000);
243+
setup = min_t(u32, setup, 0x10000);
244244
reg_val &= ~(0xffff << SPI_ADJUST_CFG0_CS_HOLD_OFFSET);
245245
reg_val |= (((hold - 1) & 0xffff)
246246
<< SPI_ADJUST_CFG0_CS_HOLD_OFFSET);
247247
reg_val &= ~(0xffff << SPI_ADJUST_CFG0_CS_SETUP_OFFSET);
248248
reg_val |= (((setup - 1) & 0xffff)
249249
<< SPI_ADJUST_CFG0_CS_SETUP_OFFSET);
250250
} else {
251-
hold = min(hold, 0xff);
252-
setup = min(setup, 0xff);
251+
hold = min_t(u32, hold, 0x100);
252+
setup = min_t(u32, setup, 0x100);
253253
reg_val &= ~(0xff << SPI_CFG0_CS_HOLD_OFFSET);
254254
reg_val |= (((hold - 1) & 0xff) << SPI_CFG0_CS_HOLD_OFFSET);
255255
reg_val &= ~(0xff << SPI_CFG0_CS_SETUP_OFFSET);
@@ -258,7 +258,7 @@ static int mtk_spi_set_hw_cs_timing(struct spi_device *spi)
258258
}
259259
writel(reg_val, mdata->base + SPI_CFG0_REG);
260260

261-
inactive = min(inactive, 0xff);
261+
inactive = min_t(u32, inactive, 0x100);
262262
reg_val = readl(mdata->base + SPI_CFG1_REG);
263263
reg_val &= ~SPI_CFG1_CS_IDLE_MASK;
264264
reg_val |= (((inactive - 1) & 0xff) << SPI_CFG1_CS_IDLE_OFFSET);

0 commit comments

Comments
 (0)