From patchwork Tue Jul 11 17:17:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3276118rwh; Tue, 11 Jul 2023 10:29:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlEIaHyy23GvmRb0GR5AkPYKuNcxzCC+ezocFRZ93S2QLyOErM5od4zbLxEmAWLIsjM9eKWQ X-Received: by 2002:a05:6a00:1a93:b0:682:edbe:4cbd with SMTP id e19-20020a056a001a9300b00682edbe4cbdmr12155683pfv.15.1689096578088; Tue, 11 Jul 2023 10:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689096578; cv=none; d=google.com; s=arc-20160816; b=LVMBPclhhwv+z35OYy4apc8EcilB43vcRDOygF7xtbQRQoO1GACzM3mq/IO0x+KMZk 4/liMGodlAwG4H9WkrHwvs/EkkOVCpMLXFX1V5QzDyOqEnMaT4a313V7IuKcJaoopTE4 4wfYi15J03xxNOnCp70bW5omcijlkvNdl+T6o5I6yZfgyh5a4UJBKY41F2MvdeUlfkxn LTDhUO/o9b+paVTSkZQffGRIp7xU2bzdIQxN2SLMDDkwD9RLzUetKE1sLs1SR0vpWHAT QZUL65aDvVF7WSrSOBI4JMtLdjEqUp4cjAX5ZbGRQgwumaNnxn8yrcmgJmwDulWrXsMP dyBg== 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=9m7mEkcyCzIIQX9iIIrHOAD6Py4ts/XqTbXDxLK5m3k=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=kbWFdj9K2QVL8ysTBu6TGjdnVt+rAm4tVVyS5BNpMuWipv2TA2XD9DckrrzZg13GVT cJLxSCDTlnh8LKNITe0cKuFqou3s5XrdrMiKa0L4rqX0NrX9dVubzT9zLR7RabQZGsAl m96S582SyyWntendx4oA8yG4vlGDzyvg9A3THNHCEXy6uDd4LV7wkQY7+RL0OsDjc4ac AhyEfDDfhwqlILCBFR+XtK3Z+YOwpkDZCKp+eQyiXcLLAcj1FjUUbx0Ocu3N0zAgLUWo SCxXtizF/au/U5d1gyPIYqReACDwZsN5pJO6EOp4bryjOC/cHx94kc6g4cxQk8Px/DBV zTCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DSY1Sox5; 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 s10-20020a056a00194a00b0068224c12950si1804512pfk.64.2023.07.11.10.29.25; Tue, 11 Jul 2023 10:29:38 -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=DSY1Sox5; 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 S231931AbjGKRSD (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230525AbjGKRR5 (ORCPT ); Tue, 11 Jul 2023 13:17:57 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8894CF9; Tue, 11 Jul 2023 10:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095876; x=1720631876; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=30sabh/p1/O/QZ5qTRNNcuYMznetHRhsRBrUeoewA/U=; b=DSY1Sox5JfyJNy5NgReIMQeBL4KH6VBuIx7+UXSNip8v+PA7/qXuOfNC 8YF+vu6h3fxJkq0KnggwYtfI5bPQDEWS1GnHMkmN8FaEG5hZ0i5zlUZNY FNeFtwqAkOl5XdGUc3OE+ImZcAcv/WtuAB3k3EoIQTIomIHODFiY1yfOZ aqcCNM/nJ9OU0JJbbLJAHb+zwguzDZ8xzfJ9JwefFu9R17e/+ICPbftiR rF4tcAeksXDobAiKyX+EUH+1KPa+tCGivz+WCgYKyRk2TZlnFsSxeYb6x paGEGp3SIAV4sP71J5bc90BB2W+9iaab750iy0qHjEcHi6NBue4Z2T3uD A==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="451044971" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="451044971" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:17:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="698501338" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="698501338" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 11 Jul 2023 10:17:53 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0ED90F7; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 01/14] spi: Remove unneeded OF node NULL checks Date: Tue, 11 Jul 2023 20:17:43 +0300 Message-Id: <20230711171756.86736-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771146133868474156 X-GMAIL-MSGID: 1771146133868474156 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 # MediaTek --- 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 Tue Jul 11 17:17:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3273402rwh; Tue, 11 Jul 2023 10:25:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlG/My0QG4peYUxSMbf1mZwSbYuTgwd00Q9kP/Rc3rAyZ0HVoo+F2+QnGCHrEvJo7/8/eR17 X-Received: by 2002:a05:6a20:1d6:b0:132:a5f:3e26 with SMTP id 22-20020a056a2001d600b001320a5f3e26mr4071968pzz.26.1689096301722; Tue, 11 Jul 2023 10:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689096301; cv=none; d=google.com; s=arc-20160816; b=MyKtBkImBgbBFDueappHGtGuB60kKR4sjIMQn/8T/+EFNzzmMXea5HDutKDZW4mu4F 4Gn3/qjU4H6PbiPxBAsQ+kcX0DyuGc+jVUoKd1IDuVZnp32Fw7LfEDkmE8kuhFg6b49h hkHEJ5lQ2hvprAgEXV2avcvs5NkifQ7bWVwN/AV3kYR2/j+vdSAGaTlFkaU2LbTr552b vyuBFjYhGxqnlYX2iIVpDWWwwvStknPScGGz3qhuxez8ea3LJ4/rpfJxhGIHyAXEBimS FOXRqPJYlWBNIq2Olin02ICjXnzn1RJ5efpsdn0Ifudge21782oU+SZbyFzM0UcE4tni Fepw== 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=g5V2lVNOGt41qLXOwmYw2FhTieMszU9KhXlySxoTDK0=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=rDE5j0N38Pj/3YRZFIftbOdi0Vk12ClvG5lnPGqVNdx96IxoJeisfDHBMZY+o3WmZu 9/Qea5WsIRvjE2TQmYa/jePoJOdFhroC4c/Ifu/oJk2FxOX7F09z62TrGRgLLfHXY3IJ xgWo5jk5A2vgOUDcZ8gFNFszU/rTzkhnyzguhWRoSaqTeS1J2m+ZZsnsVit5Qn2nx9YL gH43pIBPoZCZdXSQkA7F+FSGtcwofRbAjxqyROq9khbP1AE9og0qcmwYj45bmj/pzgr5 wgPmsHJIoNZqeggmcNb2RftDb4Ux33vn9aGlvPvZy2DtMm38jAp1rOZO6j/7pVSCscjl qnhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Y+1BlGTq; 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 t70-20020a638149000000b00543d2bb0086si1607230pgd.741.2023.07.11.10.24.47; Tue, 11 Jul 2023 10:25:01 -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=Y+1BlGTq; 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 S232013AbjGKRSF (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231901AbjGKRR6 (ORCPT ); Tue, 11 Jul 2023 13:17:58 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0456F9; Tue, 11 Jul 2023 10:17: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=1689095877; x=1720631877; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OBpaMXqlKhCkVOJrLtrCAoKDX6xSv6wtt6ulz1eFwn0=; b=Y+1BlGTqa2OY33EWiXDQdF4YhJCxVk7WHXjmbAs5wmsopZaVYV1g23tE 4rdRMzQfX5F2YMhwNR6X7v73dYdacFVAq8dfN/TtK91Hvy/D/v3rTNIXC jlsZueUVEFwTIWNTY3YcQnMFAajPBnVJot4YP8LXvt6NJivBmedc+4ulL 2FAPLpoXN2PZ1QRqG9wo+daCHuJdW4Vy8AgnfB/42TPOD3YPrL+ybumsW LEnmBVtl+bwJxXtzJU9cVH1vxGBUe+NbbYjkkPZVpD4uaeZn8I9Eb7Jgo 2s0iVmatjgxFK8m/uAU4fmeNLRotyIJQIL7xvoMTdQQ1RnTCxQHS841/a w==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="451044976" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="451044976" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:17:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="698501346" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="698501346" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 11 Jul 2023 10:17:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 22CCB385; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 02/14] spi: Deduplicate IDR allocation code in spi_register_controller() Date: Tue, 11 Jul 2023 20:17:44 +0300 Message-Id: <20230711171756.86736-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771145843582161965 X-GMAIL-MSGID: 1771145843582161965 Refactor spi_register_controller() to deduplicate IDR allocation by introducing a new spi_controller_id_alloc() helper and using it. For the dynamic ID allocation for the highest OF aliases, this will shadow the ENOSPC error code as it's done for the other two cases. It shouldn't be a problem as the result will be the same, we may not get device ID allocated and flow will fail. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 8f3282a71c63..d8064998aa27 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 @@ -3124,24 +3138,16 @@ int spi_register_controller(struct spi_controller *ctlr) 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; + status = spi_controller_id_alloc(ctlr, ctlr->bus_num, ctlr->bus_num + 1); + if (status) + return status; } 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, id, id + 1); + if (status) + return status; } } if (ctlr->bus_num < 0) { @@ -3151,13 +3157,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 Tue Jul 11 17:17:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp654627vqm; Tue, 11 Jul 2023 11:00:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlEKlymZo4XWK3uSsHZw7HMbMErFxSfbrTpHmPHGKfZ5Mj5WhiwnuyAQYg9ciJLptrob7l1t X-Received: by 2002:a17:902:7405:b0:1b8:b827:aa8e with SMTP id g5-20020a170902740500b001b8b827aa8emr12473031pll.11.1689098428274; Tue, 11 Jul 2023 11:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689098428; cv=none; d=google.com; s=arc-20160816; b=HjwbMzDWfVwQWtpPX7jZOcCfGDR7Fy2mm2x8/povFyzHP9GaqB5ahqTOU7qHm62FS8 O6vyYUbntF0Topg/q4VZFqpwnw/6i52fr2i7R7+DBlQsqZtlQTXzm9z6gGC2s+a32zfj ZdhU9PhEVAIrrKQUjcRD5opHbZ+0gycztmxYIW9Nci4Z8/JmUDubmhliBOntaS2gadqh LxR/NZ+/GHb+Dt81nH5jGkPTIvdgi86U+OgLSidzpAApffpt2eAzOZbkNwG0YuN8EXGS 1n/DRFLEC1Tr+K/DApd8Cxpdp8pyp2s7krC9zMtrw0S7BniohVOiEY1jxhrf4zIMd3vF T8NQ== 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=SYdnMuea752Oafx6+bdT61CJtwT3ZWu6h+IBFyHjMI4=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=QaVXAVicn721DM63yBZKo2VYqR0Ju8AcDxsIu/XfKUy/IX74jHX4gkJNNIugMewcTO jLubz8VP9SH1261Fr5758+qq6p7T4c3xyKkEhLglSYlpPMNf80+Hx0C3p6AjgTMRcHsi pbxqoiHbMxHQFr7/EgZz6w+eIvhiJHmDBWFJMC+WV7/AU71DghmNSbnAnvEx3ubGZMch lbplWXxN2FvPWeT26kAXnZ4t8ZUzJm2wg41GQaXgZJ3VDvai3KdwiNCEQv8vstbxuyJP G6IeEMT9RGtMFKIjZB8rqCc2KrQmLrk/CHY0P+cQFl3fH5biMYvzipu/OmSHPQfOuD/1 YLfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Y43VztpH; 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-20020a170902e54400b001b9d203659dsi2009552plf.14.2023.07.11.11.00.12; Tue, 11 Jul 2023 11:00:28 -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=Y43VztpH; 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 S232023AbjGKRUS (ORCPT + 99 others); Tue, 11 Jul 2023 13:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232541AbjGKRUH (ORCPT ); Tue, 11 Jul 2023 13:20:07 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 549501730; Tue, 11 Jul 2023 10:19:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095987; x=1720631987; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rn9d/T3W6Uq2IhVx3LkqBWZwSCJuFxg8vPiXigm9Nk4=; b=Y43VztpHyRl81FJroUoDegxhxOglgUQyWx5/v1ol5MFYrvBv9aWdJ68O dmSJzJZKkZX/p5sX3GOD2YEnywy+bc3cO/giMw5Jt5dna2jhJ7gt9yVZy GAfUWCM1RBZQLdIdmBO64RlJajXn56HGM+jLSVBJ8IbBfVZqGtG+O6tbM qWtanvTQitpqCPM2k6ocyVAKvYkem0I3r5b5cUsLz9FpFn0DDvqmrmKhj qTz0+wcRy1dlfZBzDqnwputQeaP+cy/ZnU6NfkzCq/gXY4iY5M3wzWgul 1qb/aFRQN38MqcWQkKUajLCMhGWrWGI3YA2P5TRJnOL4hA7fs/b/JF7WQ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="362148710" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="362148710" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:19:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="715240845" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="715240845" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 11 Jul 2023 10:17:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3818F3E3; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 03/14] spi: Refactor bus number assigning code in spi_register_controller() Date: Tue, 11 Jul 2023 20:17:45 +0300 Message-Id: <20230711171756.86736-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771148073254551984 X-GMAIL-MSGID: 1771148073254551984 Instead of 'else' branching use two sequential if:s, which allows to re-use the logic of IDR allocation in both cases. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d8064998aa27..6d74218cf38e 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3122,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; @@ -3136,19 +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 */ status = spi_controller_id_alloc(ctlr, ctlr->bus_num, ctlr->bus_num + 1); if (status) return status; - } else { - /* Allocate dynamic bus number using Linux idr */ - id = of_alias_get_id(ctlr->dev.of_node, "spi"); - if (id >= 0) { - status = spi_controller_id_alloc(ctlr, id, id + 1); - if (status) - return status; - } } if (ctlr->bus_num < 0) { first_dynamic = of_alias_get_highest_id("spi"); From patchwork Tue Jul 11 17:17:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3273966rwh; Tue, 11 Jul 2023 10:26:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlG2vbeCWId7NUPFsvHZl17PxRz/OwGJt9MR+6zMqNJQOqiTaU5K7t8h8sbDEbRFrdWmQMFV X-Received: by 2002:a17:903:1111:b0:1b5:64a4:be8b with SMTP id n17-20020a170903111100b001b564a4be8bmr20830140plh.35.1689096360875; Tue, 11 Jul 2023 10:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689096360; cv=none; d=google.com; s=arc-20160816; b=sJfeBAG3rcPm7ZBud+wV2OLFCRiR4YbzESMyfQ4wFpUJVWYWoE4os6FXN2DpbgmXKK dxQom9vZxwNECwqr6HoF33SevofrDtyAu4XxvXFnpP3vStGW32+ZumURnAbp54osF58H eD8xViFt7flZ0iQKsFYYyNVw+Mnq1dhXwALu4OxD7v8cTTI9MjigSz8gAr/d42Vq8AD6 tcqZLyRTOg+QEMRFSrYWs1dS5vpLMNvJnSuFVRMpmS6Wm07wMt192VCdXd7iXEXAuIws bTKyddc4FyOradxPV29B94zvf9e+RQV8H7If2ZWKog7xhYpYxdVteMUdXxXdUrba55KT YNdw== 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=R/R9dFogMHo/C7mF4NW25QJZX6gAnxQJ8bkYiYCjgVU=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=T1d+mny05v+rKJnoC+QdMNN9uPR9a15olDHMo+dWH7C8fIgQ9vZzWXeJZR9nKUfCTX YVGrL5Uajbuj4LFDRzVosfKZq2ZQRC47+skR5mPjUKej1o5sqdezysKLnG9ZsU957ZkM 9psESm8vBWLLO81XorBQx71pFIkh/bIHIPK0Y3UC7JnQxyaPL8bfbEBrP7pBDRUp/AQN Du4Ef9V2xtFQ9PM5vz8RpfzZP52t3DHfv033wOV3xeDC7tzE2zZQHUNE+Jf1D3m8yPq2 BdKZ145+zokfrT5UTtk/we11224OWynrV2hKHoAYhqlHoAxW0dN3eOP/sTKX5jdeD4xe GOlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kUhHkmwZ; 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 jj15-20020a170903048f00b001b6833d605asi1807390plb.371.2023.07.11.10.25.47; Tue, 11 Jul 2023 10:26:00 -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=kUhHkmwZ; 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 S232060AbjGKRSI (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232014AbjGKRSA (ORCPT ); Tue, 11 Jul 2023 13:18:00 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB80EA1; Tue, 11 Jul 2023 10:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095879; x=1720631879; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AaJS6i6oBeO9EHp15z+Qk/kBsYr58o4Zqaz8k2QQyPM=; b=kUhHkmwZtXGl5qK/QySrElLdCefUlHjBGSj57ajA6UXCgagYG41Mo9im hVCFU1dW7dbu585GZtRnbY0PkYkQn7RNeWrp+uzWAZ0ApSl6aPIq9ESpo fcqeYx99OmmA/M/S9iDjb/T6dPrWGG/tjjl9/3yMk36hGVGz1p8hkdTkj zgTxe0+2v/e55+z39hGQKYMQchiJ9srOdaOF4/qGAr0GiOarHjGZ+4jrk 6T8+zQmQonMkBH2YFcsyvvSBspqAKf/OAkoOpV6XaX7OlVvm54T5+lLHk 3gDIZgKAy/KxkgIgLuZllblqojOT59Y+whWVsgr8a4Z6t/zdnRqmwGy+1 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="451044983" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="451044983" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:17:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="698501352" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="698501352" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 11 Jul 2023 10:17:58 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4C9884BD; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 04/14] spi: Remove code duplication in spi_add_device*() Date: Tue, 11 Jul 2023 20:17:46 +0300 Message-Id: <20230711171756.86736-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771145905697011450 X-GMAIL-MSGID: 1771145905697011450 The commit 0c79378c0199 ("spi: add ancillary device support") added a dozen of duplicating lines of code. We may move them to the __spi_add_device(). Note, that the code may be called under the mutex. Signed-off-by: Andy Shevchenko Reviewed-by: Sebastian Reichel --- drivers/spi/spi.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 6d74218cf38e..876d40d2c708 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -631,6 +631,16 @@ static int __spi_add_device(struct spi_device *spi) struct device *dev = ctlr->dev.parent; int status; + /* 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); + /* * We need to make sure there's no other device with this * chipselect **BEFORE** we call setup(), else we'll trash @@ -689,19 +699,8 @@ static int __spi_add_device(struct spi_device *spi) int spi_add_device(struct spi_device *spi) { struct spi_controller *ctlr = spi->controller; - struct device *dev = ctlr->dev.parent; int status; - /* 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); - mutex_lock(&ctlr->add_lock); status = __spi_add_device(spi); mutex_unlock(&ctlr->add_lock); @@ -712,17 +711,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 Tue Jul 11 17:17:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3284476rwh; Tue, 11 Jul 2023 10:44:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlHwEF1qTf4ELQnVYJFkn8iNxZNyVZdbP18aUwHu06Kl0N1RWg264VsqHzN5RYgrv3GGS9Hs X-Received: by 2002:a17:906:5349:b0:993:fba5:cdef with SMTP id j9-20020a170906534900b00993fba5cdefmr8365768ejo.8.1689097482314; Tue, 11 Jul 2023 10:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689097482; cv=none; d=google.com; s=arc-20160816; b=B+hZc/LCOc2Ziu+k9eMMX+5c1SM5i7Si5cOOJQB9FQBw0BVuCDZIhcSCSUoeYWtmu2 9gnlxi9O71XdrT5WdzamRv5sf4mAo9sYcZ4HOJjpGJ2cSHdpBdgUlFsqIXYyYTdHHc1N Vss5gbRqPAT4bAZtzcqzS+zj5LBS/RBIvSEbt1z00I/f0lXIN04d5UrBCk9KsH5lRUBR +yyXvNV8/ei9o19odkxYrzEXIQUluj6cSTPSeI0/uT1YWcMmK3ytsuvmNvS+c5wyIIzE sjVh6Np82rubtkyhixzb/r4Oeh2IzDzYQBeIhceDzqEY12uoOeA9XEJVCgASxqrRL0rf woFg== 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=HpuXEIwl+MLumyUNqPICISQp+Z4rTCC9QFaJZRgkqaA=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=oM+TZxZOMUElU6yCTGXfava9gIkJB/Od+rR5YyTEBNRjdawekbaXLdd0QK9tQQVvLI irCyZ7U9QdwhKNLyp7FBEu7vyTHvwubeenbLhAIbDteHTvPe71Uq4aAF0dqZfhMMQlB4 y26WM8+MG8jnzDp0UoaVJjm5NYj6i9e7tsYPljqb/o93fk1de1seTjK+gj7SrNcE/2yW Ybxgr81xlbxXbN8RFHPpbHoTlBxSRgkF4NNtFAZCIgSEOpfmC5SIcbAXGfsL9A5dAA6z oTwgF/iuLIBet9m1KtEf2od+tdSYcCG7MkLh8wLdwemAT0WY03SGNPiU1lq+vlCDVr19 yUKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=JaStsnYz; 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 i13-20020a170906090d00b0097d787c4afesi2453096ejd.398.2023.07.11.10.44.18; Tue, 11 Jul 2023 10:44:42 -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=JaStsnYz; 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 S232492AbjGKRUY (ORCPT + 99 others); Tue, 11 Jul 2023 13:20:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232224AbjGKRUM (ORCPT ); Tue, 11 Jul 2023 13:20:12 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D91F1998; Tue, 11 Jul 2023 10:19: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=1689095994; x=1720631994; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i6xTQM/M83VGl5L40MPme6/MD9lIrLsXxW1pfo9MYv4=; b=JaStsnYzeTg9oBfhx467Zmd/FHYV1dzltl25Ux6hq1+gU5PSdnER42jw Mi7SZBFIV/rA3bO1h32I1eZrOly6nE6WhuxA3BTj3Fc07UONhBU8tgpOA 8AkhXeQsLNNoS2p+6KCS1pQN0IHW4NnfL6IxMsb7ikBcec52R9a67gegq snxhkOVSbwYwkhLVn/eO53FqgP8dJSPSEuLVYRNiYwPhyn+GLmU1lMGd2 2J7qFwXgg+NTm8dndbB1HshS6H9cN1HY8OG1eUxQpN08dlXdXaPhS13iM BL6g89tnh/ugOYxgfxM865lKrVD4xhKJxe6Pd743qh3qN7O4yBFmKf21z Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="362148714" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="362148714" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:19:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="715240870" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="715240870" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 11 Jul 2023 10:17:58 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5C3475FC; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 05/14] spi: Kill spi_add_device_locked() Date: Tue, 11 Jul 2023 20:17:47 +0300 Message-Id: <20230711171756.86736-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771147081658500962 X-GMAIL-MSGID: 1771147081658500962 Now, spi_add_device_locked() has just a line on top of __spi_add_device(). Besides that, it has a single caller. So, just kill it and embed its parts into the caller. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 876d40d2c708..57b5e4488416 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -708,14 +708,6 @@ int spi_add_device(struct spi_device *spi) } EXPORT_SYMBOL_GPL(spi_add_device); -static int spi_add_device_locked(struct spi_device *spi) -{ - struct spi_controller *ctlr = spi->controller; - - WARN_ON(!mutex_is_locked(&ctlr->add_lock)); - return __spi_add_device(spi); -} - /** * spi_new_device - instantiate one new SPI device * @ctlr: Controller to which device is connected @@ -2417,11 +2409,12 @@ static void of_register_spi_devices(struct spi_controller *ctlr) { } struct spi_device *spi_new_ancillary_device(struct spi_device *spi, u8 chip_select) { + struct spi_controller *ctlr = spi->controller; struct spi_device *ancillary; int rc = 0; /* Alloc an spi_device */ - ancillary = spi_alloc_device(spi->controller); + ancillary = spi_alloc_device(ctlr); if (!ancillary) { rc = -ENOMEM; goto err_out; @@ -2436,8 +2429,10 @@ struct spi_device *spi_new_ancillary_device(struct spi_device *spi, ancillary->max_speed_hz = spi->max_speed_hz; ancillary->mode = spi->mode; + WARN_ON(!mutex_is_locked(&ctlr->add_lock)); + /* Register the new device */ - rc = spi_add_device_locked(ancillary); + rc = __spi_add_device(ancillary); if (rc) { dev_err(&spi->dev, "failed to register ancillary device\n"); goto err_out; From patchwork Tue Jul 11 17:17:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118676 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3282438rwh; Tue, 11 Jul 2023 10:40:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlHpAxucxUbyfrFTttZcVTa7oQIhDOKEQpU0VKslQCVDbsbajl8+JZqCnVFFNONEe4jKNMD/ X-Received: by 2002:a17:907:2c6c:b0:992:b1b2:9bf4 with SMTP id ib12-20020a1709072c6c00b00992b1b29bf4mr16274328ejc.35.1689097237440; Tue, 11 Jul 2023 10:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689097237; cv=none; d=google.com; s=arc-20160816; b=ptbUr4TTS4TmBds6T/n5L4u9cV5LrpK3C36JQl4bgz69MBVc2OnJytMB7dfTwyT7/B nqhIGT16nEJQgjeVPOHLP3UPViBS6nqviEaG6ClfLq51osTMpOYJmp4gykIfotpjqz1g U/9DhhkPnQ8d0s9S7dn0r0CJ8DXgyzfMDwjhHmCNuEgo4gUxohftL5lvpTiz2dGaz9Vw cEmGcVmirXFPKFY2IBTQs8uftZiXcBYjG5v3JrFEv92xVlU85zIuBNeB2y4O8IkKd5kN Cl5wfICOLEGkLuAPL+Yg+wyJhKiA613Pp8dVL1pJN/dLPgRKsTu0QiSWOAObEe1rPIZ1 8rAA== 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=mg7JK9k9yF356Cc9qBdJzwPPVsloO553DZoFK23gOoY=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=ApWVR7PCfqAoYg1rjjdvSIluYs2V8GOTxV3NTI5c4clIsQh76iyGAiRU7l/tIA6DIL k69XGOVzUZkZ93I3OMHl9U0Ai6CW9bs30U+6OyuFu59WtULQJwBYrMVGORDFXZ5xvfrx tFgBPWn+oPykOub7tQucIm8VYSemcNg0sGSgHxvAdUbWOc0qpCFkVrrxgSLRJbv+A9iA 9Rm8A3795CUHuTEbmO9L+d7gLRo/5W4tv7FyV+JUM0ck6y4qrVpy2rZvXBQytTv3JO/U poJc9156txsbHkcuF1cor0CNPsjSUkNZ4eg9jTuFwp2kKkjLVsGFpQo9ltyKHOFQgogb mIew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DeP9nZb8; 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 rh15-20020a17090720ef00b009933cd3556fsi2473887ejb.670.2023.07.11.10.40.13; Tue, 11 Jul 2023 10:40:37 -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=DeP9nZb8; 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 S232139AbjGKRSL (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231898AbjGKRSC (ORCPT ); Tue, 11 Jul 2023 13:18:02 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BE23A1; Tue, 11 Jul 2023 10:18:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095882; x=1720631882; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=o/4VXNjwZTK0uzfbC0etPekf1RU0/kTIzMnJkGS3e1w=; b=DeP9nZb804WKeiY9ILNGLT3kUVd/GDV/VmgcS3F+SgdyJSZe/qeGQq5Y 7F4I1CeWp05WO8utbioPsOY1TGP1uYYZFF0cUw8LAQTgmgitJGMKwbLe7 ap4Qn6uQv6g5eF0XaqMoGb0JYtBzfLivGoj2R80z5trwiMRqacXox1POC 9e0ljFALJZDnGfugZg1y2gt5kF7JP2+c3oVRReVTOdP9ByUXkXfiVaILq 7L/3J555LIqTzZTyTr1+9Lo2w1TW2XBzo6mfh7xc0xgSRpnFYWAWlDV/G Ib7gx4rpk9xNy9T4SlYDBQ7PVT+IiEm1Y6cwiaWKXtcoLqpxKHlWhnnfm w==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="451044990" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="451044990" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:18:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="698501362" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="698501362" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 11 Jul 2023 10:18:00 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6B702604; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 06/14] spi: Use sysfs_emit() to instead of s*printf() Date: Tue, 11 Jul 2023 20:17:48 +0300 Message-Id: <20230711171756.86736-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771146824643809549 X-GMAIL-MSGID: 1771146824643809549 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 57b5e4488416..19846fe4c4d5 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; } @@ -2797,8 +2797,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 Tue Jul 11 17:17:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3274056rwh; Tue, 11 Jul 2023 10:26:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlE2kH9FjoJ4Q5sBV00fCUn54VxYPEn23SJjpGKh7zxCErvphrJfLYTzst343ETfiK/fyHvj X-Received: by 2002:a05:6e02:14c5:b0:346:5813:f7f5 with SMTP id o5-20020a056e0214c500b003465813f7f5mr8886124ilk.12.1689096369658; Tue, 11 Jul 2023 10:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689096369; cv=none; d=google.com; s=arc-20160816; b=LMhzwGAmymodC6Jj9HoRUWJxxOnQQQjK6yNQ4hQqKZyVQIQuPvH06qHcEeqCBSeb9h 8yeBF77Cjj8ymFgvCXcXQRmCQRqUCgcWyTRMDp8Sp9hQ/JCVJXYwKkgxWmtlF/vDUqvx hihST6GieAa+m4kGgpNB1aDb4c3C16fHdg8W5WsXoKwlq0/l59KhtDqSCPmOR5vvEE4j is2ofOffq3ClXddDpkMxRFaAkiLMONcdzOf3t3Yo6zEJ/JoGFjjjJnrNc+gDUEJIChqY mHy8inm6EJP+SVJHulMzGlz6nnCQeuJRkW4UzTE5tCMIzadTNkqrbWzLjVN2n9QNp2nT HQpA== 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=uj9fKtfNH/PzK/4CXugttlVk8uBnmcfIi9nKOCvN9LU=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=W4I7TW4Vn8Pm6iWBB3PvQKwH4YGxD1/UhgpsBE9nJkJfbSTuvNWYQLYVVtbK/8ITPv /qKWRLz9DrI/OVQCu5X3V0cpU+3xaaSX3VYSqaVDeMfoepn4as9iIclKNEoJ/Qw9/hXH 1D0exDk6asW2gJm62BreD0GcC8QKKb7+IHNiuVVgZeMzRh3AzfBfVxe5fTat2z5SHrC3 HUUF5PSvpEPYY2SrxlZ5Xl+Ew1WH1gGhVmHy/kvWGHfbaeQjIpj4j2xpeBMbF/LL2lOj nSv7EQ6VtP0SqHNF9N+mkayUx0FObdiwVVHVYcblvwsd0x14hEQtHge8xvkLT0vXMt7T O3Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SHjWZ9kw; 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 pi12-20020a17090b1e4c00b00263d559dbf1si10041509pjb.55.2023.07.11.10.25.56; Tue, 11 Jul 2023 10:26:09 -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=SHjWZ9kw; 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 S230266AbjGKRUn (ORCPT + 99 others); Tue, 11 Jul 2023 13:20:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjGKRUk (ORCPT ); Tue, 11 Jul 2023 13:20:40 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 149421991; Tue, 11 Jul 2023 10:20:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689096007; x=1720632007; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W7NEY71PqQVA5BZGww/eT8EMuOmo4A0EIfyDr5wmKTE=; b=SHjWZ9kwGj6urFDtJnz14bEmJIywzliSmsadzyWZ/DREKOOT1KVgkVJq rGGqrbn9L2A3Q1rJZ639YPCsHHVKQb2Ww/eZWJtQg9HRIUnXghT9DirYb n1JMZT6M7GYUUMYOF33xwGO+4gfUH5CuMytpt8LrpscbRwjlUTvSq0iYL FidR3prHt0mOsTFbVCiRnM7611SlZjAS70lkmqHp85AMVtmjcaurntwE+ omMbgHXrbaCkLMb2cDmcxznJgS761IfpR/UbEg2IihtADGwalFDLub88z d2nS6gtFdSLV8r2ETUaZ6dP5RmL5OkDbV9csYk6XIQEQBqfqZFtu3Ass8 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="362148724" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="362148724" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:19:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="715240900" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="715240900" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 11 Jul 2023 10:18:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 7A51969A; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 07/14] spi: Use BITS_TO_BYTES() Date: Tue, 11 Jul 2023 20:17:49 +0300 Message-Id: <20230711171756.86736-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: 1771145914748064274 X-GMAIL-MSGID: 1771145914748064274 BITS_TO_BYTES() is the existing macro which takes care about full bytes that may fully hold the given amount of bits. Use it. Signed-off-by: Andy Shevchenko --- drivers/spi/spi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 19846fe4c4d5..0259516a6943 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3881,11 +3881,9 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) */ if ((spi->mode & SPI_CS_WORD) && (!(ctlr->mode_bits & SPI_CS_WORD) || spi_get_csgpiod(spi, 0))) { - size_t maxsize; + size_t maxsize = BITS_TO_BYTES(spi->bits_per_word); int ret; - maxsize = (spi->bits_per_word + 7) / 8; - /* spi_split_transfers_maxsize() requires message->spi */ message->spi = spi; From patchwork Tue Jul 11 17:17:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3284269rwh; Tue, 11 Jul 2023 10:44:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlFA/ymzM9v3DeIXawArKPjHU3IIN7n8+asOeOM3gv+n6rOFmu0jS8q5w6QFdWvwNOZ6eHKU X-Received: by 2002:a05:6402:d3:b0:51d:9195:400f with SMTP id i19-20020a05640200d300b0051d9195400fmr15871950edu.17.1689097457545; Tue, 11 Jul 2023 10:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689097457; cv=none; d=google.com; s=arc-20160816; b=hi/AIBkvvWDZRnsD55DbFAgcLVIak6jUQRCNrPPP/ohGb7eg+Sa7181kzpwuWd5PWh HePTUU2mPeCpNP8P3qeaRfml7Qhw2enTL3Ni6WZIpOmX5MMvVmSJeV4tj3x/zdwonihA fcKhvwmKaM3yHzbVCShqJTYpwt3+xAJJjY07JisT9UDhICSqGw+l+UI09M/0b7FGpdyx 7Q2kJCe93KPkV0/txKAFoOcxMP+nDrvma+3heGjCyMNe5niWB03QDYslZXcqeTorGxTM MFj5/Ws+AUOSuV5x/ubNgjSWCk6juQsA5OLgXbqKHp2eoglSOI15Pk4bi1uAdQSx3FyZ pJoA== 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=5NOKPcL1ljPULLvSnzRRjtTA9vto5DTpPuQ9RsQ5MWo=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=Io+2PySD7e7LIll9nOYJ4ieJUx0rRLl6llfHc2AugCtysINflIiH+0t8ntEBZYWHxp /NJu/zCiKtEDZwl+ImPEjVTj1wv5J9zU93HMYdArCXzUa1M/Yd4b8Ljw2x+DHkTA6uLx YCwNjlBowgtxoFbTCU7R5/fKAKr9tRZHNEFcbAFLNdLY3xVC1IS4LLE6auVvQ4oYdBK0 O6xhULI2LIRyYuDSGD80fHeIsO/vXIjLO1TvA7Utki/xrATvFSFNppKgIG/pNRJPFkf+ TFM/aB9QHxdqjz7+ec/RzsYf4CGkAnnYYc9Y5fIe0gHopWhRuFsotg/kb8y1J/45Wq5V Phdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RHabZ6nH; 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 f25-20020a056402151900b0051e4728e759si2535682edw.520.2023.07.11.10.43.54; Tue, 11 Jul 2023 10:44:17 -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=RHabZ6nH; 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 S232179AbjGKRSO (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232004AbjGKRSF (ORCPT ); Tue, 11 Jul 2023 13:18:05 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 243D8A1; Tue, 11 Jul 2023 10:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095884; x=1720631884; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u9L8bC8uc7avplPhBiWwS/Uu0Hqr1Wth57luzKoKJGU=; b=RHabZ6nH/GzJzj3ygLUTrgjVkmgunlc/Q5tv7E4ZeX9mFFNFz19qUvLy g0AHVw3mtpK89mIf9T1SLTdxFyes22xuokvNLWbr6dHa+Gi72eRU/QcXX sCEkCp+A7xPja0R/6jzRab3T9z6yFbeKpB9t5u3oZHX3yhnY84AHJJBoE +8eTjA2P3Zyirg17z7hnn+l1O6MhRxulLLYX9VkNRTjWCvDChl7Ya/2nc 8mS4IohtaXJ1QArI+XzZ3IHSf8SVTCD9i/VMSm4/DAZ86Slwby4GfOgYp SpJjTdAXx3DNDJJNmiLptb2qNwQTS4CEcWwVX99Y+CbvL5vgXuOVtDVQn g==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="451045006" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="451045006" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:18:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="698501370" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="698501370" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 11 Jul 2023 10:18:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 896E669F; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 08/14] spi: Sort headers alphabetically Date: Tue, 11 Jul 2023 20:17:50 +0300 Message-Id: <20230711171756.86736-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771147055676273269 X-GMAIL-MSGID: 1771147055676273269 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 0259516a6943..9b096cbc9926 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 32c94eae8926..21b77bdfac29 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 Tue Jul 11 17:17:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118671 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3274062rwh; Tue, 11 Jul 2023 10:26:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlF+9SzvLC5PPZhyRXTdJnzv/3Cuz3WoTgp7B3nJPoxOPTKADi77k2gGLMFmDm9edLy/AMdf X-Received: by 2002:a05:6a20:2450:b0:132:81a8:1691 with SMTP id t16-20020a056a20245000b0013281a81691mr1616360pzc.46.1689096370132; Tue, 11 Jul 2023 10:26:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689096370; cv=none; d=google.com; s=arc-20160816; b=WeOXlrVbnitiwjWi9Lbu3n1+DbrNIpRPcCO5yHkAdI512mJ3UxbYkDqv49KO+gLqNi A8eLburro9a2TLyiRDqOMrJ31KAQ/G3/Py6bHpU57NnIUw6FLUcFI4i49tZS5mUBnStJ 9WKmNs8gj+57ItVvdWj1dg42gmC/N7JF5gKapTCLPgtLBBzidMK3wbVOBZzl6YTPOk1G ArmZYoyIkzAAD0cmzhXDUrpwGO8pkk4FOBU+fHXdRe4r8GKyHkPmU1osclolZFOMeFHU k2dlTVIVACESx+x67mWfLkfkEiy55sActOH3i++PeR4MYNJms2bdKYjgX7j4mHmFRKmL pBFA== 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=OkwnZAXUnxXlGIIXfjo6QLOuqBYji33K6e2hAQN+rq4=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=lTQ7uXV3sgfOTkLZ1xqDReX1eShw7YIT3KEsGiHlveR2nc0CG1h6dCgcqWRXq9bbzR N/rU8YsS359QnZYgCXfFk31Qla4oqGZ8zZRuZEXK8moOgmITiBUwXYZ1P8nXLoeF8eWV ArAU2NUUNS7s2qSSDL4riHjj0Fgbci4Pg7HBN1YXRrFtbYuME1KNFC7rZWLr9nsymKK4 G2ZdpWtQXE/ruTzXdDOwqVydD5D5Ms816jrnBKN+akXg4qeFArL7sxjL6MLWmXDU7chH o0xWYynUqA5qT9VQwNC9LiPjKlH6lq67aJsF82CfuIw+ZlZoIHN+JQxRFhi8ObK7zBxv PtZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dEE0UP0F; 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 g191-20020a6252c8000000b00668705a86ccsi1697458pfb.319.2023.07.11.10.25.56; Tue, 11 Jul 2023 10:26: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=dEE0UP0F; 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 S233023AbjGKRVl (ORCPT + 99 others); Tue, 11 Jul 2023 13:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232653AbjGKRVZ (ORCPT ); Tue, 11 Jul 2023 13:21:25 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 465C01BD7; Tue, 11 Jul 2023 10:20: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=1689096046; x=1720632046; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pAWPsjI4cTEbUbFXGBMVoie/XvBSHdTVWugoYwa5pwQ=; b=dEE0UP0Fej6NRF58dz6h5qF+0a1g+R7Gw+uMbSXfJRQ9jRCdGr/Kh8k8 99mpfY/+G8WxCIVhUOo9/zNnsqrUTBYyn5T30NHf3wlWlEqVj9VvgDKFu wlMqUlBsILNxydiyf+kj4NUastzpYcIJuNC6QT4UruXkTKRyAZetwmoJ7 iSYx7FPQAQl2IYw9nF+paTVpqw04QaiNxaDvleYUDz7qKETw6aMl0HQ85 udiA9CvJwgPEOK41tdhhMyPxt6WlOrgdYy5UZRFb8dBI0m1ppLlt62VBQ EmNi6BO5J4NW54gFHkaGWquvA3HaBzus17IdczqOuF29VlpYmWsAWFnlb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="362148758" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="362148758" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:19:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="715240943" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="715240943" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 11 Jul 2023 10:18:04 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 99EF06B9; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 09/14] spi: Use struct_size() helper Date: Tue, 11 Jul 2023 20:17:51 +0300 Message-Id: <20230711171756.86736-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: 1771145915330437663 X-GMAIL-MSGID: 1771145915330437663 The Documentation/process/deprecated.rst suggests to use flexible array members to provide a way to declare having a dynamically sized set of trailing elements in a structure.This makes code robust agains bunch of the issues described in the documentation, main of which is about the correctness of the sizeof() calculation for this data structure. Due to above, 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 21b77bdfac29..35fd61070d9b 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -1081,6 +1082,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" @@ -1133,6 +1136,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) @@ -1193,16 +1199,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 Tue Jul 11 17:17:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3269860rwh; Tue, 11 Jul 2023 10:19:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlFwlXHDoIS7CE5v6m9NIdb5yj5q9bQOxQaFH+Mzpf+H40kCC6YYu/gvkx6jQAjcwFPQ6wED X-Received: by 2002:a05:6a20:4284:b0:11e:e940:441e with SMTP id o4-20020a056a20428400b0011ee940441emr16148005pzj.25.1689095977786; Tue, 11 Jul 2023 10:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689095977; cv=none; d=google.com; s=arc-20160816; b=xata0IjJAHtiQAXKjorZhsml+QnRPsR3B9KZsDDu0DjTCOEXBXaoeody23A0Gm9/FR Np5Njom2V1wp3aD5Rsybe5bCnNDWyYKqeHarSau0Q2eilUDmTfppyPCPW14Bl1sIwMHH LgAmB4B50cOmW3ssEL2Le4KWdy0NIZvWp0W/rVMvVOSTGro1y/gmOsASJwl31DMqCbC4 nIUDpuQRjRmgBDQ6l4qYg4CGs78nKSTyrUPNaUumtDXFgkPLzI4/xFx/+POp8U7vkhpd S06YQB9L6/OEBwd+BRH0WCO0BEkYgG9NzQuXrsE7uzqjGYk6A4I+1NDb0mKqwNlN0AS+ BFTw== 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=777Xi7JSyNQySF5cLfIFXWmRordND3mD6AsuXbqD8i0=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=uNDutLU2j5gjWPddISpRf9W0SG+0a6qjN4dpOPCAOvF289APZgZa9j7R8BIt7XykPW 7GC+/StNuR3l+tBhSATnFQ5DqfCjO7CD86zBbEuxwdb5oj/9TQUcz4BOR/fugDzsimBr AQm3fjdPSl1s1fhJYgcjHEj9fxo2Xm6mfaIcd/nCTt4qiMRSBvw6IkPYK0j6y4wifUG6 lTYlCJfb/bQgY6+Yhwsewc8y9SUuvIvFXaeqgGOm+SfKrui2iptWpTxfJO3C2HfKNOZi +U6+5JOyLEc7x5NQklTt//vp6RGN8QdVY4Cd8GIdGNALu259IBegJkF0EzN6cbsZZ+Au bePg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OPvLu4hQ; 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 x64-20020a638643000000b0055b53a863f6si1635860pgd.833.2023.07.11.10.19.00; Tue, 11 Jul 2023 10:19:37 -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=OPvLu4hQ; 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 S232190AbjGKRSR (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbjGKRSH (ORCPT ); Tue, 11 Jul 2023 13:18:07 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38CFB1BB; Tue, 11 Jul 2023 10:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095886; x=1720631886; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rM83K+8cJkJE4xGj15BlfW6NeYwJQps/lMnHrXNpxyE=; b=OPvLu4hQ37rJm1W7IhBY0c6FKbYQfOUmJNidnwwLOHrVaY2byqQceNAS PJNMPQGYMocMU+OOG5AJddyYFd39dUAmkkEzX+2jqtUg7/83z3ORH35Zy MeWPyJVCE1Ba/AQJzDn9liwFrZPdjnnF8HVwT4GZ9HV69A6EUt3J2FmnH PqkIBlsKWbKXQYpZYVbZuwCV6r4OMC1honQ+QH/hs1LgRLdlKMxNju2Fu jLvpO27TrHrq/zNbJiwoHVzc2DEP1tiPxM7J4a8fBRgvQU7TY+cNqIlR3 1aPaDnyPzxRiVtIw6rDWautTWt7Zodcmsy1988etn34GLWM867Y0XsgJ9 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="451045013" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="451045013" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:18:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="698501378" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="698501378" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 11 Jul 2023 10:18:04 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id AE50B718; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 10/14] spi: Get rid of old SPI_MASTER_NO_TX & SPI_MASTER_NO_RX Date: Tue, 11 Jul 2023 20:17:52 +0300 Message-Id: <20230711171756.86736-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771145503715755011 X-GMAIL-MSGID: 1771145503715755011 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 35fd61070d9b..39e6271b5003 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1626,8 +1626,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 Tue Jul 11 17:17:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp656771vqm; Tue, 11 Jul 2023 11:03:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlHvYFq+NRgzDIZiXQpxTAt5UmoldBc7ZJuuMnZ1jM8e0cfen36GdRfRXg9MdNR6SnRFZnjl X-Received: by 2002:a17:90b:4017:b0:263:d249:9b7 with SMTP id ie23-20020a17090b401700b00263d24909b7mr16985121pjb.25.1689098590610; Tue, 11 Jul 2023 11:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689098590; cv=none; d=google.com; s=arc-20160816; b=fYYnfcIjPhNrYqMcluOTAI2klwyfpvT+4iRDPL3Z5qN17g30NiE33fP/69qVzYs753 7V35ZtfyElIv0gOghHCRmIjNU4yfOCFBefFsfoVbZ3YYheIPrNbDvzUWG9LoK2WyooSm ZgyrHtMWac/zsDU9OVGwRWjYg9KWWkg7QvMdrCAy+zl9ZnzNHgch7N9M2nCXSHDU8YlZ Wg3OwZJTvgsxFSFB/Hxu1YXq+AI3XIcwhlaOA3k7t2Z07R3L1jXznSKfAVx4ONVNUUQO 68SXvVhnLbOVi2wjtZXF/RqO7QzfRYgBuDZXa9tHAoIQdJ/0kV2vG+yXipV27TZUUjYb TO3A== 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=NrhJoc6o4TDzRGY1WlNBZgEqxV790LEL96nwwJKbxoQ=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=iLKnDvjr6yjcsD4ienjfIw/Bs+JVkdCjGFRGtvZy8LRF7wGoenvN7zSHbLuJgPUm8B 63Beuy2tMstcd7NuHl2DT06g4mVNl3IhH6BEHYz5KpRoP32eg1+AjJL8SnIEaNXSkDM7 3w2zBbvwgfj4yJxVdGl5E+NLWU/55CoDPOE9EwZ4Grw5YJ804rUgiahJ19JU/kuDnslE 3vlr6ZlDyGUmSnICGGYHuA4W3MuEWhrU8auVs9oB1ia0oLcrSpZyiIDmwjfdoNk+xGh5 Mj2S/dSsdQoWtvKaPEnQVz1bGugSLkE6MYAIjitiOxqO8PJgHULUiozg8qwZRof+2RIX cNyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gIvJAsrv; 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 gl18-20020a17090b121200b002636d2223fdsi1855380pjb.177.2023.07.11.11.02.56; Tue, 11 Jul 2023 11:03: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=gIvJAsrv; 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 S229655AbjGKRSX (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232077AbjGKRSJ (ORCPT ); Tue, 11 Jul 2023 13:18:09 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53914E75; Tue, 11 Jul 2023 10:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095888; x=1720631888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dEFDFR9Zjzcis3/WsD8642CwaquIx3KoLxGVFvTwtnY=; b=gIvJAsrvdhF2le5s01CkUMRW1fXChmloptCbOnUxC7IcDT25JvWbmTqT w1ntJa1jlAjeZaDgPZKO/fm36OtyG/Tyo8EQysSp8qfcdom8b3JQKLQVf RuXEBeYk9wSpDCi2mWLSDSJfy/NlZ8XzR9BeX/y+ncwFrEdhyjwDP9zch VvJrVbdURB7A5mcLuwFQVOr6689b9eQij+1LSllMQRD1AxFDyyptr6rqX PE2F488BOdZc2GtUsFe88PWbktl72rPDyzMxilXbSgQuDENTetwB7oJL9 mar4UcPvRwFwake3+xqJXBsPgeVXaBzvJHLqtSdvT1Pmp5WorPqQnseBF g==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="451045021" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="451045021" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:18:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="698501379" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="698501379" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 11 Jul 2023 10:18:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id BEBD9748; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 11/14] spi: Get rid of old SPI_MASTER_MUST_TX & SPI_MASTER_MUST_RX Date: Tue, 11 Jul 2023 20:17:53 +0300 Message-Id: <20230711171756.86736-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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: 1771148243485920530 X-GMAIL-MSGID: 1771148243485920530 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 39e6271b5003..b90c53332909 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -1626,8 +1626,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 Tue Jul 11 17:17:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3279844rwh; Tue, 11 Jul 2023 10:35:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlGkHTEKHUFV7dsz2CE5FBq9OkIJOJf1UKF5g8qFnpsTkM+wX/lHtlE9O0EUA9jz6Hw9ny7O X-Received: by 2002:a17:906:414a:b0:989:450:e567 with SMTP id l10-20020a170906414a00b009890450e567mr15559756ejk.65.1689096940104; Tue, 11 Jul 2023 10:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689096940; cv=none; d=google.com; s=arc-20160816; b=R3wlyyqnhQg0BGeDJj/DDtNhwa1ip0kNZ9DFWLKqtTO1WjOMtPYXvCJkHtNqT9cEPN XPrsPfGx43zinmaoZZF20pWf9rtPhsWosVOun81jJgx0tpliv4L2/yIzE4WTrdrT3Zpe vS3UFsLfkDyEMEJvdOuAsO2Z5A0EEr3EeBXqM6FIXs55oU3mfSBKQ53iOwiv0WQn6D// xSOjnffhpwqSoumkjRE3uWiqt0vpTorpHyqq1Jq5oggJFPuaVshhdvzgJfZuDkuE8+SC 2cM9+nQ1RK0D35tz634dMckyV1o6P57sAQItmdUf7kaGdxC18EPhO8IPUdz//TKbxUxN ymXw== 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=lC8Ew4bdSy+Luhd+fJj0Tp0OmBMDo/CLCbE/BsxvOLk=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=A7Zv8AaR2/USohWS6M2a+rpPga1b+JDj+sFd1HGY5HoFrttATzq1mPZltMuDp9j15Z esr56rC5S54i0kU7jAbK2OBpO5D/QxskBLErtZvMBfYfC8O5QfnDZ9/2jhtzMQq2ecHx tV8f1bKAUqHVuZqDKMMWrASvYeS0YWr48QiJbksyDwRLphPLlwlNEZzbHcNYzUfq01To XZgMcaeA0TeuMVawsba5kjC3m9s19zG5BzQL0rGBxKQSfo7CFRlj6NIjNj8jtX6F6Vup TWRxVJL3V2P2xAyhvvT/KMl2aBhTEMtGa+vXo7bAMq9j2/ujvvdmBkwfgWU7GRFNKPc5 u28Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OAQlBWmP; 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 l17-20020a1709067d5100b009888ce5d3d4si2356006ejp.436.2023.07.11.10.35.13; Tue, 11 Jul 2023 10:35:40 -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=OAQlBWmP; 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 S232103AbjGKRSp (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232251AbjGKRSU (ORCPT ); Tue, 11 Jul 2023 13:18:20 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3316E1BB; Tue, 11 Jul 2023 10:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095892; x=1720631892; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RLWyOf9cyhaU0D1jsbC/OzTSXA7cpjUrGSZFXoDODls=; b=OAQlBWmPEL9paXkVVg8X4c3K6hkfNbbSS+G/20vWLU/7R4oi+Y3ni8Qk Yjz+iqAVZ4E6pj3H1a68xm0Vg19V4Gy+i0R1ErWqOD/Ptr3/aSq3JaZt1 XIeiBvtVdNyxG+t2ahnGyWEDpKf07gJmWCE4fKfjY7UlvY1amgqtAhhvm NCF5Eb0BbdcSLUajcQc5JlZG02ysxOyrxuRm2IRnT/kNrpC3sM27cpbVZ zG2KPZF3709BXOZsD+GBgKTs90CECzZi2vFjQo/NKTne+FqLZA77j2ucn V6Uy8n9lmLKOBOOMRw3IKS9iXgsYkvU+c3GzOR6EKN9z9+NrjyKfVD7x9 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="363545622" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="363545622" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:18:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="756427040" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="756427040" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 11 Jul 2023 10:18:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CE41177B; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 12/14] spi: Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS Date: Tue, 11 Jul 2023 20:17:54 +0300 Message-Id: <20230711171756.86736-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,URIBL_BLOCKED autolearn=ham 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: 1771146513510177372 X-GMAIL-MSGID: 1771146513510177372 Rename SPI_MASTER_GPIO_SS to SPI_CONTROLLER_GPIO_SS and convert the code to using SPI_CONTROLLER_GPIO_SS to follow the new naming schema. Signed-off-by: Andy Shevchenko Reviewed-by: Serge Semin # DW APB/AHB SSI --- 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 9b096cbc9926..0612610a091a 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -986,7 +986,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) { @@ -3035,7 +3035,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 b90c53332909..458369939fa5 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -563,8 +563,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 Tue Jul 11 17:17:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3282244rwh; Tue, 11 Jul 2023 10:40:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlF4KHHMjwyRJ5DZRstwrTXnoocmrOb+uvA0lEGWkJHexUGagD2w7IbEMk7pmuv0/JD9+6xT X-Received: by 2002:a05:6512:3e25:b0:4fa:f79f:85a with SMTP id i37-20020a0565123e2500b004faf79f085amr15880754lfv.69.1689097211065; Tue, 11 Jul 2023 10:40:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689097211; cv=none; d=google.com; s=arc-20160816; b=jtRoGsH6lSos6D18N/Hk+iQrLGGfHGoyld76YKa4PEpT58GSDPqhD6/AIyQSH83d+R +8UcmKH4K4yQNqMbdmxauI9oGQM3d5iWJA1nFhgZTcEiZwhCaLIwZsgqysFFQf8kQpcY OOdO57rQC/rKc8YxRWzIrs6Dlq5oRcj5PyTvAR8sqQgPUPxQvohiaN3NDywoRp1wxaM1 TRV79C6mEySAPFWV7VJozXIfqIsYpq4ZBsOhzDU/0VnjuJbajSPoTt0yWp41m9sZXlSe XlmCSwHAg4h2dO58ysI7Abd7kVXNgIdny9PwSQF/2NOzFEZQve/9OIsoEVNKPaEDRzKa Z8Jg== 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=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=P5cRNIeuVJD2IJGHOMeL4yMatQ1pCKX/dGIcJ5gflbdPzr0nsY07g9Zi6huXSgh8i3 JdYc6O7PGBvZ+o6vGP4fw97Dq+Qnno87rwWbcFewxvEavyjs6GXXcrOQOZPRkIcHY1IP YoQzhnVQq6OXkcQDWFg6axGsSRnyXjFMCizy/iEDvrj4TxHOKr5lhwR+ipB3rlDM8/vF CJe7EHPo43BYEvYXdi6hw1SU3QzaLXJaeyijZ9qWkg7XLfAvAxpNaUq3ctBdKcbwwmsz KoPuo4EMrD9DGNJYsqgvzZLt0X+lQUHI3PhVgzlbAWr28rMQEF1VRBsucQSeb55sYC3D BjJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SGbt8SOb; 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 m21-20020aa7d355000000b0051e0fa6f6a6si2652642edr.113.2023.07.11.10.39.47; Tue, 11 Jul 2023 10:40:11 -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=SGbt8SOb; 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 S232306AbjGKRSZ (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231901AbjGKRSM (ORCPT ); Tue, 11 Jul 2023 13:18:12 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEEA310FC; Tue, 11 Jul 2023 10:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095890; x=1720631890; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Fi7Z+SejqB8FmLnWihYsJBZfmhjua3hB69p3/WVjRY=; b=SGbt8SObiAgaHPJ3usbKbQBte1azVKHZ/P+WF31+Cx3zgKfXUw7rBuF9 xB76OPWXC9sgc89JOZCacSAyUcsffPRdHywWSbMNudFAOBB6PTKxxhnrC SeejvGVqnVTPPpQSS6Y0KQ/pp3Gtgjf3JIQRlny2UUmYVRlmIu6FuBF3l 6Y+vT9OYrd2pxxdlfXgtasAuAnIRQLJaWDS+E9mLKA7NhJXm7LQW244J+ +jlgu1LLv+aEmUIdBxA0MH/5yfvPz9oI36Y52sT0sXIudXp3VxKJt1GL0 kR8IgmNeePUXiOTq09jbm9sRFv4DXAV0R6X1gAYB5idzhTKw7b3RRbGzo Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="363545620" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="363545620" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:18:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="756427039" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="756427039" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 11 Jul 2023 10:18:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DE1AC7AB; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 13/14] spi: Convert to SPI_CONTROLLER_HALF_DUPLEX Date: Tue, 11 Jul 2023 20:17:55 +0300 Message-Id: <20230711171756.86736-14-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,URIBL_BLOCKED autolearn=ham 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: 1771146797019309542 X-GMAIL-MSGID: 1771146797019309542 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 Tue Jul 11 17:17:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 118667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:6406:b0:135:48c7:ea9a with SMTP id f6csp3272798rwh; Tue, 11 Jul 2023 10:24:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlGbq6K/xM+kinxTwEdGPwfGYO01RszDz2JXX6vUfzicNlJOE/fJPiFBSoJ7PGEhAsldTyhV X-Received: by 2002:a17:902:f68c:b0:1b8:c1f:fcfc with SMTP id l12-20020a170902f68c00b001b80c1ffcfcmr14446731plg.11.1689096243482; Tue, 11 Jul 2023 10:24:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689096243; cv=none; d=google.com; s=arc-20160816; b=b7YV3HSpawj7ANIhopWuNW+Xug6yTT5qHBtcXf1tFhb/U+txe1sAR8PiaHKkqvme3W +pszrApOZZ6yggl/pgZiWDm8B15YlHNy3jhBrO4wirccBfaWGFLK+ohmRnR21b862XwD purc3vbKib7vG0k4jcHyKBsHplX65+XM4d24LXxl3ttbk5LTJdTK2oKSOMInUKR8TrSo nJQAUyKPwfgzIwH/5Cx1yUguztWdaaaYopNj0DeYHmvIOR7clBN3QjzbV027oQUjxCFB lxfpL6kMbd3zJKuFTw86GzrFdP/VptaLB1ylRuy5PjsbAiys2NcoLes79ouJRYwRSSWf d8yg== 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=O3dzB6QWLTeX2Z1NViCahOECG5qpWmiMvseKyYgVV8A=; fh=1nNdhl7R87shz8NR0wsonZRuXIWFIMAGTVMiI+iZ2Fo=; b=oOPHWvfMzA1p2uAOYyKHL90ZrBvNV3xYf/XjWjDvlc2w52YG9XZUVigP5ubseg8tQU 6wa9FCWbpWvk6XCmEJNTqd8J6POz/RLwWOBO3OuWxQhE5gOZib1niAypGDLYyLatfhRE p/tZ+h1qwjqAOCWvWIVmbb4JzENwoB4+NH9n+7uhn3TFZpI2nxFbsrF7wD0p94XAr4/Q iZizyxTnqmx1qRbkZr6ctALiWJS8eFlRfv6ixzer9QqUlXL+RWnafEF87ZFnaLWgFGYz ZyzLlHGXP9S5YcHRRcqYu6QlTcJxQCMOz0XUbOjiXNkkwuwn0/yKmqjcaLjaT1u0GD/L eF3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EifqWDxV; 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 n17-20020a170902d2d100b001b9fb999147si200914plc.89.2023.07.11.10.23.49; Tue, 11 Jul 2023 10:24: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=EifqWDxV; 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 S232477AbjGKRSr (ORCPT + 99 others); Tue, 11 Jul 2023 13:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232067AbjGKRSV (ORCPT ); Tue, 11 Jul 2023 13:18:21 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E5C5E6C; Tue, 11 Jul 2023 10:18:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689095892; x=1720631892; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E9WeSu8QMGcIxkSmBA1XfBRsutXFax5a+227s9dtqxc=; b=EifqWDxVz+7O06TL6WVBVrPnpgWIBMXAcWtqrWmKF3IgHmeaxUoHksfV 6XaccjYD7nP1UV40TubnQa65RmXu4iQnv/tgyeR5BsBCJZrIqoYYTZEn4 cByUiLe96JpazofDr3MnBkognqxWRrLsx8rUSf16yYTcLpdEf38d5CemB bXhzhQJPQYef1/ZNdxBEezcthpMhiDR20ry39bsRnd/edRWbsxWZo0hAo t+N8nNp6clAx5DRM9WxF28S9vp/XNEnejzOwLcv5xIbU/1B3xK3AOO1B3 aaMnBYprrafeCgj+SXUCiTGgY2wWdZs7z/1DYlziE64v2yij4pa3bXbTY w==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="363545624" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="363545624" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 10:18:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="756427037" X-IronPort-AV: E=Sophos;i="6.01,197,1684825200"; d="scan'208";a="756427037" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 11 Jul 2023 10:18:07 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EE2C9854; Tue, 11 Jul 2023 20:17:59 +0300 (EEST) From: Andy Shevchenko To: Mark Brown , Cristian Ciocaltea , Yang Yingliang , Andy Shevchenko , Amit Kumar Mahapatra via Alsa-devel , Serge Semin , 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 , 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 , Sebastian Reichel Subject: [PATCH v3 14/14] spi: Fix spelling typos and acronyms capitalization Date: Tue, 11 Jul 2023 20:17:56 +0300 Message-Id: <20230711171756.86736-15-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230711171756.86736-1-andriy.shevchenko@linux.intel.com> References: <20230711171756.86736-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,URIBL_BLOCKED autolearn=ham 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: 1771145782765667581 X-GMAIL-MSGID: 1771145782765667581 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 0612610a091a..e656696e3d99 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -692,7 +692,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 */ @@ -869,7 +869,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 @@ -895,7 +895,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) @@ -911,7 +911,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) @@ -923,7 +923,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 */ @@ -1404,7 +1404,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) @@ -1719,11 +1719,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. * @@ -1738,7 +1738,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 */ @@ -2149,8 +2149,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. */ @@ -2479,7 +2479,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) @@ -2613,10 +2613,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. @@ -3314,7 +3314,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) @@ -3527,7 +3528,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) @@ -3597,7 +3598,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 @@ -3646,7 +3647,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. */ @@ -3706,7 +3708,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 @@ -4044,7 +4046,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. @@ -4098,7 +4100,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. @@ -4361,9 +4363,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 * @@ -4374,7 +4376,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. */ @@ -4419,7 +4421,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 458369939fa5..7f8b478fdeb3 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -37,7 +37,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 @@ -56,7 +56,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 @@ -157,7 +157,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 @@ -213,7 +213,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; @@ -224,7 +224,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 @@ -300,11 +300,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 @@ -416,7 +416,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 @@ -474,7 +474,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 @@ -501,7 +501,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. @@ -523,15 +523,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; @@ -576,8 +578,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); @@ -595,7 +597,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 @@ -613,18 +616,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 @@ -705,7 +709,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; @@ -789,7 +793,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); @@ -878,13 +882,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; @@ -902,7 +906,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.) * @@ -913,8 +917,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 @@ -937,7 +941,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 @@ -966,16 +970,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; @@ -1009,7 +1013,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 @@ -1023,10 +1027,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; @@ -1046,9 +1051,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; @@ -1069,7 +1074,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 @@ -1079,7 +1084,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 @@ -1108,7 +1113,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. @@ -1126,14 +1132,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 */ @@ -1173,7 +1180,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 @@ -1190,10 +1197,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; @@ -1293,7 +1300,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 @@ -1303,9 +1310,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; @@ -1331,7 +1338,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. */ @@ -1474,7 +1482,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) @@ -1502,7 +1510,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. */ @@ -1539,12 +1547,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; @@ -1556,7 +1565,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; @@ -1565,12 +1575,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 @@ -1587,7 +1599,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. */