[v2] siox: make siox_bus_type const

Message ID 20240204-bus_cleanup-siox-v2-1-3813a6a55dcc@marliere.net
State New
Headers
Series [v2] siox: make siox_bus_type const |

Commit Message

Ricardo B. Marliere Feb. 4, 2024, 10:26 p.m. UTC
  Since commit d492cc2573a0 ("driver core: device.h: make struct bus_type
a const *"), 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>
---
Changes in v2:
- Fixed changelog: mentioned commit d492cc2573a0 instead of the word
  "Now".
- Link to v1: https://lore.kernel.org/r/20240204-bus_cleanup-siox-v1-1-2d12583d3a6c@marliere.net
---
 drivers/siox/siox-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


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

Best regards,
  

Comments

Greg KH Feb. 5, 2024, 12:45 p.m. UTC | #1
On Sun, Feb 04, 2024 at 07:26:42PM -0300, Ricardo B. Marliere wrote:
> Since commit d492cc2573a0 ("driver core: device.h: make struct bus_type
> a const *"), 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>

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  
Thorsten Scherer Feb. 9, 2024, 6:13 p.m. UTC | #2
Hello,

On Sun, Feb 04, 2024 at 07:26:42PM -0300, Ricardo B. Marliere wrote:
> Since commit d492cc2573a0 ("driver core: device.h: make struct bus_type
> a const *"), 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>

Acked-by: Thorsten Scherer <t.scherer@eckelmann.de>

@Ricardo: Thank you!

@gregkh: Would you please pick up this patch?

> ---
> Changes in v2:
> - Fixed changelog: mentioned commit d492cc2573a0 instead of the word
>   "Now".
> - Link to v1: https://lore.kernel.org/r/20240204-bus_cleanup-siox-v1-1-2d12583d3a6c@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>
> 

Best regards
Thorsten
  

Patch

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,