Skip to contentSkip to conversation

drm/docs: improve docs for drm_drv.c

PATCH In review Daniel Vetter 3 participants 12 messages Jan 11, 2019 – Jan 12, 2019

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

PATCH 1/5 drm/docs: improve docs for drm_drv.c

Just a bit of drive-by reading:
- drm_dev_set_unique() is really the exception, make that clear.
- drm_dev_init() is the recomended approach.

---
 drivers/gpu/drm/drm_drv.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_drv.c +11 -12
index a5fe91b8c3c9..381581b01d48 100644
@@ -264,14 +264,13 @@ void drm_minor_release(struct drm_minor *minor)
  * DOC: driver instance overview
  *
  * A device instance for a drm driver is represented by &struct drm_device. This
- * is allocated with drm_dev_alloc(), usually from bus-specific ->probe()
+ * is initialized with drm_dev_init(), usually from bus-specific ->probe()
  * callbacks implemented by the driver. The driver then needs to initialize all
  * the various subsystems for the drm device like memory management, vblank
  * handling, modesetting support and intial output configuration plus obviously
- * initialize all the corresponding hardware bits. An important part of this is
- * also calling drm_dev_set_unique() to set the userspace-visible unique name of
- * this device instance. Finally when everything is up and running and ready for
- * userspace the device instance can be published using drm_dev_register().
+ * initialize all the corresponding hardware bits. Finally when everything is up
+ * and running and ready for userspace the device instance can be published
+ * using drm_dev_register().
  *
  * There is also deprecated support for initalizing device instances using
  * bus-specific helpers and the &drm_driver.load callback. But due to
@@ -287,9 +286,6 @@ void drm_minor_release(struct drm_minor *minor)
  * Note that the lifetime rules for &drm_device instance has still a lot of
  * historical baggage. Hence use the reference counting provided by
  * drm_dev_get() and drm_dev_put() only carefully.
- *
- * It is recommended that drivers embed &struct drm_device into their own device
- * structure, which is supported through drm_dev_init().
  */
 
 /**
@@ -475,6 +471,9 @@ static void drm_fs_inode_free(struct inode *inode)
  * The initial ref-count of the object is 1. Use drm_dev_get() and
  * drm_dev_put() to take and drop further ref-counts.
  *
+ * It is recommended that drivers embed &struct drm_device into their own device
+ * structure.
+ *
  * Drivers that do not want to allocate their own device struct
  * embedding &struct drm_device can call drm_dev_alloc() instead. For drivers
  * that do embed &struct drm_device it must be placed first in the overall
@@ -765,7 +764,7 @@ static void remove_compat_control_link(struct drm_device *dev)
  * @flags: Flags passed to the driver's .load() function
  *
  * Register the DRM device @dev with the system, advertise device to user-space
- * and start normal device operation. @dev must be allocated via drm_dev_alloc()
+ * and start normal device operation. @dev must be initialized via drm_dev_init()
  * previously.
  *
  * Never call this twice on any device!
@@ -877,9 +876,9 @@ EXPORT_SYMBOL(drm_dev_unregister);
  * @dev: device of which to set the unique name
  * @name: unique name
  *
- * Sets the unique name of a DRM device using the specified string. Drivers
- * can use this at driver probe time if the unique name of the devices they
- * drive is static.
+ * Sets the unique name of a DRM device using the specified string. This is
+ * already done by drm_dev_init(), drivers should only override the default
+ * unique name for backwards compatibility reasons.
  *
  * Return: 0 on success or a negative error code on failure.
  */
Signature · 6 lines
2.20.1

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

PATCH 2/5 drm/of: Fix kerneldoc

I noticed a link that didn't work ...

Fixes 1f2db3034c9f ("drm: of: introduce drm_of_find_panel_or_bridge")
Cc Rob Herring <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc Sean Paul <[email protected]>
---
 drivers/gpu/drm/drm_of.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_of.c +3 -1
index 2763a5ec845b..f2f71d71494a 100644
@@ -217,9 +217,11 @@ int drm_of_encoder_active_endpoint(struct device_node *node,
 }
 EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint);
 
