summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/media/v4l2-device.h13
-rw-r--r--include/media/v4l2-subdev.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index d61febfb1668..c9b1593923f6 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -190,4 +190,17 @@ v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev);
##args); \
})
+#define v4l2_device_has_op(v4l2_dev, o, f) \
+({ \
+ struct v4l2_subdev *__sd; \
+ bool __result = false; \
+ list_for_each_entry(__sd, &(v4l2_dev)->subdevs, list) { \
+ if (v4l2_subdev_has_op(__sd, o, f)) { \
+ __result = true; \
+ break; \
+ } \
+ } \
+ __result; \
+})
+
#endif
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 8158a0810fdc..c42703a37602 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -687,4 +687,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
(sd)->v4l2_dev->notify((sd), (notification), (arg)))
+#define v4l2_subdev_has_op(sd, o, f) \
+ ((sd)->ops->o && (sd)->ops->o->f)
+
#endif