[PATCH] siox: make siox_bus_type const

Ricardo B. Marliere posted 1 patch 2 years ago
There is a newer version of this series
drivers/siox/siox-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] siox: make siox_bus_type const
Posted by Ricardo B. Marliere 2 years ago
Now that the driver core can properly handle constant struct bus_type,
move the siox_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 drivers/siox/siox-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
index 561408583b2b..a1eda7bd76ed 100644
--- a/drivers/siox/siox-core.c
+++ b/drivers/siox/siox-core.c
@@ -543,7 +543,7 @@ static void siox_shutdown(struct device *dev)
 		sdriver->shutdown(sdevice);
 }
 
-static struct bus_type siox_bus_type = {
+static const struct bus_type siox_bus_type = {
 	.name = "siox",
 	.match = siox_match,
 	.probe = siox_probe,

---
base-commit: 41b9fb381a486360b2daaec0c7480f8e3ff72bc7
change-id: 20240204-bus_cleanup-siox-ccf8775bf069

Best regards,
-- 
Ricardo B. Marliere <ricardo@marliere.net>
Re: [PATCH] siox: make siox_bus_type const
Posted by Uwe Kleine-König 2 years ago
Hello Ricardo,

On Sun, Feb 04, 2024 at 05:36:03PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the siox_bus_type variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
>  drivers/siox/siox-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
> index 561408583b2b..a1eda7bd76ed 100644
> --- a/drivers/siox/siox-core.c
> +++ b/drivers/siox/siox-core.c
> @@ -543,7 +543,7 @@ static void siox_shutdown(struct device *dev)
>  		sdriver->shutdown(sdevice);
>  }
>  
> -static struct bus_type siox_bus_type = {
> +static const struct bus_type siox_bus_type = {
>  	.name = "siox",
>  	.match = siox_match,
>  	.probe = siox_probe,

while I like this change, I wonder about the "Now" in the commit log.
Doing the homework, this is about commit d492cc2573a0 ("driver core:
device.h: make struct bus_type a const *") which is in 6.4-rc1. Would
you please care to mention that commit as the one that makes this siox
change possible?

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Re: [PATCH] siox: make siox_bus_type const
Posted by Ricardo B. Marliere 2 years ago
On  4 Feb 22:29, Uwe Kleine-König wrote:
> Hello Ricardo,
> 
> On Sun, Feb 04, 2024 at 05:36:03PM -0300, Ricardo B. Marliere wrote:
> > Now that the driver core can properly handle constant struct bus_type,
> > move the siox_bus_type variable to be a constant structure as well,
> > placing it into read-only memory which can not be modified at runtime.
> > 
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> > ---
> >  drivers/siox/siox-core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/siox/siox-core.c b/drivers/siox/siox-core.c
> > index 561408583b2b..a1eda7bd76ed 100644
> > --- a/drivers/siox/siox-core.c
> > +++ b/drivers/siox/siox-core.c
> > @@ -543,7 +543,7 @@ static void siox_shutdown(struct device *dev)
> >  		sdriver->shutdown(sdevice);
> >  }
> >  
> > -static struct bus_type siox_bus_type = {
> > +static const struct bus_type siox_bus_type = {
> >  	.name = "siox",
> >  	.match = siox_match,
> >  	.probe = siox_probe,
> 
> while I like this change, I wonder about the "Now" in the commit log.
> Doing the homework, this is about commit d492cc2573a0 ("driver core:
> device.h: make struct bus_type a const *") which is in 6.4-rc1. Would
> you please care to mention that commit as the one that makes this siox
> change possible?

Hi Uwe!

Sounds reasonable, I just sent a v2. The original log is being used
across the tree, took from a template first used by Greg.

Thanks for reviewing,
-	Ricardo.


> 
> Thanks
> Uwe
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-K�nig            |
> Industrial Linux Solutions                 | https://www.pengutronix.de/ |