2024-02-20 12:20:23

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH] parport: constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
parport_device_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 <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
---
drivers/parport/share.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 49c74ded8a53..33159392d70c 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -101,7 +101,7 @@ static struct parport_operations dead_ops = {
.owner = NULL,
};

-static struct device_type parport_device_type = {
+static const struct device_type parport_device_type = {
.name = "parport",
};


---
base-commit: b401b621758e46812da61fa58a67c3fd8d91de0d
change-id: 20240219-device_cleanup-parport-ba048a859198

Best regards,
--
Ricardo B. Marliere <[email protected]>