driver core: mark remaining local bus_type variables as const

Message ID 2023121908-paver-follow-cc21@gregkh
State New
Headers
Series driver core: mark remaining local bus_type variables as const |

Commit Message

Greg KH Dec. 19, 2023, 3:35 p.m. UTC
  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 <david.m.ertman@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: William Breathitt Gray <william.gray@linaro.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Kevin Hilman <khilman@kernel.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 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(-)
  

Comments

Ertman, David M Dec. 19, 2023, 6:02 p.m. UTC | #1
> -----Original Message-----
> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Sent: Tuesday, December 19, 2023 7:35 AM
> To: rafael@kernel.org; linux-kernel@vger.kernel.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Ertman, David M
> <david.m.ertman@intel.com>; Weiny, Ira <ira.weiny@intel.com>; William
> Breathitt Gray <william.gray@linaro.org>; David Hildenbrand
> <david@redhat.com>; Oscar Salvador <osalvador@suse.de>; Kevin Hilman
> <khilman@kernel.org>; Ulf Hansson <ulf.hansson@linaro.org>; Brown, Len
> <len.brown@intel.com>
> 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 <david.m.ertman@intel.com>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: William Breathitt Gray <william.gray@linaro.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Kevin Hilman <khilman@kernel.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Len Brown <len.brown@intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  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(-)
> 
> diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
> index 4d4c2c8d26c4..d3a2c40c2f12 100644
> --- a/drivers/base/auxiliary.c
> +++ b/drivers/base/auxiliary.c
> @@ -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,
> diff --git a/drivers/base/isa.c b/drivers/base/isa.c
> index 675ad3139224..e23d0b49a793 100644
> --- a/drivers/base/isa.c
> +++ b/drivers/base/isa.c

LGTM - ACK

DaveE
  
Greg KH Dec. 19, 2023, 6:13 p.m. UTC | #2
On Tue, Dec 19, 2023 at 06:02:33PM +0000, Ertman, David M wrote:
> > -----Original Message-----
> > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Sent: Tuesday, December 19, 2023 7:35 AM
> > To: rafael@kernel.org; linux-kernel@vger.kernel.org
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Ertman, David M
> > <david.m.ertman@intel.com>; Weiny, Ira <ira.weiny@intel.com>; William
> > Breathitt Gray <william.gray@linaro.org>; David Hildenbrand
> > <david@redhat.com>; Oscar Salvador <osalvador@suse.de>; Kevin Hilman
> > <khilman@kernel.org>; Ulf Hansson <ulf.hansson@linaro.org>; Brown, Len
> > <len.brown@intel.com>
> > 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 <david.m.ertman@intel.com>
> > Cc: Ira Weiny <ira.weiny@intel.com>
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > Cc: William Breathitt Gray <william.gray@linaro.org>
> > Cc: David Hildenbrand <david@redhat.com>
> > Cc: Oscar Salvador <osalvador@suse.de>
> > Cc: Kevin Hilman <khilman@kernel.org>
> > Cc: Ulf Hansson <ulf.hansson@linaro.org>
> > Cc: Len Brown <len.brown@intel.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  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(-)
> > 
> > diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
> > index 4d4c2c8d26c4..d3a2c40c2f12 100644
> > --- a/drivers/base/auxiliary.c
> > +++ b/drivers/base/auxiliary.c
> > @@ -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,
> > diff --git a/drivers/base/isa.c b/drivers/base/isa.c
> > index 675ad3139224..e23d0b49a793 100644
> > --- a/drivers/base/isa.c
> > +++ b/drivers/base/isa.c
> 
> LGTM - ACK

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

thanks,

greg k-h
  
