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 <jonathanh@nvidia.com>
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 <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
This commit is contained in:
Jon Hunter
2025-06-02 16:52:24 +01:00
committed by mobile promotions
parent 594c03645c
commit eaa2a1abe1

View File

@@ -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_priv *cdi_mgr, struct cdi_mgr_new_dev *new_dev)
{ {
struct cdi_mgr_client *cdi_dev; struct cdi_mgr_client *cdi_dev;
struct i2c_board_info brd = { 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
};
int err = 0; int err = 0;
if (cdi_mgr == NULL || new_dev == NULL) { if (cdi_mgr == NULL || new_dev == NULL) {
pr_err("%s: invalid dev params\n", __func__); pr_err("%s: invalid dev params\n", __func__);
return -EINVAL; return -EINVAL;
@@ -578,6 +566,8 @@ static int __cdi_create_dev(
mutex_init(&cdi_dev->mutex); mutex_init(&cdi_dev->mutex);
INIT_LIST_HEAD(&cdi_dev->list); 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.addr = cdi_dev->cfg.addr;
brd.platform_data = &cdi_dev->pdata; brd.platform_data = &cdi_dev->pdata;
cdi_dev->client = i2c_new_client_device(cdi_mgr->adap, &brd); cdi_dev->client = i2c_new_client_device(cdi_mgr->adap, &brd);