Commit cb743930 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

[media] sh_mobile_csi2: fix module reloading

If the camera host driver (sh_mobile_ceu_camera.c) is unloaded and then
reloaded, probe will fail, because camera client .set_bus_param() and
.query_bus_param() methods have been set to NULL. Fix this by caching
the original pointers and restoring them on driver-unbind.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c8dd7078
...@@ -38,6 +38,8 @@ struct sh_csi2 { ...@@ -38,6 +38,8 @@ struct sh_csi2 {
void __iomem *base; void __iomem *base;
struct platform_device *pdev; struct platform_device *pdev;
struct sh_csi2_client_config *client; struct sh_csi2_client_config *client;
unsigned long (*query_bus_param)(struct soc_camera_device *);
int (*set_bus_param)(struct soc_camera_device *, unsigned long);
}; };
static int sh_csi2_try_fmt(struct v4l2_subdev *sd, static int sh_csi2_try_fmt(struct v4l2_subdev *sd,
...@@ -216,6 +218,8 @@ static int sh_csi2_notify(struct notifier_block *nb, ...@@ -216,6 +218,8 @@ static int sh_csi2_notify(struct notifier_block *nb,
priv->client = pdata->clients + i; priv->client = pdata->clients + i;
priv->set_bus_param = icd->ops->set_bus_param;
priv->query_bus_param = icd->ops->query_bus_param;
icd->ops->set_bus_param = sh_csi2_set_bus_param; icd->ops->set_bus_param = sh_csi2_set_bus_param;
icd->ops->query_bus_param = sh_csi2_query_bus_param; icd->ops->query_bus_param = sh_csi2_query_bus_param;
...@@ -227,8 +231,10 @@ static int sh_csi2_notify(struct notifier_block *nb, ...@@ -227,8 +231,10 @@ static int sh_csi2_notify(struct notifier_block *nb,
priv->client = NULL; priv->client = NULL;
/* Driver is about to be unbound */ /* Driver is about to be unbound */
icd->ops->set_bus_param = NULL; icd->ops->set_bus_param = priv->set_bus_param;
icd->ops->query_bus_param = NULL; icd->ops->query_bus_param = priv->query_bus_param;
priv->set_bus_param = NULL;
priv->query_bus_param = NULL;
v4l2_device_unregister_subdev(&priv->subdev); v4l2_device_unregister_subdev(&priv->subdev);
......
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