media: ivsc: csi: Clean up parsing firmware and setting up async notifier
Set up async notifier right after obtaining the local endpoint. This makes error handling straightforward. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Wentong Wu <wentong.wu@intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
a6a42fada1
commit
623017a4bb
@ -654,21 +654,20 @@ static int mei_csi_parse_firmware(struct mei_csi *csi)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v4l2_async_subdev_nf_init(&csi->notifier, &csi->subdev);
|
||||||
|
csi->notifier.ops = &mei_csi_notify_ops;
|
||||||
|
|
||||||
ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep);
|
ret = v4l2_fwnode_endpoint_parse(ep, &v4l2_ep);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "could not parse v4l2 endpoint\n");
|
dev_err(dev, "could not parse v4l2 endpoint\n");
|
||||||
fwnode_handle_put(ep);
|
ret = -EINVAL;
|
||||||
return -EINVAL;
|
goto out_nf_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
csi->nr_of_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes;
|
csi->nr_of_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes;
|
||||||
|
|
||||||
v4l2_async_subdev_nf_init(&csi->notifier, &csi->subdev);
|
|
||||||
csi->notifier.ops = &mei_csi_notify_ops;
|
|
||||||
|
|
||||||
asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep,
|
asd = v4l2_async_nf_add_fwnode_remote(&csi->notifier, ep,
|
||||||
struct v4l2_async_connection);
|
struct v4l2_async_connection);
|
||||||
fwnode_handle_put(ep);
|
|
||||||
if (IS_ERR(asd)) {
|
if (IS_ERR(asd)) {
|
||||||
ret = PTR_ERR(asd);
|
ret = PTR_ERR(asd);
|
||||||
goto out_nf_cleanup;
|
goto out_nf_cleanup;
|
||||||
@ -678,10 +677,13 @@ static int mei_csi_parse_firmware(struct mei_csi *csi)
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out_nf_cleanup;
|
goto out_nf_cleanup;
|
||||||
|
|
||||||
|
fwnode_handle_put(ep);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_nf_cleanup:
|
out_nf_cleanup:
|
||||||
v4l2_async_nf_cleanup(&csi->notifier);
|
v4l2_async_nf_cleanup(&csi->notifier);
|
||||||
|
fwnode_handle_put(ep);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user