Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2413307pxt; Sun, 8 Aug 2021 23:07:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPYlYT40ApLOJK7shZVEj5FWb3ri716ZBUGTVaRM7VdPZwLGGTo/a/GAKXITYSV5pbA5w6 X-Received: by 2002:aa7:de05:: with SMTP id h5mr11323015edv.174.1628489257814; Sun, 08 Aug 2021 23:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628489257; cv=none; d=google.com; s=arc-20160816; b=KQJSu8YU7plAdljo26QcEzJYRQQudNtG/VI3L6N3laBH/e1AUTPSkwFrZxiFM7vEUu Ao8c1lk8nqAyaqZGBhDLu6AUfHTLXbCdZn4oVpNx1DhFd0hEzVvxwaXLOE/b5K1AKVcT HRIyf6tB+VOE+xIMh7LikKE73BittNOUcm5QdhxK75+Iiml7a29144Ah3zC0xYyAkOlT uMo0Kqy72t/PYw4pQmdbTvUpcOGh/PKfbpZfvRC95uys6sw0DN3Km9gJs7VFyI7JwOXs ix+HGn1dSmeFdcxEGjJUMqub7YM3jmYBCmLxVITm0FiBRCN1xoaipvZz60rvk5PYJi+w 7QAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=Av1FKeYu1z/VWgKC9y5t7+3kAZ/v8dv/qaOg6VQNSCs=; b=w8JI83liHoUG2XH0FD6E3JDuD3oCgjlyUGSYnxRi0uFfVf8n/CDh9sc3GHIueBpWRl 9hZ0FsJ7jHUAIVl1/Vzp/ZN6wddXk9Dl2D6RrEj53x0j/U9EfuzrAviEGfaNrq0rPuOy qM4hIQ0dUu2O+1LycBguO6tvIis8o15A/D4SETm2twvszcpSLT2ahBNc+bBKsWGGNRfZ u6EliyFnuIyChHWNPq5J/hq9Dq+c6DrX0nNtlHM6Aqo6w4us4JCh9ES7ZSsi24ThnrZm CPV9+htmzAouPfmWVsmgRnVfftd7xpwM5p9uuaX5K76PJs54+nRn+HZihzRp3KUtELV9 VXCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ec14si3112870edb.84.2021.08.08.23.07.14; Sun, 08 Aug 2021 23:07:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233022AbhHIGB6 (ORCPT + 99 others); Mon, 9 Aug 2021 02:01:58 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:51390 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229483AbhHIGB6 (ORCPT ); Mon, 9 Aug 2021 02:01:58 -0400 X-UUID: 9113354633154d349f0240378f5a3eba-20210809 X-UUID: 9113354633154d349f0240378f5a3eba-20210809 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 625483577; Mon, 09 Aug 2021 14:01:32 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 9 Aug 2021 14:01:32 +0800 Received: from localhost.localdomain (10.15.20.246) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 9 Aug 2021 14:01:31 +0800 From: Mason Zhang To: Mark Brown , Matthias Brugger CC: , , , , , Mason Zhang Subject: [PATCH 1/1] spi: mediatek: fix build warnning in set cs timing Date: Mon, 9 Aug 2021 13:59:12 +0800 Message-ID: <20210809055911.17538-1-Mason.Zhang@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org this patch fixed the build warnning in set cs timing. Signed-off-by: Mason Zhang --- drivers/spi/spi-mt65xx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index bb09592bc009..2f83599642fd 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -214,7 +214,7 @@ static int mtk_spi_set_hw_cs_timing(struct spi_device *spi) struct spi_delay *cs_setup = &spi->cs_setup; struct spi_delay *cs_hold = &spi->cs_hold; struct spi_delay *cs_inactive = &spi->cs_inactive; - u16 setup, hold, inactive; + u32 setup, hold, inactive; u32 reg_val; int delay; @@ -239,8 +239,8 @@ static int mtk_spi_set_hw_cs_timing(struct spi_device *spi) reg_val = readl(mdata->base + SPI_CFG0_REG); if (mdata->dev_comp->enhance_timing) { - hold = min(hold, 0xffff); - setup = min(setup, 0xffff); + hold = min_t(u32, hold, 0x10000); + setup = min_t(u32, setup, 0x10000); reg_val &= ~(0xffff << SPI_ADJUST_CFG0_CS_HOLD_OFFSET); reg_val |= (((hold - 1) & 0xffff) << SPI_ADJUST_CFG0_CS_HOLD_OFFSET); @@ -248,8 +248,8 @@ static int mtk_spi_set_hw_cs_timing(struct spi_device *spi) reg_val |= (((setup - 1) & 0xffff) << SPI_ADJUST_CFG0_CS_SETUP_OFFSET); } else { - hold = min(hold, 0xff); - setup = min(setup, 0xff); + hold = min_t(u32, hold, 0x100); + setup = min_t(u32, setup, 0x100); reg_val &= ~(0xff << SPI_CFG0_CS_HOLD_OFFSET); reg_val |= (((hold - 1) & 0xff) << SPI_CFG0_CS_HOLD_OFFSET); reg_val &= ~(0xff << SPI_CFG0_CS_SETUP_OFFSET); @@ -258,7 +258,7 @@ static int mtk_spi_set_hw_cs_timing(struct spi_device *spi) } writel(reg_val, mdata->base + SPI_CFG0_REG); - inactive = min(inactive, 0xff); + inactive = min_t(u32, inactive, 0x100); reg_val = readl(mdata->base + SPI_CFG1_REG); reg_val &= ~SPI_CFG1_CS_IDLE_MASK; reg_val |= (((inactive - 1) & 0xff) << SPI_CFG1_CS_IDLE_OFFSET); -- 2.18.0