Message ID | 20230710154932.68377-11-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5138162vqx; Mon, 10 Jul 2023 09:19:35 -0700 (PDT) X-Google-Smtp-Source: APBJJlENtxBzxLU+P50C9taCSySmluUpq0PunMau7IsPjW0QdyY/f5Tfktw3MKU8wyGPHb6/FbPU X-Received: by 2002:a17:906:77c7:b0:993:f6c8:3007 with SMTP id m7-20020a17090677c700b00993f6c83007mr9057505ejn.12.1689005975320; Mon, 10 Jul 2023 09:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005975; cv=none; d=google.com; s=arc-20160816; b=jlr8uleOqKTzkylpfxrX+FYcgHHq+792WbAP00eJDR3kvfaYs+GTRZJzc5m1iWh8Wi lcPfHK9moD9h6bXkJibns8VWRGZN+fgc5/1oKFQUrxU8fu9xRKkEgDf7Ec0pPAO2xkcR bLOBhPlHh3QYbGprXvXhL37dmrDT3qEnDBt9LnAjdZQhi51SfyEMY6T7l5coK4XenVMV bG9+8LvInxPoaqqfU72ej/x9fUKAE+ZnUN+K6SWvLEvZfXOfyHbAvlBbcdpKZX7gMyU4 CqQIu4ol9kwd7zssLaMumdIk6pL6PPZpgXT0uzCta8X8mmcNrE7zXVaWOam8u+llaq3y dy6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yBZbHOlD6VizGIM1DeGRe0RTGa+49mLhN6tQEmZZZvE=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=O3nDpdlSnjtDh8d7MCMXD9df48m0Q/1vGzN7R2hJ5F7WbtbN5tYjLZJ/cTAQmzVcSW wrkV1j9gvH0KP5JS8rUD6Aufu8h7CmhRABVwugivg5dQ7XLmXmS1+2PS4K624CrgDpBz tIt6ePbRfsFEUTFye/yISidPQgHsodzzHBk7DW30/TgqBcIyJTqJ4OKJZlJHn3Z0kNLL 76pdiRn52+abNS5ethaFfBXQRMFOAhCMFOvujGkafGkhvtfLyf2/dU5D4C4MIVXNUlua bHch6arc2qtWhzDSb1ScEfRNAC3kbTxHlxscbJfE2es5ckMsiixtoPalkRsxienytGlc +1xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dkGOw8BS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020a1709067c5400b00992dc9d3b33si10195811ejp.863.2023.07.10.09.19.08; Mon, 10 Jul 2023 09:19:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dkGOw8BS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233613AbjGJPuX (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Mon, 10 Jul 2023 11:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233600AbjGJPty (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 10 Jul 2023 11:49:54 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3C5F19F; Mon, 10 Jul 2023 08:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004193; x=1720540193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iFM79YydR4MNlFIdl2NOHjMiuF+oxhq3YQtKaR8hU0E=; b=dkGOw8BSqNgYKRRwGpM3Yhu2OqwWEmJ3SBCvsWf+LarNUrKLz4WaAm/n xhSqbIR3a3EARtoOdvyUDp1nqApvAgC9oVToech6UUcjedf1itsBrN6JO uvSH9Mh6M5PnoeGfZqpXuGHvAAe92nMI9GU7ZfMiWuUxeWKklEDpM4NI0 J/sBa3Rx2wCZwSpG0jkTeXyummVoEf92xUJRHDcTvJZKUCduFdCAebDni 4d4ZfSDCcwpUBnyt4qvtf03+8v/7Wm+BUyNhJJ154UwnoxYrwys3hnr2S 3FQsaykPF3gf4Ksmn7Yx/r7eSpFxro7AZ6CEGgPivNr0nBqXNoPUoqbgv A==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361842544" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="361842544" 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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771051129450022619 X-GMAIL-MSGID: 1771051129450022619 |
Series |
spi: Header and core clean up and refactoring
|
|
Commit Message
Andy Shevchenko
July 10, 2023, 3:49 p.m. UTC
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(-)
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); } /*---------------------------------------------------------------------------*/