sh: switch ap325rxa to dynamically manage the platform camera
Use soc_camera_platform helper functions to dynamically manage the camera device. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
parent
d762f43831
commit
a3793a0d86
1 changed files with 14 additions and 20 deletions
|
@ -359,37 +359,31 @@ static struct soc_camera_link camera_link = {
|
||||||
.priv = &camera_info,
|
.priv = &camera_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void dummy_release(struct device *dev)
|
static struct platform_device *camera_device;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct platform_device camera_device = {
|
static void ap325rxa_camera_release(struct device *dev)
|
||||||
.name = "soc_camera_platform",
|
{
|
||||||
.dev = {
|
soc_camera_platform_release(&camera_device);
|
||||||
.platform_data = &camera_info,
|
}
|
||||||
.release = dummy_release,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
static int ap325rxa_camera_add(struct soc_camera_link *icl,
|
static int ap325rxa_camera_add(struct soc_camera_link *icl,
|
||||||
struct device *dev)
|
struct device *dev)
|
||||||
{
|
{
|
||||||
if (icl != &camera_link || camera_probe() <= 0)
|
int ret = soc_camera_platform_add(icl, dev, &camera_device, &camera_link,
|
||||||
return -ENODEV;
|
ap325rxa_camera_release, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
camera_info.dev = dev;
|
ret = camera_probe();
|
||||||
|
if (ret < 0)
|
||||||
|
soc_camera_platform_del(icl, camera_device, &camera_link);
|
||||||
|
|
||||||
return platform_device_register(&camera_device);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ap325rxa_camera_del(struct soc_camera_link *icl)
|
static void ap325rxa_camera_del(struct soc_camera_link *icl)
|
||||||
{
|
{
|
||||||
if (icl != &camera_link)
|
soc_camera_platform_del(icl, camera_device, &camera_link);
|
||||||
return;
|
|
||||||
|
|
||||||
platform_device_unregister(&camera_device);
|
|
||||||
memset(&camera_device.dev.kobj, 0,
|
|
||||||
sizeof(camera_device.dev.kobj));
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_I2C */
|
#endif /* CONFIG_I2C */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue