Merge tag 'sound-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[linux-2.6-block.git] / include / media / media-device.h
index 2ab4e68038429e079b5eaff8c8c78fabcebdd186..d3855898c3fc6767fe7f7fb30895173845e8548f 100644 (file)
@@ -275,11 +275,10 @@ struct device;
  * @driver_version: Device driver version
  * @topology_version: Monotonic counter for storing the version of the graph
  *             topology. Should be incremented each time the topology changes.
- * @entity_id: Unique ID used on the last entity registered
- * @pad_id:    Unique ID used on the last pad registered
- * @link_id:   Unique ID used on the last link registered
- * @intf_devnode_id: Unique ID used on the last interface devnode registered
- * @entity_internal_idx: Allocated internal entity indices
+ * @id:                Unique ID used on the last registered graph object
+ * @entity_internal_idx: Unique internal entity ID used by the graph traversal
+ *             algorithms
+ * @entity_internal_idx_max: Allocated internal entity indices
  * @entities:  List of registered entities
  * @interfaces:        List of registered interfaces
  * @pads:      List of registered pads
@@ -311,10 +310,7 @@ struct media_device {
 
        u32 topology_version;
 
-       u32 entity_id;
-       u32 pad_id;
-       u32 link_id;
-       u32 intf_devnode_id;
+       u32 id;
        struct ida entity_internal_idx;
        int entity_internal_idx_max;
 
@@ -341,6 +337,21 @@ struct media_device {
 /* media_devnode to media_device */
 #define to_media_device(node) container_of(node, struct media_device, devnode)
 
+/**
+ * media_entity_enum_init - Initialise an entity enumeration
+ *
+ * @ent_enum: Entity enumeration to be initialised
+ * @mdev: The related media device
+ *
+ * Returns zero on success or a negative error code.
+ */
+static inline __must_check int media_entity_enum_init(
+       struct media_entity_enum *ent_enum, struct media_device *mdev)
+{
+       return __media_entity_enum_init(ent_enum,
+                                       mdev->entity_internal_idx_max + 1);
+}
+
 /**
  * media_device_init() - Initializes a media device element
  *
@@ -413,6 +424,8 @@ void media_device_cleanup(struct media_device *mdev);
  * a sysfs attribute.
  *
  * Unregistering a media device that hasn't been registered is *NOT* safe.
+ *
+ * Return: returns zero on success or a negative error code.
  */
 int __must_check __media_device_register(struct media_device *mdev,
                                         struct module *owner);
@@ -422,6 +435,10 @@ int __must_check __media_device_register(struct media_device *mdev,
  * __media_device_unregister() - Unegisters a media device element
  *
  * @mdev:      pointer to struct &media_device
+ *
+ *
+ * It is safe to call this function on an unregistered (but initialised)
+ * media device.
  */
 void media_device_unregister(struct media_device *mdev);