aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cohen <dacohen@gmail.com>2010-12-08 07:13:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-30 19:29:20 -0500
commitf7b74f76a3a5bcad4d2e8db76834253a63977545 (patch)
tree2a0edb5b53dbcf480c7439da6fd9a67aa91d2483
parent9804ed9e840c461f88b290dea43173e3eed37102 (diff)
[media] ov9640: use macro to request OmniVision OV9640 sensor private data
This cleanup patch creates macro to request OmniVision OV9640 private data, which increases readability. Signed-off-by: David Cohen <dacohen@gmail.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/ov9640.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c
index 99e9e1d3c83b..c6d8e8a88d2d 100644
--- a/drivers/media/video/ov9640.c
+++ b/drivers/media/video/ov9640.c
@@ -31,6 +31,8 @@
31 31
32#include "ov9640.h" 32#include "ov9640.h"
33 33
34#define to_ov9640_sensor(sd) container_of(sd, struct ov9640_priv, subdev)
35
34/* default register setup */ 36/* default register setup */
35static const struct ov9640_reg ov9640_regs_dflt[] = { 37static const struct ov9640_reg ov9640_regs_dflt[] = {
36 { OV9640_COM5, OV9640_COM5_SYSCLK | OV9640_COM5_LONGEXP }, 38 { OV9640_COM5, OV9640_COM5_SYSCLK | OV9640_COM5_LONGEXP },
@@ -308,9 +310,7 @@ static unsigned long ov9640_query_bus_param(struct soc_camera_device *icd)
308/* Get status of additional camera capabilities */ 310/* Get status of additional camera capabilities */
309static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 311static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
310{ 312{
311 struct i2c_client *client = v4l2_get_subdevdata(sd); 313 struct ov9640_priv *priv = to_ov9640_sensor(sd);
312 struct ov9640_priv *priv = container_of(i2c_get_clientdata(client),
313 struct ov9640_priv, subdev);
314 314
315 switch (ctrl->id) { 315 switch (ctrl->id) {
316 case V4L2_CID_VFLIP: 316 case V4L2_CID_VFLIP:
@@ -327,8 +327,7 @@ static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
327static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 327static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
328{ 328{
329 struct i2c_client *client = v4l2_get_subdevdata(sd); 329 struct i2c_client *client = v4l2_get_subdevdata(sd);
330 struct ov9640_priv *priv = container_of(i2c_get_clientdata(client), 330 struct ov9640_priv *priv = to_ov9640_sensor(sd);
331 struct ov9640_priv, subdev);
332 331
333 int ret = 0; 332 int ret = 0;
334 333
@@ -360,9 +359,7 @@ static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
360static int ov9640_g_chip_ident(struct v4l2_subdev *sd, 359static int ov9640_g_chip_ident(struct v4l2_subdev *sd,
361 struct v4l2_dbg_chip_ident *id) 360 struct v4l2_dbg_chip_ident *id)
362{ 361{
363 struct i2c_client *client = v4l2_get_subdevdata(sd); 362 struct ov9640_priv *priv = to_ov9640_sensor(sd);
364 struct ov9640_priv *priv = container_of(i2c_get_clientdata(client),
365 struct ov9640_priv, subdev);
366 363
367 id->ident = priv->model; 364 id->ident = priv->model;
368 id->revision = priv->revision; 365 id->revision = priv->revision;