Skip to contentSkip to conversation

drm: Series with core improvements/refactorings

PATCH In review Heiner Kallweit 2 participants 6 messages Nov 2, 2024 – Nov 3, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover drm: Series with core improvements/refactorings

Series with DRM core improvements/refactorings.

v2:
- Improve commit descriptions
- Partially split patches
- Remove patches from the series which need more clarification

Heiner Kallweit (3):
drm/sysfs: Drop unused drm_class_device_(un)register drm/sysfs: Remove device type drm_sysfs_device_minor drm/sysfs: Constify struct drm_sysfs_device_connector

 drivers/gpu/drm/drm_sysfs.c | 39 +------------------------------------
 include/drm/drm_sysfs.h     |  3 ---
 2 files changed, 1 insertion(+), 41 deletions(-)
Signature · 1 line
2.47.0
#1 lore raw

PATCH v2 1/3 drm/sysfs: Drop unused drm_class_device_(un)register

Only user of these functions was TTM code which dropped sysfs interfaces in commit ed89fff97382 ("drm/ttm: drop sysfs directory"). So remove these now unused functions.

---
 drivers/gpu/drm/drm_sysfs.c | 32 --------------------------------
 include/drm/drm_sysfs.h     |  3 ---
 2 files changed, 35 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -32
index fb3bbb6ad..3bc90fe5c 100644
@@ -548,35 +548,3 @@ struct device *drm_sysfs_minor_alloc(struct drm_minor *minor)
 	put_device(kdev);
 	return ERR_PTR(r);
 }
-
-/**
- * drm_class_device_register - register new device with the DRM sysfs class
- * @dev: device to register
- *
- * Registers a new &struct device within the DRM sysfs class. Essentially only
- * used by ttm to have a place for its global settings. Drivers should never use
- * this.
- */
-int drm_class_device_register(struct device *dev)
-{
-	if (!drm_class || IS_ERR(drm_class))
-		return -ENOENT;
-
-	dev->class = drm_class;
-	return device_register(dev);
-}
-EXPORT_SYMBOL_GPL(drm_class_device_register);
-
-/**
- * drm_class_device_unregister - unregister device with the DRM sysfs class
- * @dev: device to unregister
- *
- * Unregisters a &struct device from the DRM sysfs class. Essentially only used
- * by ttm to have a place for its global settings. Drivers should never use
- * this.
- */
-void drm_class_device_unregister(struct device *dev)
-{
-	return device_unregister(dev);
-}
-EXPORT_SYMBOL_GPL(drm_class_device_unregister);
include/drm/drm_sysfs.h +0 -3
index 96a5d8584..929d957e4 100644
@@ -7,9 +7,6 @@ struct device;
 struct drm_connector;
 struct drm_property;
 
-int drm_class_device_register(struct device *dev);
-void drm_class_device_unregister(struct device *dev);
-
 void drm_sysfs_hotplug_event(struct drm_device *dev);
 void drm_sysfs_connector_hotplug_event(struct drm_connector *connector);
 void drm_sysfs_connector_property_event(struct drm_connector *connector,
Signature · 1 line
2.47.0
#2 lore raw

PATCH v2 2/3 drm/sysfs: Remove device type drm_sysfs_device_minor

In reply to Heiner Kallweit

Only user of this device type was struct dev_pm_ops of drm_class which was removed in d14d2a8453d6 ("drm: Remove dev_pm_ops from drm_class"). So remove this now unused device type.

---
 drivers/gpu/drm/drm_sysfs.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -5
index 3bc90fe5c..82e2d0c0d 100644
@@ -50,10 +50,6 @@
  * drm_connector_unregister().
  */
 
-static struct device_type drm_sysfs_device_minor = {
-	.name = "drm_minor"
-};
-
 static struct device_type drm_sysfs_device_connector = {
 	.name = "drm_connector",
 };
@@ -531,7 +527,6 @@ struct device *drm_sysfs_minor_alloc(struct drm_minor *minor)
 
 		kdev->devt = MKDEV(DRM_MAJOR, minor->index);
 		kdev->class = drm_class;
-		kdev->type = &drm_sysfs_device_minor;
 	}
 
 	kdev->parent = minor->dev->dev;
Signature · 1 line
2.47.0
Reviewed-by on v2 2/3
#3 lore raw

Re: [PATCH v2 2/3] drm/sysfs: Remove device type drm_sysfs_device_minor

Quoted 9 lines · Heiner Kallweit

Only user of this device type was struct dev_pm_ops of drm_class which was removed in d14d2a8453d6 ("drm: Remove dev_pm_ops from drm_class"). So remove this now unused device type.

---
 drivers/gpu/drm/drm_sysfs.c | 5 -----
 1 file changed, 5 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

PATCH v2 3/3 drm/sysfs: Constify struct drm_sysfs_device_connector

In reply to Heiner Kallweit

Constify struct drm_sysfs_device_connector to eliminate the risk of code trying to change it.

---
 drivers/gpu/drm/drm_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_sysfs.c +1 -1
index 82e2d0c0d..c6b95fa06 100644
@@ -50,7 +50,7 @@
  * drm_connector_unregister().
  */
 
-static struct device_type drm_sysfs_device_connector = {
+static const struct device_type drm_sysfs_device_connector = {
 	.name = "drm_connector",
 };
 
Signature · 1 line
2.47.0
Reviewed-by on v2 3/3
#5 lore raw

Re: [PATCH v2 3/3] drm/sysfs: Constify struct drm_sysfs_device_connector

Quoted 8 lines · Heiner Kallweit

Constify struct drm_sysfs_device_connector to eliminate the risk of code trying to change it.

---
 drivers/gpu/drm/drm_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry