Commit eb81065b authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: Register /dev/* nodes at the end of atomisp_pci_probe()

Register /dev/* nodes at the end of atomisp_pci_probe(), this is
a prerequisite for dropping the loading mutex + ready flag kludge
for delaying open() calls on the /dev/* nodes .
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 3b423e1b
......@@ -1194,11 +1194,8 @@ static int atomisp_register_entities(struct atomisp_device *isp)
struct atomisp_sub_device *asd = &isp->asd[i];
ret = atomisp_subdev_register_subdev(asd, &isp->v4l2_dev);
if (ret == 0)
ret = atomisp_subdev_register_video_nodes(asd, &isp->v4l2_dev);
if (ret < 0) {
dev_err(isp->dev,
"atomisp_subdev_register_entities fail\n");
dev_err(isp->dev, "atomisp_subdev_register_subdev fail\n");
for (; i > 0; i--)
atomisp_subdev_unregister_entities(
&isp->asd[i - 1]);
......@@ -1248,11 +1245,7 @@ static int atomisp_register_entities(struct atomisp_device *isp)
dev_warn(isp->dev, "too many atomisp inputs, TPG ignored.\n");
}
ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
if (ret < 0)
goto link_failed;
return media_device_register(&isp->media_dev);
return 0;
link_failed:
for (i = 0; i < isp->num_of_streams; i++)
......@@ -1275,6 +1268,27 @@ static int atomisp_register_entities(struct atomisp_device *isp)
return ret;
}
static int atomisp_register_device_nodes(struct atomisp_device *isp)
{
int i, err;
for (i = 0; i < isp->num_of_streams; i++) {
err = atomisp_subdev_register_video_nodes(&isp->asd[i], &isp->v4l2_dev);
if (err)
return err;
}
err = atomisp_create_pads_links(isp);
if (err)
return err;
err = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
if (err)
return err;
return media_device_register(&isp->media_dev);
}
static int atomisp_initialize_modules(struct atomisp_device *isp)
{
int ret;
......@@ -1687,9 +1701,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
dev_err(&pdev->dev, "atomisp_register_entities failed (%d)\n", err);
goto register_entities_fail;
}
err = atomisp_create_pads_links(isp);
if (err < 0)
goto register_entities_fail;
/* init atomisp wdts */
err = init_atomisp_wdts(isp);
if (err != 0)
......@@ -1727,8 +1738,13 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
isp->firmware = NULL;
isp->css_env.isp_css_fw.data = NULL;
isp->ready = true;
rt_mutex_unlock(&isp->loading);
err = atomisp_register_device_nodes(isp);
if (err)
goto css_init_fail;
atomisp_drvfs_init(isp);
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment