Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp573118rdh; Tue, 19 Dec 2023 07:23:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IESAl0fy+JjIwNYhd7JL9549i6EI811X6vFWAJJ13nk2BEjvul1jkT+lifSfnRvrRWY+gfX X-Received: by 2002:a05:6a20:6a03:b0:18f:bd86:ccaa with SMTP id p3-20020a056a206a0300b0018fbd86ccaamr10090565pzk.55.1702999392804; Tue, 19 Dec 2023 07:23:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702999392; cv=none; d=google.com; s=arc-20160816; b=dd3KGKD7aHUaXXw1IPZT8DUJWjAaWhh8FA2XSgXDPwAbDch/05fvCGuP41N43kbDTD M97DxRoqli/6rETVTYKQxKuGp7vbyXwsSqHCIjKeffLeZ2AARDzOlsLGDJ5jtBnJMh+i YW3LAbWpZ42IReMbGskptghqIygIxSZAGBh3q1P83YW5oN+qzpJoHpHGE3ri0MlLowEb Y8bCmAufDK2ExHOsbJ2l/eVm2rn1TMQbpEgN3UEZb99QxIHaLLZixtVvrcNwduBNtfFh 0DZdF/RCW4De1dSIgZIAdrv/cQ2VriZvoJg132C3RCVjGtRmYp2spYBx5SP+oVFnQmwa jKFw== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c14-20020a6566ce000000b005cd896e80ebsi5034424pgw.504.2023.12.19.07.23.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 07:23:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5476-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 72FF6281F45 for ; Tue, 19 Dec 2023 15:23:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD0FD1CA82; Tue, 19 Dec 2023 15:22:50 +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 Content-Transfer-Encoding: 8bit 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 --- 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[] = { -- 2.43.0