Skip to content

Commit 0267987

Browse files
committed
media: v4l2-subdev: document remaining undocumented functions
There are several undocumented v4l2-subdev functions that are part of kAPI. Document them. Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
1 parent ab9bb73 commit 0267987

1 file changed

Lines changed: 64 additions & 5 deletions

File tree

‎include/media/v4l2-subdev.h‎

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,13 @@ struct v4l2_subdev {
861861
struct v4l2_subdev_platform_data *pdata;
862862
};
863863

864+
865+
/**
866+
* media_entity_to_v4l2_subdev - Returns a &struct v4l2_subdev from
867+
* the &struct media_entity embedded in it.
868+
*
869+
* @ent: pointer to &struct media_entity.
870+
*/
864871
#define media_entity_to_v4l2_subdev(ent) \
865872
({ \
866873
typeof(ent) __me_sd_ent = (ent); \
@@ -870,14 +877,20 @@ struct v4l2_subdev {
870877
NULL; \
871878
})
872879

880+
/**
881+
* vdev_to_v4l2_subdev - Returns a &struct v4l2_subdev from
882+
* the &struct video_device embedded on it.
883+
*
884+
* @vdev: pointer to &struct video_device
885+
*/
873886
#define vdev_to_v4l2_subdev(vdev) \
874887
((struct v4l2_subdev *)video_get_drvdata(vdev))
875888

876889
/**
877890
* struct v4l2_subdev_fh - Used for storing subdev information per file handle
878891
*
879-
* @vfh: pointer to struct v4l2_fh
880-
* @pad: pointer to v4l2_subdev_pad_config
892+
* @vfh: pointer to &struct v4l2_fh
893+
* @pad: pointer to &struct v4l2_subdev_pad_config
881894
*/
882895
struct v4l2_subdev_fh {
883896
struct v4l2_fh vfh;
@@ -886,10 +899,25 @@ struct v4l2_subdev_fh {
886899
#endif
887900
};
888901

902+
/**
903+
* to_v4l2_subdev_fh - Returns a &struct v4l2_subdev_fh from
904+
* the &struct v4l2_fh embedded on it.
905+
*
906+
* @fh: pointer to &struct v4l2_fh
907+
*/
889908
#define to_v4l2_subdev_fh(fh) \
890909
container_of(fh, struct v4l2_subdev_fh, vfh)
891910

892911
#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
912+
913+
/**
914+
* v4l2_subdev_get_try_format - ancillary routine to call
915+
* &struct v4l2_subdev_pad_config->try_fmt
916+
*
917+
* @sd: pointer to &struct v4l2_subdev
918+
* @cfg: pointer to &struct v4l2_subdev_pad_config array.
919+
* @pad: index of the pad in the @cfg array.
920+
*/
893921
static inline struct v4l2_mbus_framefmt
894922
*v4l2_subdev_get_try_format(struct v4l2_subdev *sd,
895923
struct v4l2_subdev_pad_config *cfg,
@@ -900,6 +928,14 @@ static inline struct v4l2_mbus_framefmt
900928
return &cfg[pad].try_fmt;
901929
}
902930

931+
/**
932+
* v4l2_subdev_get_try_crop - ancillary routine to call
933+
* &struct v4l2_subdev_pad_config->try_crop
934+
*
935+
* @sd: pointer to &struct v4l2_subdev
936+
* @cfg: pointer to &struct v4l2_subdev_pad_config array.
937+
* @pad: index of the pad in the @cfg array.
938+
*/
903939
static inline struct v4l2_rect
904940
*v4l2_subdev_get_try_crop(struct v4l2_subdev *sd,
905941
struct v4l2_subdev_pad_config *cfg,
@@ -910,6 +946,14 @@ static inline struct v4l2_rect
910946
return &cfg[pad].try_crop;
911947
}
912948

949+
/**
950+
* v4l2_subdev_get_try_crop - ancillary routine to call
951+
* &struct v4l2_subdev_pad_config->try_compose
952+
*
953+
* @sd: pointer to &struct v4l2_subdev
954+
* @cfg: pointer to &struct v4l2_subdev_pad_config array.
955+
* @pad: index of the pad in the @cfg array.
956+
*/
913957
static inline struct v4l2_rect
914958
*v4l2_subdev_get_try_compose(struct v4l2_subdev *sd,
915959
struct v4l2_subdev_pad_config *cfg,
@@ -1026,9 +1070,16 @@ void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg);
10261070
void v4l2_subdev_init(struct v4l2_subdev *sd,
10271071
const struct v4l2_subdev_ops *ops);
10281072

1029-
/*
1030-
* Call an ops of a v4l2_subdev, doing the right checks against
1031-
* NULL pointers.
1073+
/**
1074+
* v4l2_subdev_call - call an operation of a v4l2_subdev.
1075+
*
1076+
* @sd: pointer to the &struct v4l2_subdev
1077+
* @o: name of the element at &struct v4l2_subdev_ops that contains @f.
1078+
* Each element there groups a set of callbacks functions.
1079+
* @f: callback function that will be called if @cond matches.
1080+
* The callback functions are defined in groups, according to
1081+
* each element at &struct v4l2_subdev_ops.
1082+
* @args...: arguments for @f.
10321083
*
10331084
* Example: err = v4l2_subdev_call(sd, video, s_std, norm);
10341085
*/
@@ -1044,6 +1095,14 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
10441095
__result; \
10451096
})
10461097

1098+
/**
1099+
* v4l2_subdev_has_op - Checks if a subdev defines a certain operation.
1100+
*
1101+
* @sd: pointer to the &struct v4l2_subdev
1102+
* @o: The group of callback functions in &struct v4l2_subdev_ops
1103+
* which @f is a part of.
1104+
* @f: callback function to be checked for its existence.
1105+
*/
10471106
#define v4l2_subdev_has_op(sd, o, f) \
10481107
((sd)->ops->o && (sd)->ops->o->f)
10491108

0 commit comments

Comments
 (0)