-/*
+/**
  * drm_of_find_panel_or_bridge - return connected panel or bridge device
  * @np: device tree node containing encoder output ports
+ * @port: port in the device tree node
+ * @endpoint: endpoint in the device tree node
  * @panel: pointer to hold returned drm_panel
  * @bridge: pointer to hold returned drm_bridge
  *
Signature · 6 lines
2.20.1

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

Re: [PATCH 2/5] drm/of: Fix kerneldoc

Quoted 7 lines · Daniel Vetter

I noticed a link that didn't work ...

Fixes 1f2db3034c9f ("drm: of: introduce drm_of_find_panel_or_bridge")
Cc Rob Herring <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc Sean Paul <[email protected]>

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

#3 lore raw

PATCH 3/5 drm/panel: Small documentation polish

In reply to Daniel Vetter

Need to make sure people can find the panel-bridge to avoid typing too much.

---
 drivers/gpu/drm/bridge/panel.c | 22 ++++++++++++++++++----
 drivers/gpu/drm/drm_panel.c    |  3 +++
 2 files changed, 21 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/panel.c +18 -4
index caf12b8fd572..e3687d78cd0c 100644
@@ -134,8 +134,8 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
 };
 
 /**
- * drm_panel_bridge_add - Creates a drm_bridge and drm_connector that
- * just calls the appropriate functions from drm_panel.
+ * drm_panel_bridge_add - Creates a &drm_bridge and &drm_connector that
+ * just calls the appropriate functions from &drm_panel.
  *
  * @panel: The drm_panel being wrapped.  Must be non-NULL.
  * @connector_type: The DRM_MODE_CONNECTOR_* for the connector to be
@@ -149,9 +149,12 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
  * passed to drm_bridge_attach().  The drm_panel_prepare() and related
  * functions can be dropped from the encoder driver (they're now
  * called by the KMS helpers before calling into the encoder), along
- * with connector creation.  When done with the bridge,
- * drm_bridge_detach() should be called as normal, then
+ * with connector creation.  When done with the bridge (after
+ * drm_mode_config_cleanup() if the bridge has already been attached), then
  * drm_panel_bridge_remove() to free it.
+ *
+ * See devm_drm_panel_bridge_add() for an automatically manged version of this
+ * function.
  */
 struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel,
 					u32 connector_type)
@@ -210,6 +213,17 @@ static void devm_drm_panel_bridge_release(struct device *dev, void *res)
 	drm_panel_bridge_remove(*bridge);
 }
 
+/**
+ * devm_drm_panel_bridge_add - Creates a managed &drm_bridge and &drm_connector
+ * that just calls the appropriate functions from &drm_panel.
+ * @dev: device to tie the bridge lifetime to
+ * @panel: The drm_panel being wrapped.  Must be non-NULL.
+ * @connector_type: The DRM_MODE_CONNECTOR_* for the connector to be
+ * created.
+ *
+ * This is the managed version of drm_panel_bridge_add() which automatically
+ * calls drm_panel_bridge_remove() when @dev is unbound.
+ */
 struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev,
 					     struct drm_panel *panel,
 					     u32 connector_type)
drivers/gpu/drm/drm_panel.c +3 -0
index c33f95e08e1b..dbd5b873e8f2 100644
@@ -36,6 +36,9 @@ static LIST_HEAD(panel_list);
  * The DRM panel helpers allow drivers to register panel objects with a
  * central registry and provide functions to retrieve those panels in display
  * drivers.
