mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-14 22:44:27 +08:00
media: ipu-bridge: Move graph checking to IPU bridge
Move checking the graph to the IPU bridge. This way the caller won't need to do it. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
ec86a04bed
commit
e0251c2a1d
@ -2,6 +2,7 @@
|
||||
/* Author: Dan Scally <djrscally@gmail.com> */
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/mei_cl_bus.h>
|
||||
@ -749,6 +750,22 @@ static int ipu_bridge_ivsc_is_ready(void)
|
||||
return ready;
|
||||
}
|
||||
|
||||
static int ipu_bridge_check_fwnode_graph(struct fwnode_handle *fwnode)
|
||||
{
|
||||
struct fwnode_handle *endpoint;
|
||||
|
||||
if (IS_ERR_OR_NULL(fwnode))
|
||||
return -EINVAL;
|
||||
|
||||
endpoint = fwnode_graph_get_next_endpoint(fwnode, NULL);
|
||||
if (endpoint) {
|
||||
fwnode_handle_put(endpoint);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ipu_bridge_check_fwnode_graph(fwnode->secondary);
|
||||
}
|
||||
|
||||
int ipu_bridge_init(struct device *dev,
|
||||
ipu_parse_sensor_fwnode_t parse_sensor_fwnode)
|
||||
{
|
||||
@ -757,6 +774,9 @@ int ipu_bridge_init(struct device *dev,
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
if (!ipu_bridge_check_fwnode_graph(dev_fwnode(dev)))
|
||||
return 0;
|
||||
|
||||
if (!ipu_bridge_ivsc_is_ready())
|
||||
return -EPROBE_DEFER;
|
||||
|
||||
|
@ -1667,29 +1667,12 @@ static void cio2_queues_exit(struct cio2_device *cio2)
|
||||
cio2_queue_exit(cio2, &cio2->queue[i]);
|
||||
}
|
||||
|
||||
static int cio2_check_fwnode_graph(struct fwnode_handle *fwnode)
|
||||
{
|
||||
struct fwnode_handle *endpoint;
|
||||
|
||||
if (IS_ERR_OR_NULL(fwnode))
|
||||
return -EINVAL;
|
||||
|
||||
endpoint = fwnode_graph_get_next_endpoint(fwnode, NULL);
|
||||
if (endpoint) {
|
||||
fwnode_handle_put(endpoint);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return cio2_check_fwnode_graph(fwnode->secondary);
|
||||
}
|
||||
|
||||
/**************** PCI interface ****************/
|
||||
|
||||
static int cio2_pci_probe(struct pci_dev *pci_dev,
|
||||
const struct pci_device_id *id)
|
||||
{
|
||||
struct device *dev = &pci_dev->dev;
|
||||
struct fwnode_handle *fwnode = dev_fwnode(dev);
|
||||
struct cio2_device *cio2;
|
||||
int r;
|
||||
|
||||
@ -1698,17 +1681,9 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,
|
||||
* if the device has no endpoints then we can try to build those as
|
||||
* software_nodes parsed from SSDB.
|
||||
*/
|
||||
r = cio2_check_fwnode_graph(fwnode);
|
||||
if (r) {
|
||||
if (fwnode && !IS_ERR_OR_NULL(fwnode->secondary)) {
|
||||
dev_err(dev, "fwnode graph has no endpoints connected\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = ipu_bridge_init(dev, ipu_bridge_parse_ssdb);
|
||||
if (r)
|
||||
return r;
|
||||
}
|
||||
r = ipu_bridge_init(dev, ipu_bridge_parse_ssdb);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
cio2 = devm_kzalloc(dev, sizeof(*cio2), GFP_KERNEL);
|
||||
if (!cio2)
|
||||
|
Loading…
Reference in New Issue
Block a user