From patchwork Tue Dec 19 15:22:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181058 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2014297dyi; Tue, 19 Dec 2023 07:23:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGwwjJiP/lyknVGvQo3EjQncTpP4xuO6NeUSxmqUVqm3uyksP3keyiThr5084KPfUcy+zgy X-Received: by 2002:a2e:a685:0:b0:2cc:69a6:a49d with SMTP id q5-20020a2ea685000000b002cc69a6a49dmr1792020lje.78.1702999403680; Tue, 19 Dec 2023 07:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702999403; cv=none; d=google.com; s=arc-20160816; b=kZSQsJpv/td6Z1GoxGRZHJupt3BlTUhGvA/p0goVUbcsvTQ6vE8h5FMbUKIvBqvLdB PoHscaxgL6QRseYtYO62SZ803V9N5hayOQ6t6jCTGsPEjVvWnWHopEP95FClFvoLx8Ky Ug5DFKFv5wltznbqGs5XLw5w6VjFLcqUb2nhgwA9Nw3eK8vAGWXTmnGWyMq7oQQHEhTT +5kHhmkeyMjtBia77RyMrhlmrqCzJYEWqRSEdF8E5Ff/PsDQgnj8R+d75KtTUjjqDZ2g PgBfsjluZaZ8rDua9TjdUQTJCMwR6ALMf35TPwFPLiadnIV+4OptDXOSbuj1bC/OyzYP ywZw== 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=FjptakCFRGoZHCOCZ2wvuUJYcnyw1P94Xr8igVmZ5XU=; fh=Xr83CS9dk/a3lYjcXQDSrKY1kS8RDkseiraDBDFnRl0=; b=jy5+BD8bomsvkH5ZBBWm236V3e4bfPWLb5Z3qJUpytbzxU7ZO8jiLwA3ysn+QB3l9g bV5EFnEYgLa++SyVlwiowEArwiz1OSgXFqwQGF/Wb16G++dSpig4bgzd3K0JcL3mCndp YkCFBuVPYRrNs0EvnCJ/B2ERaC1dnQOR1CM+L2qHofBPp00qRLtKD6vDDvimrFD7y6/A 7HCb/CHxPIS/etGmc7UpgoMW07jYCgxUDwMq5koakKV55nYyObP1TnStPou88w0PpFfg 6B498iAoVo7fUn+CztXojWjyWJ9Bqf7K6Iu8z3+J9DJVjRF+3cFITk8KxTB17VsqWAbw q6Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WsR5eIqp; spf=pass (google.com: domain of linux-kernel+bounces-5476-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5476-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 r11-20020a50c00b000000b00552eb91b0d0si3476771edb.534.2023.12.19.07.23.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 07:23:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5476-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=WsR5eIqp; spf=pass (google.com: domain of linux-kernel+bounces-5476-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5476-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 3E1041F233E5 for ; Tue, 19 Dec 2023 15:23:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 933941CFA8; Tue, 19 Dec 2023 15:22:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WsR5eIqp" 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 D63421C69D; Tue, 19 Dec 2023 15:22:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D439FC433C8; Tue, 19 Dec 2023 15:22:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702999369; bh=vOJ9fKH6Xqs5UvwP9s7vsM9ZkdDZzxdG2BYm96rLvAY=; h=From:To:Cc:Subject:Date:From; b=WsR5eIqpOuTF0cIbg+QKbJk945zH4aWyXTOIY1x3RQA0jbBvivNWsuj7e6Upmrryd RyL951N7XwvzbPbR4ViNCIRb5JLQqt7ZEr7thVILxZfFjWkwanT8MVZ+xBn2ZcerUg bXjNwD7NXCrngu8Maaslp8kRTGGO1BmBMQOT/Ooc= From: Greg Kroah-Hartman To: wsa@kernel.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Heiko Stuebner , linux-i2c@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH] i2c: make i2c_bus_type const Date: Tue, 19 Dec 2023 16:22:43 +0100 Message-ID: <2023121942-jumble-unethical-3163@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: 66 X-Developer-Signature: v=1; a=openpgp-sha256; l=2417; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=vOJ9fKH6Xqs5UvwP9s7vsM9ZkdDZzxdG2BYm96rLvAY=; b=owGbwMvMwCRo6H6F97bub03G02pJDKmNW51Sba1dDtXZnllysInD6hGjp6HmpIbM+iDrWF39f x6PXrh0xLIwCDIxyIopsnzZxnN0f8UhRS9D29Mwc1iZQIYwcHEKwEQKIhjm2U4SyLvO9cnsvoJq 3W9WhQ+C58WMGObp7bSdUBOyNC9E6FVt/PQlO9Sz518HAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785724302856464788 X-GMAIL-MSGID: 1785724302856464788 Now that the driver core can properly handle constant struct bus_type, move the i2c_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Note, the sound/soc/rockchip/rk3399_gru_sound.c also needed tweaking as it decided to save off a pointer to a bus type for internal stuff, and it was using the i2c_bus_type as well. Cc: Wolfram Sang Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Heiko Stuebner Cc: linux-i2c@vger.kernel.org Cc: linux-sound@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Signed-off-by: Greg Kroah-Hartman Acked-by: Mark Brown --- drivers/i2c/i2c-core-base.c | 2 +- include/linux/i2c.h | 2 +- sound/soc/rockchip/rk3399_gru_sound.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index eac90a3cf61a..24c6e1b52668 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -689,7 +689,7 @@ static struct attribute *i2c_dev_attrs[] = { }; ATTRIBUTE_GROUPS(i2c_dev); -struct bus_type i2c_bus_type = { +const struct bus_type i2c_bus_type = { .name = "i2c", .match = i2c_device_match, .probe = i2c_device_probe, diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 0dae9db27538..180462d1a373 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -23,7 +23,7 @@ #include /* for swab16 */ #include -extern struct bus_type i2c_bus_type; +extern const struct bus_type i2c_bus_type; extern struct device_type i2c_adapter_type; extern struct device_type i2c_client_type; diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 1a504ebd3a0e..6c89c7331229 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -446,7 +446,7 @@ static const struct rockchip_sound_route rockchip_routes[] = { struct dailink_match_data { const char *compatible; - struct bus_type *bus_type; + const struct bus_type *bus_type; }; static const struct dailink_match_data dailink_match[] = {