Message ID | 2024010549-erasure-swoop-1cc6@gregkh |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-17752-ouuuleilei=gmail.com@vger.kernel.org> 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 <ouuuleilei@gmail.com> (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 <ouuuleilei@gmail.com>; 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 <gregkh@linuxfoundation.org> To: broonie@kernel.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> 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 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787246194718612722 X-GMAIL-MSGID: 1787246194718612722 |
Series |
spi: make spi_bus_type const
|
|
Commit Message
Greg KH
Jan. 5, 2024, 10:32 a.m. UTC
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 <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/spi/spi.c | 2 +-
include/linux/spi/spi.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
On Fri, Jan 05, 2024 at 11:32:50AM +0100, Greg Kroah-Hartman wrote: > 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. Whatever makes the driver core able to handle this doesn't seem to be in mainline yet - what's the story there?
On Fri, Jan 05, 2024 at 02:55:01PM +0000, Mark Brown wrote: > On Fri, Jan 05, 2024 at 11:32:50AM +0100, Greg Kroah-Hartman wrote: > > 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. > > Whatever makes the driver core able to handle this doesn't seem to be in > mainline yet - what's the story there? Odd, what errors are you seeing when you build? I have had to fix up a few subsys_* calls for this type of thing, but I don't see spi_bus_type being used in those that I saw in my local tree. Did I miss something else? Maybe just wait for after 6.8-rc1, it builds properly here locally :) thanks, greg k-h
On Fri, Jan 05, 2024 at 04:05:18PM +0100, Greg Kroah-Hartman wrote: > On Fri, Jan 05, 2024 at 02:55:01PM +0000, Mark Brown wrote: > > Whatever makes the driver core able to handle this doesn't seem to be in > > mainline yet - what's the story there? > Odd, what errors are you seeing when you build? I have had to fix up a > few subsys_* calls for this type of thing, but I don't see spi_bus_type > being used in those that I saw in my local tree. Did I miss something > else? > Maybe just wait for after 6.8-rc1, it builds properly here locally :) It's this on an x86 allmodconfig: /build/stage/linux/sound/soc/rockchip/rk3399_gru_sound.c:471:29: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 471 | .bus_type = &spi_bus_type, | ^ cc1: all warnings being treated as errors so not actually a core thing, I have to confess I didn't notice where the assignment was when I glanced at the errors.
On Fri, Jan 05, 2024 at 03:45:37PM +0000, Mark Brown wrote: > On Fri, Jan 05, 2024 at 04:05:18PM +0100, Greg Kroah-Hartman wrote: > > On Fri, Jan 05, 2024 at 02:55:01PM +0000, Mark Brown wrote: > > > > Whatever makes the driver core able to handle this doesn't seem to be in > > > mainline yet - what's the story there? > > > Odd, what errors are you seeing when you build? I have had to fix up a > > few subsys_* calls for this type of thing, but I don't see spi_bus_type > > being used in those that I saw in my local tree. Did I miss something > > else? > > > Maybe just wait for after 6.8-rc1, it builds properly here locally :) > > It's this on an x86 allmodconfig: > > /build/stage/linux/sound/soc/rockchip/rk3399_gru_sound.c:471:29: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] > 471 | .bus_type = &spi_bus_type, > | ^ > cc1: all warnings being treated as errors > > so not actually a core thing, I have to confess I didn't notice where > the assignment was when I glanced at the errors. Ah, missed that, as it was handled by this commit for the i2c tree: https://lore.kernel.org/all/2023121942-jumble-unethical-3163@gregkh/ So just hold off on this until after 6.8-rc1 is out, or I can wait until then as well if you ack it and take it through my tree. thanks, greg k-h
On Fri, Jan 05, 2024 at 04:51:04PM +0100, Greg Kroah-Hartman wrote: > On Fri, Jan 05, 2024 at 03:45:37PM +0000, Mark Brown wrote: > > so not actually a core thing, I have to confess I didn't notice where > > the assignment was when I glanced at the errors. > Ah, missed that, as it was handled by this commit for the i2c tree: > https://lore.kernel.org/all/2023121942-jumble-unethical-3163@gregkh/ > So just hold off on this until after 6.8-rc1 is out, or I can wait until > then as well if you ack it and take it through my tree. It's OK - I can just drop it in my queue for applying after -rc1.
On Fri, Jan 05, 2024 at 03:59:04PM +0000, Mark Brown wrote: > On Fri, Jan 05, 2024 at 04:51:04PM +0100, Greg Kroah-Hartman wrote: > > On Fri, Jan 05, 2024 at 03:45:37PM +0000, Mark Brown wrote: > > > > so not actually a core thing, I have to confess I didn't notice where > > > the assignment was when I glanced at the errors. > > > Ah, missed that, as it was handled by this commit for the i2c tree: > > https://lore.kernel.org/all/2023121942-jumble-unethical-3163@gregkh/ > > > So just hold off on this until after 6.8-rc1 is out, or I can wait until > > then as well if you ack it and take it through my tree. > > It's OK - I can just drop it in my queue for applying after -rc1. Wonderful, many thanks. greg k-h
On Fri, 05 Jan 2024 11:32:50 +0100, Greg Kroah-Hartman wrote: > 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. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: make spi_bus_type const commit: 6df534cc7136fc9e023cbd4e0011a04e3659e74d All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
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