Ertman, David M Dec. 19, 2023, 6:32 p.m. UTC | #3
> -----Original Message-----
> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Sent: Tuesday, December 19, 2023 10:13 AM
> To: Ertman, David M <david.m.ertman@intel.com>
> Cc: rafael@kernel.org; linux-kernel@vger.kernel.org; Weiny, Ira
> <ira.weiny@intel.com>; William Breathitt Gray <william.gray@linaro.org>;
> David Hildenbrand <david@redhat.com>; Oscar Salvador
> <osalvador@suse.de>; Kevin Hilman <khilman@kernel.org>; Ulf Hansson
> <ulf.hansson@linaro.org>; Brown, Len <len.brown@intel.com>
> Subject: Re: [PATCH] driver core: mark remaining local bus_type variables as
> const
> 
> On Tue, Dec 19, 2023 at 06:02:33PM +0000, Ertman, David M wrote:
> > > -----Original Message-----
> > > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Sent: Tuesday, December 19, 2023 7:35 AM
> > > To: rafael@kernel.org; linux-kernel@vger.kernel.org
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Ertman, David
> M
> > > <david.m.ertman@intel.com>; Weiny, Ira <ira.weiny@intel.com>;
> William
> > > Breathitt Gray <william.gray@linaro.org>; David Hildenbrand
> > > <david@redhat.com>; Oscar Salvador <osalvador@suse.de>; Kevin
> Hilman
> > > <khilman@kernel.org>; Ulf Hansson <ulf.hansson@linaro.org>; Brown,
> Len
> > > <len.brown@intel.com>
> > > 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 <david.m.ertman@intel.com>
> > > Cc: Ira Weiny <ira.weiny@intel.com>
> > > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > > Cc: William Breathitt Gray <william.gray@linaro.org>
> > > Cc: David Hildenbrand <david@redhat.com>
> > > Cc: Oscar Salvador <osalvador@suse.de>
> > > Cc: Kevin Hilman <khilman@kernel.org>
> > > Cc: Ulf Hansson <ulf.hansson@linaro.org>
> > > Cc: Len Brown <len.brown@intel.com>
> > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > ---
> > >  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(-)
> > >
> > > diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
> > > index 4d4c2c8d26c4..d3a2c40c2f12 100644
> > > --- a/drivers/base/auxiliary.c
> > > +++ b/drivers/base/auxiliary.c
> > > @@ -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,
> > > diff --git a/drivers/base/isa.c b/drivers/base/isa.c
> > > index 675ad3139224..e23d0b49a793 100644
> > > --- a/drivers/base/isa.c
> > > +++ b/drivers/base/isa.c
> >
> > LGTM - ACK
> 
> 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: Dave Ertman <david.m.ertman@intel.com>
  
William Breathitt Gray Dec. 20, 2023, 11:53 a.m. UTC | #4
On Tue, Dec 19, 2023 at 04:35:09PM +0100, Greg Kroah-Hartman wrote:
> 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 <david.m.ertman@intel.com>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: William Breathitt Gray <william.gray@linaro.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Kevin Hilman <khilman@kernel.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Len Brown <len.brown@intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: William Breathitt Gray <william.gray@linaro.org>
  
Ulf Hansson Jan. 3, 2024, 1:24 p.m. UTC | #5
On Tue, 19 Dec 2023 at 16:35, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> 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 <david.m.ertman@intel.com>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Cc: William Breathitt Gray <william.gray@linaro.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Kevin Hilman <khilman@kernel.org>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: Len Brown <len.brown@intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  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
  
Greg KH Jan. 3, 2024, 4:47 p.m. UTC | #6
On Wed, Jan 03, 2024 at 02:24:05PM +0100, Ulf Hansson wrote:
> On Tue, 19 Dec 2023 at 16:35, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > 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 <david.m.ertman@intel.com>
> > Cc: Ira Weiny <ira.weiny@intel.com>
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > Cc: William Breathitt Gray <william.gray@linaro.org>
> > Cc: David Hildenbrand <david@redhat.com>
> > Cc: Oscar Salvador <osalvador@suse.de>
> > Cc: Kevin Hilman <khilman@kernel.org>
> > Cc: Ulf Hansson <ulf.hansson@linaro.org>
> > Cc: Len Brown <len.brown@intel.com>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  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.

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

thanks,

greg k-h
  

Patch

diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
index 4d4c2c8d26c4..d3a2c40c2f12 100644
--- a/drivers/base/auxiliary.c
+++ b/drivers/base/auxiliary.c
@@ -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,
diff --git a/drivers/base/isa.c b/drivers/base/isa.c
index 675ad3139224..e23d0b49a793 100644
--- a/drivers/base/isa.c
+++ b/drivers/base/isa.c
@@ -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,
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index f3b9a4d0fa3b..4ac3266da6b5 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -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,
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 4d588f4658c8..433897eecbdc 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -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",
 };
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index da1777e39eaa..096871334cc7 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -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",
 };
 
diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index c741d0845852..282c38aece0d 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -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;