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

media: vimc: use data link entities enum to index the ent_config array

Future additions to the ent_config[] could break the association between
the index of the struct vimc_ent_config entries in the ent_config[] array,
and the index defined by the enum proposed in the previous patch. Using
designated initializers solves this by linking the 2 together clearly in
code and prevents the array not reflecting the enum. There is no
functional change intended.

Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Daniel Oakley and committed by
Mauro Carvalho Chehab
ee8dadd7 f2e761fd

+11 -11
+11 -11
drivers/media/test-drivers/vimc/vimc-core.c
··· 82 82 */ 83 83 84 84 static struct vimc_ent_config ent_config[] = { 85 - { 85 + [SENSOR_A] = { 86 86 .name = "Sensor A", 87 87 .type = &vimc_sensor_type 88 88 }, 89 - { 89 + [SENSOR_B] = { 90 90 .name = "Sensor B", 91 91 .type = &vimc_sensor_type 92 92 }, 93 - { 93 + [DEBAYER_A] = { 94 94 .name = "Debayer A", 95 95 .type = &vimc_debayer_type 96 96 }, 97 - { 97 + [DEBAYER_B] = { 98 98 .name = "Debayer B", 99 99 .type = &vimc_debayer_type 100 100 }, 101 - { 101 + [RAW_CAPTURE_0] = { 102 102 .name = "Raw Capture 0", 103 103 .type = &vimc_capture_type 104 104 }, 105 - { 105 + [RAW_CAPTURE_1] = { 106 106 .name = "Raw Capture 1", 107 107 .type = &vimc_capture_type 108 108 }, 109 - { 109 + [RGB_YUV_INPUT] = { 110 110 /* TODO: change this to vimc-input when it is implemented */ 111 111 .name = "RGB/YUV Input", 112 112 .type = &vimc_sensor_type 113 113 }, 114 - { 114 + [SCALER] = { 115 115 .name = "Scaler", 116 116 .type = &vimc_scaler_type 117 117 }, 118 - { 118 + [RGB_YUV_CAPTURE] = { 119 119 .name = "RGB/YUV Capture", 120 120 .type = &vimc_capture_type 121 121 }, 122 - { 122 + [LENS_A] = { 123 123 .name = "Lens A", 124 124 .type = &vimc_lens_type 125 125 }, 126 - { 126 + [LENS_B] = { 127 127 .name = "Lens B", 128 128 .type = &vimc_lens_type 129 129 },