aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/soc_camera.h
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-09-21 14:16:30 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 16:28:58 -0400
commit14178aa57ce6ac4f05b4df8ea9e010486ce83a76 (patch)
tree992b8ae46ddad4f16c0d5d7b8fa3ab2a84b4e50e /include/media/soc_camera.h
parent09362ec25c3f42d00a4008d0622bfbca68e540f5 (diff)
[media] V4L: soc-camera: start removing struct soc_camera_device from client drivers
Remove most trivial uses of struct soc_camera_device from most client drivers, abstracting some of them inside inline functions. Next steps will eliminate remaining uses and modify inline functions to not use struct soc_camera_device. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/soc_camera.h')
-rw-r--r--include/media/soc_camera.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 6398ff0f08ab..67a52c729eff 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -251,18 +251,35 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl,
251 251
252/* This is only temporary here - until v4l2-subdev begins to link to video_device */ 252/* This is only temporary here - until v4l2-subdev begins to link to video_device */
253#include <linux/i2c.h> 253#include <linux/i2c.h>
254static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *client) 254static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client)
255{ 255{
256 struct soc_camera_device *icd = client->dev.platform_data; 256 struct soc_camera_device *icd = client->dev.platform_data;
257 return icd->vdev; 257 return icd ? icd->vdev : NULL;
258} 258}
259 259
260static inline struct soc_camera_device *soc_camera_from_vb2q(struct vb2_queue *vq) 260static inline struct soc_camera_link *soc_camera_i2c_to_link(const struct i2c_client *client)
261{
262 struct soc_camera_device *icd = client->dev.platform_data;
263 return icd ? to_soc_camera_link(icd) : NULL;
264}
265
266static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_device *vdev)
267{
268 struct soc_camera_device *icd = dev_get_drvdata(vdev->parent);
269 return soc_camera_to_subdev(icd);
270}
271
272static inline struct soc_camera_device *soc_camera_from_i2c(const struct i2c_client *client)
273{
274 return client->dev.platform_data;
275}
276
277static inline struct soc_camera_device *soc_camera_from_vb2q(const struct vb2_queue *vq)
261{ 278{
262 return container_of(vq, struct soc_camera_device, vb2_vidq); 279 return container_of(vq, struct soc_camera_device, vb2_vidq);
263} 280}
264 281
265static inline struct soc_camera_device *soc_camera_from_vbq(struct videobuf_queue *vq) 282static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobuf_queue *vq)
266{ 283{
267 return container_of(vq, struct soc_camera_device, vb_vidq); 284 return container_of(vq, struct soc_camera_device, vb_vidq);
268} 285}