* [PATCH] i2c: make i2c_bus_type const
@ 2023-12-19 15:22 Greg Kroah-Hartman
2023-12-19 15:24 ` Mark Brown
2023-12-19 21:01 ` Wolfram Sang
0 siblings, 2 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2023-12-19 15:22 UTC (permalink / raw)
To: wsa
Cc: linux-kernel, Greg Kroah-Hartman, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Heiko Stuebner, linux-i2c,
linux-sound, linux-arm-kernel, linux-rockchip
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 <wsa@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Heiko Stuebner <heiko@sntech.de>
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 <gregkh@linuxfoundation.org>
---
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 <linux/swab.h> /* for swab16 */
#include <uapi/linux/i2c.h>
-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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: make i2c_bus_type const
2023-12-19 15:22 [PATCH] i2c: make i2c_bus_type const Greg Kroah-Hartman
@ 2023-12-19 15:24 ` Mark Brown
2023-12-19 21:01 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2023-12-19 15:24 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: wsa, linux-kernel, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Heiko Stuebner, linux-i2c, linux-sound, linux-arm-kernel,
linux-rockchip
[-- Attachment #1.1: Type: text/plain, Size: 326 bytes --]
On Tue, Dec 19, 2023 at 04:22:43PM +0100, Greg Kroah-Hartman wrote:
> 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.
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: make i2c_bus_type const
2023-12-19 15:22 [PATCH] i2c: make i2c_bus_type const Greg Kroah-Hartman
2023-12-19 15:24 ` Mark Brown
@ 2023-12-19 21:01 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2023-12-19 21:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: linux-kernel, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Heiko Stuebner, linux-i2c, linux-sound,
linux-arm-kernel, linux-rockchip
[-- Attachment #1.1: Type: text/plain, Size: 976 bytes --]
On Tue, Dec 19, 2023 at 04:22:43PM +0100, Greg Kroah-Hartman wrote:
> 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 <wsa@kernel.org>
> Cc: Liam Girdwood <lgirdwood@gmail.com>
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Heiko Stuebner <heiko@sntech.de>
> 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 <gregkh@linuxfoundation.org>
Applied to for-next, thanks!
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-19 21:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 15:22 [PATCH] i2c: make i2c_bus_type const Greg Kroah-Hartman
2023-12-19 15:24 ` Mark Brown
2023-12-19 21:01 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox