History

[media] v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs

Instead of abusing MEDIA_ENT_T_V4L2_SUBDEV, initialize new subdev entities as MEDIA_ENT_T_UNKNOWN.

Mauro Carvalho Chehab committed 11 years ago

Commit b50bde41 parent bf4178a3 files · +21 −1Browse files

Unified · Split

3 files
  1. drivers/media/media-device.c +6 −0
  2. drivers/media/v4l2-core/v4l2-subdev.c +1 −1
  3. include/uapi/linux/media.h +14 −0
drivers/media/media-device.c+6−0
@@ -435,6 +435,12 @@ int __must_check media_device_register_entity(struct media_device *mdev, · 434 unmodified lines
435435 {
436436 int i;
437437
438+ if (entity->type == MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN ||
439+ entity->type == MEDIA_ENT_T_UNKNOWN)
440+ dev_warn(mdev->dev,
441+ "Entity type for entity %s was not initialized!\n",
442+ entity->name);
443+
438444 /* Warn if we apparently re-register an entity */
439445 WARN_ON(entity->graph_obj.mdev != NULL);
440446 entity->graph_obj.mdev = mdev;
drivers/media/v4l2-core/v4l2-subdev.c+1−1
@@ -584,7 +584,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) · 583 unmodified lines
584584 sd->host_priv = NULL;
585585 #if defined(CONFIG_MEDIA_CONTROLLER)
586586 sd->entity.name = sd->name;
587− sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV;
587+ sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
588588 #endif
589589 }
590590 EXPORT_SYMBOL(v4l2_subdev_init);
include/uapi/linux/media.h+14−0
@@ -42,6 +42,14 @@ struct media_device_info { · 41 unmodified lines
4242
4343 #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
4444
45+/* Used values for media_entity_desc::type */
46+
47+/*
48+ * Initial value to be used when a new entity is created
49+ * Drivers should change it to something useful
50+ */
51+#define MEDIA_ENT_T_UNKNOWN 0x00000000
52+
4553 /*
4654 * Base numbers for entity types
4755 *
@@ -76,6 +84,12 @@ struct media_device_info { · 28 unmodified lines
7684
7785 /* V4L2 Sub-device entities */
7886
87+/*
88+ * Subdevs are initialized with MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN,
89+ * in order to preserve backward compatibility.
90+ * Drivers should change to the proper subdev type before
91+ * registering the entity.
92+ */
7993 #define MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_T_V4L2_SUBDEV_BASE
8094
8195 #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t