mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
V4L/DVB (12509): sh: prepare board-ap325rxa.c for v4l2-subdev conversion
We will be registering and unregistering the soc_camera_platform platform device multiple times, therefore we need a .release() method and have to nullify the kobj. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
dd4f0ad4b0
commit
0bab829de1
1 changed files with 12 additions and 2 deletions
|
@ -329,13 +329,19 @@ static struct soc_camera_platform_info camera_info = {
|
||||||
.bus_id = 0,
|
.bus_id = 0,
|
||||||
.add_device = ap325rxa_camera_add,
|
.add_device = ap325rxa_camera_add,
|
||||||
.del_device = ap325rxa_camera_del,
|
.del_device = ap325rxa_camera_del,
|
||||||
|
.module_name = "soc_camera_platform",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void dummy_release(struct device *dev)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static struct platform_device camera_device = {
|
static struct platform_device camera_device = {
|
||||||
.name = "soc_camera_platform",
|
.name = "soc_camera_platform",
|
||||||
.dev = {
|
.dev = {
|
||||||
.platform_data = &camera_info,
|
.platform_data = &camera_info,
|
||||||
|
.release = dummy_release,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -352,8 +358,12 @@ static int ap325rxa_camera_add(struct soc_camera_link *icl,
|
||||||
|
|
||||||
static void ap325rxa_camera_del(struct soc_camera_link *icl)
|
static void ap325rxa_camera_del(struct soc_camera_link *icl)
|
||||||
{
|
{
|
||||||
if (icl == &camera_info.link)
|
if (icl != &camera_info.link)
|
||||||
|
return;
|
||||||
|
|
||||||
platform_device_unregister(&camera_device);
|
platform_device_unregister(&camera_device);
|
||||||
|
memset(&camera_device.dev.kobj, 0,
|
||||||
|
sizeof(camera_device.dev.kobj));
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_I2C */
|
#endif /* CONFIG_I2C */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue