diff options
Diffstat (limited to 'drivers/media/video/ov9640.c')
-rw-r--r-- | drivers/media/video/ov9640.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c index 99e9e1d3c83b..53d88a2ab920 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 */ |
35 | static const struct ov9640_reg ov9640_regs_dflt[] = { | 37 | static 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 */ |
309 | static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | 311 | static 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) | |||
327 | static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | 327 | static 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) | |||
360 | static int ov9640_g_chip_ident(struct v4l2_subdev *sd, | 359 | static 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; |
@@ -654,7 +651,8 @@ static int ov9640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) | |||
654 | static int ov9640_video_probe(struct soc_camera_device *icd, | 651 | static int ov9640_video_probe(struct soc_camera_device *icd, |
655 | struct i2c_client *client) | 652 | struct i2c_client *client) |
656 | { | 653 | { |
657 | struct ov9640_priv *priv = i2c_get_clientdata(client); | 654 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
655 | struct ov9640_priv *priv = to_ov9640_sensor(sd); | ||
658 | u8 pid, ver, midh, midl; | 656 | u8 pid, ver, midh, midl; |
659 | const char *devname; | 657 | const char *devname; |
660 | int ret = 0; | 658 | int ret = 0; |
@@ -791,7 +789,8 @@ static int ov9640_probe(struct i2c_client *client, | |||
791 | 789 | ||
792 | static int ov9640_remove(struct i2c_client *client) | 790 | static int ov9640_remove(struct i2c_client *client) |
793 | { | 791 | { |
794 | struct ov9640_priv *priv = i2c_get_clientdata(client); | 792 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
793 | struct ov9640_priv *priv = to_ov9640_sensor(sd); | ||
795 | 794 | ||
796 | kfree(priv); | 795 | kfree(priv); |
797 | return 0; | 796 | return 0; |