parport: make parport_bus_type const

Message ID 20240204-bus_cleanup-parport-v1-1-e6a0f756bbb8@marliere.net
State New
Headers
Series parport: make parport_bus_type const |

Commit Message

Ricardo B. Marliere Feb. 4, 2024, 8:25 p.m. UTC
  Now that the driver core can properly handle constant struct bus_type,
move the parport_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/parport/share.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 41b9fb381a486360b2daaec0c7480f8e3ff72bc7
change-id: 20240204-bus_cleanup-parport-a016e7319d81

Best regards,
  

Comments

Greg KH Feb. 5, 2024, 12:47 p.m. UTC | #1
On Sun, Feb 04, 2024 at 05:25:51PM -0300, Ricardo B. Marliere wrote:
> Now that the driver core can properly handle constant struct bus_type,
> move the parport_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>
  

Patch

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 49c74ded8a53..08dfa74be3c5 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -130,7 +130,7 @@  static int parport_probe(struct device *dev)
 	return drv->probe(to_pardevice(dev));
 }
 
-static struct bus_type parport_bus_type = {
+static const struct bus_type parport_bus_type = {
 	.name = "parport",
 	.probe = parport_probe,
 };