Skip to contentSkip to conversation

driver core: mark remaining local bus_type variables as const

PATCH In review Greg Kroah-Hartman 4 participants 7 messages Dec 19, 2023 – Jan 3, 2024

Subsystems (7)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 1/1 driver core: mark remaining local bus_type variables as const

Now that the driver core can properly handle constant struct bus_type, change the local driver core bus_type variables to be a constant structure as well, placing them into read-only memory which can not be modified at runtime.

Cc Dave Ertman <[email protected]>
Cc Ira Weiny <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc William Breathitt Gray <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Len Brown <[email protected]>
---
 drivers/base/auxiliary.c    | 2 +-
 drivers/base/isa.c          | 2 +-
 drivers/base/memory.c       | 2 +-
 drivers/base/node.c         | 2 +-
 drivers/base/power/domain.c | 2 +-
 drivers/base/soc.c          | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/base/auxiliary.c +1 -1
index 4d4c2c8d26c4..d3a2c40c2f12 100644
@@ -244,7 +244,7 @@ static void auxiliary_bus_shutdown(struct device *dev)
 		auxdrv->shutdown(auxdev);
 }
 
-static struct bus_type auxiliary_bus_type = {
+static const struct bus_type auxiliary_bus_type = {
 	.name = "auxiliary",
 	.probe = auxiliary_bus_probe,
 	.remove = auxiliary_bus_remove,
drivers/base/isa.c +1 -1
index 675ad3139224..e23d0b49a793 100644
@@ -82,7 +82,7 @@ static int isa_bus_resume(struct device *dev)
 	return 0;
 }
 
-static struct bus_type isa_bus_type = {
+static const struct bus_type isa_bus_type = {
 	.name		= "isa",
 	.match		= isa_bus_match,
 	.probe		= isa_bus_probe,
drivers/base/memory.c +1 -1
index f3b9a4d0fa3b..4ac3266da6b5 100644
@@ -68,7 +68,7 @@ static inline unsigned long phys_to_block_id(unsigned long phys)
 static int memory_subsys_online(struct device *dev);
 static int memory_subsys_offline(struct device *dev);
 
-static struct bus_type memory_subsys = {
+static const struct bus_type memory_subsys = {
 	.name = MEMORY_CLASS_NAME,
 	.dev_name = MEMORY_CLASS_NAME,
 	.online = memory_subsys_online,
drivers/base/node.c +1 -1
index 4d588f4658c8..433897eecbdc 100644
@@ -21,7 +21,7 @@
 #include <linux/swap.h>
 #include <linux/slab.h>
 
-static struct bus_type node_subsys = {
+static const struct bus_type node_subsys = {
 	.name = "node",
 	.dev_name = "node",
 };
drivers/base/power/domain.c +1 -1
index da1777e39eaa..096871334cc7 100644
@@ -2670,7 +2670,7 @@ static void genpd_release_dev(struct device *dev)
 	kfree(dev);
 }
 
-static struct bus_type genpd_bus_type = {
+static const struct bus_type genpd_bus_type = {
 	.name		= "genpd",
 };
 
drivers/base/soc.c +1 -1
index c741d0845852..282c38aece0d 100644
@@ -28,7 +28,7 @@ struct soc_device {
 	int soc_dev_num;
 };
 
-static struct bus_type soc_bus_type = {
+static const struct bus_type soc_bus_type = {
 	.name  = "soc",
 };
 static bool soc_bus_registered;
Signature · 1 line
2.43.0
#1 lore raw

drivers/base/isa.c

Quoted 55 lines

-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Tuesday, December 19, 2023 7:35 AM
To: [email protected]; [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; Ertman, David M <[email protected]>; Weiny, Ira <[email protected]>; William Breathitt Gray <[email protected]>; David Hildenbrand <[email protected]>; Oscar Salvador <[email protected]>; Kevin Hilman <[email protected]>; Ulf Hansson <[email protected]>; Brown, Len <[email protected]>
Subject: [PATCH] driver core: mark remaining local bus_type variables as const

Now that the driver core can properly handle constant struct bus_type, change the local driver core bus_type variables to be a constant structure as well, placing them into read-only memory which can not be modified at runtime.

Cc Dave Ertman <[email protected]>
Cc Ira Weiny <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc William Breathitt Gray <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Len Brown <[email protected]>
---
 drivers/base/auxiliary.c    | 2 +-
 drivers/base/isa.c          | 2 +-
 drivers/base/memory.c       | 2 +-
 drivers/base/node.c         | 2 +-
 drivers/base/power/domain.c | 2 +-
 drivers/base/soc.c          | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/base/auxiliary.c +1 -1
index 4d4c2c8d26c4..d3a2c40c2f12 100644
@@ -244,7 +244,7 @@ static void auxiliary_bus_shutdown(struct device
 *dev)
 		auxdrv->shutdown(auxdev);
 }
 
-static struct bus_type auxiliary_bus_type = {
+static const struct bus_type auxiliary_bus_type = {
 	.name = "auxiliary",
 	.probe = auxiliary_bus_probe,
drivers/base/auxiliary.c +0 -0
 	.remove = auxiliary_bus_remove,
drivers/base/isa.c +0 -0
index 675ad3139224..e23d0b49a793 100644

LGTM - ACK

DaveE

author maintainer
#2 lore raw
Quoted 46 lines · David M
Quoted 46 lines

-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Tuesday, December 19, 2023 7:35 AM
To: [email protected]; [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; Ertman, David M <[email protected]>; Weiny, Ira <[email protected]>; William Breathitt Gray <[email protected]>; David Hildenbrand <[email protected]>; Oscar Salvador <[email protected]>; Kevin Hilman <[email protected]>; Ulf Hansson <[email protected]>; Brown, Len <[email protected]>
Subject: [PATCH] driver core: mark remaining local bus_type variables as const

Now that the driver core can properly handle constant struct bus_type, change the local driver core bus_type variables to be a constant structure as well, placing them into read-only memory which can not be modified at runtime.

Cc Dave Ertman <[email protected]>
Cc Ira Weiny <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc William Breathitt Gray <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Len Brown <[email protected]>
---
 drivers/base/auxiliary.c    | 2 +-
 drivers/base/isa.c          | 2 +-
 drivers/base/memory.c       | 2 +-
 drivers/base/node.c         | 2 +-
 drivers/base/power/domain.c | 2 +-
 drivers/base/soc.c          | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/base/auxiliary.c +0 -0
index 4d4c2c8d26c4..d3a2c40c2f12 100644
@@ -244,7 +244,7 @@ static void auxiliary_bus_shutdown(struct device
 *dev)
 		auxdrv->shutdown(auxdev);
 }
 
Quoted 11 lines

drivers/base/isa.c

Quoted 9 lines
drivers/base/auxiliary.c +1 -1
-static struct bus_type auxiliary_bus_type = {
+static const struct bus_type auxiliary_bus_type = {
 	.name = "auxiliary",
 	.probe = auxiliary_bus_probe,
drivers/base/auxiliary.c +0 -0
 	.remove = auxiliary_bus_remove,
drivers/base/isa.c +0 -0
index 675ad3139224..e23d0b49a793 100644

LGTM - ACK

So, is that an "Acked-by:" type response? We need something standard for our tools to pick up...

thanks,

greg k-h

reviewer Acked-by
#3 lore raw
Quoted 75 lines

-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Tuesday, December 19, 2023 10:13 AM
To: Ertman, David M <[email protected]>
Cc: [email protected]; [email protected]; Weiny, Ira <[email protected]>; William Breathitt Gray <[email protected]>; David Hildenbrand <[email protected]>; Oscar Salvador <[email protected]>; Kevin Hilman <[email protected]>; Ulf Hansson <[email protected]>; Brown, Len <[email protected]>
Subject: Re: [PATCH] driver core: mark remaining local bus_type variables as const

Quoted 5 lines · David M
Quoted 5 lines

-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Tuesday, December 19, 2023 7:35 AM
To: [email protected]; [email protected]
Cc: Greg Kroah-Hartman <[email protected]>; Ertman, David

M

Quoted 1 line
Quoted 1 line

<[email protected]>; Weiny, Ira <[email protected]>;

William

Quoted 2 lines
Quoted 2 lines

Breathitt Gray <[email protected]>; David Hildenbrand <[email protected]>; Oscar Salvador <[email protected]>; Kevin

Hilman

Quoted 1 line
Quoted 1 line

<[email protected]>; Ulf Hansson <[email protected]>; Brown,

Len

Quoted 37 lines
Quoted 37 lines

<[email protected]>
Subject: [PATCH] driver core: mark remaining local bus_type variables as const

Now that the driver core can properly handle constant struct bus_type, change the local driver core bus_type variables to be a constant structure as well, placing them into read-only memory which can not be modified at runtime.

Cc Dave Ertman <[email protected]>
Cc Ira Weiny <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc William Breathitt Gray <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Len Brown <[email protected]>
---
 drivers/base/auxiliary.c    | 2 +-
 drivers/base/isa.c          | 2 +-
 drivers/base/memory.c       | 2 +-
 drivers/base/node.c         | 2 +-
 drivers/base/power/domain.c | 2 +-
 drivers/base/soc.c          | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/base/auxiliary.c +0 -0
index 4d4c2c8d26c4..d3a2c40c2f12 100644
@@ -244,7 +244,7 @@ static void auxiliary_bus_shutdown(struct device
 *dev)
 		auxdrv->shutdown(auxdev);
 }
 
Quoted 11 lines

drivers/base/isa.c

Quoted 9 lines
drivers/base/auxiliary.c +1 -1
-static struct bus_type auxiliary_bus_type = {
+static const struct bus_type auxiliary_bus_type = {
 	.name = "auxiliary",
 	.probe = auxiliary_bus_probe,
drivers/base/auxiliary.c +0 -0
 	.remove = auxiliary_bus_remove,
drivers/base/isa.c +0 -0
index 675ad3139224..e23d0b49a793 100644

LGTM - ACK

Quoted 6 lines

So, is that an "Acked-by:" type response? We need something standard for our tools to pick up...

thanks,

greg k-h

Sorry about that :)

Acked-by on v1 1/1
#4 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, change the local driver core bus_type variables to be a constant structure as well, placing them into read-only memory which can not be modified at runtime.

Quoted 10 lines
Cc Dave Ertman <[email protected]>
Cc Ira Weiny <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc William Breathitt Gray <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Len Brown <[email protected]>
#5 lore raw
In reply to Greg Kroah-Hartman
Quoted 16 lines · Greg Kroah-Hartman

Now that the driver core can properly handle constant struct bus_type, change the local driver core bus_type variables to be a constant structure as well, placing them into read-only memory which can not be modified at runtime.

Cc Dave Ertman <[email protected]>
Cc Ira Weiny <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc William Breathitt Gray <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Len Brown <[email protected]>
Quoted 6 lines
---
 drivers/base/auxiliary.c    | 2 +-
 drivers/base/isa.c          | 2 +-
 drivers/base/memory.c       | 2 +-
 drivers/base/node.c         | 2 +-
 drivers/base/power/domain.c | 2 +-

This above file has moved to drivers/pmdomain/core.c and I am carrying that patch in my pmdomain tree. If you have the time to send a separate patch for it, I can pick it up.

Kind regards
Uffe

author maintainer
#6 lore raw
Quoted 25 lines · Ulf Hansson
Quoted 16 lines · Greg Kroah-Hartman

Now that the driver core can properly handle constant struct bus_type, change the local driver core bus_type variables to be a constant structure as well, placing them into read-only memory which can not be modified at runtime.

Cc Dave Ertman <[email protected]>
Cc Ira Weiny <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc William Breathitt Gray <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Ulf Hansson <[email protected]>
Cc Len Brown <[email protected]>
Quoted 6 lines
---
 drivers/base/auxiliary.c    | 2 +-
 drivers/base/isa.c          | 2 +-
 drivers/base/memory.c       | 2 +-
 drivers/base/node.c         | 2 +-
 drivers/base/power/domain.c | 2 +-
Quoted 3 lines

This above file has moved to drivers/pmdomain/core.c and I am carrying that patch in my pmdomain tree. If you have the time to send a separate patch for it, I can pick it up.

This is already in my tree and in linux-next, so all should be good.

thanks,

greg k-h