From eaa2a1abe1532dfeba3221d2d1eb414c02ff6125 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Mon, 2 Jun 2025 16:52:24 +0100 Subject: [PATCH] media: camera: cdi-mgr: Simplify i2c_board_info init In Linux v6.16, the 'of_node' structure was removed from the 'i2c_board_info' structure and the 'cdi-mgr' driver fails to build. Although it is possible to detect whether the 'i2c_board_info' structure has the 'of_node' structure using conftest, the 'cdi-mgr' driver does not even use this. Therefore, it is simpler to fix this by using memset and strncpy to initialize the 'i2c_board_info' structure and this also aligns the camera 'cdi-mgr' driver with the camera 'isc-mgr' driver that initializes the 'i2c_board_info' structure in this way. JIRA LINQPJ14-60 Change-Id: I1d9df0fb1ccea3d303f256f65d187a131b7352ad Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3374654 (cherry picked from commit 30cad15a2e832ad445003911a76627fb18f91b49) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461876 GVS: buildbot_gerritrpt Reviewed-by: Brad Griffis --- drivers/media/platform/tegra/cdi/cdi_mgr.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/tegra/cdi/cdi_mgr.c b/drivers/media/platform/tegra/cdi/cdi_mgr.c index 864b9b30..21818cf0 100644 --- a/drivers/media/platform/tegra/cdi/cdi_mgr.c +++ b/drivers/media/platform/tegra/cdi/cdi_mgr.c @@ -498,21 +498,9 @@ static int __cdi_create_dev( struct cdi_mgr_priv *cdi_mgr, struct cdi_mgr_new_dev *new_dev) { struct cdi_mgr_client *cdi_dev; - struct i2c_board_info brd = { - .type = "cdi-dev", - .flags = 0U, - .addr = 0U, - .dev_name = NULL, - .platform_data = NULL, - .of_node = NULL, - .fwnode = NULL, - .swnode = NULL, - .resources = NULL, - .num_resources = 0U, - .irq = 0 - }; - + struct i2c_board_info brd; int err = 0; + if (cdi_mgr == NULL || new_dev == NULL) { pr_err("%s: invalid dev params\n", __func__); return -EINVAL; @@ -578,6 +566,8 @@ static int __cdi_create_dev( mutex_init(&cdi_dev->mutex); INIT_LIST_HEAD(&cdi_dev->list); + memset(&brd, 0, sizeof(brd)); + strncpy(brd.type, "cdi-dev", sizeof(brd.type)); brd.addr = cdi_dev->cfg.addr; brd.platform_data = &cdi_dev->pdata; cdi_dev->client = i2c_new_client_device(cdi_mgr->adap, &brd);