Skip to contentSkip to conversation

coresight: make coresight_bustype const

PATCH In review Greg Kroah-Hartman 2 participants 4 messages Jan 5, 2024 – Feb 12, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 coresight: make coresight_bustype const

Now that the driver core can properly handle constant struct bus_type, move the coresight_bustype variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Cc Suzuki K Poulose <[email protected]>
Cc Mike Leach <[email protected]>
Cc James Clark <[email protected]>
Cc Leo Yan <[email protected]>
Cc Alexander Shishkin <[email protected]>
---
 drivers/hwtracing/coresight/coresight-core.c | 2 +-
 include/linux/coresight.h                    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +1 -1
index 9fabe00a40d6..24c49e581737 100644
@@ -1796,7 +1796,7 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,
 }
 EXPORT_SYMBOL_GPL(coresight_alloc_device_name);
 
-struct bus_type coresight_bustype = {
+const struct bus_type coresight_bustype = {
 	.name	= "coresight",
 };
 
include/linux/coresight.h +1 -1
index a269fffaf991..8fe75a0d7693 100644
@@ -35,7 +35,7 @@
 
 #define CORESIGHT_UNLOCK	0xc5acce55
 
-extern struct bus_type coresight_bustype;
+extern const struct bus_type coresight_bustype;
 
 enum coresight_dev_type {
 	CORESIGHT_DEV_TYPE_SINK,
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 35 lines · Greg Kroah-Hartman

Now that the driver core can properly handle constant struct bus_type, move the coresight_bustype variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Cc Suzuki K Poulose <[email protected]>
Cc Mike Leach <[email protected]>
Cc James Clark <[email protected]>
Cc Leo Yan <[email protected]>
Cc Alexander Shishkin <[email protected]>
---
  drivers/hwtracing/coresight/coresight-core.c | 2 +-
  include/linux/coresight.h                    | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +1 -1
index 9fabe00a40d6..24c49e581737 100644
@@ -1796,7 +1796,7 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,
  }
  EXPORT_SYMBOL_GPL(coresight_alloc_device_name);
 
-struct bus_type coresight_bustype = {
+const struct bus_type coresight_bustype = {
  	.name	= "coresight",
  };
 
include/linux/coresight.h +0 -0
index a269fffaf991..8fe75a0d7693 100644

include/linux/coresight.h line 38

Quoted 5 lines
include/linux/coresight.h +1 -1
@@ -35,7 +35,7 @@
 
  #define CORESIGHT_UNLOCK	0xc5acce55
 
-extern struct bus_type coresight_bustype;
+extern const struct bus_type coresight_bustype;

Thanks, for the patch. I will queue this for v6.8.

Thanks
Suzuki

Quoted 3 lines
include/linux/coresight.h +0 -0
  enum coresight_dev_type {
  	CORESIGHT_DEV_TYPE_SINK,
#2 lore raw
Quoted 31 lines · Suzuki K Poulose
Quoted 30 lines · Greg Kroah-Hartman

Now that the driver core can properly handle constant struct bus_type, move the coresight_bustype variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Cc Suzuki K Poulose <[email protected]>
Cc Mike Leach <[email protected]>
Cc James Clark <[email protected]>
Cc Leo Yan <[email protected]>
Cc Alexander Shishkin <[email protected]>
---
  drivers/hwtracing/coresight/coresight-core.c | 2 +-
  include/linux/coresight.h                    | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +1 -1
index 9fabe00a40d6..24c49e581737 100644
@@ -1796,7 +1796,7 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,
  }
  EXPORT_SYMBOL_GPL(coresight_alloc_device_name);
-struct bus_type coresight_bustype = {
+const struct bus_type coresight_bustype = {
  	.name	= "coresight",
  };
include/linux/coresight.h +0 -0
index a269fffaf991..8fe75a0d7693 100644
Quoted 8 lines

include/linux/coresight.h line 36

Quoted 6 lines
include/linux/coresight.h +1 -1
@@ -35,7 +35,7 @@
  #define CORESIGHT_UNLOCK	0xc5acce55
-extern struct bus_type coresight_bustype;
+extern const struct bus_type coresight_bustype;

Thanks, for the patch. I will queue this for v6.8.

Thanks!

maintainer
#3 lore raw
In reply to Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman

Now that the driver core can properly handle constant struct bus_type, move the coresight_bustype variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.

Moved to next, thanks!

[1/1] coresight: make coresight_bustype const

      https://git.kernel.org/coresight/c/dd95255d44c0

Best regards,

Signature · 1 line
Suzuki K Poulose <[email protected]>