From patchwork Fri Jan 5 10:32:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 185341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6136311dyb; Fri, 5 Jan 2024 02:33:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8jpQBmYer1fBtIdWGTi39CkAps/XHLuKMkm6bZzxkUWo3o4ApZKawFP34Hrw39kP0PlPV X-Received: by 2002:a17:906:c08b:b0:a26:a6d9:5410 with SMTP id f11-20020a170906c08b00b00a26a6d95410mr691977ejz.169.1704450793256; Fri, 05 Jan 2024 02:33:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704450793; cv=none; d=google.com; s=arc-20160816; b=Twa84SBzaP6UOfRJuRAHqV+5Cp+KeZnLzgQYDl/XSz5GBV+GDpHyBTd7LyTreI4b86 IxOmYfP5h3GpiU5yyLOf6v2ADZlJ0/pUnuX6m94HJ5fdFFhh3Y3cwSeWWLV+hQxnTC+w OF3AyeX0RRCdE8H3IZLGkrKt1bAiubcHNDyIr9XMr6hpVetbS7lj/PDGps7YVp5ZYUCI +D9+lj235Wx5CDZ5rH/zBrdBAgFoYRSITCDiHhRm37wfRxRrbuOwL5+1vw1gjJt9416b ba32nNokF/6fAqQzpGNTXMzahg/hNSQrFtZGOcFUTxfn5q3LRu49BuRSue2gm74eOKG7 hrEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=JCNC1Qf9EKoo2pTz20SpI1wxf0Ui9SMd/pDbZ//QTYo=; fh=WNWHacS6Ik8MrHKegPFi7FoyW50UHepgcVe58esaX/w=; b=tQtS4xa/OTBX7iUPeZDW7i8R8z5UnhKSYAUm02hWxh9Y8f0oOpF2FuCDbB3HR04/vs ciukoSe7+Rh+IH8M5+14bTkpUAe6iD4QMBl5dwKjprb/ODJ31wo7LkVCdgVzVIbucjrn ez74Ws49+j5/ABi40qeVHUErRAXwe1nuUKsKxylWbjXPoVkRGiZxOKbfGzud/cZvVP1e u1Yn2WzCae6ZYRY2+k+jXlEk5nsOm5F7rmZo56bnzBMFa9HoPVSTu1qpRIfG3j8JedOd p5aACJwsk8eR8gbgKgttnlmvBFORvQmM/2sMWDEi9/q5GynC093pXGZtXvqeorphaEC1 ka3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XvBMOKWv; spf=pass (google.com: domain of linux-kernel+bounces-17752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17752-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d15-20020a1709067f0f00b00a280651f7efsi476049ejr.794.2024.01.05.02.33.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 02:33:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XvBMOKWv; spf=pass (google.com: domain of linux-kernel+bounces-17752-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17752-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DA00F1F23F27 for ; Fri, 5 Jan 2024 10:33:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 317CF2836A; Fri, 5 Jan 2024 10:32:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XvBMOKWv" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77599250E7; Fri, 5 Jan 2024 10:32:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61627C433C7; Fri, 5 Jan 2024 10:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1704450774; bh=tAtGPzyENe7G8V+fHZtEGeUbT9NOsNspX0RJlOE6D7g=; h=From:To:Cc:Subject:Date:From; b=XvBMOKWvx8Ihe9KWS7Xectnpfug8yO72QOOc4B2sgHXITIfWrS9HqDO1TGQltXTRf vbG9e9YXxghuZYH21HDTNjZn8JTnkUhOE19GkfDHEcWD6SW2IX7uZLNehpNWdofx42 UuCGkto3q9uTq6EGlVX0YXEAzrzjWOfxpU22E2fs= From: Greg Kroah-Hartman To: broonie@kernel.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-spi@vger.kernel.org Subject: [PATCH] spi: make spi_bus_type const Date: Fri, 5 Jan 2024 11:32:50 +0100 Message-ID: <2024010549-erasure-swoop-1cc6@gregkh> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lines: 40 X-Developer-Signature: v=1; a=openpgp-sha256; l=1336; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=tAtGPzyENe7G8V+fHZtEGeUbT9NOsNspX0RJlOE6D7g=; b=owGbwMvMwCRo6H6F97bub03G02pJDKnTb13iW7v2mPKxmbuzzdd9fqhSfezLz7tp0etP1/c/c 9iypWOOfkcsC4MgE4OsmCLLl208R/dXHFL0MrQ9DTOHlQlkCAMXpwBMxKKZYQ5Pbqy9l+VZDV7z P9fvvt+yMapSSZBhweSzN++FlLXxX12a/2J32qN7HporQwE= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787246194718612722 X-GMAIL-MSGID: 1787246194718612722 Now that the driver core can properly handle constant struct bus_type, move the spi_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Mark Brown Cc: linux-spi@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi.c | 2 +- include/linux/spi/spi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 8ead7acb99f3..6e962befc450 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -459,7 +459,7 @@ static void spi_shutdown(struct device *dev) } } -struct bus_type spi_bus_type = { +const struct bus_type spi_bus_type = { .name = "spi", .dev_groups = spi_dev_groups, .match = spi_match_device, diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 255a0562aea5..f6c157dee55d 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -33,7 +33,7 @@ struct spi_message; * INTERFACES between SPI master-side drivers and SPI slave protocol handlers, * and SPI infrastructure. */ -extern struct bus_type spi_bus_type; +extern const struct bus_type spi_bus_type; /** * struct spi_statistics - statistics for spi transfers