media: i2c: Fix build for GCC 6/7

Building nv_ar0234 and nv_hawk_owl sensor drivers with GCC 6/7 fails
with the following errors ...

 drivers/media/i2c/nv_ar0234.c:797:66: error: initialiser element is not
 constant
 .compound_ctrl_size = {sizeof(struct NvCamSyncSensorCalibData),
                        alternating_exposure_cfg_size},
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 drivers/media/i2c/nv_hawk_owl.c:883:59: error: initialiser element is
 not constant
 .compound_ctrl_size = {sizeof(NvCamSyncSensorCalibData),
                        alternating_exposure_cfg_size},
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These older versions of GCC are not able to reconcile the size from the
variable 'alternating_exposure_cfg_size' even though it is defined as
const. Given that the variable 'alternating_exposure_cfg_size' is only
used here, fix this by removing this variable and directly defining the
size in the declaration of the 'compound_ctrl_size' parameter.

Note that the minimum GCC compiler currently supported by the Linux
kernel is v5.1.

Bug 4448563

Change-Id: I4d3ac6eeb961a944901e73a1d92e753cae44220c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3050272
(cherry picked from commit 8b3ebff940)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051959
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2024-01-10 14:45:19 +00:00
committed by mobile promotions
parent 560b7c1345
commit f7d42ed1c4
2 changed files with 5 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2018-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. // SPDX-FileCopyrightText: Copyright (c) 2018-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/* /*
* ar0234.c - ar0234 sensor driver * ar0234.c - ar0234 sensor driver
*/ */
@@ -62,7 +62,6 @@ static const u32 ctrl_cid_list[] = {
TEGRA_CAMERA_CID_ALTERNATING_EXPOSURE, TEGRA_CAMERA_CID_ALTERNATING_EXPOSURE,
}; };
const u16 alternating_exposure_cfg_size = sizeof(struct alternating_exposure_cfg);
// Coefficients as per distortion model (wide FOV) being used // Coefficients as per distortion model (wide FOV) being used
struct fisheye_lens_distortion_coeff { struct fisheye_lens_distortion_coeff {
@@ -792,7 +791,7 @@ static struct tegracam_ctrl_ops ar0234_ctrl_ops = {
.numctrls = ARRAY_SIZE(ctrl_cid_list), .numctrls = ARRAY_SIZE(ctrl_cid_list),
.ctrl_cid_list = ctrl_cid_list, .ctrl_cid_list = ctrl_cid_list,
.string_ctrl_size = {AR0234_EEPROM_STR_SIZE}, .string_ctrl_size = {AR0234_EEPROM_STR_SIZE},
.compound_ctrl_size = {sizeof(struct NvCamSyncSensorCalibData), alternating_exposure_cfg_size}, .compound_ctrl_size = {sizeof(struct NvCamSyncSensorCalibData), sizeof(struct alternating_exposure_cfg)},
.set_gain = ar0234_set_gain, .set_gain = ar0234_set_gain,
.set_exposure = ar0234_set_exposure, .set_exposure = ar0234_set_exposure,
.set_exposure_short = ar0234_set_exposure, .set_exposure_short = ar0234_set_exposure,

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/* /*
* nv_hawk_owl.c.c - ar0234 sensor driver * nv_hawk_owl.c.c - ar0234 sensor driver
*/ */
@@ -65,8 +65,6 @@ static const u32 ctrl_cid_list[] = {
TEGRA_CAMERA_CID_ALTERNATING_EXPOSURE, TEGRA_CAMERA_CID_ALTERNATING_EXPOSURE,
}; };
const u16 alternating_exposure_cfg_size = sizeof(struct alternating_exposure_cfg);
// Coefficients as per distortion model (wide FOV) being used // Coefficients as per distortion model (wide FOV) being used
typedef struct typedef struct
{ {
@@ -878,7 +876,7 @@ static struct tegracam_ctrl_ops ar0234_ctrl_ops = {
.numctrls = ARRAY_SIZE(ctrl_cid_list), .numctrls = ARRAY_SIZE(ctrl_cid_list),
.ctrl_cid_list = ctrl_cid_list, .ctrl_cid_list = ctrl_cid_list,
.string_ctrl_size = {AR0234_EEPROM_STR_SIZE}, .string_ctrl_size = {AR0234_EEPROM_STR_SIZE},
.compound_ctrl_size = {sizeof(NvCamSyncSensorCalibData), alternating_exposure_cfg_size}, .compound_ctrl_size = {sizeof(NvCamSyncSensorCalibData), sizeof(struct alternating_exposure_cfg)},
.set_gain = ar0234_set_gain, .set_gain = ar0234_set_gain,
.set_exposure = ar0234_set_exposure, .set_exposure = ar0234_set_exposure,
.set_exposure_short = ar0234_set_exposure, .set_exposure_short = ar0234_set_exposure,