+ *
+ * For easy integration into drivers using the &drm_bridge infrastructure please
+ * take look at drm_panel_bridge_add() and devm_drm_panel_bridge_add().
  */
 
 /**
Signature · 6 lines
2.20.1

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

PATCH 4/5 drm/doc: Move bridge link target to the right place

In reply to Daniel Vetter

I screwed up a rebase somehow.

v2: Drop bogus hunk.

v3: Really drop bogus hunk (Lubomir).

---
 Documentation/gpu/drm-kms-helpers.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/gpu/drm-kms-helpers.rst +2 -2
index 7a3fc569bc68..fbd11b2fe5b5 100644
@@ -116,8 +116,6 @@ Framebuffer CMA Helper Functions Reference
 .. kernel-doc:: drivers/gpu/drm/drm_fb_cma_helper.c
    :export:
 
-.. _drm_bridges:
-
 Framebuffer GEM Helper Reference
 ================================
 
@@ -127,6 +125,8 @@ Framebuffer GEM Helper Reference
 .. kernel-doc:: drivers/gpu/drm/drm_gem_framebuffer_helper.c
    :export:
 
+.. _drm_bridges:
+
 Bridges
 =======
 
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 4/5
#6 lore raw

Re: [PATCH 4/5] drm/doc: Move bridge link target to the right place

Quoted 8 lines · Daniel Vetter

I screwed up a rebase somehow.

v2: Drop bogus hunk.

v3: Really drop bogus hunk (Lubomir).

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

#7 lore raw

Re: [PATCH 4/5] drm/doc: Move bridge link target to the right place

Quoted 10 lines · Sam Ravnborg
Quoted 8 lines · Daniel Vetter

I screwed up a rebase somehow.

v2: Drop bogus hunk.

v3: Really drop bogus hunk (Lubomir).

Thanks a lot for your review, all remaining patches applied to drm-misc-next.
-Daniel

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
#8 lore raw

PATCH 5/5 drm/doc: Polish kerneldoc for drm_device.h

In reply to Daniel Vetter

- Move all the legacy gunk at the bottom, and exclude it from kerneldoc.
- Documentation for the remaining bits.

---
 Documentation/gpu/drm-internals.rst |   3 +
 include/drm/drm_device.h            | 150 ++++++++++++++++------------
 2 files changed, 88 insertions(+), 65 deletions(-)
Documentation/gpu/drm-internals.rst +3 -0
index 36c569444e12..2d2d8ad7e05f 100644
@@ -81,6 +81,9 @@ Device Instance and Driver Handling
 .. kernel-doc:: drivers/gpu/drm/drm_drv.c
    :doc: driver instance overview
 
+.. kernel-doc:: include/drm/drm_device.h
+   :internal:
+
 .. kernel-doc:: include/drm/drm_drv.h
    :internal:
 
include/drm/drm_device.h +85 -65

215 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 5/5
#9 lore raw

Re: [PATCH 5/5] drm/doc: Polish kerneldoc for drm_device.h

Hi Daniel.

Thanks, good to have it ready and plugged into DRM doc. I like that the legacy stuff is now separate - so one knows what not to look at.

include/drm/drm_device.h struct drm_device { · line 191

Quoted 5 lines
include/drm/drm_device.h +4 -0
+
+	/**
+	 * @irq: Use by the drm_irq_install() and drm_irq_unistall() helpers.
+	 */
 	int irq;

"Use => Used"

Other than the above nit:

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

#10 lore raw

Re: [PATCH 5/5] drm/doc: Polish kerneldoc for drm_device.h

Quoted 14 lines · Sam Ravnborg

Hi Daniel.

Thanks, good to have it ready and plugged into DRM doc. I like that the legacy stuff is now separate - so one knows what not to look at.

include/drm/drm_device.h struct drm_device { · line 191

Quoted 5 lines
include/drm/drm_device.h +4 -0
+
+	/**
+	 * @irq: Use by the drm_irq_install() and drm_irq_unistall() helpers.
+	 */
 	int irq;

"Use => Used"

Quoted 2 lines

Other than the above nit:

Fixed and applied, thanks for taking a look. Care to also review the first 4 patches in this small documentation series?

Thanks, Daniel

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
Reviewed-by on v1 1/5
#11 lore raw
In reply to Daniel Vetter
Quoted 5 lines · Daniel Vetter

Just a bit of drive-by reading:
- drm_dev_set_unique() is really the exception, make that clear.
- drm_dev_init() is the recomended approach.

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