2024-02-19 12:02:45

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH drm-misc 0/3] drm: constify the struct device_type usage

This is a simple and straight forward cleanup series that makes all device
types in the net subsystem constants. This has been possible since 2011 [1]
but not all occurrences were cleaned. I have been sweeping the tree to fix
them all.

---
[1] https://lore.kernel.org/all/[email protected]/

To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Daniel Vetter <[email protected]>
To: Hans de Goede <[email protected]>
Cc: <[email protected]>
Cc: <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>

---
Ricardo B. Marliere (3):
drm/dp: constify the struct device_type usage
drm/privacy_screen: constify the struct device_type usage
drm/sysfs: constify the struct device_type usage

drivers/gpu/drm/display/drm_dp_aux_bus.c | 2 +-
drivers/gpu/drm/drm_privacy_screen.c | 2 +-
drivers/gpu/drm/drm_sysfs.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
---
base-commit: b59dcca97bf052341b9ac28b1ee1af46498b8833
change-id: 20240219-device_cleanup-drm-eeeb5c7468da

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



2024-02-19 12:02:51

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH drm-misc 2/3] drm/privacy_screen: 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
drm_privacy_screen_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/gpu/drm/drm_privacy_screen.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_privacy_screen.c b/drivers/gpu/drm/drm_privacy_screen.c
index 6cc39e30781f..088a30b3b488 100644
--- a/drivers/gpu/drm/drm_privacy_screen.c
+++ b/drivers/gpu/drm/drm_privacy_screen.c
@@ -363,7 +363,7 @@ static struct attribute *drm_privacy_screen_attrs[] = {
};
ATTRIBUTE_GROUPS(drm_privacy_screen);

-static struct device_type drm_privacy_screen_type = {
+static const struct device_type drm_privacy_screen_type = {
.name = "privacy_screen",
.groups = drm_privacy_screen_groups,
};

--
2.43.0


2024-02-19 12:04:20

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH drm-misc 1/3] drm/dp: 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
dp_aux_device_type_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/gpu/drm/display/drm_dp_aux_bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/display/drm_dp_aux_bus.c b/drivers/gpu/drm/display/drm_dp_aux_bus.c
index 5afc26be9d2a..f4c66937ef79 100644
--- a/drivers/gpu/drm/display/drm_dp_aux_bus.c
+++ b/drivers/gpu/drm/display/drm_dp_aux_bus.c
@@ -166,7 +166,7 @@ static int dp_aux_ep_dev_modalias(const struct device *dev, struct kobj_uevent_e
return of_device_uevent_modalias(dev, env);
}

-static struct device_type dp_aux_device_type_type = {
+static const struct device_type dp_aux_device_type_type = {
.groups = dp_aux_ep_dev_groups,
.uevent = dp_aux_ep_dev_modalias,
.release = dp_aux_ep_dev_release,

--
2.43.0


2024-02-19 12:04:46

by Ricardo B. Marliere

[permalink] [raw]
Subject: [PATCH drm-misc 3/3] drm/sysfs: 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
drm_sysfs_device_minor and drm_sysfs_device_connector variables to be
constant structures 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/gpu/drm/drm_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index a953f69a34b6..6d72dfc4b25a 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -50,11 +50,11 @@
* drm_connector_unregister().
*/

-static struct device_type drm_sysfs_device_minor = {
+static const struct device_type drm_sysfs_device_minor = {
.name = "drm_minor"
};

-static struct device_type drm_sysfs_device_connector = {
+static const struct device_type drm_sysfs_device_connector = {
.name = "drm_connector",
};


--
2.43.0