Instead of abusing MEDIA_ENT_T_V4L2_SUBDEV, initialize new subdev entities as MEDIA_ENT_T_UNKNOWN.
Unified · Split
| @@ -435,6 +435,12 @@ int __must_check media_device_register_entity(struct media_device *mdev, · 434 unmodified lines | ||
| 435 | 435 | { |
| 436 | 436 | int i; |
| 437 | 437 | |
| 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 | + | |
| 438 | 444 | /* Warn if we apparently re-register an entity */ |
| 439 | 445 | WARN_ON(entity->graph_obj.mdev != NULL); |
| 440 | 446 | entity->graph_obj.mdev = mdev; |
| @@ -584,7 +584,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) · 583 unmodified lines | ||
| 584 | 584 | sd->host_priv = NULL; |
| 585 | 585 | #if defined(CONFIG_MEDIA_CONTROLLER) |
| 586 | 586 | sd->entity.name = sd->name; |
| 587 | − sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV; | |
| 587 | + sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN; | |
| 588 | 588 | #endif |
| 589 | 589 | } |
| 590 | 590 | EXPORT_SYMBOL(v4l2_subdev_init); |
| @@ -42,6 +42,14 @@ struct media_device_info { · 41 unmodified lines | ||
| 42 | 42 | |
| 43 | 43 | #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) |
| 44 | 44 | |
| 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 | + | |
| 45 | 53 | /* |
| 46 | 54 | * Base numbers for entity types |
| 47 | 55 | * |
| @@ -76,6 +84,12 @@ struct media_device_info { · 28 unmodified lines | ||
| 76 | 84 | |
| 77 | 85 | /* V4L2 Sub-device entities */ |
| 78 | 86 | |
| 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 | + */ | |
| 79 | 93 | #define MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_T_V4L2_SUBDEV_BASE |
| 80 | 94 | |
| 81 | 95 | #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1) |