Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: v4l2-isp: Rename block_info to block_type_info

The v4l2_isp_params_block_info structure contains validation information
that apply to a block -type- and not only to a specific ISP block
implementation.

Clarify this by renaming v4l2_isp_params_block_info in
v4l2_isp_params_block_type_info and update the documentation and the
users of v4l2-isp accordingly.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Jacopo Mondi and committed by
Hans Verkuil
d619dd9a 48ecdf25

+35 -32
+5 -4
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c
··· 536 536 .size = sizeof(struct c3_isp_params_ ## data), \ 537 537 } 538 538 539 - static const struct v4l2_isp_params_block_info c3_isp_params_blocks_info[] = { 539 + static const struct v4l2_isp_params_block_type_info 540 + c3_isp_params_block_types_info[] = { 540 541 C3_ISP_PARAMS_BLOCK_INFO(AWB_GAINS, awb_gains), 541 542 C3_ISP_PARAMS_BLOCK_INFO(AWB_CONFIG, awb_config), 542 543 C3_ISP_PARAMS_BLOCK_INFO(AE_CONFIG, ae_config), ··· 549 548 }; 550 549 551 550 static_assert(ARRAY_SIZE(c3_isp_params_handlers) == 552 - ARRAY_SIZE(c3_isp_params_blocks_info)); 551 + ARRAY_SIZE(c3_isp_params_block_types_info)); 553 552 554 553 static void c3_isp_params_cfg_blocks(struct c3_isp_params *params) 555 554 { ··· 782 781 783 782 return v4l2_isp_params_validate_buffer(params->isp->dev, vb, 784 783 (struct v4l2_isp_params_buffer *)cfg, 785 - c3_isp_params_blocks_info, 786 - ARRAY_SIZE(c3_isp_params_blocks_info)); 784 + c3_isp_params_block_types_info, 785 + ARRAY_SIZE(c3_isp_params_block_types_info)); 787 786 } 788 787 789 788 static int c3_isp_params_vb2_buf_init(struct vb2_buffer *vb)
+4 -3
drivers/media/platform/arm/mali-c55/mali-c55-params.c
··· 428 428 [MALI_C55_PARAM_MESH_SHADING_SELECTION] = &mali_c55_params_lsc_selection, 429 429 }; 430 430 431 - static const struct v4l2_isp_params_block_info mali_c55_params_blocks_info[] = { 431 + static const struct v4l2_isp_params_block_type_info 432 + mali_c55_params_block_types_info[] = { 432 433 [MALI_C55_PARAM_BLOCK_SENSOR_OFFS] = { 433 434 .size = sizeof(struct mali_c55_params_sensor_off_preshading), 434 435 }, ··· 600 599 memcpy(buf->config, config, v4l2_isp_params_buffer_size(MALI_C55_PARAMS_MAX_SIZE)); 601 600 602 601 return v4l2_isp_params_validate_buffer(mali_c55->dev, vb, buf->config, 603 - mali_c55_params_blocks_info, 604 - ARRAY_SIZE(mali_c55_params_blocks_info)); 602 + mali_c55_params_block_types_info, 603 + ARRAY_SIZE(mali_c55_params_block_types_info)); 605 604 } 606 605 607 606 static void mali_c55_params_buf_queue(struct vb2_buffer *vb)
+5 -4
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
··· 2198 2198 .size = sizeof(struct rkisp1_ext_params_ ## data ## _config), \ 2199 2199 } 2200 2200 2201 - static const struct v4l2_isp_params_block_info rkisp1_ext_params_blocks_info[] = { 2201 + static const struct v4l2_isp_params_block_type_info 2202 + rkisp1_ext_params_block_types_info[] = { 2202 2203 RKISP1_PARAMS_BLOCK_INFO(BLS, bls), 2203 2204 RKISP1_PARAMS_BLOCK_INFO(DPCC, dpcc), 2204 2205 RKISP1_PARAMS_BLOCK_INFO(SDG, sdg), ··· 2224 2223 }; 2225 2224 2226 2225 static_assert(ARRAY_SIZE(rkisp1_ext_params_handlers) == 2227 - ARRAY_SIZE(rkisp1_ext_params_blocks_info)); 2226 + ARRAY_SIZE(rkisp1_ext_params_block_types_info)); 2228 2227 2229 2228 static void rkisp1_ext_params_config(struct rkisp1_params *params, 2230 2229 struct rkisp1_ext_params_cfg *cfg, ··· 2678 2677 2679 2678 return v4l2_isp_params_validate_buffer(params->rkisp1->dev, vb, 2680 2679 (struct v4l2_isp_params_buffer *)cfg, 2681 - rkisp1_ext_params_blocks_info, 2682 - ARRAY_SIZE(rkisp1_ext_params_blocks_info)); 2680 + rkisp1_ext_params_block_types_info, 2681 + ARRAY_SIZE(rkisp1_ext_params_block_types_info)); 2683 2682 } 2684 2683 2685 2684 static int rkisp1_params_vb2_buf_prepare(struct vb2_buffer *vb)
+8 -8
drivers/media/v4l2-core/v4l2-isp.c
··· 38 38 39 39 int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb, 40 40 const struct v4l2_isp_params_buffer *buffer, 41 - const struct v4l2_isp_params_block_info *info, 42 - size_t num_blocks) 41 + const struct v4l2_isp_params_block_type_info *type_info, 42 + size_t num_block_types) 43 43 { 44 44 size_t header_size = offsetof(struct v4l2_isp_params_buffer, data); 45 45 size_t payload_size = vb2_get_plane_payload(vb, 0); ··· 71 71 /* Walk the list of ISP configuration blocks and validate them. */ 72 72 buffer_size = buffer->data_size; 73 73 while (buffer_size >= sizeof(struct v4l2_isp_params_block_header)) { 74 - const struct v4l2_isp_params_block_info *block_info; 74 + const struct v4l2_isp_params_block_type_info *info; 75 75 const struct v4l2_isp_params_block_header *block; 76 76 77 77 block = (const struct v4l2_isp_params_block_header *) 78 78 (buffer->data + block_offset); 79 79 80 - if (block->type >= num_blocks) { 80 + if (block->type >= num_block_types) { 81 81 dev_dbg(dev, 82 82 "Invalid block type %u at offset %zu\n", 83 83 block->type, block_offset); ··· 100 100 } 101 101 102 102 /* 103 - * Match the block reported size against the info provided 103 + * Match the block reported size against the type info provided 104 104 * one, but allow the block to only contain the header in 105 105 * case it is going to be disabled. 106 106 */ 107 - block_info = &info[block->type]; 108 - if (block->size != block_info->size && 107 + info = &type_info[block->type]; 108 + if (block->size != info->size && 109 109 (!(block->flags & V4L2_ISP_PARAMS_FL_BLOCK_DISABLE) || 110 110 block->size != sizeof(*block))) { 111 111 dev_dbg(dev, 112 112 "Invalid block size %u (expected %zu) at offset %zu\n", 113 - block->size, block_info->size, block_offset); 113 + block->size, info->size, block_offset); 114 114 return -EINVAL; 115 115 } 116 116
+13 -13
include/media/v4l2-isp.h
··· 49 49 size_t max_size); 50 50 51 51 /** 52 - * struct v4l2_isp_params_block_info - V4L2 ISP per-block info 53 - * @size: the block expected size 52 + * struct v4l2_isp_params_block_type_info - V4L2 ISP per-block-type info 53 + * @size: the block type expected size 54 54 * 55 - * The v4l2_isp_params_block_info collects information of the ISP configuration 56 - * blocks for validation purposes. It currently only contains the expected 57 - * block size. 55 + * The v4l2_isp_params_block_type_info collects information of the ISP 56 + * configuration block types for validation purposes. It currently only contains 57 + * the expected block type size. 58 58 * 59 - * Drivers shall prepare a list of block info, indexed by block type, one for 60 - * each supported ISP block and correctly populate them with the expected block 61 - * size. 59 + * Drivers shall prepare a list of block type info, indexed by block type, one 60 + * for each supported ISP block type and correctly populate them with the 61 + * expected block type size. 62 62 */ 63 - struct v4l2_isp_params_block_info { 63 + struct v4l2_isp_params_block_type_info { 64 64 size_t size; 65 65 }; 66 66 ··· 69 69 * @dev: the driver's device pointer 70 70 * @vb: the videobuf2 buffer 71 71 * @buffer: the V4L2 ISP parameters buffer 72 - * @info: the list of per-block validation info 73 - * @num_blocks: the number of blocks 72 + * @type_info: the array of per-block-type validation info 73 + * @num_block_types: the number of block types in the type_info array 74 74 * 75 75 * This function completes the validation of a V4L2 ISP parameters buffer, 76 76 * verifying each configuration block correctness before the driver can use ··· 85 85 */ 86 86 int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb, 87 87 const struct v4l2_isp_params_buffer *buffer, 88 - const struct v4l2_isp_params_block_info *info, 89 - size_t num_blocks); 88 + const struct v4l2_isp_params_block_type_info *type_info, 89 + size_t num_block_types); 90 90 91 91 #endif /* _V4L2_ISP_H_ */