Message ID | 20230710154932.68377-11-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C3A0EB64D9 for <linux-mediatek@archiver.kernel.org>; Mon, 10 Jul 2023 15:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yBZbHOlD6VizGIM1DeGRe0RTGa+49mLhN6tQEmZZZvE=; b=ewn9GYL/rd/fI/2IeUBNCicY2d FCZ7qbXCUzwVzRH741M4v1yZBIkFyxV225e5pOvtVFvZoWOYSdHT5kqht9gJ/8JpC302xLJa+s1Aq TsfZhMizQvU6G9+LASXBTJE7LA4JqZzHWNKyxZwb1IH1wJ8uRLnJwz8BJ5Zb89rgOgsp+fSwEv30a lPXfmDMLUaaaP7nDN3JCdEzJqjgzLT3KEmOtkITnivUBcFfX3RYGZrr3QvN71FcsuE74vjhngX0lK 1awfCB+/X5OGJ6J9iCe/R4niKo1pM3Mp4YK/ZdODtgrAG9QW8SnE5clrex1fNcqg2/fvyENGZto+H TTLB3vYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qIt9y-00C4hr-04; Mon, 10 Jul 2023 15:50:46 +0000 Received: from mga11.intel.com ([192.55.52.93]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qIt98-00C3mb-1w; Mon, 10 Jul 2023 15:49:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004194; x=1720540194; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iFM79YydR4MNlFIdl2NOHjMiuF+oxhq3YQtKaR8hU0E=; b=KbH/OIhir3H0b+T3sLjom2qsVMACoyU0Crzw0MvKgq+9fh5rmbTmikAy IJUpvMzQyfTZ47IVXVkB0pahgbWcLp3iNBSMaRF2Y4YdCJs39MN9+gKjx EsPxHoU57ZEyMDCV7/mssarCqNKAecNLZ90pdmK2LluroMxqdtMlrwLeZ WEVyGkEbUTdm8gwzry9ZxSY9mron+RggeudYlfQah7nHkfazPPVD1y+AL QAH2gRgLs32HoKS1OR8btUTJwsc9N2fb8PjTkreRveg4AlSCdhOUIqnRY gbeP2AOa5iXbdkXiedORwRzkEymTdzCeHQObZDsnHPpURkCzFw85QcMM7 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361842549" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="361842549" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="720743961" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="720743961" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2023 08:49:37 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B9DAD718; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Mark Brown <broonie@kernel.org>, Cristian Ciocaltea <cristian.ciocaltea@collabora.com>, Yang Yingliang <yangyingliang@huawei.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Amit Kumar Mahapatra via Alsa-devel <alsa-devel@alsa-project.org>, Neil Armstrong <neil.armstrong@linaro.org>, Tharun Kumar P <tharunkumar.pasumarthi@microchip.com>, Vijaya Krishna Nivarthi <quic_vnivarth@quicinc.com>, =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Sanjay R Mehta <sanju.mehta@amd.com>, Radu Pirea <radu_nicolae.pirea@upb.ro>, Nicolas Ferre <nicolas.ferre@microchip.com>, Alexandre Belloni <alexandre.belloni@bootlin.com>, Claudiu Beznea <claudiu.beznea@microchip.com>, Tudor Ambarus <tudor.ambarus@linaro.org>, Serge Semin <fancer.lancer@gmail.com>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Kevin Hilman <khilman@baylibre.com>, Jerome Brunet <jbrunet@baylibre.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Heiko Stuebner <heiko@sntech.de>, Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com>, Orson Zhai <orsonzhai@gmail.com>, Baolin Wang <baolin.wang@linux.alibaba.com>, Chunyan Zhang <zhang.lyra@gmail.com>, Alain Volmat <alain.volmat@foss.st.com>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Max Filippov <jcmvbkbc@gmail.com>, Steven Rostedt <rostedt@goodmis.org>, Masami Hiramatsu <mhiramat@kernel.org>, Richard Cochran <richardcochran@gmail.com> Subject: [PATCH v2 10/15] spi: Use predefined constants from bits.h and units.h Date: Mon, 10 Jul 2023 18:49:27 +0300 Message-Id: <20230710154932.68377-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230710154932.68377-1-andriy.shevchenko@linux.intel.com> References: <20230710154932.68377-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230710_084954_743151_E26F82BF X-CRM114-Status: GOOD ( 14.20 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-mediatek.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mediatek>, <mailto:linux-mediatek-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-mediatek/> List-Post: <mailto:linux-mediatek@lists.infradead.org> List-Help: <mailto:linux-mediatek-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mediatek>, <mailto:linux-mediatek-request@lists.infradead.org?subject=subscribe> Sender: "Linux-mediatek" <linux-mediatek-bounces@lists.infradead.org> Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org |
Series |
spi: Header and core clean up and refactoring
|
expand
|
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 9fb8efb068c6..10265184ea02 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -25,6 +25,7 @@ #include <linux/string.h> #include <linux/types.h> #include <linux/u64_stats_sync.h> +#include <linux/units.h> #include <asm/byteorder.h> @@ -1294,9 +1295,9 @@ static inline bool spi_is_bpw_supported(struct spi_device *spi, u32 bpw) static inline unsigned int spi_controller_xfer_timeout(struct spi_controller *ctlr, struct spi_transfer *xfer) { - u32 speed_hz = xfer->speed_hz ?: 100000; + u32 speed_hz = xfer->speed_hz ?: 100 * HZ_PER_KHZ; - return max(xfer->len * 8 * 2 / (speed_hz / 1000), 500U); + return max(xfer->len * BITS_PER_BYTE * 2 / (speed_hz / MILLI), 500UL); } /*---------------------------------------------------------------------------*/
Instead of hard coded numbers, use predefined constancts, such as BITS_PER_BYTE. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- include/linux/spi/spi.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)