video: rockchip: mpp: fix issue for devices register to service

The device must be registered last. If there is an error, the device
should not succeed.

Change-Id: Ie342c8bbf30e8a94822dcb2e0417fe1230e4482a
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
This commit is contained in:
Ding Wei
2021-10-22 17:16:19 +08:00
committed by Tao Huang
parent 607ec674a1
commit 570ca7f242
11 changed files with 29 additions and 4 deletions

View File

@@ -927,10 +927,6 @@ static int mpp_attach_service(struct mpp_dev *mpp, struct device *dev)
}
}
/* register current device to mpp service */
mpp->srv->sub_devices[mpp->var->device_type] = mpp;
set_bit(mpp->var->device_type, &mpp->srv->hw_support);
return 0;
err_put_pdev:
@@ -1962,6 +1958,16 @@ int mpp_dev_remove(struct mpp_dev *mpp)
return 0;
}
int mpp_dev_register_srv(struct mpp_dev *mpp, struct mpp_service *srv)
{
enum MPP_DEVICE_TYPE device_type = mpp->var->device_type;
srv->sub_devices[device_type] = mpp;
set_bit(device_type, &srv->hw_support);
return 0;
}
irqreturn_t mpp_dev_irq(int irq, void *param)
{
struct mpp_dev *mpp = param;

View File

@@ -589,6 +589,7 @@ int mpp_session_deinit(struct mpp_session *session);
int mpp_dev_probe(struct mpp_dev *mpp,
struct platform_device *pdev);
int mpp_dev_remove(struct mpp_dev *mpp);
int mpp_dev_register_srv(struct mpp_dev *mpp, struct mpp_service *srv);
int mpp_power_on(struct mpp_dev *mpp);
int mpp_power_off(struct mpp_dev *mpp);

View File

@@ -967,6 +967,8 @@ static int iep2_probe(struct platform_device *pdev)
mpp->session_max_buffers = IEP2_SESSION_MAX_BUFFERS;
iep2_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;

View File

@@ -599,6 +599,8 @@ static int jpgdec_probe(struct platform_device *pdev)
mpp->session_max_buffers = JPGDEC_SESSION_MAX_BUFFERS;
jpgdec_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;

View File

@@ -1900,6 +1900,8 @@ static int rkvdec_probe(struct platform_device *pdev)
mpp->session_max_buffers = RKVDEC_SESSION_MAX_BUFFERS;
rkvdec_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;

View File

@@ -1037,6 +1037,8 @@ static int rkvdec2_probe(struct platform_device *pdev)
mpp->session_max_buffers = RKVDEC_SESSION_MAX_BUFFERS;
rkvdec2_procfs_init(mpp);
rkvdec2_link_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;

View File

@@ -1453,6 +1453,8 @@ static int rkvenc_probe(struct platform_device *pdev)
mpp->session_max_buffers = RKVENC_SESSION_MAX_BUFFERS;
rkvenc_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;

View File

@@ -827,6 +827,8 @@ static int vdpu_probe(struct platform_device *pdev)
mpp->session_max_buffers = VDPU1_SESSION_MAX_BUFFERS;
vdpu_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;

View File

@@ -721,6 +721,8 @@ static int vdpu_probe(struct platform_device *pdev)
mpp->session_max_buffers = VDPU2_SESSION_MAX_BUFFERS;
vdpu_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;

View File

@@ -748,6 +748,8 @@ static int vepu_probe(struct platform_device *pdev)
mpp->session_max_buffers = VEPU1_SESSION_MAX_BUFFERS;
vepu_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;

View File

@@ -841,6 +841,8 @@ static int vepu_probe(struct platform_device *pdev)
mpp->session_max_buffers = VEPU2_SESSION_MAX_BUFFERS;
vepu_procfs_init(mpp);
/* register current device to mpp service */
mpp_dev_register_srv(mpp, mpp->srv);
dev_info(dev, "probing finish\n");
return 0;