Store the dev pointer in struct cio2_bridge instead of passing it around 3 levels deep. This takes up slightly more memory but further patches in this series add more data which needs to be passed around making passing everything as arguments cumbersome and those further patches also add data to struct cio2_bridge. To be consistent with these upcoming patches also add the dev pointer to struct cio2_bridge. Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> --- drivers/media/pci/intel/ipu3/cio2-bridge.c | 15 +++++++-------- drivers/media/pci/intel/ipu3/cio2-bridge.h | 1 + 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.c b/drivers/media/pci/intel/ipu3/cio2-bridge.c index 72a28844dfdb..746c1dda31d1 100644 --- a/drivers/media/pci/intel/ipu3/cio2-bridge.c +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.c @@ -286,8 +286,7 @@ static void cio2_bridge_unregister_sensors(struct cio2_bridge *bridge) } static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, - struct cio2_bridge *bridge, - struct device *dev) + struct cio2_bridge *bridge) { struct fwnode_handle *fwnode, *primary; struct cio2_sensor *sensor; @@ -301,7 +300,7 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, if (bridge->n_sensors >= CIO2_NUM_PORTS) { acpi_dev_put(adev); - dev_err(dev, "Exceeded available CIO2 ports\n"); + dev_err(bridge->dev, "Exceeded available CIO2 ports\n"); return -EINVAL; } @@ -356,7 +355,7 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, cio2_bridge_instantiate_vcm_i2c_client(sensor); - dev_info(dev, "Found supported sensor %s\n", + dev_info(bridge->dev, "Found supported sensor %s\n", acpi_dev_name(adev)); bridge->n_sensors++; @@ -373,8 +372,7 @@ static int cio2_bridge_connect_sensor(const struct cio2_sensor_config *cfg, return ret; } -static int cio2_bridge_connect_sensors(struct cio2_bridge *bridge, - struct device *dev) +static int cio2_bridge_connect_sensors(struct cio2_bridge *bridge) { unsigned int i; int ret; @@ -383,7 +381,7 @@ static int cio2_bridge_connect_sensors(struct cio2_bridge *bridge, const struct cio2_sensor_config *cfg = &cio2_supported_sensors[i]; - ret = cio2_bridge_connect_sensor(cfg, bridge, dev); + ret = cio2_bridge_connect_sensor(cfg, bridge); if (ret) goto err_unregister_sensors; } @@ -446,6 +444,7 @@ int cio2_bridge_init(struct device *dev) strscpy(bridge->cio2_node_name, CIO2_HID, sizeof(bridge->cio2_node_name)); bridge->cio2_hid_node.name = bridge->cio2_node_name; + bridge->dev = dev; ret = software_node_register(&bridge->cio2_hid_node); if (ret < 0) { @@ -463,7 +462,7 @@ int cio2_bridge_init(struct device *dev) for (i = 0; i < CIO2_MAX_LANES; i++) bridge->data_lanes[i] = i + 1; - ret = cio2_bridge_connect_sensors(bridge, dev); + ret = cio2_bridge_connect_sensors(bridge); if (ret || bridge->n_sensors == 0) goto err_unregister_cio2; diff --git a/drivers/media/pci/intel/ipu3/cio2-bridge.h b/drivers/media/pci/intel/ipu3/cio2-bridge.h index a824b96bcdf2..8045ceab899b 100644 --- a/drivers/media/pci/intel/ipu3/cio2-bridge.h +++ b/drivers/media/pci/intel/ipu3/cio2-bridge.h @@ -137,6 +137,7 @@ struct cio2_sensor { }; struct cio2_bridge { + struct device *dev; char cio2_node_name[ACPI_ID_LEN]; struct software_node cio2_hid_node; u32 data_lanes[4]; -- 2.41.0