Skip to contentSkip to conversation

drm: Drop unused drm_device_class_(un)register API

PATCH In review Tvrtko Ursulin 3 participants 4 messages Apr 29

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

PATCH 1/1 drm: Drop unused drm_device_class_(un)register API

The API has been unused since commit
ed89fff97382 ("drm/ttm: drop sysfs directory")
so lets remove it.

Cc Christian König <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>
---
 drivers/gpu/drm/drm_sysfs.c | 32 --------------------------------
 include/drm/drm_sysfs.h     |  4 ----
 2 files changed, 36 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -32
index 43b2c3eaa7e4..7433bf8136cc 100644
@@ -645,35 +645,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 -4
index 96a5d858404b..7695873a9456 100644
@@ -3,13 +3,9 @@
 #define _DRM_SYSFS_H_
 
 struct drm_device;
-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.52.0
#1 lore raw

Hi

Am 29.04.26 um 10:57 schrieb Tvrtko Ursulin:

Quoted 3 lines

The API has been unused since commit
ed89fff97382 ("drm/ttm: drop sysfs directory")
so lets remove it.

drm_privacy_screen_register() uses the same pattern. [1] If that helper is being converted over to drm_class_device_register(), the global drm_class could be internalized into drm_sysfb.c. Personally, I think this is the better solution, but either seems fine. [1] https://elixir.bootlin.com/linux/v7.0.1/source/drivers/gpu/drm/drm_privacy_screen.c#L405

Best regards
Thomas

Quoted 71 lines
Cc Christian König <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>
---
  drivers/gpu/drm/drm_sysfs.c | 32 --------------------------------
  include/drm/drm_sysfs.h     |  4 ----
  2 files changed, 36 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -32
index 43b2c3eaa7e4..7433bf8136cc 100644
@@ -645,35 +645,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 -4
index 96a5d858404b..7695873a9456 100644
@@ -3,13 +3,9 @@
  #define _DRM_SYSFS_H_
 
  struct drm_device;
-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 · 6 lines
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)
#2 lore raw
Quoted 8 lines · Thomas Zimmermann

Hi

Am 29.04.26 um 10:57 schrieb Tvrtko Ursulin:

Quoted 3 lines

The API has been unused since commit
ed89fff97382 ("drm/ttm: drop sysfs directory")
so lets remove it.

drm_privacy_screen_register() uses the same pattern. [1] If that helper is being converted over to drm_class_device_register(), the global drm_class could be internalized into drm_sysfb.c. Personally, I think this is the better solution, but either seems fine. [1] https:// elixir.bootlin.com/linux/v7.0.1/source/drivers/gpu/drm/ drm_privacy_screen.c#L405

I did not spot that one. The alternative sounds reasonable to me. Adding Hans to check if he wants to take over converting this driver.

Regards,

Tvrtko

Quoted 76 lines
Quoted 75 lines
Cc Christian König <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>

---
  drivers/gpu/drm/drm_sysfs.c | 32 -------------------------------- include/drm/drm_sysfs.h     |  4 ----

  2 files changed, 36 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -0
index 43b2c3eaa7e4..7433bf8136cc 100644
@@ -645,35 +645,3 @@ struct device *drm_sysfs_minor_alloc(struct 
 drm_minor *minor)
       put_device(kdev);
       return ERR_PTR(r);

  }

drivers/gpu/drm/drm_sysfs.c +0 -3
-
-/**
- * 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.
- */

drivers/gpu/drm/drm_sysfs.c +0 -12
-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.
- */

drivers/gpu/drm/drm_sysfs.c +0 -5
-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 -4
index 96a5d858404b..7695873a9456 100644
@@ -3,13 +3,9 @@
   #define _DRM_SYSFS_H_
   struct drm_device;
-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,
Reviewed-by on v1 1/1
#3 lore raw
In reply to Tvrtko Ursulin
Quoted 11 lines · Tvrtko Ursulin

The API has been unused since commit
ed89fff97382 ("drm/ttm: drop sysfs directory")
so lets remove it.

Cc Christian König <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Cc David Airlie <[email protected]>
Cc Simona Vetter <[email protected]>
Quoted 63 lines
---
 drivers/gpu/drm/drm_sysfs.c | 32 --------------------------------
 include/drm/drm_sysfs.h     |  4 ----
 2 files changed, 36 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -32
index 43b2c3eaa7e4..7433bf8136cc 100644
@@ -645,35 +645,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 -4
index 96a5d858404b..7695873a9456 100644
@@ -3,13 +3,9 @@
 #define _DRM_SYSFS_H_
 
 struct drm_device;
-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,