media: ipu-bridge: Move initialization of node_names.vcm to ipu_bridge_init_swnode_na...
authorHans de Goede <hdegoede@redhat.com>
Wed, 5 Jul 2023 21:29:55 +0000 (23:29 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 10 Aug 2023 05:58:40 +0000 (07:58 +0200)
Move initialization of node_names.vcm to ipu_bridge_init_swnode_names()
where it belongs.

And make the initialization of nodes[SWNODE_VCM] unconditional,
ipu_bridge_init_swnode_group() takes care of not registering it
when there is no VCM.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/pci/intel/ipu-bridge.c
drivers/media/pci/intel/ipu-bridge.h
drivers/media/pci/intel/ipu3/ipu3-cio2.c

index d1bc703..8f6f88f 100644 (file)
@@ -4,7 +4,6 @@
 #include <linux/acpi.h>
 #include <linux/device.h>
 #include <linux/i2c.h>
-#include <linux/pci.h>
 #include <linux/property.h>
 #include <media/v4l2-fwnode.h>
 
@@ -288,7 +287,7 @@ static void ipu_bridge_unregister_sensors(struct ipu_bridge *bridge)
 
 static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
                                     struct ipu_bridge *bridge,
-                                    struct pci_dev *ipu)
+                                    struct device *dev)
 {
        struct fwnode_handle *fwnode, *primary;
        struct ipu_sensor *sensor;
@@ -302,7 +301,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
 
                if (bridge->n_sensors >= IPU_MAX_PORTS) {
                        acpi_dev_put(adev);
-                       dev_err(&ipu->dev, "Exceeded available IPU ports\n");
+                       dev_err(dev, "Exceeded available IPU ports\n");
                        return -EINVAL;
                }
 
@@ -362,7 +361,7 @@ static int ipu_bridge_connect_sensor(const struct ipu_sensor_config *cfg,
 
                ipu_bridge_instantiate_vcm_i2c_client(sensor);
 
-               dev_info(&ipu->dev, "Found supported sensor %s\n",
+               dev_info(dev, "Found supported sensor %s\n",
                         acpi_dev_name(adev));
 
                bridge->n_sensors++;
@@ -380,7 +379,7 @@ err_put_adev:
 }
 
 static int ipu_bridge_connect_sensors(struct ipu_bridge *bridge,
-                                     struct pci_dev *ipu)
+                                     struct device *dev)
 {
        unsigned int i;
        int ret;
@@ -389,7 +388,7 @@ static int ipu_bridge_connect_sensors(struct ipu_bridge *bridge,
                const struct ipu_sensor_config *cfg =
                        &ipu_supported_sensors[i];
 
-               ret = ipu_bridge_connect_sensor(cfg, bridge, ipu);
+               ret = ipu_bridge_connect_sensor(cfg, bridge, dev);
                if (ret)
                        goto err_unregister_sensors;
        }
@@ -435,9 +434,8 @@ static int ipu_bridge_sensors_are_ready(void)
        return ready;
 }
 
-int ipu_bridge_init(struct pci_dev *ipu)
+int ipu_bridge_init(struct device *dev)
 {
-       struct device *dev = &ipu->dev;
        struct fwnode_handle *fwnode;
        struct ipu_bridge *bridge;
        unsigned int i;
@@ -470,7 +468,7 @@ int ipu_bridge_init(struct pci_dev *ipu)
        for (i = 0; i < IPU_MAX_LANES; i++)
                bridge->data_lanes[i] = i + 1;
 
-       ret = ipu_bridge_connect_sensors(bridge, ipu);
+       ret = ipu_bridge_connect_sensors(bridge, dev);
        if (ret || bridge->n_sensors == 0)
                goto err_unregister_ipu;
 
index 6cce712..8c1437f 100644 (file)
@@ -144,9 +144,9 @@ struct ipu_bridge {
 };
 
 #if IS_ENABLED(CONFIG_IPU_BRIDGE)
-int ipu_bridge_init(struct pci_dev *ipu);
+int ipu_bridge_init(struct device *dev);
 #else
-static inline int ipu_bridge_init(struct pci_dev *ipu) { return 0; }
+static inline int ipu_bridge_init(struct device *dev) { return 0; }
 #endif
 
 #endif
index 8df0304..3cadf94 100644 (file)
@@ -1725,7 +1725,7 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
                        return -EINVAL;
                }
 
-               r = ipu_bridge_init(pci_dev);
+               r = ipu_bridge_init(dev);
                if (r)
                        return r;
        }