From patchwork Mon Jul 10 15:49:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5134036vqx; Mon, 10 Jul 2023 09:13:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlGnFoCAb7pm3fofODXBQf55IKEO697S+v6zqtGxmql7yxJkOvnnSSZJlfKdLbovekxgXwYY X-Received: by 2002:a17:902:b202:b0:1ae:626b:475f with SMTP id t2-20020a170902b20200b001ae626b475fmr9804221plr.12.1689005621428; Mon, 10 Jul 2023 09:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005621; cv=none; d=google.com; s=arc-20160816; b=fnVON+it8fg/LH8VNOSXgTWM3Qis/6Qgwz464O+Q7wJXzD7LBvsC8Zj0y2s35Inv9T gFTi/iP/MUbamlOxtIWgAs1jgxQHbidAexFObHMoajoEFLUD+uxnt79RZc/60QSHZdIu 4gZTpZvK2FV2DO32QdUCNR09B0rPmU6HOlnHAldeB3uDzrioORkTsJEda0vCgeKaPYfN TJufnLrKfqWu6CXa1dIHI4iahCD7lFOQVbBShJg5zX/69/dxezhF/qjK263IDtbJ5qyy HfPgBU3vJVTpiL2YXG8gzFST60NbattX+1MmqyVpQswpvN5uyzH6flxTMPOnyQ0Gh6z2 6A5g== 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=yonqcIdYIcSOrkp8Q9O3wO9J4Xret+9m7bgDiaovK/8=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=vVaKVlu4osqWTF2cObc78aezptj6Y6lTArxHNFtp5HEESgnKzbgKxHLgVOVklWgMdg PSW3edDZY/14m26F0ZWrse9Yz1FDjNbZl46EVtuJO6u0U+eAZI6igwsQKkBSKydjhG7h W0KZSKNnNQr5I55+HHqSfweoruyLy/iA3xVWJaDCvyjpD8SsvxK39e+EAh4+pbJcGaC2 SUTp9UC42lPOKp6D4tEmlWIqUNgr6XWxYvpVKtu8HKFQOUx+Wx3eWOkDoSUPvRdhCB6u +jzZVAyD3doV/9gA5VapXkBKWDC8LqWqohlBhFjvBU8wthVLd2dQh8y1Tvz0bWkU9UUz Wh4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Xt8gkiHk; 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 n4-20020a170903110400b001b54cd227c0si86576plh.115.2023.07.10.09.13.27; Mon, 10 Jul 2023 09:13:41 -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=Xt8gkiHk; 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 S232903AbjGJPty (ORCPT + 99 others); Mon, 10 Jul 2023 11:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233576AbjGJPtq (ORCPT ); Mon, 10 Jul 2023 11:49:46 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25DCA129; Mon, 10 Jul 2023 08:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004184; x=1720540184; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1YMEKoH26Jvs8dKIC6vdH9uSV/g2LDeyMP+ZqFMU56I=; b=Xt8gkiHk3aA3k/dAILBIpXCqRSLwugB3LtWxm1P44OCowTvz0NXjF5Cz 2Q0FS9CtqcK6S2JYYbSRmaiAqef9yD8/KmJOhROBmLl0yVpBBz3OU/hJi LYcDxvnDW1j60h1scix0HsPUDQaVFHv63482VlY6yE2PYX+s10QReEJQ7 bCJoXt21uVkOI+wG+0Krcol47keqjZXapZWQCIKLCn473PQ8ePNZ8x6cu PhbpsnhAHIPXtkqKfXy92wIRXngOsWSRpnfmbg3kpwkwkAF/iRJQWOke4 2D/60B12ZbI4CTQ9b0jW8ERenTVVLsrzZXkXqsjKXSb/hMOvKxGquJ51a w==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="366955259" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="366955259" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="671015611" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="671015611" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 10 Jul 2023 08:49:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1E05F1D9; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 01/15] spi: Remove unneeded OF node NULL checks Date: Mon, 10 Jul 2023 18:49:18 +0300 Message-Id: <20230710154932.68377-2-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 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050758630355863 X-GMAIL-MSGID: 1771050758630355863 In the couple of places the NULL check of OF node is implied by the call that takes it as a parameter. Drop the respective duplicate checks. Signed-off-by: Andy Shevchenko Reviewed-by: AngeloGioacchino Del Regno # --- drivers/spi/spi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 9291b2a0e887..8f3282a71c63 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2399,9 +2399,6 @@ static void of_register_spi_devices(struct spi_controller *ctlr) struct spi_device *spi; struct device_node *nc; - if (!ctlr->dev.of_node) - return; - for_each_available_child_of_node(ctlr->dev.of_node, nc) { if (of_node_test_and_set_flag(nc, OF_POPULATED)) continue; @@ -3134,7 +3131,7 @@ int spi_register_controller(struct spi_controller *ctlr) if (WARN(id < 0, "couldn't get idr")) return id == -ENOSPC ? -EBUSY : id; ctlr->bus_num = id; - } else if (ctlr->dev.of_node) { + } else { /* Allocate dynamic bus number using Linux idr */ id = of_alias_get_id(ctlr->dev.of_node, "spi"); if (id >= 0) { From patchwork Mon Jul 10 15:49:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5135728vqx; Mon, 10 Jul 2023 09:16:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlFmDzevwvz0Zr1gNwhbIUfYyB0MajSnNmiCNAzu+AjOcxhsdgaXMWPvZKAv7/B/AHjJNDVg X-Received: by 2002:a05:6a00:24d5:b0:682:bd6e:b16a with SMTP id d21-20020a056a0024d500b00682bd6eb16amr10918210pfv.14.1689005764665; Mon, 10 Jul 2023 09:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005764; cv=none; d=google.com; s=arc-20160816; b=KILfgmSvs+zmMlaFg4PWE2H+0Es1rLIxQ3A2b/LmgxvE7DQ+NR62wQPae9M2RnSlHL bcI5C91PjH+7WOTHf8NfopkDwCXt7hP26eE93SpAs9qDDBJpGfg1rwAwODmtY8Q8lKO+ JXuwO1xxkAHQP+cG7FFis72BNCa/0NFsbhN6WhOeRvemqvxC6y+yRwME1EdYujUIAOgu mI0HGHEUm702Dt+/eyPFkGbwxI0HmhIh32DII6iqN6K1IlXLeorpq+6GcgML9A3MN/ad sURP1BE+RuOKBG5vvv/AoQZ37MBFB3SMdksUtJ24lCiem6GbSXMnf68oagK/qk6/vUdq YjdA== 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=05Eo8yAcewTO+WPsEETnF/DlVCQ3v4XdrP+vRxVBOe8=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=gfphF41LWNQJhRoAzsE9zX1jRUHnJ54grVOx76nj9o2ptUESLArFuWrXNGKGEKMATB kAPnkgmFGxTRCSY2eAIXTRruTY5UYwkgsQJxA3Jf5opBqs8qiRgSGy/H5Q48uFGJfvYL zZOH7aFJOsmX222Pm/HM9h/CdgKFi4fXJFVu4Juaamht5cW2NlVs8fteAvwiRk0Jx4qs 0rkYHYhQuoRWoqNF1OHGGAo3RjTnkjjP7vLzPhDo/m8mfNUPDuc3wv0sw8EMPuvoEID9 Sel4j4LIkwyg2gY5ZpdokulstGgkGZHTJGeNx9K5IyCZQeb5JW48oI+GbeYmB2AQJYqe SJ8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UwygpstZ; 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 x22-20020aa784d6000000b00682c1cd974asi8579331pfn.379.2023.07.10.09.15.50; Mon, 10 Jul 2023 09:16:04 -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=UwygpstZ; 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 S233570AbjGJPto (ORCPT + 99 others); Mon, 10 Jul 2023 11:49:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233554AbjGJPtm (ORCPT ); Mon, 10 Jul 2023 11:49:42 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4090E11F; Mon, 10 Jul 2023 08:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004181; x=1720540181; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=REWyC/nAC6Z96ggpA1NLsyDE3cGETw1DuCTFixDA/T8=; b=UwygpstZm01bGkJjy4XU9BnFvg5PsxZxOMwSe9HDbbGLPoeppOUCS8tA y5w99YgV+9BUeGiEgqSsnfMTdlMJHQg0E8ooiQRulthMyD92Qey26oUR8 rHFVIhnoE79E0VjI4vJumbFIwXseC85q7u4O1akMJqp6DgtWaF0ZYs3kI 9q2wy9O0iJyTdPsA+ypVzqQEMl3KD4SB8RxKQKTdVLD/5gHO8eyrVQuuB 0Kl85W4bPU4Gf4sKVoktwg62seIZK9WGFh1bNrr7osAaR+zVmD7x1gmSz ZC8iBtt/CAhvmvaa/B9LZbgUDbulqZeW1OiqteCcqchAWuI7W9I6peaOY Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361842417" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="361842417" 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:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="720743949" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="720743949" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2023 08:49:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 36E48385; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 02/15] spi: Drop duplicate IDR allocation code in spi_register_controller() Date: Mon, 10 Jul 2023 18:49:19 +0300 Message-Id: <20230710154932.68377-3-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050908647866283 X-GMAIL-MSGID: 1771050908647866283 Refactor spi_register_controller() to drop duplicate IDR allocation. Instead of if-else-if branching use two sequential if:s, which allows to re-use the logic of IDR allocation in all cases. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 50 ++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 8f3282a71c63..6d74218cf38e 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3081,6 +3081,20 @@ static int spi_controller_check_ops(struct spi_controller *ctlr) return 0; } +/* Allocate dynamic bus number using Linux idr */ +static int spi_controller_id_alloc(struct spi_controller *ctlr, int start, int end) +{ + int id; + + mutex_lock(&board_lock); + id = idr_alloc(&spi_master_idr, ctlr, start, end, GFP_KERNEL); + mutex_unlock(&board_lock); + if (WARN(id < 0, "couldn't get idr")) + return id == -ENOSPC ? -EBUSY : id; + ctlr->bus_num = id; + return 0; +} + /** * spi_register_controller - register SPI master or slave controller * @ctlr: initialized master, originally from spi_alloc_master() or @@ -3108,8 +3122,8 @@ int spi_register_controller(struct spi_controller *ctlr) { struct device *dev = ctlr->dev.parent; struct boardinfo *bi; + int first_dynamic; int status; - int id, first_dynamic; if (!dev) return -ENODEV; @@ -3122,27 +3136,13 @@ int spi_register_controller(struct spi_controller *ctlr) if (status) return status; + if (ctlr->bus_num < 0) + ctlr->bus_num = of_alias_get_id(ctlr->dev.of_node, "spi"); if (ctlr->bus_num >= 0) { /* Devices with a fixed bus num must check-in with the num */ - mutex_lock(&board_lock); - id = idr_alloc(&spi_master_idr, ctlr, ctlr->bus_num, - ctlr->bus_num + 1, GFP_KERNEL); - mutex_unlock(&board_lock); - if (WARN(id < 0, "couldn't get idr")) - return id == -ENOSPC ? -EBUSY : id; - ctlr->bus_num = id; - } else { - /* Allocate dynamic bus number using Linux idr */ - id = of_alias_get_id(ctlr->dev.of_node, "spi"); - if (id >= 0) { - ctlr->bus_num = id; - mutex_lock(&board_lock); - id = idr_alloc(&spi_master_idr, ctlr, ctlr->bus_num, - ctlr->bus_num + 1, GFP_KERNEL); - mutex_unlock(&board_lock); - if (WARN(id < 0, "couldn't get idr")) - return id == -ENOSPC ? -EBUSY : id; - } + status = spi_controller_id_alloc(ctlr, ctlr->bus_num, ctlr->bus_num + 1); + if (status) + return status; } if (ctlr->bus_num < 0) { first_dynamic = of_alias_get_highest_id("spi"); @@ -3151,13 +3151,9 @@ int spi_register_controller(struct spi_controller *ctlr) else first_dynamic++; - mutex_lock(&board_lock); - id = idr_alloc(&spi_master_idr, ctlr, first_dynamic, - 0, GFP_KERNEL); - mutex_unlock(&board_lock); - if (WARN(id < 0, "couldn't get idr")) - return id; - ctlr->bus_num = id; + status = spi_controller_id_alloc(ctlr, first_dynamic, 0); + if (status) + return status; } ctlr->bus_lock_flag = 0; init_completion(&ctlr->xfer_completion); From patchwork Mon Jul 10 15:49:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117965 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5130510vqx; Mon, 10 Jul 2023 09:08:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlEh/FLmTHZLc8QN1cJpVKyj9VbLF/qUTAiloFTpuFJKT0g03b9FeudNcl/415wcDLiwHaho X-Received: by 2002:a19:2d46:0:b0:4f8:7754:62e1 with SMTP id t6-20020a192d46000000b004f8775462e1mr9567338lft.40.1689005336126; Mon, 10 Jul 2023 09:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005336; cv=none; d=google.com; s=arc-20160816; b=Gr9AOn0Qcsa9WH30+qqRGzxbso5dbgP5ms6nRo6/ZN7aAx7i4PZ2W6pG+fKWCtqrXv 82aZl1EHQ2aBa7ZfLSn8tDe2PYCj22pebLxn3eJ4m24uJKTI8yiZMte4A8x7TVvulpMa +uLM4hM7MDRwgtZv/YxgCa5EidAJqGwhE3YhsyJlUpeH8zB4TdYWeot1/HF72owF3mq0 RM3XTcddJN+6v5agPtzN4fNDJfIyw/A2UdPU5rJ6ZOOxBvalKcSz6+QyZ5zwytfGYW+b WB7QEqSUaQzI4jnIlsf+PyAJnwmEbKQ5o9Rjzd8bjWkLy+G7Eiw3jvvE+2M3jTPIKe+b 2wlQ== 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=w39HcD/C+m8DBdOohl92QIDnMjeqtcf1GqHEJ0IQ5f4=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=Cp/76UrVF5wLTUsghAwzs9qCK5uummVb6UwoRkWX/1hFUlmMsBlktVqvmwL9/xSNFc vZYER36xRzUy56QUdvJa1+IuLaIPxFgEFPpI7OqrJX8aD2T4ovTGiOyRe1zTYzj9dqJu e/w7Xnn6AB4j9h0AGfANf9iuz73T9Yz4ZVrb0QY89vPXdIAF8SNPRS230LxKA/44rOyP KRw5ByE+ElKdAjkGi9Csf1JuuUV4AjqDouhQYhP863/4Mf91o96srpM3pqbIj3KezWFD 8050ZhL+0h5Fs0AVBN+piRzULeE0B5gK6g72WDu1+YvalFPVWddr8Oh551Vd80rl97By EZUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="c9A/RJz0"; 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 z20-20020a170906241400b00992b521a3f6si9454691eja.24.2023.07.10.09.08.32; Mon, 10 Jul 2023 09:08:56 -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="c9A/RJz0"; 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 S233645AbjGJPt7 (ORCPT + 99 others); Mon, 10 Jul 2023 11:49:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233590AbjGJPtt (ORCPT ); Mon, 10 Jul 2023 11:49:49 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2854187; Mon, 10 Jul 2023 08:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004186; x=1720540186; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vBn0rQkEvhyNS8x5dx+OCo1BBkRa+6Quzvw7Xp2sQ+U=; b=c9A/RJz0XWvj4cFFGeif9AVCOZqiLSpQ8sgFktP0B1GyWNDV5yWYliDS 05KHFZC0+Aflt2QmRPURtcDynjEaHW0HtKYmn7JgxRIdS69U8fQUvtIdQ xGDcodwh1/1ESHelVNJzE0XQf4QzaMkifWvrZv5dQnVM5KALB92pYSyHZ sJZNiGxVw2IWpqBpTRECRpr5+8TZd+Dg9aNkjFTt0ZaMWNhZKAqNlPJBi 0mW8MNdcg6jq5LVKgknka2ruzDX1thNg60GNqMSUQ9Z0ok40Ui05s1brE pYcayTM9fWpDrbi/5/jBIfdKzI2yLH+YHa5B1uGZhoCVni9drxZO/H2/W A==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="349185378" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="349185378" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844921835" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844921835" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 08:49:31 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4B00D3E3; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 03/15] spi: Replace if-else-if by bitops and multiplications Date: Mon, 10 Jul 2023 18:49:20 +0300 Message-Id: <20230710154932.68377-4-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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050459361029212 X-GMAIL-MSGID: 1771050459361029212 Instead of if-else-if, simply call roundup_pow_of_two(BITS_PER_BYTES()). Note, there is no division assumed as compiler may optimize it away. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6d74218cf38e..125dea8fae00 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3643,13 +3643,7 @@ int spi_split_transfers_maxwords(struct spi_controller *ctlr, size_t maxsize; int ret; - if (xfer->bits_per_word <= 8) - maxsize = maxwords; - else if (xfer->bits_per_word <= 16) - maxsize = 2 * maxwords; - else - maxsize = 4 * maxwords; - + maxsize = maxwords * roundup_pow_of_two(BITS_TO_BYTES(xfer->bits_per_word)); if (xfer->len > maxsize) { ret = __spi_split_transfer_maxsize(ctlr, msg, &xfer, maxsize, gfp); From patchwork Mon Jul 10 15:49:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5125968vqx; Mon, 10 Jul 2023 09:03:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlHNTYOmYZdJ2XAG2v7PODdCA50v5Xg6xcV729lGL+k66D+s8HqfEYwcUjRZwp/4btH5IYMy X-Received: by 2002:a17:902:c3c6:b0:1b8:1c9e:444e with SMTP id j6-20020a170902c3c600b001b81c9e444emr14129818plj.25.1689005003642; Mon, 10 Jul 2023 09:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005003; cv=none; d=google.com; s=arc-20160816; b=TZgAdUS2S+YVFYEt8IpHHhrA/mmSHH9NvMJR9bYBLNKnn1cAA77D7ZUouR5xLFg0qK 1OZNaLAZYebzev+wyBue81rm4yZiYtMFCT0MS0UCGRa29eozYXWJW1fXY9hY9sxa3V1W 5jNSje4DPnTykakuJeVlKbX2m4Tox0bvU+D8dZrLifvyULkW9mtztWfIDc0JMkhHSz/R UOptLa/k02vvwCmQZIzikx6MM69+X0v+VKmtonC6xiv3X2q16XX5wEo8OqvEoVHW72dL dwmE3DM+p9n0p+K1Y0hCX7vWWU7bPTgItfMis+UhaXL86WgtTS/8CKaAV0bBuojQsPJa QvdA== 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=PWA7GIOFewi2OU47McNhmbZ1Ir0zrg7xiPluBsL/qi8=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=qGJgsuCPt2xeX7B0Z7golCIChVt5NR25AL4fqsnaFGxxBF16KdeoX6AqCF/ATmeefq K1NruBXIfGzBYWg28CJ5twQETdf1IEx4yuHIuSKfllI0nC6I7asxbgQuPJwz0V+gBKUD 2P+OCkEKFq3MVmB4jqrspTDZ1ZfOgV4sc2VCs/PfnNkyMKHtbRiRUFqvrdj7bmw/3Uq7 4EXVfiWkmO4WFgAEr0iluyUjs3k3XCvh0DD7DueH5fkxm/GJefX1qWaiQvo7sj/5ItMa t67qyrOQT1WWgw86O8ncgtiHSWRk/ia/rx8NhdzRJSG5qQTIrBkb7c+ldQ20fXzVLv24 wG0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LInZBwE6; 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 b7-20020a170902650700b001b9d2982362si76513plk.36.2023.07.10.09.03.08; Mon, 10 Jul 2023 09:03:23 -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=LInZBwE6; 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 S233555AbjGJPtu (ORCPT + 99 others); Mon, 10 Jul 2023 11:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233572AbjGJPtp (ORCPT ); Mon, 10 Jul 2023 11:49:45 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6492C10D; Mon, 10 Jul 2023 08:49:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004184; x=1720540184; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wJa3Jmu6iVXPZMGevJvu2fkKY/Gm2mVbHm4RgDFco0c=; b=LInZBwE6tEjIur82JS/nzgbv26KmwM6gQWfbFQKHJOsA4wNR8QALYJZl Q6Avc5vn6FbysTPj0MEVXon6sFKiFlQ/qZ5tLclW+3LO0cdC367RBj2fy Cwg1EPn5oj6a6oqnBsg4FS2QgGLXvzYeA/qocHSId4B3bJtL5YilS33TQ ftYPvM58RfjdYXOxJkh2rnAi2zi28fq2kR8M/iQz5jZwDEpFnyqsDuysq oEx9d4VElghXmIN8A33hARLqTGhMWM6nvGXiBmjb1hrG1uzgWTBxSBvvA RxEtWevkBwG2SJBJAB6Uo+p8D3zPR0j+vla8cSI2r5C8e/0T3BFV1D2Zo Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="349185345" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="349185345" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844921834" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844921834" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 08:49:31 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5A18C4BD; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 04/15] spi: Replace open coded spi_controller_xfer_timeout() Date: Mon, 10 Jul 2023 18:49:21 +0300 Message-Id: <20230710154932.68377-5-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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050110811315954 X-GMAIL-MSGID: 1771050110811315954 Since the new spi_controller_xfer_timeout() helper appeared, we may replace open coded variant in spi_transfer_wait(). Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 25 ++----------------------- include/linux/spi/spi.h | 6 +++++- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 125dea8fae00..c99ee4164f11 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1342,8 +1342,7 @@ static int spi_transfer_wait(struct spi_controller *ctlr, { struct spi_statistics __percpu *statm = ctlr->pcpu_statistics; struct spi_statistics __percpu *stats = msg->spi->pcpu_statistics; - u32 speed_hz = xfer->speed_hz; - unsigned long long ms; + unsigned long ms; if (spi_controller_is_slave(ctlr)) { if (wait_for_completion_interruptible(&ctlr->xfer_completion)) { @@ -1351,29 +1350,9 @@ static int spi_transfer_wait(struct spi_controller *ctlr, return -EINTR; } } else { - if (!speed_hz) - speed_hz = 100000; - - /* - * For each byte we wait for 8 cycles of the SPI clock. - * Since speed is defined in Hz and we want milliseconds, - * use respective multiplier, but before the division, - * otherwise we may get 0 for short transfers. - */ - ms = 8LL * MSEC_PER_SEC * xfer->len; - do_div(ms, speed_hz); - - /* - * Increase it twice and add 200 ms tolerance, use - * predefined maximum in case of overflow. - */ - ms += ms + 200; - if (ms > UINT_MAX) - ms = UINT_MAX; - + ms = spi_controller_xfer_timeout(ctlr, xfer); ms = wait_for_completion_timeout(&ctlr->xfer_completion, msecs_to_jiffies(ms)); - if (ms == 0) { SPI_STATISTICS_INCREMENT_FIELD(statm, timedout); SPI_STATISTICS_INCREMENT_FIELD(stats, timedout); diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 32c94eae8926..0ce1cb18a076 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1270,12 +1270,16 @@ static inline bool spi_is_bpw_supported(struct spi_device *spi, u32 bpw) * that it would take on a single data line and take twice this amount of time * with a minimum of 500ms to avoid false positives on loaded systems. * + * Assume speed to be 100 kHz if it's not defined at the time of invocation. + * * Returns: Transfer timeout value in milliseconds. */ static inline unsigned int spi_controller_xfer_timeout(struct spi_controller *ctlr, struct spi_transfer *xfer) { - return max(xfer->len * 8 * 2 / (xfer->speed_hz / 1000), 500U); + u32 speed_hz = xfer->speed_hz ?: 100000; + + return max(xfer->len * 8 * 2 / (speed_hz / 1000), 500U); } /*---------------------------------------------------------------------------*/ From patchwork Mon Jul 10 15:49:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117963 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5128043vqx; Mon, 10 Jul 2023 09:05:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGoX/A91RztrEcVw2ZzFEtaYB/+9yA8t1CNklI9SN4WF1S9a1uFHqpQS4NWogUToheeWBx0 X-Received: by 2002:a05:6808:1383:b0:3a1:b9d7:3821 with SMTP id c3-20020a056808138300b003a1b9d73821mr13763324oiw.37.1689005147157; Mon, 10 Jul 2023 09:05:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005147; cv=none; d=google.com; s=arc-20160816; b=0RTsDQDkw96hWkEJoGBk2ngbGzYtsc5zXDKHpCV0Ue1O6L6JVVtf4xXkLVDm3nUbdK fT6MhYuduS1H9hJdrlJMPX9EUtye3TqHd0mKfxyvI9DK7hJvbsnB5PwOHCGOm0plZyCX UNrG+Vc/gDqeL/Fy6OrzidRec7UhQd0MwHcpJJuF3IX1a9nsWcmLDRtajuJ8qdD0oynf 2S6Yc1NHK+2tBzzvVLFQkVYcVhiNLdXg7iX9LxP9Ok2k3vAmLNhnq0K4kRFKwhxZukqo iuxUxRMD5iSlPrMTriz04vGTVl370VF2Hd1Z28pP+aO/i7W1JyJYNOiBwjKGcdcUHq8r j0Lg== 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=dnF+LMHcVlGKDCydGVoyV5aZC40d8p/xMENgpGUnHO0=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=f+z3WDFbbRsw62SD//sB9m7q9wlNpYKhR6GkSpyI5ra2aC2VX1/47/SjjgcxmIRiOI WKvQ7LXySAfEyvhjye/W/8aiL0DpyGVuDZXWBbejEMCfGf3r+jGLe9NvsCUQyFO8MsOo bVkMeIEYLpapnjw4/JX4ojC1NMSLpfm0ZJGwJU8jZDFVDPOjtX5yXizGlZgU6OM6CNI3 ejOYXUi6ukMyqlvZFeKMm8nOL6iuLJ+Tn1xJrYQax85CLYHPT5LpKZtd96a8JQHWYICQ dnTcx+Gi7Q2eh7egKk+XTOVk6CSCnTq1A08Z3Z7j217evcs3LFcO/t0mDZnYyQRW41qb GB5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QZam7m3P; 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 26-20020a63195a000000b005577ad28a97si4288817pgz.633.2023.07.10.09.05.34; Mon, 10 Jul 2023 09:05:47 -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=QZam7m3P; 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 S233631AbjGJPt5 (ORCPT + 99 others); Mon, 10 Jul 2023 11:49:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233583AbjGJPts (ORCPT ); Mon, 10 Jul 2023 11:49:48 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25A25137; Mon, 10 Jul 2023 08:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004186; x=1720540186; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0v8XTkg22X4+SjZKJZYJseJJcu9T6jyLmPuYe7Mrmmg=; b=QZam7m3PSZMzi8qOur8uz44+WuSV1Ye2Ok33FuV6B0NUgKABvOXLDSeb deibbcVTr5wVEXsyZD4N4ftH4Ba52nW8f2MQtMlI/TucDm7s7IF9ZMFJm oTb0wS6f4qjjh0g/YE8o9kCQ9vHm7/OXRFsO4i0Ct0lLMAU5v/nahU8FS 2kyk4GqO8J2hMrusFVgTlMS9DIL2LGQnKfUFBzdTJFmaY+0t6rQ+MB93a muUyKeFEXzmavWsSR9xEpzWLXmnuWaOXxbL268sLLmVXwftsnSRsWMVsu FfY/ojY3Otv+covAncddYCHfsYyo0BQNgIJRInzb2YVzxLzlWIJTqGcW4 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="349185404" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="349185404" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844921854" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844921854" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 08:49:33 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6932A5FC; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 05/15] spi: Remove code duplication in spi_add_device_locked() Date: Mon, 10 Jul 2023 18:49:22 +0300 Message-Id: <20230710154932.68377-6-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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050261138228923 X-GMAIL-MSGID: 1771050261138228923 Seems by unknown reason, probably some kind of mis-rebase, the commit 0c79378c0199 ("spi: add ancillary device support") adds a dozen of duplicating lines of code. Drop them. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c99ee4164f11..46cbda383228 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -712,17 +712,6 @@ EXPORT_SYMBOL_GPL(spi_add_device); static int spi_add_device_locked(struct spi_device *spi) { struct spi_controller *ctlr = spi->controller; - struct device *dev = ctlr->dev.parent; - - /* Chipselects are numbered 0..max; validate. */ - if (spi_get_chipselect(spi, 0) >= ctlr->num_chipselect) { - dev_err(dev, "cs%d >= max %d\n", spi_get_chipselect(spi, 0), - ctlr->num_chipselect); - return -EINVAL; - } - - /* Set the bus ID string */ - spi_dev_set_name(spi); WARN_ON(!mutex_is_locked(&ctlr->add_lock)); return __spi_add_device(spi); From patchwork Mon Jul 10 15:49:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5143126vqx; Mon, 10 Jul 2023 09:27:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlHdgg3RcrGBA67l3On08ZpJPc28VVxz2vu+Mq5EK3iosEhIJ9lrvoFF1wXLSu2eSb+y51Cg X-Received: by 2002:a17:906:b50:b0:98d:ff8f:5d43 with SMTP id v16-20020a1709060b5000b0098dff8f5d43mr11172951ejg.74.1689006463663; Mon, 10 Jul 2023 09:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689006463; cv=none; d=google.com; s=arc-20160816; b=r3fQOHJL12vSLA56XteT4Fbyn9iMo67odvaC9Cx9LbsNxeC8g4r0v3b6eiX5PnH18Y AARSekzZG8FXkXAmgXBYqRh9kXyEo6dVbEK/+67lLO5EvOeVpobN4xo7RPUTpR9SdIr2 UydqdY6N0yQ6esy+SJxkwjtA3Y2rC/kpyE+zdvLzIozMWT7VJNP2jSYX2T13Xb2RGNOW FLICc47lipn/p6CJS9LTJj4CLoeBigyY2apKR+vJ59sVKkwPnPtPKeIHw7E0RCPvOkxp X4SjQ36ds3okS47YOWO5WDJqTvp9fITAnh1dVpeUrKRSxj09SX4J2pXNUMDR2nh4Vvxt pXvQ== 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=ECLAvl1mSEryVlCd64h7dkI/H4oLCmS1Sp3JftYHCLY=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=WSHHWNASNdoknfE3yiCD10V5vZDpZet24pV3SjEzAZlf8zkDYcYspg1D9pCSuGMSKz i0wpRKq+a6HMWszttpxy4lcRYsopsWR/P8Im8+S1ukFZGy1QBP5LX2AvIYLLxFiR1TK0 cNONjtFhilcwMyKrfJ2JHRis8dwdffcbNwKFgOtoYqH3N93Cj+PqRzU0QhhJKUQmevQG CPPw+EJIB+llZuXz+RySVAMIdczJva2ypdZRznnLXrkd0nT5ivQPKpU9w+jOKsthp5El gc2i8pGYGJtKG/7/Acs5D8fSNCB1dEcy7SPx+PDjNF0uLEoEB7eBOqC800tK7jiVu7W/ vN3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=afsTSj0f; 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 qw16-20020a170906fcb000b009930d4e327dsi9059345ejb.880.2023.07.10.09.27.19; Mon, 10 Jul 2023 09:27:43 -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=afsTSj0f; 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 S230063AbjGJPuG (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233595AbjGJPtu (ORCPT ); Mon, 10 Jul 2023 11:49:50 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E58A18D; Mon, 10 Jul 2023 08:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004188; x=1720540188; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KmPI7TYMCxCRb9tm8UqoN5rT6jb9j7EvGYVTFPfVpOU=; b=afsTSj0fdpe/Ia8kaRxJlyPSYbaNp+4K2i3lQet0NfkfQM+VvF1a2nBD GwcgeIX8+NoZk8y/vxERpYpYffLr1JomjvMZRsEUf7fxBUQY9TxN1Tdyb IJOs3DHAaV7HBktvRlRZJCw8QXM6hFjZZv+42nnHNnqHktP/RpLgNejyw oCWOeziG/5iVrjYKX6U44q2yGD3NCzY9ASi+bViV9lMNVIg5XMLWXzUIE 748PlyoICC7HGOCmwwUonhv3Gpuy4piYs5V2BEtcYxitpow9i2MsLFw7N D9WzPTr35YMOecydEg3NekLDjzyn8ouQruP1fhF3p0AdErYdZgXN7JEAB Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="349185430" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="349185430" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844921857" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844921857" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 08:49:33 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 77C76604; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 06/15] spi: Use sysfs_emit() to instead of s*printf() Date: Mon, 10 Jul 2023 18:49:23 +0300 Message-Id: <20230710154932.68377-7-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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771051641522595812 X-GMAIL-MSGID: 1771051641522595812 Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 46cbda383228..cfb1c985d940 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -64,7 +64,7 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf) if (len != -ENODEV) return len; - return sprintf(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias); + return sysfs_emit(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias); } static DEVICE_ATTR_RO(modalias); @@ -89,7 +89,7 @@ static ssize_t driver_override_show(struct device *dev, ssize_t len; device_lock(dev); - len = snprintf(buf, PAGE_SIZE, "%s\n", spi->driver_override ? : ""); + len = sysfs_emit(buf, "%s\n", spi->driver_override ? : ""); device_unlock(dev); return len; } @@ -2782,8 +2782,7 @@ static ssize_t slave_show(struct device *dev, struct device_attribute *attr, struct device *child; child = device_find_any_child(&ctlr->dev); - return sprintf(buf, "%s\n", - child ? to_spi_device(child)->modalias : NULL); + return sysfs_emit(buf, "%s\n", child ? to_spi_device(child)->modalias : NULL); } static ssize_t slave_store(struct device *dev, struct device_attribute *attr, From patchwork Mon Jul 10 15:49:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117961 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5124504vqx; Mon, 10 Jul 2023 09:01:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlFHTqupIy+y8vrl9Xr9ZZCVqrTcLONy8FAxTSKpJsj51cFBAgPcbGYmKAqhNSv3eyaF7nb2 X-Received: by 2002:a05:6358:419c:b0:12b:df63:9d64 with SMTP id w28-20020a056358419c00b0012bdf639d64mr11347683rwc.19.1689004911269; Mon, 10 Jul 2023 09:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689004911; cv=none; d=google.com; s=arc-20160816; b=Z1jubJTZ3kEb0BkyO0o6w1QfQ5jtTNqWcz627cJw/h8lESP9/24ReJnoUveiyDy9+r sXaepSy5MYtecONjpinFBmT3V1E5LxupllCR76yLq1oBOUv1/eO/qTh3VqY/kstkbTyO fB5yBHwE2tEy7FzJzlevwU04DpDnFkGofyJ41AUJ6CarUIMtgko1mmR5vJkhTp2Sc8Rt /A/+TYZGRG56wofjGa1LwB45MDAPwubrZP7RSp+8C/58NcxsHrCTBkWLiMj5rjzVKycw /fiQuC+2nAzqwrMLXIKI3+XTMKR8ZvQK45XS8AkdJZFGUNQTxzZ7oEZvUujo+0ZA103P YFyA== 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=Zyov40Q0wo9O6asj4knI9mVgPVy/8ZXTtED7OO2jTIo=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=qL+gQdd7sUDXpR2hF/QKTBP8V1Mqq8MIGSMgqh7WgWVR1vwBiET078Ak2Qh51HWkE6 VbT5P/tFQIpG8rrp02PpqyL+rxOS/ygQuHYpcXwO1RRljlr6dCQQG6zmNyVfuuxTDTh9 NVsBaH//c9DoPBc4rdJkUGO+NyGKSoyTKbLQc314hJvDKPmhCTd5BxSSbiwB6ATdZvKo ioBTRNUlYcGmsTgn5L57MRYjLojd6H8bYdSOgP5UwjBhTXzcr8feM4Dh8zVF0pZJmJry urDMXwTXQT9V0iFn/WEB0GeeLms0x+RP+Z2yG3muFZvQpDiDoEZFU0yfzs8LjpqH4olx 9yzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UEuBUyQI; 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 l185-20020a6391c2000000b0055bc21d797esi4019977pge.231.2023.07.10.09.01.35; Mon, 10 Jul 2023 09:01:51 -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=UEuBUyQI; 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 S233075AbjGJPuL (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233602AbjGJPtw (ORCPT ); Mon, 10 Jul 2023 11:49:52 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31048120; Mon, 10 Jul 2023 08:49:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004189; x=1720540189; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NaAUtfuKUjWfIyo2AvU+b2/TN3c63zF3Fr8TWiuiUkI=; b=UEuBUyQIf112A0i0q6pGwKi1pkCsjIwGATrnpBMOAra8u0HNKs9vxoqZ 4n79vyWu1/O+eYCzIehP1WTi+MX2+j6xWW1Nf4G98PFZA9SkC/klwMbda lG2D1fLKLGu7AcP8cs0veblCHVFYgTIUfPlarHX9FSe6/0PSci8E6Uw+D G45yI+K54YsQr362x06CLWgixx76+Aclk5uuPeTXCt0qrq2ICLdtLQiYk jYSFwv9oNJhkQYHSChY5nqBa2wjYYoMLtQME/YRWhMZIiea+af1aeFFPg 9mdtJB/hHJLW7sa40HLacjQIZJaYDCypXpt8DhbCNKpPalSA2e6ncQBTc A==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="349185443" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="349185443" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844921872" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844921872" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 08:49:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8BD3669A; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 07/15] spi: Sort headers alphabetically Date: Mon, 10 Jul 2023 18:49:24 +0300 Message-Id: <20230710154932.68377-8-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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050013969818968 X-GMAIL-MSGID: 1771050013969818968 Sorting headers alphabetically helps locating duplicates, and make it easier to figure out where to insert new headers. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 42 ++++++++++++++++++++--------------------- include/linux/spi/spi.h | 14 +++++++------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index cfb1c985d940..06a92a3a5746 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -4,36 +4,36 @@ // Copyright (C) 2005 David Brownell // Copyright (C) 2008 Secret Lab Technologies Ltd. -#include -#include -#include +#include #include -#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include +#include #include -#include +#include #include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #define CREATE_TRACE_POINTS #include diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 0ce1cb18a076..2026eae97329 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -6,19 +6,19 @@ #ifndef __LINUX_SPI_H #define __LINUX_SPI_H +#include #include +#include #include -#include -#include +#include #include -#include +#include #include -#include - -#include -#include +#include #include +#include + struct dma_chan; struct software_node; struct ptp_system_timestamp; From patchwork Mon Jul 10 15:49:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117966 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5130709vqx; Mon, 10 Jul 2023 09:09:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlFVTEdZ34hS0xO35Vat0vvieRFC0cBI19Rp83fllGfguKk39s0+T+0YEr+XCnQ/COoss1XQ X-Received: by 2002:aa7:ca51:0:b0:51d:e495:626a with SMTP id j17-20020aa7ca51000000b0051de495626amr10980487edt.6.1689005350990; Mon, 10 Jul 2023 09:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005350; cv=none; d=google.com; s=arc-20160816; b=P2tFiuLNe8VpI5KpHlMAcsC6EsPsn/6GZBj3qHbtFRa/MeQZygOcgqi77UifdLygto ia68JJl5TMNkSkDBCjBctvdQCexGOoGVrMNUF7T8lZspgA/DTVEpzJQWzoz2OaHXa+TJ TuqRattReqIvruzSg0hEMUNFZS5XUJ7lsDz0xQs1WygzcmM/V8yLE2LdhNs3FhuLyjyG 5sZhG9wfnhYlFQMxcd8Wgbaru4Fii2Kk+V21rfSShViFWenmtgHHA21wj6jPKrY3JUUP TDlbreZ3K7oi7flHava873apycXCA7Q+jzWgI9gWAH+UMCS+wGPT0sCVS9I18jSG3TWe FwRA== 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=7+E5h/3KfyYlvQoSV523/vEMiTBzry7vfI4d7ZX9BSg=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=wJK/l+beaajlm5+Q49mES/exd/KcwjbyJLxfPhw7LzLamf+RFJ7Lw8gZ7rWsk67d/P XIeRBMHQCjinCummTP2tK3WOGmvKXfwiIrRSpYFhUVRIvRtsP1dqVycVEEheEoDapbvF 8LSBUUDiAjeHaJTRFJpr+sz2ofRi3s5peoOnVkj4BS0YxzooHksIFA6RoeWWqE8zX80b Zzmbi4r7Hl2jRJtZcqsD/ejw5O9a3Jbru9/keafNisw7N0owop59OPXV6fNXpAHYflpt 0rvDtvvjAj2bYu4uLrK7ZrEGYB38eBV3IHRIUX/j5N7SP6HtsCn4P/Hhu/ErcvVGWQfk eb6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Xhe7Uc3b; 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 e16-20020a056402089000b00516a1feabc6si9733351edy.657.2023.07.10.09.08.47; Mon, 10 Jul 2023 09:09:10 -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=Xhe7Uc3b; 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 S233657AbjGJPuD (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233562AbjGJPtu (ORCPT ); Mon, 10 Jul 2023 11:49:50 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CE4C194; Mon, 10 Jul 2023 08:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004188; x=1720540188; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eCA4jmpHdK4tCQy+WYVaMHkZ61alyGNaPi2evxW0e9A=; b=Xhe7Uc3bWEFAN7lTH3RBzaljG/Fz36zbn7OKy5oU4TrvfA5Ud/5M7hkU oQnmtNIPm+s7VmlHK+IYqbqRVymvGWNefM8fWm0XyUiL1uTUR4IYgd9GF ZBmE09Qzq/nxtAgf22erwg3StRH5OBXMFD3jtepn/ff0ZH+f8iOALlDno n6vvCLCVy2LguzMpQgEWwD6sP17tJl4IMAXxo/LKHUPQ/FqYn3iJ/gtbx VysSzGU4T91AAH5NWHk0aR4ymr1+2Itze/L1OSnxhjzTa2iQ08Xh/SOTO 8mSdyodJxNsQlokgzsoM7HsowdViZFNXJQQYD2i9sTsfOuNQ+uKZcodpE g==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361842484" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="361842484" 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:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="720743959" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="720743959" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2023 08:49:35 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9C17069F; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 08/15] spi: Clean up headers Date: Mon, 10 Jul 2023 18:49:25 +0300 Message-Id: <20230710154932.68377-9-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050475084140169 X-GMAIL-MSGID: 1771050475084140169 There is a few things done: - include only the headers we are direct user of - when pointer is in use, provide a forward declaration - add missing headers - group generic headers and subsystem headers - sort each group alphabetically Signed-off-by: Andy Shevchenko --- include/linux/spi/spi.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 2026eae97329..c9479badf38c 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -6,27 +6,41 @@ #ifndef __LINUX_SPI_H #define __LINUX_SPI_H -#include #include #include +#include #include -#include +#include #include +#include +#include +#include #include +#include #include #include +#include +#include +#include +#include #include +#include + #include +struct acpi_device; struct dma_chan; -struct software_node; +struct gpio_desc; struct ptp_system_timestamp; +struct software_node; + struct spi_controller; -struct spi_transfer; struct spi_controller_mem_ops; struct spi_controller_mem_caps; +struct spi_device_id; struct spi_message; +struct spi_transfer; /* * INTERFACES between SPI master-side drivers and SPI slave protocol handlers, From patchwork Mon Jul 10 15:49:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5131196vqx; Mon, 10 Jul 2023 09:09:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlHLjbikTTPT4T3YjH/QKR8y/99pibiDXEiECRgG3Y4n9SnG9fpYoyW2FRadGHWOwocxdRNf X-Received: by 2002:a17:906:83:b0:992:a2fe:757e with SMTP id 3-20020a170906008300b00992a2fe757emr14088895ejc.31.1689005387274; Mon, 10 Jul 2023 09:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005387; cv=none; d=google.com; s=arc-20160816; b=AXxrTY6ra6IBZ18rPoGfUutJ+AladCRIg4t34/T++B4uiGhpEzzTcoRcfWj5R9l/L+ ZrAnik/UK4EMDbNaEbDe0KqG26SjUbhk62N6LLXpET7XqG9SVHEuLOeG8TTHXSSbZhcD iIPc21NGsR8R+zJ3XLLNznTQT1htGoHrNOBBgv0Tlra4KBtejonjv0NPOiDIqdG7yLYD qnCJ+P3rYHe37YI6FefMQcA1gfGstrGOKgBnUhixLsDs4WQfb+b0byTf2WqQf7BmTXfu iKyksnGYKsFEmrarj2VOgNXSXLAm42B5+CGNUBEBf5O8sFLyo28aH73liUgTDd1ioQN2 9rfw== 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=TDiXHoYTJnRZnqhsnfThuK4h1+zWj+oTDicnc+AEmQE=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=h02rseDrJo7mIo0o0zLeAO9eiFMNjoER0yV2KKnYkwhTFK9Bl23nDVsGkL/03VjgFY lTggBx+EYpUwEYEsyq2t4h0Ty2xt2j8dQ6uxpVEBJ+iuJsfgcAyhyy5LiaH9/Y92/m6f ccPNweYTCrGKmFvxqHGkayQ6wt5oVmfhqjEb8SGGYyVixZCyNHUPyb99L19azBxvQ1f3 6IL06FE32gARZ8RLBFkxYCbiMIgC6yC89SoMDF1p4iA5QjncN6Tz1K5g8xzJWewp5ix4 x5U2qF4mlC2VoqXulWQjIyuKaJdIofhRfEsqWXyNHH2gkLnVnZNXMf1OKHzTCfVdg2BR dzgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EVjOppnU; 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 sa29-20020a170906edbd00b00992bfd00fdbsi9296923ejb.971.2023.07.10.09.09.23; Mon, 10 Jul 2023 09:09:47 -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=EVjOppnU; 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 S233660AbjGJPuP (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233605AbjGJPtw (ORCPT ); Mon, 10 Jul 2023 11:49:52 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79933198; Mon, 10 Jul 2023 08:49:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004189; x=1720540189; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2ECimbLN3Odgvy6H4NztBc0veTLSWVtVr1a7U9ECQf8=; b=EVjOppnU7a5dlvJvqS3dje8fQGfbLZRD0ckEl1RuA/6vig4Q5D8x5OPG iNMHq70xQOQVs/EizKV0MSeSd2387kGSjc8Gg3qM1nUtj9i4CCvzSxx2j xDiZJ43l2XO35B9towE7HRIAdWhdwUV2I/A04MX7761a/lJIQ0P08UKW0 OgsQvmhvZdU+Q0XO4tcEGGTNj8KOISz4zHrJeftPaOp1xmeFX73tgIVUt RcZ/lou8FU6w26zuYZ8O6LfZ1lsjMvx8jr0LPX7SUQlzuVCTNxxPsTqdE WV56X5gI2y15/fSMTQ6EUJduSY/9diVJrd4/15RzjHE/0FcMILubZWXEz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361842517" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="361842517" 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:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="720743960" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="720743960" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2023 08:49:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id AC4E86B9; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 09/15] spi: Use struct_size() helper Date: Mon, 10 Jul 2023 18:49:26 +0300 Message-Id: <20230710154932.68377-10-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050512628932335 X-GMAIL-MSGID: 1771050512628932335 Prefer struct_size() over open-coded versions. Signed-off-by: Andy Shevchenko --- include/linux/spi/spi.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index c9479badf38c..9fb8efb068c6 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1095,6 +1096,8 @@ struct spi_transfer { * @state: for use by whichever driver currently owns the message * @resources: for resource management when the spi message is processed * @prepared: spi_prepare_message was called for the this message + * @t: for use with spi_message_alloc() when message and transfers have + * been allocated together * * A @spi_message is used to execute an atomic sequence of data transfers, * each represented by a struct spi_transfer. The sequence is "atomic" @@ -1147,6 +1150,9 @@ struct spi_message { /* List of spi_res reources when the spi message is processed */ struct list_head resources; + + /* For embedding transfers into the memory of the message */ + struct spi_transfer t[]; }; static inline void spi_message_init_no_memset(struct spi_message *m) @@ -1207,16 +1213,13 @@ static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags { struct spi_message *m; - m = kzalloc(sizeof(struct spi_message) - + ntrans * sizeof(struct spi_transfer), - flags); + m = kzalloc(struct_size(m, t, ntrans), flags); if (m) { unsigned i; - struct spi_transfer *t = (struct spi_transfer *)(m + 1); spi_message_init_no_memset(m); - for (i = 0; i < ntrans; i++, t++) - spi_message_add_tail(t, m); + for (i = 0; i < ntrans; i++) + spi_message_add_tail(&m->t[i], m); } return m; } From patchwork Mon Jul 10 15:49:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117970 Return-Path: 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 + 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 ); 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 To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran 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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771051129450022619 X-GMAIL-MSGID: 1771051129450022619 Instead of hard coded numbers, use predefined constancts, such as BITS_PER_BYTE. Signed-off-by: Andy Shevchenko --- 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 #include #include +#include #include @@ -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); } /*---------------------------------------------------------------------------*/ From patchwork Mon Jul 10 15:49:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117964 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5128322vqx; Mon, 10 Jul 2023 09:06:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlG8+h6kzgIjbsguYmEi2Zlw1LC0yv1w9ZcrFT1YdO/SrxV3vOClXmy0iBHYExLIL7+fDTMh X-Received: by 2002:a17:90b:2355:b0:262:e0aa:bbc8 with SMTP id ms21-20020a17090b235500b00262e0aabbc8mr13938709pjb.8.1689005167889; Mon, 10 Jul 2023 09:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689005167; cv=none; d=google.com; s=arc-20160816; b=gcuMfZ91+ST0wi9r6DgqrUuIYxWBZJBIitx4bDTpArxkQ7BJntVHwqkPUqJmtq0i6f LMy4BeNIxg+wOmaUuXkljjlLZjlwjUA9Wul0XdybBV96HA79ydc+A1B4j4akyQdAArsH REELbh9y5WcEc+dnQs/yQsZvOFeSFy7YInJtq95WYojQ/Itoj1QrJ+jJf8OsBc7J48lA +Ydw78PKuSQeOgUSK2/u3M1XBj2ZEvEbT7sSxFJAS2uvSEnZsAJNL6gms2pPIMoq5FjB O8Lmut3pMPDaD9rckyJUrf5rcuknB9vKFtHMKv4zqF7D3WRDBU0Nqx4gqZKeQx8Uj8Zs 5v5Q== 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=3aQg+8I1ynwXGlF4TTUrdjOo2Je1yb28S7Dnd/Wdzs8=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=E7Y+wbCax/S39Qqw4JJGQmA5XPKQaEGfx308EzHIuQkB773CTbWpXgQ+k450czC5j1 M+i6Scc7YG8W7rtedSu+glFmRhFrx6E7n0RHHnge5u1TpYi0dtcbwO4f45wn0p+JifmZ euUF5jagfZ+YBN8X6sZXd2RH6h99aPdMRfGm6xqggIPtlYhh3mj3e0B5YEv8AXiRTG+W Cuhf4DvdiaP2rt9VeYpy2LPXDMrJB3AWT5HUnFkQSFwD04KYbxD7ssejOtrqRIOSCnLe Vj2LxfPlluEQ9SZ+j5JCSnD7UoCb2zcwo55fB4+wge3KSQ2w5RYu76b1jOMtJkOPb4Dj GLKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LytWtWVa; 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 26-20020a63195a000000b005577ad28a97si4288817pgz.633.2023.07.10.09.05.54; Mon, 10 Jul 2023 09:06:07 -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=LytWtWVa; 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 S233380AbjGJPuS (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233613AbjGJPtx (ORCPT ); Mon, 10 Jul 2023 11:49:53 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3063137; Mon, 10 Jul 2023 08:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004191; x=1720540191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a4OeQXOY1tsroZV4NMFgyMSROfjvqRdZJUYq/GX8st8=; b=LytWtWVaKsCVc/c/BPRb++9/KXEsF21R1LyQqOcCZrFyoe7iE3KF10+N 5o8oMgopgxR203apCyE6XMHhLz9ARGJbkKwJHh9X1mLy6CfoPPx8xwSO7 lju2AzfvdFGK11wNyHS5R/5A3nvx+5UWMKSk9T1XBzQ8NoQKfKImjOTk9 j5YFX4MvVy/e9a2ZoIXkurocRpajCa7CfgMABdXTNDTGvhxaMCtJlgbUq +Jxuwv9dFpf1fPjRKmnb4SvHiERL1Gy0JFnOd3NKdGZtQm+zEJ1pC8mzc SXo/5jfRaMayMcDjcq/sRggD2NRGgq3WT3jnHTemrtsKVyh7tWaWPq5aN g==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="349185482" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="349185482" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844921907" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844921907" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 08:49:39 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C66AA748; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 11/15] spi: Get rid of old SPI_MASTER_NO_TX & SPI_MASTER_NO_RX Date: Mon, 10 Jul 2023 18:49:28 +0300 Message-Id: <20230710154932.68377-12-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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771050282942036967 X-GMAIL-MSGID: 1771050282942036967 Convert the users from SPI_MASTER_NO_TX and/or SPI_MASTER_NO_RX to SPI_CONTROLLER_NO_TX and/or SPI_CONTROLLER_NO_RX respectively and kill the not used anymore definitions. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-bitbang-txrx.h | 16 ++++++++-------- drivers/spi/spi-bitbang.c | 2 +- drivers/spi/spi-gpio.c | 8 ++++---- drivers/spi/spi-lp8841-rtc.c | 8 ++++---- drivers/spi/spi-xtensa-xtfpga.c | 2 +- include/linux/spi/spi.h | 2 -- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-bitbang-txrx.h b/drivers/spi/spi-bitbang-txrx.h index 2dcbe166df63..0cab48b7875b 100644 --- a/drivers/spi/spi-bitbang-txrx.h +++ b/drivers/spi/spi-bitbang-txrx.h @@ -57,7 +57,7 @@ bitbang_txrx_be_cpha0(struct spi_device *spi, for (word <<= (32 - bits); likely(bits); bits--) { /* setup MSB (to slave) on trailing edge */ - if ((flags & SPI_MASTER_NO_TX) == 0) { + if ((flags & SPI_CONTROLLER_NO_TX) == 0) { if ((word & (1 << 31)) != oldbit) { setmosi(spi, word & (1 << 31)); oldbit = word & (1 << 31); @@ -70,7 +70,7 @@ bitbang_txrx_be_cpha0(struct spi_device *spi, /* sample MSB (from slave) on leading edge */ word <<= 1; - if ((flags & SPI_MASTER_NO_RX) == 0) + if ((flags & SPI_CONTROLLER_NO_RX) == 0) word |= getmiso(spi); setsck(spi, cpol); } @@ -90,7 +90,7 @@ bitbang_txrx_be_cpha1(struct spi_device *spi, /* setup MSB (to slave) on leading edge */ setsck(spi, !cpol); - if ((flags & SPI_MASTER_NO_TX) == 0) { + if ((flags & SPI_CONTROLLER_NO_TX) == 0) { if ((word & (1 << 31)) != oldbit) { setmosi(spi, word & (1 << 31)); oldbit = word & (1 << 31); @@ -103,7 +103,7 @@ bitbang_txrx_be_cpha1(struct spi_device *spi, /* sample MSB (from slave) on trailing edge */ word <<= 1; - if ((flags & SPI_MASTER_NO_RX) == 0) + if ((flags & SPI_CONTROLLER_NO_RX) == 0) word |= getmiso(spi); } return word; @@ -122,7 +122,7 @@ bitbang_txrx_le_cpha0(struct spi_device *spi, for (; likely(bits); bits--) { /* setup LSB (to slave) on trailing edge */ - if ((flags & SPI_MASTER_NO_TX) == 0) { + if ((flags & SPI_CONTROLLER_NO_TX) == 0) { if ((word & 1) != oldbit) { setmosi(spi, word & 1); oldbit = word & 1; @@ -135,7 +135,7 @@ bitbang_txrx_le_cpha0(struct spi_device *spi, /* sample LSB (from slave) on leading edge */ word >>= 1; - if ((flags & SPI_MASTER_NO_RX) == 0) + if ((flags & SPI_CONTROLLER_NO_RX) == 0) word |= getmiso(spi) << rxbit; setsck(spi, cpol); } @@ -156,7 +156,7 @@ bitbang_txrx_le_cpha1(struct spi_device *spi, /* setup LSB (to slave) on leading edge */ setsck(spi, !cpol); - if ((flags & SPI_MASTER_NO_TX) == 0) { + if ((flags & SPI_CONTROLLER_NO_TX) == 0) { if ((word & 1) != oldbit) { setmosi(spi, word & 1); oldbit = word & 1; @@ -169,7 +169,7 @@ bitbang_txrx_le_cpha1(struct spi_device *spi, /* sample LSB (from slave) on trailing edge */ word >>= 1; - if ((flags & SPI_MASTER_NO_RX) == 0) + if ((flags & SPI_CONTROLLER_NO_RX) == 0) word |= getmiso(spi) << rxbit; } return word; diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index 27d0087f8688..862f209cada1 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -248,7 +248,7 @@ static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t) if (spi->mode & SPI_3WIRE) { unsigned flags; - flags = t->tx_buf ? SPI_MASTER_NO_RX : SPI_MASTER_NO_TX; + flags = t->tx_buf ? SPI_CONTROLLER_NO_RX : SPI_CONTROLLER_NO_TX; return cs->txrx_bufs(spi, cs->txrx_word, nsecs, t, flags); } return cs->txrx_bufs(spi, cs->txrx_word, nsecs, t, 0); diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index 092afc7679d4..85e149ec2910 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c @@ -170,7 +170,7 @@ static u32 spi_gpio_txrx_word_mode3(struct spi_device *spi, /* * These functions do not call setmosi or getmiso if respective flag - * (SPI_MASTER_NO_RX or SPI_MASTER_NO_TX) is set, so they are safe to + * (SPI_CONTROLLER_NO_RX or SPI_CONTROLLER_NO_TX) is set, so they are safe to * call when such pin is not present or defined in the controller. * A separate set of callbacks is defined to get highest possible * speed in the generic case (when both MISO and MOSI lines are @@ -416,11 +416,11 @@ static int spi_gpio_probe(struct platform_device *pdev) if (!spi_gpio->mosi) { /* HW configuration without MOSI pin * - * No setting SPI_MASTER_NO_RX here - if there is only + * No setting SPI_CONTROLLER_NO_RX here - if there is only * a MOSI pin connected the host can still do RX by * changing the direction of the line. */ - master->flags = SPI_MASTER_NO_TX; + master->flags = SPI_CONTROLLER_NO_TX; } master->bus_num = pdev->id; @@ -438,7 +438,7 @@ static int spi_gpio_probe(struct platform_device *pdev) bb->chipselect = spi_gpio_chipselect; bb->set_line_direction = spi_gpio_set_direction; - if (master->flags & SPI_MASTER_NO_TX) { + if (master->flags & SPI_CONTROLLER_NO_TX) { bb->txrx_word[SPI_MODE_0] = spi_gpio_spec_txrx_word_mode0; bb->txrx_word[SPI_MODE_1] = spi_gpio_spec_txrx_word_mode1; bb->txrx_word[SPI_MODE_2] = spi_gpio_spec_txrx_word_mode2; diff --git a/drivers/spi/spi-lp8841-rtc.c b/drivers/spi/spi-lp8841-rtc.c index 2d436541d6c2..ccaa7a946359 100644 --- a/drivers/spi/spi-lp8841-rtc.c +++ b/drivers/spi/spi-lp8841-rtc.c @@ -75,14 +75,14 @@ bitbang_txrx_be_cpha0_lsb(struct spi_lp8841_rtc *data, for (; likely(bits); bits--) { /* setup LSB (to slave) on leading edge */ - if ((flags & SPI_MASTER_NO_TX) == 0) + if ((flags & SPI_CONTROLLER_NO_TX) == 0) setmosi(data, (word & 1)); usleep_range(usecs, usecs + 1); /* T(setup) */ /* sample LSB (from slave) on trailing edge */ word >>= 1; - if ((flags & SPI_MASTER_NO_RX) == 0) + if ((flags & SPI_CONTROLLER_NO_RX) == 0) word |= (getmiso(data) << 31); setsck(data, !cpol); @@ -113,7 +113,7 @@ spi_lp8841_rtc_transfer_one(struct spi_master *master, while (likely(count > 0)) { word = *tx++; bitbang_txrx_be_cpha0_lsb(data, 1, 0, - SPI_MASTER_NO_RX, word, 8); + SPI_CONTROLLER_NO_RX, word, 8); count--; } } else if (rx) { @@ -121,7 +121,7 @@ spi_lp8841_rtc_transfer_one(struct spi_master *master, writeb(data->state, data->iomem); while (likely(count > 0)) { word = bitbang_txrx_be_cpha0_lsb(data, 1, 0, - SPI_MASTER_NO_TX, word, 8); + SPI_CONTROLLER_NO_TX, word, 8); *rx++ = word; count--; } diff --git a/drivers/spi/spi-xtensa-xtfpga.c b/drivers/spi/spi-xtensa-xtfpga.c index 24dc845b940e..dbd85d7a1526 100644 --- a/drivers/spi/spi-xtensa-xtfpga.c +++ b/drivers/spi/spi-xtensa-xtfpga.c @@ -87,7 +87,7 @@ static int xtfpga_spi_probe(struct platform_device *pdev) if (!master) return -ENOMEM; - master->flags = SPI_MASTER_NO_RX; + master->flags = SPI_CONTROLLER_NO_RX; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16); master->bus_num = pdev->dev.id; master->dev.of_node = pdev->dev.of_node; diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 10265184ea02..ce77dcf47b96 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1645,8 +1645,6 @@ spi_transfer_is_last(struct spi_controller *ctlr, struct spi_transfer *xfer) #define spi_master spi_controller #define SPI_MASTER_HALF_DUPLEX SPI_CONTROLLER_HALF_DUPLEX -#define SPI_MASTER_NO_RX SPI_CONTROLLER_NO_RX -#define SPI_MASTER_NO_TX SPI_CONTROLLER_NO_TX #define SPI_MASTER_MUST_RX SPI_CONTROLLER_MUST_RX #define SPI_MASTER_MUST_TX SPI_CONTROLLER_MUST_TX From patchwork Mon Jul 10 15:49:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5118519vqx; Mon, 10 Jul 2023 08:52:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlFdUBOwOQf4Fv3PEw3S7JnZHw9ygr4bb75e/ok5bOgzBVfxB9DCXWnutGxWqja2xtxXmfWW X-Received: by 2002:a17:90b:ecd:b0:263:a6a:49b8 with SMTP id gz13-20020a17090b0ecd00b002630a6a49b8mr9723374pjb.3.1689004330632; Mon, 10 Jul 2023 08:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689004330; cv=none; d=google.com; s=arc-20160816; b=FNuTz0jNjd2zCRoES6492Kc+XaOfhwkd154OQt02JqvsaU8oZT9qDS3id9n07q7j7x h9wCrL0FM7GfPgNosCPUwMtN8XWGlU+Y9gfnULamC4msXEM5zD2tJr05JXL0GrJXr5A4 m9PNPbDTMO/1X1PWIMaYCFr53ztBGzlR/hM8Vy8WwMa/t+52+7++EfztOxuJwuC2IOWb Fi5NqCpbTkcjUTUxk7wu/LW2riCo+jcvlIiPGvaHKsRZiCifrS9/fpFNoC6zbqZGZ/xH S7F6wXZ+w4x9m4C37FuMHoyLljDEuNvZPM2SZnX4dbA61HF0svEF3YRPzlTI/vFl0jqM ZOVA== 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=vaGJJ0CCoEfigXxDOw7muBjhc8QMCsiLkDiICqLBjpw=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=hEzfDteVD9HcUXf92bBW1nl0RyhsWb7YUfLaWvgmxROi7Mee+esXynNM5HRXhggHno vo9BbDd3yboL2GcK8c0jsia05M9kwcvr1hVcycq+ExwNRgKdxAR6lNSce44hOSL8LjEH OCMj6+75tmo2AAyD1JAVz9i4EWfEE/skCGofwpd+Hv3Nn48uVOM/jTAtRB4PsWWVQ1Jn 8MPjLys+nCc4WaAbtcZ6rNy5KszsXApiIM1ytivFMnpuOecBLqobg9f539UT4x5eKIqW /6KQ3WlGFcPeBDVThnF4KXsx+rC5omODA1jYcXDgPkGV5E7mZjqBO0GyktL5+CFoSRmC GDnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fHmP0Qpk; 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 s4-20020a17090a948400b0025c1d114af0si92817pjo.93.2023.07.10.08.51.57; Mon, 10 Jul 2023 08:52:10 -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=fHmP0Qpk; 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 S232358AbjGJPu3 (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233576AbjGJPt4 (ORCPT ); Mon, 10 Jul 2023 11:49:56 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 077641A2; Mon, 10 Jul 2023 08:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004195; x=1720540195; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X4L2zj0s8AySDlJPOTwB53/1Cp1xNye7i+ww1MhojGE=; b=fHmP0QpkPTXwHfacbvlfPLDuWCQX3wbQW1BepwDN7vDiY6l1G03IB6Jk /JsZon6CluP1P9tWpgjWVDHVQRV5hwE59G07+sDneQAK2YDh3KvvDMp45 vh528HIXLha2rJ1Hw8rWb3RmVwPR9HyUOsxIovWfNd9FwSb2uRC4FCdAh gvoVhhZOELTzS3ae/AlRjmTB/5SAatnGQmZUe4dzNSoALbyugA6SMFNOm LrcVxDonXdYK1wZJ+Xcogc7cPOzUPB4RWpxu/3l1Jrx4uWXaY27clw6kG yH5lSNRsiU1xso6f+rNxTOcfpO9n5fyvOTMcUVwQD7gqARxp3HDR3fwAT w==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361842577" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="361842577" 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:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="720743962" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="720743962" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2023 08:49:39 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D2DB477B; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 12/15] spi: Get rid of old SPI_MASTER_MUST_TX & SPI_MASTER_MUST_RX Date: Mon, 10 Jul 2023 18:49:29 +0300 Message-Id: <20230710154932.68377-13-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771049404863123670 X-GMAIL-MSGID: 1771049404863123670 Convert the users from SPI_MASTER_MUST_TX and/or SPI_MASTER_MUST_RX to SPI_CONTROLLER_MUST_TX and/or SPI_CONTROLLER_MUST_RX respectively and kill the not used anymore definitions. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-at91-usart.c | 2 +- drivers/spi/spi-atmel.c | 2 +- drivers/spi/spi-davinci.c | 2 +- drivers/spi/spi-fsl-lpspi.c | 2 +- drivers/spi/spi-meson-spicc.c | 2 +- drivers/spi/spi-mt65xx.c | 2 +- drivers/spi/spi-pci1xxxx.c | 2 +- drivers/spi/spi-pic32.c | 2 +- drivers/spi/spi-rb4xx.c | 2 +- drivers/spi/spi-slave-mt27xx.c | 2 +- drivers/spi/spi-stm32.c | 2 +- include/linux/spi/spi.h | 2 -- 12 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c index 7854d9790fe9..7dfe2b6c2990 100644 --- a/drivers/spi/spi-at91-usart.c +++ b/drivers/spi/spi-at91-usart.c @@ -527,7 +527,7 @@ static int at91_usart_spi_probe(struct platform_device *pdev) controller->dev.of_node = pdev->dev.parent->of_node; controller->bits_per_word_mask = SPI_BPW_MASK(8); controller->setup = at91_usart_spi_setup; - controller->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX; + controller->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX; controller->transfer_one = at91_usart_spi_transfer_one; controller->prepare_message = at91_usart_spi_prepare_message; controller->unprepare_message = at91_usart_spi_unprepare_message; diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 152cd6773403..0865993005b2 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1475,7 +1475,7 @@ static int atmel_spi_probe(struct platform_device *pdev) host->bus_num = pdev->id; host->num_chipselect = 4; host->setup = atmel_spi_setup; - host->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX | + host->flags = (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX | SPI_MASTER_GPIO_SS); host->transfer_one = atmel_spi_one_transfer; host->set_cs = atmel_spi_set_cs; diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index b04811c911e2..014392459d5e 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -939,7 +939,7 @@ static int davinci_spi_probe(struct platform_device *pdev) master->bus_num = pdev->id; master->num_chipselect = pdata->num_chipselect; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); - master->flags = SPI_MASTER_MUST_RX | SPI_MASTER_GPIO_SS; + master->flags = SPI_CONTROLLER_MUST_RX | SPI_MASTER_GPIO_SS; master->setup = davinci_spi_setup; master->cleanup = davinci_spi_cleanup; master->can_dma = davinci_spi_can_dma; diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index fb68c72df171..1c907d5d5bb3 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -856,7 +856,7 @@ static int fsl_lpspi_probe(struct platform_device *pdev) controller->prepare_transfer_hardware = lpspi_prepare_xfer_hardware; controller->unprepare_transfer_hardware = lpspi_unprepare_xfer_hardware; controller->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; - controller->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX; + controller->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX; controller->dev.of_node = pdev->dev.of_node; controller->bus_num = pdev->id; controller->num_chipselect = fsl_lpspi->num_cs; diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index 141562c882f1..7a9eba35ac38 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -864,7 +864,7 @@ static int meson_spicc_probe(struct platform_device *pdev) SPI_BPW_MASK(24) | SPI_BPW_MASK(16) | SPI_BPW_MASK(8); - master->flags = (SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX); + master->flags = (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX); master->min_speed_hz = spicc->data->min_speed_hz; master->max_speed_hz = spicc->data->max_speed_hz; master->setup = meson_spicc_setup; diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c index 39272ad6641b..0757985947dd 100644 --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -1142,7 +1142,7 @@ static int mtk_spi_probe(struct platform_device *pdev) master->mode_bits |= SPI_CS_HIGH; if (mdata->dev_comp->must_tx) - master->flags = SPI_MASTER_MUST_TX; + master->flags = SPI_CONTROLLER_MUST_TX; if (mdata->dev_comp->ipm_design) master->mode_bits |= SPI_LOOP | SPI_RX_DUAL | SPI_TX_DUAL | SPI_RX_QUAD | SPI_TX_QUAD; diff --git a/drivers/spi/spi-pci1xxxx.c b/drivers/spi/spi-pci1xxxx.c index 4445d82409d6..d23c42839da1 100644 --- a/drivers/spi/spi-pci1xxxx.c +++ b/drivers/spi/spi-pci1xxxx.c @@ -365,7 +365,7 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id * spi_host->bits_per_word_mask = SPI_BPW_MASK(8); spi_host->max_speed_hz = PCI1XXXX_SPI_MAX_CLOCK_HZ; spi_host->min_speed_hz = PCI1XXXX_SPI_MIN_CLOCK_HZ; - spi_host->flags = SPI_MASTER_MUST_TX; + spi_host->flags = SPI_CONTROLLER_MUST_TX; spi_master_set_devdata(spi_host, spi_sub_ptr); ret = devm_spi_register_master(dev, spi_host); if (ret) diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c index f2af5e653f3d..e9b4c9cb97fb 100644 --- a/drivers/spi/spi-pic32.c +++ b/drivers/spi/spi-pic32.c @@ -773,7 +773,7 @@ static int pic32_spi_probe(struct platform_device *pdev) master->max_speed_hz = clk_get_rate(pic32s->clk); master->setup = pic32_spi_setup; master->cleanup = pic32_spi_cleanup; - master->flags = SPI_MASTER_MUST_TX | SPI_MASTER_MUST_RX; + master->flags = SPI_CONTROLLER_MUST_TX | SPI_CONTROLLER_MUST_RX; master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16) | SPI_BPW_MASK(32); master->transfer_one = pic32_spi_one_transfer; diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c index 5073736d3d1f..c817889a7797 100644 --- a/drivers/spi/spi-rb4xx.c +++ b/drivers/spi/spi-rb4xx.c @@ -156,7 +156,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev) master->num_chipselect = 3; master->mode_bits = SPI_TX_DUAL; master->bits_per_word_mask = SPI_BPW_MASK(8); - master->flags = SPI_MASTER_MUST_TX; + master->flags = SPI_CONTROLLER_MUST_TX; master->transfer_one = rb4xx_transfer_one; master->set_cs = rb4xx_set_cs; diff --git a/drivers/spi/spi-slave-mt27xx.c b/drivers/spi/spi-slave-mt27xx.c index 4e4d426bfb43..6d6772974783 100644 --- a/drivers/spi/spi-slave-mt27xx.c +++ b/drivers/spi/spi-slave-mt27xx.c @@ -414,7 +414,7 @@ static int mtk_spi_slave_probe(struct platform_device *pdev) mdata->dev_comp = of_id->data; if (mdata->dev_comp->must_rx) - ctlr->flags = SPI_MASTER_MUST_RX; + ctlr->flags = SPI_CONTROLLER_MUST_RX; platform_set_drvdata(pdev, ctlr); diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index 6d10fa4ab783..423212bd0675 100644 --- a/drivers/spi/spi-stm32.c +++ b/drivers/spi/spi-stm32.c @@ -1750,7 +1750,7 @@ static const struct stm32_spi_cfg stm32f4_spi_cfg = { .baud_rate_div_min = STM32F4_SPI_BR_DIV_MIN, .baud_rate_div_max = STM32F4_SPI_BR_DIV_MAX, .has_fifo = false, - .flags = SPI_MASTER_MUST_TX, + .flags = SPI_CONTROLLER_MUST_TX, }; static const struct stm32_spi_cfg stm32h7_spi_cfg = { diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index ce77dcf47b96..cdc3addfe117 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1645,8 +1645,6 @@ spi_transfer_is_last(struct spi_controller *ctlr, struct spi_transfer *xfer) #define spi_master spi_controller #define SPI_MASTER_HALF_DUPLEX SPI_CONTROLLER_HALF_DUPLEX -#define SPI_MASTER_MUST_RX SPI_CONTROLLER_MUST_RX -#define SPI_MASTER_MUST_TX SPI_CONTROLLER_MUST_TX #define spi_master_get_devdata(_ctlr) spi_controller_get_devdata(_ctlr) #define spi_master_set_devdata(_ctlr, _data) \ From patchwork Mon Jul 10 15:49:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5142921vqx; Mon, 10 Jul 2023 09:27:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlEQ2CvisARnBl4fHfu5/UhnQVpSXRlMONXjilz97hpR+BJ4Vjf7cJNge53k0/5jTV7qA9iN X-Received: by 2002:a17:906:1114:b0:978:a186:464f with SMTP id h20-20020a170906111400b00978a186464fmr12904484eja.39.1689006444937; Mon, 10 Jul 2023 09:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689006444; cv=none; d=google.com; s=arc-20160816; b=ZjRI4rG2SsGkda8BFshWbOVrKZBMxuD09J4JtAGjMLDpfvlSdaXIJL9XeoLO2DuUv/ 9IO3kCYnLYW7s4Sw4xVn47KlCmgt1COn5oAVSlgyZ9fmzmbD6hUYTtWEhztOmpVoluoF L4/9kWKy/q6yanrFZa+egK5lXsrE8P8WiposE4DlU3z6Q6AyayQWj9Ja0zR+g6xP9Kfc /Q9psP+Tbat98C1XAMhKChP6mWL3cI7igIYE2MkonVXmUeiv+0TJO/OocMENV1hB/vgE 3TwZNhakKq9q2E//DQsc+2Xl11H0o+otNFUViHXVJTxswBTKSfmO13j9E0SvoXHDuL75 BG8w== 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=MqHNYa9Sb1NFP6WRZc+chUZMGfStbmZelFmYhNj+28k=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=au3VZGBTmmHC+48wm6nDFJN5dGryIaw78tCatbSJlVx8YKZrmmD3LpDuoMQNmL7Prn 5uGbI04yPA72BQRsClypE2cpCBFkdupiwO5zu2K18OnhY9bpsBRVvezIkc2KxODG9COB 9eBPMz7Z/aXPwz8aP5pVUH+zj3/UgiUtamvpbsY+PvghPekD6xj1z4RUCFRMBa4PogA5 nDqL88nyG2MVHsQgC53p73g2uvCVJK66aZLH3HrnnkLDcfjB/auvodqMqp6q75+U+792 Qj32rU52lOlAbYJI9n51zHiThdK0paNdyOc3Jh3RTHGBBtXBXv9N/9zXeJrJjGuk+qsc lz4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HtT9swgn; 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 jo17-20020a170906f6d100b00977e10fafd3si9784276ejb.1045.2023.07.10.09.27.01; Mon, 10 Jul 2023 09:27:24 -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=HtT9swgn; 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 S233144AbjGJPuc (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233640AbjGJPt7 (ORCPT ); Mon, 10 Jul 2023 11:49:59 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D1D81A7; Mon, 10 Jul 2023 08:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004195; x=1720540195; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IeVSPWVD107VIF34v9BU3Oj6m3Q5DOG73amK5fjo1Vs=; b=HtT9swgnfRA+b72ku+D8ZWuEqNcEEOaz2SXND7WdvQEynQ1x1nN2LOtx Aum0YP/FsUGcahy1VulWTBd3M6BxYVO0nOg3RDyDLUa9u4fRCM55x4ByN YeZwbSjUOa5kDJXf0yQjs5subqbx39PiBKE7xvrdOAsnmG8IQldfI0y/g Ttq7/dUrzFdJPpN79Yy2dVCGQhXHESsxOS6IhiOj5ToDG4OU9UZhmzavd Synf46CeOyW/2P2YljGLFopx1076f/GhdJFpDknJ99CWJEjmyLG2Bq+Ph 4saUFzF6Lrh2k5o2ucGAzAUiSs/TB6CdjrRMGJEeguD2mOMs1wekFWqun g==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361842600" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="361842600" 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:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="720743965" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="720743965" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2023 08:49:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DE5C17AB; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 13/15] spi: Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS Date: Mon, 10 Jul 2023 18:49:30 +0300 Message-Id: <20230710154932.68377-14-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771051621829079076 X-GMAIL-MSGID: 1771051621829079076 Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS and convert the users to SPI_CONTROLLER_GPIO_SS to follow the new naming shema. Signed-off-by: Andy Shevchenko Reviewed-by: Serge Semin --- drivers/spi/spi-ath79.c | 2 +- drivers/spi/spi-atmel.c | 2 +- drivers/spi/spi-bitbang.c | 6 +++--- drivers/spi/spi-davinci.c | 2 +- drivers/spi/spi-dw-core.c | 2 +- drivers/spi/spi-gpio.c | 2 +- drivers/spi/spi-imx.c | 2 +- drivers/spi/spi-orion.c | 2 +- drivers/spi/spi-rockchip.c | 2 +- drivers/spi/spi-sifive.c | 2 +- drivers/spi/spi.c | 4 ++-- include/linux/spi/spi.h | 3 +-- 12 files changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index d3dd21386f12..1b6d977d111c 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c @@ -185,7 +185,7 @@ static int ath79_spi_probe(struct platform_device *pdev) host->use_gpio_descriptors = true; host->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32); - host->flags = SPI_MASTER_GPIO_SS; + host->flags = SPI_CONTROLLER_GPIO_SS; host->num_chipselect = 3; host->mem_ops = &ath79_mem_ops; diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 0865993005b2..9674499ed0a6 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1476,7 +1476,7 @@ static int atmel_spi_probe(struct platform_device *pdev) host->num_chipselect = 4; host->setup = atmel_spi_setup; host->flags = (SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX | - SPI_MASTER_GPIO_SS); + SPI_CONTROLLER_GPIO_SS); host->transfer_one = atmel_spi_one_transfer; host->set_cs = atmel_spi_set_cs; host->cleanup = atmel_spi_cleanup; diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index 862f209cada1..ecd44016c197 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -349,11 +349,11 @@ int spi_bitbang_init(struct spi_bitbang *bitbang) /* * We only need the chipselect callback if we are actually using it. * If we just use GPIO descriptors, it is surplus. If the - * SPI_MASTER_GPIO_SS flag is set, we always need to call the + * SPI_CONTROLLER_GPIO_SS flag is set, we always need to call the * driver-specific chipselect routine. */ custom_cs = (!master->use_gpio_descriptors || - (master->flags & SPI_MASTER_GPIO_SS)); + (master->flags & SPI_CONTROLLER_GPIO_SS)); if (custom_cs && !bitbang->chipselect) return -EINVAL; @@ -371,7 +371,7 @@ int spi_bitbang_init(struct spi_bitbang *bitbang) master->transfer_one = spi_bitbang_transfer_one; /* * When using GPIO descriptors, the ->set_cs() callback doesn't even - * get called unless SPI_MASTER_GPIO_SS is set. + * get called unless SPI_CONTROLLER_GPIO_SS is set. */ if (custom_cs) master->set_cs = spi_bitbang_set_cs; diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 014392459d5e..7ea2ac053052 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -939,7 +939,7 @@ static int davinci_spi_probe(struct platform_device *pdev) master->bus_num = pdev->id; master->num_chipselect = pdata->num_chipselect; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); - master->flags = SPI_CONTROLLER_MUST_RX | SPI_MASTER_GPIO_SS; + master->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_GPIO_SS; master->setup = davinci_spi_setup; master->cleanup = davinci_spi_cleanup; master->can_dma = davinci_spi_can_dma; diff --git a/drivers/spi/spi-dw-core.c b/drivers/spi/spi-dw-core.c index a8ba41ad4541..45f5acc26b1d 100644 --- a/drivers/spi/spi-dw-core.c +++ b/drivers/spi/spi-dw-core.c @@ -932,7 +932,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) if (dws->mem_ops.exec_op) master->mem_ops = &dws->mem_ops; master->max_speed_hz = dws->max_freq; - master->flags = SPI_MASTER_GPIO_SS; + master->flags = SPI_CONTROLLER_GPIO_SS; master->auto_runtime_pm = true; /* Get default rx sample delay */ diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index 85e149ec2910..612db477ad12 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c @@ -434,7 +434,7 @@ static int spi_gpio_probe(struct platform_device *pdev) * line, that we need to do on selection. This makes the local * callback for chipselect always get called. */ - master->flags |= SPI_MASTER_GPIO_SS; + master->flags |= SPI_CONTROLLER_GPIO_SS; bb->chipselect = spi_gpio_chipselect; bb->set_line_direction = spi_gpio_set_direction; diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 528ae46c087f..8d97f2b32c2b 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c @@ -1779,7 +1779,7 @@ static int spi_imx_probe(struct platform_device *pdev) if (is_imx51_ecspi(spi_imx) || is_imx53_ecspi(spi_imx)) { controller->max_native_cs = 4; - controller->flags |= SPI_MASTER_GPIO_SS; + controller->flags |= SPI_CONTROLLER_GPIO_SS; } spi_imx->spi_drctl = spi_drctl; diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index ad9e83e34297..4882aafd0505 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -677,7 +677,7 @@ static int orion_spi_probe(struct platform_device *pdev) master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); master->auto_runtime_pm = true; master->use_gpio_descriptors = true; - master->flags = SPI_MASTER_GPIO_SS; + master->flags = SPI_CONTROLLER_GPIO_SS; platform_set_drvdata(pdev, master); diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 143ede958ac1..a37943847e81 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -858,7 +858,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) ctlr->mode_bits |= SPI_NO_CS; ctlr->slave_abort = rockchip_spi_slave_abort; } else { - ctlr->flags = SPI_MASTER_GPIO_SS; + ctlr->flags = SPI_CONTROLLER_GPIO_SS; ctlr->max_native_cs = ROCKCHIP_SPI_MAX_CS_NUM; /* * rk spi0 has two native cs, spi1..5 one cs only diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c index dae9e097c333..2f77dae85386 100644 --- a/drivers/spi/spi-sifive.c +++ b/drivers/spi/spi-sifive.c @@ -379,7 +379,7 @@ static int sifive_spi_probe(struct platform_device *pdev) * we need to "left-align" the bits (unless SPI_LSB_FIRST) */ master->bits_per_word_mask = SPI_BPW_MASK(8); - master->flags = SPI_CONTROLLER_MUST_TX | SPI_MASTER_GPIO_SS; + master->flags = SPI_CONTROLLER_MUST_TX | SPI_CONTROLLER_GPIO_SS; master->prepare_message = sifive_spi_prepare_message; master->set_cs = sifive_spi_set_cs; master->transfer_one = sifive_spi_transfer_one; diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 06a92a3a5746..bcabae98cb7c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -995,7 +995,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force) gpiod_set_value_cansleep(spi_get_csgpiod(spi, 0), activate); } /* Some SPI masters need both GPIO CS & slave_select */ - if ((spi->controller->flags & SPI_MASTER_GPIO_SS) && + if ((spi->controller->flags & SPI_CONTROLLER_GPIO_SS) && spi->controller->set_cs) spi->controller->set_cs(spi, !enable); } else if (spi->controller->set_cs) { @@ -3020,7 +3020,7 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr) ctlr->unused_native_cs = ffs(~native_cs_mask) - 1; - if ((ctlr->flags & SPI_MASTER_GPIO_SS) && num_cs_gpios && + if ((ctlr->flags & SPI_CONTROLLER_GPIO_SS) && num_cs_gpios && ctlr->max_native_cs && ctlr->unused_native_cs >= ctlr->max_native_cs) { dev_err(dev, "No unused native chip select available\n"); return -EINVAL; diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index cdc3addfe117..43f6c3f71a76 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -578,8 +578,7 @@ struct spi_controller { #define SPI_CONTROLLER_NO_TX BIT(2) /* Can't do buffer write */ #define SPI_CONTROLLER_MUST_RX BIT(3) /* Requires rx */ #define SPI_CONTROLLER_MUST_TX BIT(4) /* Requires tx */ - -#define SPI_MASTER_GPIO_SS BIT(5) /* GPIO CS must select slave */ +#define SPI_CONTROLLER_GPIO_SS BIT(5) /* GPIO CS must select slave */ /* Flag indicating if the allocation of this struct is devres-managed */ bool devm_allocated; From patchwork Mon Jul 10 15:49:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5118441vqx; Mon, 10 Jul 2023 08:52:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlHX++pBTxXfE6P5+FFYOxEubSTJhRvphKqDdynaDYOda+/T+q6NZSBzSUjjU2wjQhEETrMI X-Received: by 2002:a17:902:daca:b0:1b8:9195:1dd8 with SMTP id q10-20020a170902daca00b001b891951dd8mr12205442plx.51.1689004323514; Mon, 10 Jul 2023 08:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689004323; cv=none; d=google.com; s=arc-20160816; b=ZlTbFj05nRkONBdqP7EDCgCGnppL6UQetm9zpl5E1j6RK14EOlb7zOjf/9q9v7DwTM 92V/mb0nA9HUugXwnplzWptLLW6dykJk5EStOIc3FhEbGL+MglPW3uwwIOjcJEuRQZN7 1mPwrG4dpNBetPNO7mdd+CjaMlvx5W23x2t3cUiLl3tFyrnu7E2/4IXCVyw/mFDZxcz1 Dy4cXhvJkcf37ZPaLDfV9EHQPtcDrgRvjO6PYEa2Ri3XUki+6HW122SNfAvCdsUCsLAS P5wch5ZeZK/P5lgwqVpA1QLk4eHEbBq++1nXNSsHbX2ti34p/w3PPzIwBwf0We3E0jzN hIjA== 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=DOfMs9cbWPXD/svaPipEUPqAEXyFHuk5K2qp3P8jxrg=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=xjwFanOOPwhQXvaxsL4Ov4fHvXyAFGLhVRn3LAUAiopJ3iJWSakWS91Whzm1lVmy44 LJmBbtA4loK+yPfYDGN0mBwCnsoHCsl9MEOaGN5Q5STqdQDvscqpxv0VSfMVhkfVGMrg 3bJ/d+MF7iDyUFF9Gd1Qk1lpL+/4Eun6HC8inYOmqn+GregroV5nbICVrzE9CVQSodM9 SsKjohU07E8cdLi4qhi64f+oLwlFGQWbxbTCj300bjcsGce4LQrqotKcV/q1567SgmNm rslaKGOO7DjcyXjOfEnz7yqzje+h+YagiOAnC9ILRymdI8Ht+ko55a6iiY/1KXKwwIB0 VhHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ht9SYUkk; 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 n13-20020a170902f60d00b001b9e82a6beesi31756plg.548.2023.07.10.08.51.50; Mon, 10 Jul 2023 08:52:03 -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=ht9SYUkk; 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 S231256AbjGJPu0 (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233625AbjGJPtz (ORCPT ); Mon, 10 Jul 2023 11:49:55 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5185194; 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=8Fi7Z+SejqB8FmLnWihYsJBZfmhjua3hB69p3/WVjRY=; b=ht9SYUkkzg5jMOGzf4d86WBjRh+0ZJzu/uGqkB0vfroI1tZ4ryX7+uDc p+uWWFmkPY96m+AtcXBd3Pe0tTcZqWuT7jxILDE1CUyleWsFiFdjX10NS aL7wJgtUdRKOTZH3mX2ptC3oMCYPBke5v7P57ppux1vhLE1wu7RRDgtS+ djLzjXQzlBRr+ThLDnv1wAX85jCqolYARFYlp/I/LSdK7mNFBazDAP5KP opTlptgqnuXPaHwK4V7C3TR+lhtRAMir8dcNoiBRgJSkYCFZ4fCzzmrYA QyNmbSDh5CDKfCj2Dll9lCd1LmdiSfLhbjdg8fheV3y1xIzoDhmWyphho A==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="349185515" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="349185515" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2023 08:49:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="844921926" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="844921926" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Jul 2023 08:49:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E9B59854; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 14/15] spi: Convert to SPI_CONTROLLER_HALF_DUPLEX Date: Mon, 10 Jul 2023 18:49:31 +0300 Message-Id: <20230710154932.68377-15-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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771049397464742541 X-GMAIL-MSGID: 1771049397464742541 Convert the users under SPI subsystem to SPI_CONTROLLER_HALF_DUPLEX. Signed-off-by: Andy Shevchenko --- drivers/spi/spi-amd.c | 2 +- drivers/spi/spi-cavium-thunderx.c | 2 +- drivers/spi/spi-falcon.c | 2 +- drivers/spi/spi-lp8841-rtc.c | 2 +- drivers/spi/spi-mxs.c | 2 +- drivers/spi/spi-omap-uwire.c | 2 +- drivers/spi/spi-pic32-sqi.c | 2 +- drivers/spi/spi-qcom-qspi.c | 2 +- drivers/spi/spi-rockchip-sfc.c | 2 +- drivers/spi/spi-sprd-adi.c | 2 +- drivers/spi/spi-ti-qspi.c | 2 +- drivers/spi/spi-xcomm.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index fecead757a3c..b19766571f28 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -404,7 +404,7 @@ static int amd_spi_probe(struct platform_device *pdev) master->bus_num = 0; master->num_chipselect = 4; master->mode_bits = 0; - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->max_speed_hz = AMD_SPI_MAX_HZ; master->min_speed_hz = AMD_SPI_MIN_HZ; master->setup = amd_spi_master_setup; diff --git a/drivers/spi/spi-cavium-thunderx.c b/drivers/spi/spi-cavium-thunderx.c index 60c0d6934654..535f7eb9fa69 100644 --- a/drivers/spi/spi-cavium-thunderx.c +++ b/drivers/spi/spi-cavium-thunderx.c @@ -64,7 +64,7 @@ static int thunderx_spi_probe(struct pci_dev *pdev, p->sys_freq = SYS_FREQ_DEFAULT; dev_info(dev, "Set system clock to %u\n", p->sys_freq); - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->num_chipselect = 4; master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | SPI_LSB_FIRST | SPI_3WIRE; diff --git a/drivers/spi/spi-falcon.c b/drivers/spi/spi-falcon.c index 4c103dff0d44..8a8414cbb400 100644 --- a/drivers/spi/spi-falcon.c +++ b/drivers/spi/spi-falcon.c @@ -401,7 +401,7 @@ static int falcon_sflash_probe(struct platform_device *pdev) priv->master = master; master->mode_bits = SPI_MODE_3; - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->setup = falcon_sflash_setup; master->transfer_one_message = falcon_sflash_xfer_one; master->dev.of_node = pdev->dev.of_node; diff --git a/drivers/spi/spi-lp8841-rtc.c b/drivers/spi/spi-lp8841-rtc.c index ccaa7a946359..c6810720b3b5 100644 --- a/drivers/spi/spi-lp8841-rtc.c +++ b/drivers/spi/spi-lp8841-rtc.c @@ -191,7 +191,7 @@ spi_lp8841_rtc_probe(struct platform_device *pdev) return -ENOMEM; platform_set_drvdata(pdev, master); - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->mode_bits = SPI_CS_HIGH | SPI_3WIRE | SPI_LSB_FIRST; master->bus_num = pdev->id; diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 963a53dd680b..cd0e7ae07162 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c @@ -572,7 +572,7 @@ static int mxs_spi_probe(struct platform_device *pdev) master->mode_bits = SPI_CPOL | SPI_CPHA; master->num_chipselect = 3; master->dev.of_node = np; - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->auto_runtime_pm = true; spi = spi_master_get_devdata(master); diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index 902d2e0c1f2f..f89aa9e52c23 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c @@ -486,7 +486,7 @@ static int uwire_probe(struct platform_device *pdev) /* the spi->mode bits understood by this driver: */ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 16); - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->bus_num = 2; /* "official" */ master->num_chipselect = 4; diff --git a/drivers/spi/spi-pic32-sqi.c b/drivers/spi/spi-pic32-sqi.c index 51dfb49523f3..5cbebcf26a2a 100644 --- a/drivers/spi/spi-pic32-sqi.c +++ b/drivers/spi/spi-pic32-sqi.c @@ -648,7 +648,7 @@ static int pic32_sqi_probe(struct platform_device *pdev) master->dev.of_node = pdev->dev.of_node; master->mode_bits = SPI_MODE_3 | SPI_MODE_0 | SPI_TX_DUAL | SPI_RX_DUAL | SPI_TX_QUAD | SPI_RX_QUAD; - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->can_dma = pic32_sqi_can_dma; master->bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32); master->transfer_one_message = pic32_sqi_one_message; diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c index a8a683d6145c..5a98c52bad32 100644 --- a/drivers/spi/spi-qcom-qspi.c +++ b/drivers/spi/spi-qcom-qspi.c @@ -724,7 +724,7 @@ static int qcom_qspi_probe(struct platform_device *pdev) master->mode_bits = SPI_MODE_0 | SPI_TX_DUAL | SPI_RX_DUAL | SPI_TX_QUAD | SPI_RX_QUAD; - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->prepare_message = qcom_qspi_prepare_message; master->transfer_one = qcom_qspi_transfer_one; master->handle_err = qcom_qspi_handle_err; diff --git a/drivers/spi/spi-rockchip-sfc.c b/drivers/spi/spi-rockchip-sfc.c index 583f4187f030..bd550e76ab3d 100644 --- a/drivers/spi/spi-rockchip-sfc.c +++ b/drivers/spi/spi-rockchip-sfc.c @@ -565,7 +565,7 @@ static int rockchip_sfc_probe(struct platform_device *pdev) if (!master) return -ENOMEM; - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->mem_ops = &rockchip_sfc_mem_ops; master->dev.of_node = pdev->dev.of_node; master->mode_bits = SPI_TX_QUAD | SPI_TX_DUAL | SPI_RX_QUAD | SPI_RX_DUAL; diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c index 22e39c4c12c4..94d16aadfa44 100644 --- a/drivers/spi/spi-sprd-adi.c +++ b/drivers/spi/spi-sprd-adi.c @@ -580,7 +580,7 @@ static int sprd_adi_probe(struct platform_device *pdev) ctlr->dev.of_node = pdev->dev.of_node; ctlr->bus_num = pdev->id; ctlr->num_chipselect = num_chipselect; - ctlr->flags = SPI_MASTER_HALF_DUPLEX; + ctlr->flags = SPI_CONTROLLER_HALF_DUPLEX; ctlr->bits_per_word_mask = 0; ctlr->transfer_one = sprd_adi_transfer_one; diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 5914335ff63d..bf4b40289bee 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -770,7 +770,7 @@ static int ti_qspi_probe(struct platform_device *pdev) master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD; - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->setup = ti_qspi_setup; master->auto_runtime_pm = true; master->transfer_one_message = ti_qspi_start_transfer_one; diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index ae6218bcd02a..a3d57554f5ba 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c @@ -218,7 +218,7 @@ static int spi_xcomm_probe(struct i2c_client *i2c) master->num_chipselect = 16; master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_3WIRE; master->bits_per_word_mask = SPI_BPW_MASK(8); - master->flags = SPI_MASTER_HALF_DUPLEX; + master->flags = SPI_CONTROLLER_HALF_DUPLEX; master->transfer_one_message = spi_xcomm_transfer_one; master->dev.of_node = i2c->dev.of_node; i2c_set_clientdata(i2c, master); From patchwork Mon Jul 10 15:49:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 117972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp5143033vqx; Mon, 10 Jul 2023 09:27:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFMMyPG2klyNyDD+qTAOOTS85H1PEoY2/QdGYtLVK7mG7hWAXV2lqSWnKbdndjegeOPCP4e X-Received: by 2002:a5d:63cd:0:b0:314:96f:bb81 with SMTP id c13-20020a5d63cd000000b00314096fbb81mr11197819wrw.22.1689006455700; Mon, 10 Jul 2023 09:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689006455; cv=none; d=google.com; s=arc-20160816; b=F3DIOUmE2KwaflpP1BQAtxu2QFJhlNXa7b9yyX8UxGhTb3+L3JefHdoJ/OCDVxrjzx r+HHy97l/ZzARPAFeX0suUcrm9hALIm5/9FHtOSrzOt31ZAlzYdOZJRxPQiyQIO3BeMx vCGZv2EkPDioazVKhYu8hrmmydgG98cTvrRvAmlTj5+Qr2v5Be+yleUcT0G/fKMw3gJS hH/76w+4qC2SaBh/damdJALtv8Xl8XC6zhJOsedsDw1y2K4fb79UtwqazYSuJnVHpD1d higU9RZcZ8fOG+IhJS3skALcGXEq4rzOLIhzkEuFcKRR4PowBWxqYsRyNBEANvSFMcbY 5mKQ== 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=ZP+/yZ+NpP/g76dVDclPB+ZaWjmPB9ZdwEzJpshiifw=; fh=CWfEt6/vd4IsHMc+T8W3bMkH4b5uOoX72TeJSijIGlU=; b=SWWVIL2RlFK7yYsT5R3LTIkyejwKDAzoTzBCzw73nsLq4sCC1swMU1U8p3GR8t9tro 6gVqkdW6TWte20a7zWYzOpEHZ0P3g6fJoA6r+5ERe3Q42bmuZqWEa1leqSSFRYADHQKY E10yiTeRDhr2mNQIyBtgljU5iGiRIOA0gmVLXvLbs4tfwMZ74oX8h+0yPzbyFKXfqA5w v7MbKh3oAGAPLFn8RypO+Seaatx2Xz0ZmS7atFsZkoAGTvqLz5rq1V/Gknh8nDkAcO63 pvTuas2PSzxMszZANWvbPOAUwfwIXRp9SF26PpSeX603yslfNpdFJvuLR7BPRsiat7lw gg5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nXflHYcZ; 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 f15-20020a056402150f00b0051da4b65e72si9729564edw.360.2023.07.10.09.27.09; Mon, 10 Jul 2023 09:27: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=nXflHYcZ; 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 S233676AbjGJPut (ORCPT + 99 others); Mon, 10 Jul 2023 11:50:49 -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 S233661AbjGJPuP (ORCPT ); Mon, 10 Jul 2023 11:50:15 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79021128; Mon, 10 Jul 2023 08:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689004197; x=1720540197; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pXRHx4OKVyPhzKBBfkn4k3c8ye7f1YNOMH6JkwpbZi4=; b=nXflHYcZi2IEMglUZqcKXKtpqkqX8xyRURYwRCkhuLNagF1rGLTGPHsf DopjL6cIyL7QEEkzYkbYeOMJeHWIHmem1iJCZ2lrog4MsQ0Pxl52A5d2m g9wO+7eEp9J4lSwkpu1gJ6l1ZHUFsjb9YEm+6NQsf1tnMEulekONHsFSr v0nfjGBubApLVpLvZR+GbWBoPRjhGya/7Z7JvjHjtwyf2XCkPj1MgrmQ0 10mLphZp9Iy662eqCz0EiYh1PqJBuW/uJ+sAJvUQlgRzOeqIL1Mei851+ hCN2Cjdl7+bM48ShzmnaptBnft9+lm2IRSSLxnw9J9ceJrKXsUZ7/yf3I A==; X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="361842645" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="361842645" 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:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10767"; a="720743967" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="720743967" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2023 08:49:41 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 01240888; Mon, 10 Jul 2023 18:49:34 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , 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 , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , AngeloGioacchino Del Regno , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran Subject: [PATCH v2 15/15] spi: Fix spelling typos and acronyms capitalization Date: Mon, 10 Jul 2023 18:49:32 +0300 Message-Id: <20230710154932.68377-16-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771051633373950183 X-GMAIL-MSGID: 1771051633373950183 Fix - spelling typos - capitalization of acronyms in the comments. While at it, fix the multi-line comment style. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 54 ++++++++------- include/linux/spi/spi.h | 137 ++++++++++++++++++++----------------- include/trace/events/spi.h | 2 +- 3 files changed, 104 insertions(+), 89 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index bcabae98cb7c..43f7c9b18676 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -682,7 +682,7 @@ static int __spi_add_device(struct spi_device *spi) * @spi: spi_device to register * * Companion function to spi_alloc_device. Devices allocated with - * spi_alloc_device can be added onto the spi bus with this function. + * spi_alloc_device can be added onto the SPI bus with this function. * * Return: 0 on success; negative errno on failure */ @@ -878,7 +878,7 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n) * spi_res_alloc - allocate a spi resource that is life-cycle managed * during the processing of a spi_message while using * spi_transfer_one - * @spi: the spi device for which we allocate memory + * @spi: the SPI device for which we allocate memory * @release: the release code to execute for this resource * @size: size to alloc and return * @gfp: GFP allocation flags @@ -904,7 +904,7 @@ static void *spi_res_alloc(struct spi_device *spi, spi_res_release_t release, } /** - * spi_res_free - free an spi resource + * spi_res_free - free an SPI resource * @res: pointer to the custom data of a resource */ static void spi_res_free(void *res) @@ -920,7 +920,7 @@ static void spi_res_free(void *res) /** * spi_res_add - add a spi_res to the spi_message - * @message: the spi message + * @message: the SPI message * @res: the spi_resource */ static void spi_res_add(struct spi_message *message, void *res) @@ -932,7 +932,7 @@ static void spi_res_add(struct spi_message *message, void *res) } /** - * spi_res_release - release all spi resources for this message + * spi_res_release - release all SPI resources for this message * @ctlr: the @spi_controller * @message: the @spi_message */ @@ -1392,7 +1392,7 @@ int spi_delay_to_ns(struct spi_delay *_delay, struct spi_transfer *xfer) return -EINVAL; /* * If there is unknown effective speed, approximate it - * by underestimating with half of the requested hz. + * by underestimating with half of the requested Hz. */ hz = xfer->effective_speed_hz ?: xfer->speed_hz / 2; if (!hz) @@ -1707,11 +1707,11 @@ static int __spi_pump_transfer_message(struct spi_controller *ctlr, } /** - * __spi_pump_messages - function which processes spi message queue + * __spi_pump_messages - function which processes SPI message queue * @ctlr: controller to process queue for * @in_kthread: true if we are in the context of the message pump thread * - * This function checks if there is any spi message in the queue that + * This function checks if there is any SPI message in the queue that * needs processing and if so call out to the driver to initialize hardware * and transfer each message. * @@ -1726,7 +1726,7 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) unsigned long flags; int ret; - /* Take the IO mutex */ + /* Take the I/O mutex */ mutex_lock(&ctlr->io_mutex); /* Lock queue */ @@ -2137,8 +2137,8 @@ static int __spi_queued_transfer(struct spi_device *spi, /** * spi_queued_transfer - transfer function for queued transfers - * @spi: spi device which is requesting transfer - * @msg: spi message which is to handled is queued to driver queue + * @spi: SPI device which is requesting transfer + * @msg: SPI message which is to handled is queued to driver queue * * Return: zero on success, else a negative error code. */ @@ -2464,7 +2464,7 @@ static int acpi_spi_count(struct acpi_resource *ares, void *data) * acpi_spi_count_resources - Count the number of SpiSerialBus resources * @adev: ACPI device * - * Returns the number of SpiSerialBus resources in the ACPI-device's + * Return: the number of SpiSerialBus resources in the ACPI-device's * resource-list; or a negative error code. */ int acpi_spi_count_resources(struct acpi_device *adev) @@ -2598,10 +2598,10 @@ static int acpi_spi_add_resource(struct acpi_resource *ares, void *data) * @adev: ACPI Device for the spi device * @index: Index of the spi resource inside the ACPI Node * - * This should be used to allocate a new spi device from and ACPI Node. - * The caller is responsible for calling spi_add_device to register the spi device. + * This should be used to allocate a new SPI device from and ACPI Device node. + * The caller is responsible for calling spi_add_device to register the SPI device. * - * If ctlr is set to NULL, the Controller for the spi device will be looked up + * If ctlr is set to NULL, the Controller for the SPI device will be looked up * using the resource. * If index is set to -1, index is not used. * Note: If index is -1, ctlr must be set. @@ -3299,7 +3299,8 @@ void spi_unregister_controller(struct spi_controller *ctlr) if (IS_ENABLED(CONFIG_SPI_DYNAMIC)) mutex_unlock(&ctlr->add_lock); - /* Release the last reference on the controller if its driver + /* + * Release the last reference on the controller if its driver * has not yet been converted to devm_spi_alloc_master/slave(). */ if (!ctlr->devm_allocated) @@ -3512,7 +3513,7 @@ static int __spi_split_transfer_maxsize(struct spi_controller *ctlr, /* All the others need rx_buf/tx_buf also set */ for (i = 1, offset = maxsize; i < count; offset += maxsize, i++) { - /* Update rx_buf, tx_buf and dma */ + /* Update rx_buf, tx_buf and DMA */ if (xfers[i].rx_buf) xfers[i].rx_buf += offset; if (xfers[i].rx_dma) @@ -3582,7 +3583,7 @@ EXPORT_SYMBOL_GPL(spi_split_transfers_maxsize); /** - * spi_split_transfers_maxwords - split spi transfers into multiple transfers + * spi_split_transfers_maxwords - split SPI transfers into multiple transfers * when an individual transfer exceeds a * certain number of SPI words * @ctlr: the @spi_controller for this transfer @@ -3625,7 +3626,8 @@ EXPORT_SYMBOL_GPL(spi_split_transfers_maxwords); /*-------------------------------------------------------------------------*/ -/* Core methods for SPI controller protocol drivers. Some of the +/* + * Core methods for SPI controller protocol drivers. Some of the * other core methods are currently defined as inline functions. */ @@ -3685,7 +3687,7 @@ static int spi_set_cs_timing(struct spi_device *spi) * changes those settings, and must be called from a context that can sleep. * Except for SPI_CS_HIGH, which takes effect immediately, the changes take * effect the next time the device is selected and data is transferred to - * or from it. When this function returns, the spi device is deselected. + * or from it. When this function returns, the SPI device is deselected. * * Note that this call will fail if the protocol driver specifies an option * that the underlying controller or its driver does not support. For @@ -4025,7 +4027,7 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message) * spi_async - asynchronous SPI transfer * @spi: device with which data will be exchanged * @message: describes the data transfers, including completion callback - * Context: any (irqs may be blocked, etc) + * Context: any (IRQs may be blocked, etc) * * This call may be used in_irq and other contexts which can't sleep, * as well as from task contexts which can sleep. @@ -4079,7 +4081,7 @@ EXPORT_SYMBOL_GPL(spi_async); * spi_async_locked - version of spi_async with exclusive bus usage * @spi: device with which data will be exchanged * @message: describes the data transfers, including completion callback - * Context: any (irqs may be blocked, etc) + * Context: any (IRQs may be blocked, etc) * * This call may be used in_irq and other contexts which can't sleep, * as well as from task contexts which can sleep. @@ -4342,9 +4344,9 @@ static u8 *buf; /** * spi_write_then_read - SPI synchronous write followed by read * @spi: device with which data will be exchanged - * @txbuf: data to be written (need not be dma-safe) + * @txbuf: data to be written (need not be DMA-safe) * @n_tx: size of txbuf, in bytes - * @rxbuf: buffer into which data will be read (need not be dma-safe) + * @rxbuf: buffer into which data will be read (need not be DMA-safe) * @n_rx: size of rxbuf, in bytes * Context: can sleep * @@ -4355,7 +4357,7 @@ static u8 *buf; * * Parameters to this routine are always copied using a small buffer. * Performance-sensitive or bulk transfer code should instead use - * spi_{async,sync}() calls with dma-safe buffers. + * spi_{async,sync}() calls with DMA-safe buffers. * * Return: zero on success, else a negative error code. */ @@ -4400,7 +4402,7 @@ int spi_write_then_read(struct spi_device *spi, x[0].tx_buf = local_buf; x[1].rx_buf = local_buf + n_tx; - /* Do the i/o */ + /* Do the I/O */ status = spi_sync(spi, &message); if (status == 0) memcpy(rxbuf, x[1].rx_buf, n_rx); diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 43f6c3f71a76..e40ebffbf4ea 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -52,7 +52,7 @@ extern struct bus_type spi_bus_type; /** * struct spi_statistics - statistics for spi transfers - * @syncp: seqcount to protect members in this struct for per-cpu udate + * @syncp: seqcount to protect members in this struct for per-cpu update * on 32-bit systems * * @messages: number of spi-messages handled @@ -71,7 +71,7 @@ extern struct bus_type spi_bus_type; * @bytes_rx: number of bytes received from device * * @transfer_bytes_histo: - * transfer bytes histogramm + * transfer bytes histogram * * @transfers_split_maxsize: * number of transfers that have been split because of @@ -172,7 +172,7 @@ extern void spi_transfer_cs_change_delay_exec(struct spi_message *msg, * the device will bind to the named driver and only the named driver. * Do not set directly, because core frees it; use driver_set_override() to * set or clear it. - * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when + * @cs_gpiod: GPIO descriptor of the chipselect line (optional, NULL when * not using a GPIO line) * @word_delay: delay to be inserted between consecutive * words of a transfer @@ -228,7 +228,7 @@ struct spi_device { void *controller_data; char modalias[SPI_NAME_SIZE]; const char *driver_override; - struct gpio_desc *cs_gpiod; /* Chip select gpio desc */ + struct gpio_desc *cs_gpiod; /* Chip select GPIO descriptor */ struct spi_delay word_delay; /* Inter-word delay */ /* CS delays */ struct spi_delay cs_setup; @@ -239,7 +239,7 @@ struct spi_device { struct spi_statistics __percpu *pcpu_statistics; /* - * likely need more hooks for more protocol options affecting how + * Likely need more hooks for more protocol options affecting how * the controller talks to each chip, like: * - memory packing (12 bit samples into low bits, others zeroed) * - priority @@ -315,11 +315,11 @@ static inline void spi_set_csgpiod(struct spi_device *spi, u8 idx, struct gpio_d /** * struct spi_driver - Host side "protocol" driver * @id_table: List of SPI devices supported by this driver - * @probe: Binds this driver to the spi device. Drivers can verify + * @probe: Binds this driver to the SPI device. Drivers can verify * that the device is actually present, and may need to configure * characteristics (such as bits_per_word) which weren't needed for * the initial configuration done during system setup. - * @remove: Unbinds this driver from the spi device + * @remove: Unbinds this driver from the SPI device * @shutdown: Standard shutdown callback used during system state * transitions such as powerdown/halt and kexec * @driver: SPI device drivers should initialize the name and owner @@ -431,7 +431,7 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch * @queued: whether this controller is providing an internal message queue * @kworker: pointer to thread struct for message pump * @pump_messages: work struct for scheduling work to the message pump - * @queue_lock: spinlock to syncronise access to message queue + * @queue_lock: spinlock to synchronise access to message queue * @queue: message queue * @cur_msg: the currently in-flight message * @cur_msg_completion: a completion for the current in-flight message @@ -489,7 +489,7 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch * @unprepare_message: undo any work done by prepare_message(). * @slave_abort: abort the ongoing transfer request on an SPI slave controller * @target_abort: abort the ongoing transfer request on an SPI target controller - * @cs_gpiods: Array of GPIO descs to use as chip select lines; one per CS + * @cs_gpiods: Array of GPIO descriptors to use as chip select lines; one per CS * number. Any individual value may be NULL for CS lines that * are not GPIOs (driven by the SPI controller itself). * @use_gpio_descriptors: Turns on the code in the SPI core to parse and grab @@ -516,7 +516,7 @@ extern struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 ch * If the driver does not set this, the SPI core takes the snapshot as * close to the driver hand-over as possible. * @irq_flags: Interrupt enable state during PTP system timestamping - * @fallback: fallback to pio if dma transfer return failure with + * @fallback: fallback to PIO if DMA transfer return failure with * SPI_TRANS_FAIL_NO_START. * @queue_empty: signal green light for opportunistically skipping the queue * for spi_sync transfers. @@ -538,15 +538,17 @@ struct spi_controller { struct list_head list; - /* Other than negative (== assign one dynamically), bus_num is fully - * board-specific. usually that simplifies to being SOC-specific. - * example: one SOC has three SPI controllers, numbered 0..2, - * and one board's schematics might show it using SPI-2. software + /* + * Other than negative (== assign one dynamically), bus_num is fully + * board-specific. Usually that simplifies to being SoC-specific. + * example: one SoC has three SPI controllers, numbered 0..2, + * and one board's schematics might show it using SPI-2. Software * would normally use bus_num=2 for that controller. */ s16 bus_num; - /* chipselects will be integral to many controllers; some others + /* + * Chipselects will be integral to many controllers; some others * might use board-specific GPIOs. */ u16 num_chipselect; @@ -591,8 +593,8 @@ struct spi_controller { }; /* - * on some hardware transfer / message size may be constrained - * the limit may depend on device transfer settings + * On some hardware transfer / message size may be constrained + * the limit may depend on device transfer settings. */ size_t (*max_transfer_size)(struct spi_device *spi); size_t (*max_message_size)(struct spi_device *spi); @@ -610,7 +612,8 @@ struct spi_controller { /* Flag indicating that the SPI bus is locked for exclusive use */ bool bus_lock_flag; - /* Setup mode and clock, etc (spi driver may call many times). + /* + * Setup mode and clock, etc (SPI driver may call many times). * * IMPORTANT: this may be called when transfers to another * device are active. DO NOT UPDATE SHARED REGISTERS in ways @@ -628,18 +631,19 @@ struct spi_controller { */ int (*set_cs_timing)(struct spi_device *spi); - /* Bidirectional bulk transfers + /* + * Bidirectional bulk transfers * * + The transfer() method may not sleep; its main role is * just to add the message to the queue. * + For now there's no remove-from-queue operation, or * any other request management - * + To a given spi_device, message queueing is pure fifo + * + To a given spi_device, message queueing is pure FIFO * * + The controller's main job is to process its message queue, * selecting a chip (for masters), then transferring data * + If there are multiple spi_device children, the i/o queue - * arbitration algorithm is unspecified (round robin, fifo, + * arbitration algorithm is unspecified (round robin, FIFO, * priority, reservations, preemption, etc) * * + Chipselect stays active during the entire message @@ -720,7 +724,7 @@ struct spi_controller { const struct spi_controller_mem_ops *mem_ops; const struct spi_controller_mem_caps *mem_caps; - /* gpio chip select */ + /* GPIO chip select */ struct gpio_desc **cs_gpiods; bool use_gpio_descriptors; s8 unused_native_cs; @@ -804,7 +808,7 @@ void spi_take_timestamp_post(struct spi_controller *ctlr, struct spi_transfer *xfer, size_t progress, bool irqs_off); -/* The spi driver core manages memory for the spi_controller classdev */ +/* The SPI driver core manages memory for the spi_controller classdev */ extern struct spi_controller *__spi_alloc_controller(struct device *host, unsigned int size, bool slave); @@ -893,13 +897,13 @@ typedef void (*spi_res_release_t)(struct spi_controller *ctlr, void *res); /** - * struct spi_res - spi resource management structure + * struct spi_res - SPI resource management structure * @entry: list entry * @release: release code called prior to freeing this resource * @data: extra data allocated for the specific use-case * - * this is based on ideas from devres, but focused on life-cycle - * management during spi_message processing + * This is based on ideas from devres, but focused on life-cycle + * management during spi_message processing. */ struct spi_res { struct list_head entry; @@ -917,7 +921,7 @@ struct spi_res { * * The spi_messages themselves consist of a series of read+write transfer * segments. Those segments always read the same number of bits as they - * write; but one or the other is easily ignored by passing a null buffer + * write; but one or the other is easily ignored by passing a NULL buffer * pointer. (This is unlike most types of I/O API, because SPI hardware * is full duplex.) * @@ -928,8 +932,8 @@ struct spi_res { /** * struct spi_transfer - a read/write buffer pair - * @tx_buf: data to be written (dma-safe memory), or NULL - * @rx_buf: data to be read (dma-safe memory), or NULL + * @tx_buf: data to be written (DMA-safe memory), or NULL + * @rx_buf: data to be read (DMA-safe memory), or NULL * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped * @tx_nbits: number of bits used for writing. If 0 the default @@ -952,7 +956,7 @@ struct spi_res { * @word_delay: inter word delay to be introduced after each word size * (set by bits_per_word) transmission. * @effective_speed_hz: the effective SCK-speed that was used to - * transfer this transfer. Set to 0 if the spi bus driver does + * transfer this transfer. Set to 0 if the SPI bus driver does * not support it. * @transfer_list: transfers are sequenced through @spi_message.transfers * @tx_sg: Scatterlist for transmit, currently not for client use @@ -981,16 +985,16 @@ struct spi_res { * transmitting the "pre" word, and the "post" timestamp after receiving * transmit confirmation from the controller for the "post" word. * @timestamped: true if the transfer has been timestamped - * @error: Error status logged by spi controller driver. + * @error: Error status logged by SPI controller driver. * * SPI transfers always write the same number of bytes as they read. * Protocol drivers should always provide @rx_buf and/or @tx_buf. * In some cases, they may also want to provide DMA addresses for * the data being transferred; that may reduce overhead, when the - * underlying driver uses dma. + * underlying driver uses DMA. * - * If the transmit buffer is null, zeroes will be shifted out - * while filling @rx_buf. If the receive buffer is null, the data + * If the transmit buffer is NULL, zeroes will be shifted out + * while filling @rx_buf. If the receive buffer is NULL, the data * shifted in will be discarded. Only "len" bytes shift out (or in). * It's an error to try to shift out a partial word. (For example, by * shifting out three bytes with word size of sixteen or twenty bits; @@ -1024,7 +1028,7 @@ struct spi_res { * Some devices need protocol transactions to be built from a series of * spi_message submissions, where the content of one message is determined * by the results of previous messages and where the whole transaction - * ends when the chipselect goes intactive. + * ends when the chipselect goes inactive. * * When SPI can transfer in 1x,2x or 4x. It can get this transfer information * from device through @tx_nbits and @rx_nbits. In Bi-direction, these @@ -1038,10 +1042,11 @@ struct spi_res { * and its transfers, ignore them until its completion callback. */ struct spi_transfer { - /* It's ok if tx_buf == rx_buf (right?) - * for MicroWire, one buffer must be null - * buffers must work with dma_*map_single() calls, unless - * spi_message.is_dma_mapped reports a pre-existing mapping + /* + * It's okay if tx_buf == rx_buf (right?). + * For MicroWire, one buffer must be NULL. + * Buffers must work with dma_*map_single() calls, unless + * spi_message.is_dma_mapped reports a pre-existing mapping. */ const void *tx_buf; void *rx_buf; @@ -1061,9 +1066,9 @@ struct spi_transfer { unsigned tx_nbits:3; unsigned rx_nbits:3; unsigned timestamped:1; -#define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */ -#define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ -#define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ +#define SPI_NBITS_SINGLE 0x01 /* 1-bit transfer */ +#define SPI_NBITS_DUAL 0x02 /* 2-bit transfer */ +#define SPI_NBITS_QUAD 0x04 /* 4-bit transfer */ u8 bits_per_word; struct spi_delay delay; struct spi_delay cs_change_delay; @@ -1084,7 +1089,7 @@ struct spi_transfer { * struct spi_message - one multi-segment SPI transaction * @transfers: list of transfer segments in this transaction * @spi: SPI device to which the transaction is queued - * @is_dma_mapped: if true, the caller provided both dma and cpu virtual + * @is_dma_mapped: if true, the caller provided both DMA and CPU virtual * addresses for each transfer buffer * @complete: called to report transaction completions * @context: the argument to complete() when it's called @@ -1094,7 +1099,7 @@ struct spi_transfer { * @status: zero for success, else negative errno * @queue: for use by whichever driver currently owns the message * @state: for use by whichever driver currently owns the message - * @resources: for resource management when the spi message is processed + * @resources: for resource management when the SPI message is processed * @prepared: spi_prepare_message was called for the this message * @t: for use with spi_message_alloc() when message and transfers have * been allocated together @@ -1123,7 +1128,8 @@ struct spi_message { /* spi_prepare_message() was called for this message */ bool prepared; - /* REVISIT: we might want a flag affecting the behavior of the + /* + * REVISIT: we might want a flag affecting the behavior of the * last transfer ... allowing things like "read 16 bit length L" * immediately followed by "read L bytes". Basically imposing * a specific message scheduling algorithm. @@ -1141,14 +1147,15 @@ struct spi_message { unsigned frame_length; unsigned actual_length; - /* For optional use by whatever driver currently owns the + /* + * For optional use by whatever driver currently owns the * spi_message ... between calls to spi_async and then later * complete(), that's the spi_controller controller driver. */ struct list_head queue; void *state; - /* List of spi_res reources when the spi message is processed */ + /* List of spi_res resources when the SPI message is processed */ struct list_head resources; /* For embedding transfers into the memory of the message */ @@ -1188,7 +1195,7 @@ spi_transfer_delay_exec(struct spi_transfer *t) /** * spi_message_init_with_transfers - Initialize spi_message and append transfers * @m: spi_message to be initialized - * @xfers: An array of spi transfers + * @xfers: An array of SPI transfers * @num_xfers: Number of items in the xfer array * * This function initializes the given spi_message and adds each spi_transfer in @@ -1205,10 +1212,10 @@ struct spi_transfer *xfers, unsigned int num_xfers) spi_message_add_tail(&xfers[i], m); } -/* It's fine to embed message and transaction structures in other data +/* + * It's fine to embed message and transaction structures in other data * structures so long as you don't free them while they're in use. */ - static inline struct spi_message *spi_message_alloc(unsigned ntrans, gfp_t flags) { struct spi_message *m; @@ -1312,7 +1319,7 @@ typedef void (*spi_replaced_release_t)(struct spi_controller *ctlr, * replacements that have occurred * so that they can get reverted * @release: some extra release code to get executed prior to - * relasing this structure + * releasing this structure * @extradata: pointer to some extra data if requested or NULL * @replaced_transfers: transfers that have been replaced and which need * to get restored @@ -1322,9 +1329,9 @@ typedef void (*spi_replaced_release_t)(struct spi_controller *ctlr, * @inserted_transfers: array of spi_transfers of array-size @inserted, * that have been replacing replaced_transfers * - * note: that @extradata will point to @inserted_transfers[@inserted] + * Note: that @extradata will point to @inserted_transfers[@inserted] * if some extra allocation is requested, so alignment will be the same - * as for spi_transfers + * as for spi_transfers. */ struct spi_replaced_transfers { spi_replaced_release_t release; @@ -1350,7 +1357,8 @@ extern int spi_split_transfers_maxwords(struct spi_controller *ctlr, /*---------------------------------------------------------------------------*/ -/* All these synchronous SPI transfer routines are utilities layered +/* + * All these synchronous SPI transfer routines are utilities layered * over the core async transfer primitive. Here, "synchronous" means * they will sleep uninterruptibly until the async transfer completes. */ @@ -1493,7 +1501,7 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd) * * Callable only from contexts that can sleep. * - * Return: the (unsigned) sixteen bit number returned by the device in cpu + * Return: the (unsigned) sixteen bit number returned by the device in CPU * endianness, or else a negative error code. */ static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd) @@ -1521,7 +1529,7 @@ static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd) * As a rule, SPI devices can't be probed. Instead, board init code * provides a table listing the devices which are present, with enough * information to bind and set up the device's driver. There's basic - * support for nonstatic configurations too; enough to handle adding + * support for non-static configurations too; enough to handle adding * parport adapters, or microcontrollers acting as USB-to-SPI bridges. */ @@ -1558,12 +1566,13 @@ static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd) * are active in some dynamic board configuration models. */ struct spi_board_info { - /* The device name and module name are coupled, like platform_bus; + /* + * The device name and module name are coupled, like platform_bus; * "modalias" is normally the driver name. * * platform_data goes to spi_device.dev.platform_data, * controller_data goes to spi_device.controller_data, - * irq is copied too + * IRQ is copied too. */ char modalias[SPI_NAME_SIZE]; const void *platform_data; @@ -1575,7 +1584,8 @@ struct spi_board_info { u32 max_speed_hz; - /* bus_num is board specific and matches the bus_num of some + /* + * bus_num is board specific and matches the bus_num of some * spi_controller that will probably be registered later. * * chip_select reflects how this chip is wired to that master; @@ -1584,12 +1594,14 @@ struct spi_board_info { u16 bus_num; u16 chip_select; - /* mode becomes spi_device.mode, and is essential for chips + /* + * mode becomes spi_device.mode, and is essential for chips * where the default of SPI_CS_HIGH = 0 is wrong. */ u32 mode; - /* ... may need additional spi_device chip config data here. + /* + * ... may need additional spi_device chip config data here. * avoid stuff protocol drivers can set; but include stuff * needed to behave without being bound to a driver: * - quirks like clock rate mattering when not selected @@ -1606,7 +1618,8 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n) { return 0; } #endif -/* If you're hotplugging an adapter with devices (parport, usb, etc) +/* + * If you're hotplugging an adapter with devices (parport, USB, etc) * use spi_new_device() to describe each device. You can also call * spi_unregister_device() to start making that device vanish, but * normally that would be handled by spi_unregister_controller(). diff --git a/include/trace/events/spi.h b/include/trace/events/spi.h index c0248a8fa79c..e63d4a24d879 100644 --- a/include/trace/events/spi.h +++ b/include/trace/events/spi.h @@ -167,7 +167,7 @@ TRACE_EVENT(spi_message_done, ); /* - * consider a buffer valid if non-NULL and if it doesn't match the dummy buffer + * Consider a buffer valid if non-NULL and if it doesn't match the dummy buffer * that only exist to work with controllers that have SPI_CONTROLLER_MUST_TX or * SPI_CONTROLLER_MUST_RX. */