Skip to contentSkip to conversation

drm documentation and clean ups

PATCH Applied Gabriel Krisman Bertazi 2 participants 5 messages Jan 2, 2017 – Jan 4, 2017

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

v2 cover drm documentation and clean ups

Here's a v2 with the part of the series that didn't get pushed yet. Patch 2 has the suggestions from Daniel applied.

Thanks,

Gabriel Krisman Bertazi (2):
exynos_drm: Clean up duplicated assignment in exynos_drm_driver
drm: Document deprecated load/unload hook

 drivers/gpu/drm/exynos/exynos_drm_drv.c |  1 -
 include/drm/drm_drv.h                   | 35 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH v2 1/2 exynos_drm: Clean up duplicated assignment in exynos_drm_driver

num_ioctls is already assigned when declaring the exynos_drm_driver structure. No need to duplicate it here.

CC Inki Dae <[email protected]>
CC Joonyoung Shim <[email protected]>
CC Seung-Woo Kim <[email protected]>
CC Kyungmin Park <[email protected]>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -1
index 739180ac3da5..44b4d07eefb5 100644
@@ -570,7 +570,6 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)
 	struct component_match *match;
 
 	pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
-	exynos_drm_driver.num_ioctls = ARRAY_SIZE(exynos_ioctls);
 
 	match = exynos_drm_match_add(&pdev->dev);
 	if (IS_ERR(match))
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH v2 2/2 drm: Document deprecated load/unload hook

In reply to Gabriel Krisman Bertazi

v2:
- Replace discouraged with deprecated
- Link to new initialization/teardown functions

---
 include/drm/drm_drv.h | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
include/drm/drm_drv.h +35 -0
index c4fc49583dc0..9c2d9f0bb043 100644
@@ -64,12 +64,47 @@ struct drm_mode_create_dumb;
  * structure for GEM drivers.
  */
 struct drm_driver {
+
+	/**
+	 * @load:
+	 *
+	 * Backward-compatible driver callback to complete
+	 * initialization steps after the driver is registered.  For
+	 * this reason, may suffer from race conditions and its use is
+	 * deprecated for new drivers.  It is therefore only supported
+	 * for existing drivers not yet converted to the new scheme.
+	 * See drm_dev_init() and drm_dev_register() for proper and
+	 * race-free way to set up a &struct drm_device.
+	 *
+	 * Returns:
+	 *
+	 * Zero on success, non-zero value on failure.
+	 */
 	int (*load) (struct drm_device *, unsigned long flags);
 	int (*firstopen) (struct drm_device *);
 	int (*open) (struct drm_device *, struct drm_file *);
 	void (*preclose) (struct drm_device *, struct drm_file *file_priv);
 	void (*postclose) (struct drm_device *, struct drm_file *);
 	void (*lastclose) (struct drm_device *);
+
+	/**
+	 * @unload:
+	 *
+	 * Reverse the effects of the driver load callback.  Ideally,
+	 * the clean up performed by the driver should happen in the
+	 * reverse order of the initialization.  Similarly to the load
+	 * hook, this handler is deprecated and its usage should be
+	 * dropped in favor of an open-coded teardown function at the
+	 * driver layer.  See drm_dev_unregister() and drm_dev_unref()
+	 * for the proper way to remove a &struct drm_device.
+	 *
+	 * The unload() hook is called right after unregistering
+	 * the device.
+	 *
+	 * Returns:
+	 *
+	 * The return value is ignored.
+	 */
 	int (*unload) (struct drm_device *);
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH v2 2/2] drm: Document deprecated load/unload hook

Quoted 47 lines · Gabriel Krisman Bertazi

v2:
- Replace discouraged with deprecated
- Link to new initialization/teardown functions

---
 include/drm/drm_drv.h | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
include/drm/drm_drv.h +24 -0
index c4fc49583dc0..9c2d9f0bb043 100644
@@ -64,12 +64,47 @@ struct drm_mode_create_dumb;
  * structure for GEM drivers.
  */
 struct drm_driver {
+
+	/**
+	 * @load:
+	 *
+	 * Backward-compatible driver callback to complete
+	 * initialization steps after the driver is registered.  For
+	 * this reason, may suffer from race conditions and its use is
+	 * deprecated for new drivers.  It is therefore only supported
+	 * for existing drivers not yet converted to the new scheme.
+	 * See drm_dev_init() and drm_dev_register() for proper and
+	 * race-free way to set up a &struct drm_device.
+	 *
+	 * Returns:
+	 *
+	 * Zero on success, non-zero value on failure.
+	 */
 	int (*load) (struct drm_device *, unsigned long flags);
 	int (*firstopen) (struct drm_device *);
 	int (*open) (struct drm_device *, struct drm_file *);
 	void (*preclose) (struct drm_device *, struct drm_file *file_priv);
 	void (*postclose) (struct drm_device *, struct drm_file *);
 	void (*lastclose) (struct drm_device *);
+
+	/**
+	 * @unload:
+	 *
+	 * Reverse the effects of the driver load callback.  Ideally,
+	 * the clean up performed by the driver should happen in the
+	 * reverse order of the initialization.  Similarly to the load
+	 * hook, this handler is deprecated and its usage should be

include/drm/drm_drv.h struct drm_mode_create_dumb; · line 106

Quoted 10 lines
include/drm/drm_drv.h +10 -0
+	 * dropped in favor of an open-coded teardown function at the
+	 * driver layer.  See drm_dev_unregister() and drm_dev_unref()
+	 * for the proper way to remove a &struct drm_device.
+	 *
+	 * The unload() hook is called right after unregistering
+	 * the device.
+	 *
+	 * Returns:
+	 *
+	 * The return value is ignored.

I know this is a bit more work on top, but if you type docs that say something is ignored, it's a good excuse to fix the code. So, can you pls do the mass refactoring (I'd just do one patch for everything) that changesthe return type of this vfunc to void?

Applied this one here meanwhile to drm-misc, thanks a lot. -Daniel

Quoted 11 lines
include/drm/drm_drv.h +1 -0
+	 */
 	int (*unload) (struct drm_device *);
 	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
 	int (*dma_quiescent) (struct drm_device *);
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCH v2 2/2] drm: Document deprecated load/unload hook

Quoted 6 lines · Daniel Vetter

I know this is a bit more work on top, but if you type docs that say something is ignored, it's a good excuse to fix the code. So, can you pls do the mass refactoring (I'd just do one patch for everything) that changesthe return type of this vfunc to void?

Applied this one here meanwhile to drm-misc, thanks a lot.

Thanks, Daniel. sure, I can do it, it's going to be a good way for me to learn coccinelle.

Signature · 5 lines
Gabriel Krisman Bertazi
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel