aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-07-30 16:24:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-20 23:04:51 -0400
commitc4ce6d14b92aa1772c9d84d068d1b45114fe73cc (patch)
treeb2c492597824d43fad603cc686c3d16b3f766b0c
parent401ad27867781c327855025d4becd5bc30fe7e42 (diff)
V4L/DVB: v4l: Use v4l2_get_subdevdata instead of accessing v4l2_subdev::priv
Replace direct access to the v4l2_subdev priv field with the inline v4l2_get_subdevdata method. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/mt9m001.c26
-rw-r--r--drivers/media/video/mt9m111.c20
-rw-r--r--drivers/media/video/mt9t031.c24
-rw-r--r--drivers/media/video/mt9t112.c14
-rw-r--r--drivers/media/video/mt9v022.c26
-rw-r--r--drivers/media/video/ov772x.c18
-rw-r--r--drivers/media/video/ov9640.c12
-rw-r--r--drivers/media/video/rj54n1cb0c.c26
-rw-r--r--drivers/media/video/soc_camera.c2
-rw-r--r--drivers/media/video/tw9910.c20
10 files changed, 94 insertions, 94 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index 79f096ddcf5d..fcb4cd941853 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -157,7 +157,7 @@ static int mt9m001_init(struct i2c_client *client)
157 157
158static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) 158static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable)
159{ 159{
160 struct i2c_client *client = sd->priv; 160 struct i2c_client *client = v4l2_get_subdevdata(sd);
161 161
162 /* Switch to master "normal" mode or stop sensor readout */ 162 /* Switch to master "normal" mode or stop sensor readout */
163 if (reg_write(client, MT9M001_OUTPUT_CONTROL, enable ? 2 : 0) < 0) 163 if (reg_write(client, MT9M001_OUTPUT_CONTROL, enable ? 2 : 0) < 0)
@@ -206,7 +206,7 @@ static unsigned long mt9m001_query_bus_param(struct soc_camera_device *icd)
206 206
207static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 207static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
208{ 208{
209 struct i2c_client *client = sd->priv; 209 struct i2c_client *client = v4l2_get_subdevdata(sd);
210 struct mt9m001 *mt9m001 = to_mt9m001(client); 210 struct mt9m001 *mt9m001 = to_mt9m001(client);
211 struct v4l2_rect rect = a->c; 211 struct v4l2_rect rect = a->c;
212 struct soc_camera_device *icd = client->dev.platform_data; 212 struct soc_camera_device *icd = client->dev.platform_data;
@@ -271,7 +271,7 @@ static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
271 271
272static int mt9m001_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 272static int mt9m001_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
273{ 273{
274 struct i2c_client *client = sd->priv; 274 struct i2c_client *client = v4l2_get_subdevdata(sd);
275 struct mt9m001 *mt9m001 = to_mt9m001(client); 275 struct mt9m001 *mt9m001 = to_mt9m001(client);
276 276
277 a->c = mt9m001->rect; 277 a->c = mt9m001->rect;
@@ -297,7 +297,7 @@ static int mt9m001_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
297static int mt9m001_g_fmt(struct v4l2_subdev *sd, 297static int mt9m001_g_fmt(struct v4l2_subdev *sd,
298 struct v4l2_mbus_framefmt *mf) 298 struct v4l2_mbus_framefmt *mf)
299{ 299{
300 struct i2c_client *client = sd->priv; 300 struct i2c_client *client = v4l2_get_subdevdata(sd);
301 struct mt9m001 *mt9m001 = to_mt9m001(client); 301 struct mt9m001 *mt9m001 = to_mt9m001(client);
302 302
303 mf->width = mt9m001->rect.width; 303 mf->width = mt9m001->rect.width;
@@ -312,7 +312,7 @@ static int mt9m001_g_fmt(struct v4l2_subdev *sd,
312static int mt9m001_s_fmt(struct v4l2_subdev *sd, 312static int mt9m001_s_fmt(struct v4l2_subdev *sd,
313 struct v4l2_mbus_framefmt *mf) 313 struct v4l2_mbus_framefmt *mf)
314{ 314{
315 struct i2c_client *client = sd->priv; 315 struct i2c_client *client = v4l2_get_subdevdata(sd);
316 struct mt9m001 *mt9m001 = to_mt9m001(client); 316 struct mt9m001 *mt9m001 = to_mt9m001(client);
317 struct v4l2_crop a = { 317 struct v4l2_crop a = {
318 .c = { 318 .c = {
@@ -340,7 +340,7 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd,
340static int mt9m001_try_fmt(struct v4l2_subdev *sd, 340static int mt9m001_try_fmt(struct v4l2_subdev *sd,
341 struct v4l2_mbus_framefmt *mf) 341 struct v4l2_mbus_framefmt *mf)
342{ 342{
343 struct i2c_client *client = sd->priv; 343 struct i2c_client *client = v4l2_get_subdevdata(sd);
344 struct mt9m001 *mt9m001 = to_mt9m001(client); 344 struct mt9m001 *mt9m001 = to_mt9m001(client);
345 const struct mt9m001_datafmt *fmt; 345 const struct mt9m001_datafmt *fmt;
346 346
@@ -367,7 +367,7 @@ static int mt9m001_try_fmt(struct v4l2_subdev *sd,
367static int mt9m001_g_chip_ident(struct v4l2_subdev *sd, 367static int mt9m001_g_chip_ident(struct v4l2_subdev *sd,
368 struct v4l2_dbg_chip_ident *id) 368 struct v4l2_dbg_chip_ident *id)
369{ 369{
370 struct i2c_client *client = sd->priv; 370 struct i2c_client *client = v4l2_get_subdevdata(sd);
371 struct mt9m001 *mt9m001 = to_mt9m001(client); 371 struct mt9m001 *mt9m001 = to_mt9m001(client);
372 372
373 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 373 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
@@ -386,7 +386,7 @@ static int mt9m001_g_chip_ident(struct v4l2_subdev *sd,
386static int mt9m001_g_register(struct v4l2_subdev *sd, 386static int mt9m001_g_register(struct v4l2_subdev *sd,
387 struct v4l2_dbg_register *reg) 387 struct v4l2_dbg_register *reg)
388{ 388{
389 struct i2c_client *client = sd->priv; 389 struct i2c_client *client = v4l2_get_subdevdata(sd);
390 390
391 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 391 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
392 return -EINVAL; 392 return -EINVAL;
@@ -406,7 +406,7 @@ static int mt9m001_g_register(struct v4l2_subdev *sd,
406static int mt9m001_s_register(struct v4l2_subdev *sd, 406static int mt9m001_s_register(struct v4l2_subdev *sd,
407 struct v4l2_dbg_register *reg) 407 struct v4l2_dbg_register *reg)
408{ 408{
409 struct i2c_client *client = sd->priv; 409 struct i2c_client *client = v4l2_get_subdevdata(sd);
410 410
411 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 411 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
412 return -EINVAL; 412 return -EINVAL;
@@ -468,7 +468,7 @@ static struct soc_camera_ops mt9m001_ops = {
468 468
469static int mt9m001_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 469static int mt9m001_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
470{ 470{
471 struct i2c_client *client = sd->priv; 471 struct i2c_client *client = v4l2_get_subdevdata(sd);
472 struct mt9m001 *mt9m001 = to_mt9m001(client); 472 struct mt9m001 *mt9m001 = to_mt9m001(client);
473 int data; 473 int data;
474 474
@@ -494,7 +494,7 @@ static int mt9m001_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
494 494
495static int mt9m001_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 495static int mt9m001_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
496{ 496{
497 struct i2c_client *client = sd->priv; 497 struct i2c_client *client = v4l2_get_subdevdata(sd);
498 struct mt9m001 *mt9m001 = to_mt9m001(client); 498 struct mt9m001 *mt9m001 = to_mt9m001(client);
499 struct soc_camera_device *icd = client->dev.platform_data; 499 struct soc_camera_device *icd = client->dev.platform_data;
500 const struct v4l2_queryctrl *qctrl; 500 const struct v4l2_queryctrl *qctrl;
@@ -683,7 +683,7 @@ static void mt9m001_video_remove(struct soc_camera_device *icd)
683 683
684static int mt9m001_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) 684static int mt9m001_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines)
685{ 685{
686 struct i2c_client *client = sd->priv; 686 struct i2c_client *client = v4l2_get_subdevdata(sd);
687 struct mt9m001 *mt9m001 = to_mt9m001(client); 687 struct mt9m001 *mt9m001 = to_mt9m001(client);
688 688
689 *lines = mt9m001->y_skip_top; 689 *lines = mt9m001->y_skip_top;
@@ -704,7 +704,7 @@ static struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = {
704static int mt9m001_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 704static int mt9m001_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
705 enum v4l2_mbus_pixelcode *code) 705 enum v4l2_mbus_pixelcode *code)
706{ 706{
707 struct i2c_client *client = sd->priv; 707 struct i2c_client *client = v4l2_get_subdevdata(sd);
708 struct mt9m001 *mt9m001 = to_mt9m001(client); 708 struct mt9m001 *mt9m001 = to_mt9m001(client);
709 709
710 if (index >= mt9m001->num_fmts) 710 if (index >= mt9m001->num_fmts)
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index c71af4e0e517..2ca461a072af 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -440,7 +440,7 @@ static int mt9m111_make_rect(struct i2c_client *client,
440static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 440static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
441{ 441{
442 struct v4l2_rect rect = a->c; 442 struct v4l2_rect rect = a->c;
443 struct i2c_client *client = sd->priv; 443 struct i2c_client *client = v4l2_get_subdevdata(sd);
444 struct mt9m111 *mt9m111 = to_mt9m111(client); 444 struct mt9m111 *mt9m111 = to_mt9m111(client);
445 int ret; 445 int ret;
446 446
@@ -458,7 +458,7 @@ static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
458 458
459static int mt9m111_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 459static int mt9m111_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
460{ 460{
461 struct i2c_client *client = sd->priv; 461 struct i2c_client *client = v4l2_get_subdevdata(sd);
462 struct mt9m111 *mt9m111 = to_mt9m111(client); 462 struct mt9m111 *mt9m111 = to_mt9m111(client);
463 463
464 a->c = mt9m111->rect; 464 a->c = mt9m111->rect;
@@ -486,7 +486,7 @@ static int mt9m111_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
486static int mt9m111_g_fmt(struct v4l2_subdev *sd, 486static int mt9m111_g_fmt(struct v4l2_subdev *sd,
487 struct v4l2_mbus_framefmt *mf) 487 struct v4l2_mbus_framefmt *mf)
488{ 488{
489 struct i2c_client *client = sd->priv; 489 struct i2c_client *client = v4l2_get_subdevdata(sd);
490 struct mt9m111 *mt9m111 = to_mt9m111(client); 490 struct mt9m111 *mt9m111 = to_mt9m111(client);
491 491
492 mf->width = mt9m111->rect.width; 492 mf->width = mt9m111->rect.width;
@@ -549,7 +549,7 @@ static int mt9m111_set_pixfmt(struct i2c_client *client,
549static int mt9m111_s_fmt(struct v4l2_subdev *sd, 549static int mt9m111_s_fmt(struct v4l2_subdev *sd,
550 struct v4l2_mbus_framefmt *mf) 550 struct v4l2_mbus_framefmt *mf)
551{ 551{
552 struct i2c_client *client = sd->priv; 552 struct i2c_client *client = v4l2_get_subdevdata(sd);
553 const struct mt9m111_datafmt *fmt; 553 const struct mt9m111_datafmt *fmt;
554 struct mt9m111 *mt9m111 = to_mt9m111(client); 554 struct mt9m111 *mt9m111 = to_mt9m111(client);
555 struct v4l2_rect rect = { 555 struct v4l2_rect rect = {
@@ -584,7 +584,7 @@ static int mt9m111_s_fmt(struct v4l2_subdev *sd,
584static int mt9m111_try_fmt(struct v4l2_subdev *sd, 584static int mt9m111_try_fmt(struct v4l2_subdev *sd,
585 struct v4l2_mbus_framefmt *mf) 585 struct v4l2_mbus_framefmt *mf)
586{ 586{
587 struct i2c_client *client = sd->priv; 587 struct i2c_client *client = v4l2_get_subdevdata(sd);
588 struct mt9m111 *mt9m111 = to_mt9m111(client); 588 struct mt9m111 *mt9m111 = to_mt9m111(client);
589 const struct mt9m111_datafmt *fmt; 589 const struct mt9m111_datafmt *fmt;
590 bool bayer = mf->code == V4L2_MBUS_FMT_SBGGR8_1X8 || 590 bool bayer = mf->code == V4L2_MBUS_FMT_SBGGR8_1X8 ||
@@ -624,7 +624,7 @@ static int mt9m111_try_fmt(struct v4l2_subdev *sd,
624static int mt9m111_g_chip_ident(struct v4l2_subdev *sd, 624static int mt9m111_g_chip_ident(struct v4l2_subdev *sd,
625 struct v4l2_dbg_chip_ident *id) 625 struct v4l2_dbg_chip_ident *id)
626{ 626{
627 struct i2c_client *client = sd->priv; 627 struct i2c_client *client = v4l2_get_subdevdata(sd);
628 struct mt9m111 *mt9m111 = to_mt9m111(client); 628 struct mt9m111 *mt9m111 = to_mt9m111(client);
629 629
630 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 630 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
@@ -643,7 +643,7 @@ static int mt9m111_g_chip_ident(struct v4l2_subdev *sd,
643static int mt9m111_g_register(struct v4l2_subdev *sd, 643static int mt9m111_g_register(struct v4l2_subdev *sd,
644 struct v4l2_dbg_register *reg) 644 struct v4l2_dbg_register *reg)
645{ 645{
646 struct i2c_client *client = sd->priv; 646 struct i2c_client *client = v4l2_get_subdevdata(sd);
647 int val; 647 int val;
648 648
649 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 649 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
@@ -664,7 +664,7 @@ static int mt9m111_g_register(struct v4l2_subdev *sd,
664static int mt9m111_s_register(struct v4l2_subdev *sd, 664static int mt9m111_s_register(struct v4l2_subdev *sd,
665 struct v4l2_dbg_register *reg) 665 struct v4l2_dbg_register *reg)
666{ 666{
667 struct i2c_client *client = sd->priv; 667 struct i2c_client *client = v4l2_get_subdevdata(sd);
668 668
669 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 669 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
670 return -EINVAL; 670 return -EINVAL;
@@ -812,7 +812,7 @@ static int mt9m111_set_autowhitebalance(struct i2c_client *client, int on)
812 812
813static int mt9m111_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 813static int mt9m111_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
814{ 814{
815 struct i2c_client *client = sd->priv; 815 struct i2c_client *client = v4l2_get_subdevdata(sd);
816 struct mt9m111 *mt9m111 = to_mt9m111(client); 816 struct mt9m111 *mt9m111 = to_mt9m111(client);
817 int data; 817 int data;
818 818
@@ -855,7 +855,7 @@ static int mt9m111_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
855 855
856static int mt9m111_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 856static int mt9m111_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
857{ 857{
858 struct i2c_client *client = sd->priv; 858 struct i2c_client *client = v4l2_get_subdevdata(sd);
859 struct mt9m111 *mt9m111 = to_mt9m111(client); 859 struct mt9m111 *mt9m111 = to_mt9m111(client);
860 const struct v4l2_queryctrl *qctrl; 860 const struct v4l2_queryctrl *qctrl;
861 int ret; 861 int ret;
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
index a9a28b214235..9bd44a816ea1 100644
--- a/drivers/media/video/mt9t031.c
+++ b/drivers/media/video/mt9t031.c
@@ -163,7 +163,7 @@ static int mt9t031_disable(struct i2c_client *client)
163 163
164static int mt9t031_s_stream(struct v4l2_subdev *sd, int enable) 164static int mt9t031_s_stream(struct v4l2_subdev *sd, int enable)
165{ 165{
166 struct i2c_client *client = sd->priv; 166 struct i2c_client *client = v4l2_get_subdevdata(sd);
167 int ret; 167 int ret;
168 168
169 if (enable) 169 if (enable)
@@ -393,7 +393,7 @@ static int mt9t031_set_params(struct i2c_client *client,
393static int mt9t031_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 393static int mt9t031_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
394{ 394{
395 struct v4l2_rect rect = a->c; 395 struct v4l2_rect rect = a->c;
396 struct i2c_client *client = sd->priv; 396 struct i2c_client *client = v4l2_get_subdevdata(sd);
397 struct mt9t031 *mt9t031 = to_mt9t031(client); 397 struct mt9t031 *mt9t031 = to_mt9t031(client);
398 398
399 rect.width = ALIGN(rect.width, 2); 399 rect.width = ALIGN(rect.width, 2);
@@ -410,7 +410,7 @@ static int mt9t031_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
410 410
411static int mt9t031_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 411static int mt9t031_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
412{ 412{
413 struct i2c_client *client = sd->priv; 413 struct i2c_client *client = v4l2_get_subdevdata(sd);
414 struct mt9t031 *mt9t031 = to_mt9t031(client); 414 struct mt9t031 *mt9t031 = to_mt9t031(client);
415 415
416 a->c = mt9t031->rect; 416 a->c = mt9t031->rect;
@@ -436,7 +436,7 @@ static int mt9t031_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
436static int mt9t031_g_fmt(struct v4l2_subdev *sd, 436static int mt9t031_g_fmt(struct v4l2_subdev *sd,
437 struct v4l2_mbus_framefmt *mf) 437 struct v4l2_mbus_framefmt *mf)
438{ 438{
439 struct i2c_client *client = sd->priv; 439 struct i2c_client *client = v4l2_get_subdevdata(sd);
440 struct mt9t031 *mt9t031 = to_mt9t031(client); 440 struct mt9t031 *mt9t031 = to_mt9t031(client);
441 441
442 mf->width = mt9t031->rect.width / mt9t031->xskip; 442 mf->width = mt9t031->rect.width / mt9t031->xskip;
@@ -451,7 +451,7 @@ static int mt9t031_g_fmt(struct v4l2_subdev *sd,
451static int mt9t031_s_fmt(struct v4l2_subdev *sd, 451static int mt9t031_s_fmt(struct v4l2_subdev *sd,
452 struct v4l2_mbus_framefmt *mf) 452 struct v4l2_mbus_framefmt *mf)
453{ 453{
454 struct i2c_client *client = sd->priv; 454 struct i2c_client *client = v4l2_get_subdevdata(sd);
455 struct mt9t031 *mt9t031 = to_mt9t031(client); 455 struct mt9t031 *mt9t031 = to_mt9t031(client);
456 u16 xskip, yskip; 456 u16 xskip, yskip;
457 struct v4l2_rect rect = mt9t031->rect; 457 struct v4l2_rect rect = mt9t031->rect;
@@ -490,7 +490,7 @@ static int mt9t031_try_fmt(struct v4l2_subdev *sd,
490static int mt9t031_g_chip_ident(struct v4l2_subdev *sd, 490static int mt9t031_g_chip_ident(struct v4l2_subdev *sd,
491 struct v4l2_dbg_chip_ident *id) 491 struct v4l2_dbg_chip_ident *id)
492{ 492{
493 struct i2c_client *client = sd->priv; 493 struct i2c_client *client = v4l2_get_subdevdata(sd);
494 struct mt9t031 *mt9t031 = to_mt9t031(client); 494 struct mt9t031 *mt9t031 = to_mt9t031(client);
495 495
496 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 496 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
@@ -509,7 +509,7 @@ static int mt9t031_g_chip_ident(struct v4l2_subdev *sd,
509static int mt9t031_g_register(struct v4l2_subdev *sd, 509static int mt9t031_g_register(struct v4l2_subdev *sd,
510 struct v4l2_dbg_register *reg) 510 struct v4l2_dbg_register *reg)
511{ 511{
512 struct i2c_client *client = sd->priv; 512 struct i2c_client *client = v4l2_get_subdevdata(sd);
513 513
514 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 514 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
515 return -EINVAL; 515 return -EINVAL;
@@ -528,7 +528,7 @@ static int mt9t031_g_register(struct v4l2_subdev *sd,
528static int mt9t031_s_register(struct v4l2_subdev *sd, 528static int mt9t031_s_register(struct v4l2_subdev *sd,
529 struct v4l2_dbg_register *reg) 529 struct v4l2_dbg_register *reg)
530{ 530{
531 struct i2c_client *client = sd->priv; 531 struct i2c_client *client = v4l2_get_subdevdata(sd);
532 532
533 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 533 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
534 return -EINVAL; 534 return -EINVAL;
@@ -545,7 +545,7 @@ static int mt9t031_s_register(struct v4l2_subdev *sd,
545 545
546static int mt9t031_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 546static int mt9t031_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
547{ 547{
548 struct i2c_client *client = sd->priv; 548 struct i2c_client *client = v4l2_get_subdevdata(sd);
549 struct mt9t031 *mt9t031 = to_mt9t031(client); 549 struct mt9t031 *mt9t031 = to_mt9t031(client);
550 int data; 550 int data;
551 551
@@ -577,7 +577,7 @@ static int mt9t031_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
577 577
578static int mt9t031_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 578static int mt9t031_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
579{ 579{
580 struct i2c_client *client = sd->priv; 580 struct i2c_client *client = v4l2_get_subdevdata(sd);
581 struct mt9t031 *mt9t031 = to_mt9t031(client); 581 struct mt9t031 *mt9t031 = to_mt9t031(client);
582 const struct v4l2_queryctrl *qctrl; 582 const struct v4l2_queryctrl *qctrl;
583 int data; 583 int data;
@@ -703,7 +703,7 @@ static int mt9t031_runtime_resume(struct device *dev)
703 struct soc_camera_device *icd = container_of(vdev->parent, 703 struct soc_camera_device *icd = container_of(vdev->parent,
704 struct soc_camera_device, dev); 704 struct soc_camera_device, dev);
705 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 705 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
706 struct i2c_client *client = sd->priv; 706 struct i2c_client *client = v4l2_get_subdevdata(sd);
707 struct mt9t031 *mt9t031 = to_mt9t031(client); 707 struct mt9t031 *mt9t031 = to_mt9t031(client);
708 708
709 int ret; 709 int ret;
@@ -780,7 +780,7 @@ static int mt9t031_video_probe(struct i2c_client *client)
780 780
781static int mt9t031_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) 781static int mt9t031_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines)
782{ 782{
783 struct i2c_client *client = sd->priv; 783 struct i2c_client *client = v4l2_get_subdevdata(sd);
784 struct mt9t031 *mt9t031 = to_mt9t031(client); 784 struct mt9t031 *mt9t031 = to_mt9t031(client);
785 785
786 *lines = mt9t031->y_skip_top; 786 *lines = mt9t031->y_skip_top;
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
index 8ec47e42d4d0..bffa9ee10968 100644
--- a/drivers/media/video/mt9t112.c
+++ b/drivers/media/video/mt9t112.c
@@ -804,7 +804,7 @@ static struct soc_camera_ops mt9t112_ops = {
804static int mt9t112_g_chip_ident(struct v4l2_subdev *sd, 804static int mt9t112_g_chip_ident(struct v4l2_subdev *sd,
805 struct v4l2_dbg_chip_ident *id) 805 struct v4l2_dbg_chip_ident *id)
806{ 806{
807 struct i2c_client *client = sd->priv; 807 struct i2c_client *client = v4l2_get_subdevdata(sd);
808 struct mt9t112_priv *priv = to_mt9t112(client); 808 struct mt9t112_priv *priv = to_mt9t112(client);
809 809
810 id->ident = priv->model; 810 id->ident = priv->model;
@@ -817,7 +817,7 @@ static int mt9t112_g_chip_ident(struct v4l2_subdev *sd,
817static int mt9t112_g_register(struct v4l2_subdev *sd, 817static int mt9t112_g_register(struct v4l2_subdev *sd,
818 struct v4l2_dbg_register *reg) 818 struct v4l2_dbg_register *reg)
819{ 819{
820 struct i2c_client *client = sd->priv; 820 struct i2c_client *client = v4l2_get_subdevdata(sd);
821 int ret; 821 int ret;
822 822
823 reg->size = 2; 823 reg->size = 2;
@@ -831,7 +831,7 @@ static int mt9t112_g_register(struct v4l2_subdev *sd,
831static int mt9t112_s_register(struct v4l2_subdev *sd, 831static int mt9t112_s_register(struct v4l2_subdev *sd,
832 struct v4l2_dbg_register *reg) 832 struct v4l2_dbg_register *reg)
833{ 833{
834 struct i2c_client *client = sd->priv; 834 struct i2c_client *client = v4l2_get_subdevdata(sd);
835 int ret; 835 int ret;
836 836
837 mt9t112_reg_write(ret, client, reg->reg, reg->val); 837 mt9t112_reg_write(ret, client, reg->reg, reg->val);
@@ -858,7 +858,7 @@ static struct v4l2_subdev_core_ops mt9t112_subdev_core_ops = {
858************************************************************************/ 858************************************************************************/
859static int mt9t112_s_stream(struct v4l2_subdev *sd, int enable) 859static int mt9t112_s_stream(struct v4l2_subdev *sd, int enable)
860{ 860{
861 struct i2c_client *client = sd->priv; 861 struct i2c_client *client = v4l2_get_subdevdata(sd);
862 struct mt9t112_priv *priv = to_mt9t112(client); 862 struct mt9t112_priv *priv = to_mt9t112(client);
863 int ret = 0; 863 int ret = 0;
864 864
@@ -968,7 +968,7 @@ static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
968 968
969static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 969static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
970{ 970{
971 struct i2c_client *client = sd->priv; 971 struct i2c_client *client = v4l2_get_subdevdata(sd);
972 struct v4l2_rect *rect = &a->c; 972 struct v4l2_rect *rect = &a->c;
973 973
974 return mt9t112_set_params(client, rect->width, rect->height, 974 return mt9t112_set_params(client, rect->width, rect->height,
@@ -978,7 +978,7 @@ static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
978static int mt9t112_g_fmt(struct v4l2_subdev *sd, 978static int mt9t112_g_fmt(struct v4l2_subdev *sd,
979 struct v4l2_mbus_framefmt *mf) 979 struct v4l2_mbus_framefmt *mf)
980{ 980{
981 struct i2c_client *client = sd->priv; 981 struct i2c_client *client = v4l2_get_subdevdata(sd);
982 struct mt9t112_priv *priv = to_mt9t112(client); 982 struct mt9t112_priv *priv = to_mt9t112(client);
983 983
984 if (!priv->format) { 984 if (!priv->format) {
@@ -1000,7 +1000,7 @@ static int mt9t112_g_fmt(struct v4l2_subdev *sd,
1000static int mt9t112_s_fmt(struct v4l2_subdev *sd, 1000static int mt9t112_s_fmt(struct v4l2_subdev *sd,
1001 struct v4l2_mbus_framefmt *mf) 1001 struct v4l2_mbus_framefmt *mf)
1002{ 1002{
1003 struct i2c_client *client = sd->priv; 1003 struct i2c_client *client = v4l2_get_subdevdata(sd);
1004 1004
1005 /* TODO: set colorspace */ 1005 /* TODO: set colorspace */
1006 return mt9t112_set_params(client, mf->width, mf->height, mf->code); 1006 return mt9t112_set_params(client, mf->width, mf->height, mf->code);
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index b48473c7896b..b96171cc79f9 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -184,7 +184,7 @@ static int mt9v022_init(struct i2c_client *client)
184 184
185static int mt9v022_s_stream(struct v4l2_subdev *sd, int enable) 185static int mt9v022_s_stream(struct v4l2_subdev *sd, int enable)
186{ 186{
187 struct i2c_client *client = sd->priv; 187 struct i2c_client *client = v4l2_get_subdevdata(sd);
188 struct mt9v022 *mt9v022 = to_mt9v022(client); 188 struct mt9v022 *mt9v022 = to_mt9v022(client);
189 189
190 if (enable) 190 if (enable)
@@ -273,7 +273,7 @@ static unsigned long mt9v022_query_bus_param(struct soc_camera_device *icd)
273 273
274static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 274static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
275{ 275{
276 struct i2c_client *client = sd->priv; 276 struct i2c_client *client = v4l2_get_subdevdata(sd);
277 struct mt9v022 *mt9v022 = to_mt9v022(client); 277 struct mt9v022 *mt9v022 = to_mt9v022(client);
278 struct v4l2_rect rect = a->c; 278 struct v4l2_rect rect = a->c;
279 int ret; 279 int ret;
@@ -334,7 +334,7 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
334 334
335static int mt9v022_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 335static int mt9v022_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
336{ 336{
337 struct i2c_client *client = sd->priv; 337 struct i2c_client *client = v4l2_get_subdevdata(sd);
338 struct mt9v022 *mt9v022 = to_mt9v022(client); 338 struct mt9v022 *mt9v022 = to_mt9v022(client);
339 339
340 a->c = mt9v022->rect; 340 a->c = mt9v022->rect;
@@ -360,7 +360,7 @@ static int mt9v022_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
360static int mt9v022_g_fmt(struct v4l2_subdev *sd, 360static int mt9v022_g_fmt(struct v4l2_subdev *sd,
361 struct v4l2_mbus_framefmt *mf) 361 struct v4l2_mbus_framefmt *mf)
362{ 362{
363 struct i2c_client *client = sd->priv; 363 struct i2c_client *client = v4l2_get_subdevdata(sd);
364 struct mt9v022 *mt9v022 = to_mt9v022(client); 364 struct mt9v022 *mt9v022 = to_mt9v022(client);
365 365
366 mf->width = mt9v022->rect.width; 366 mf->width = mt9v022->rect.width;
@@ -375,7 +375,7 @@ static int mt9v022_g_fmt(struct v4l2_subdev *sd,
375static int mt9v022_s_fmt(struct v4l2_subdev *sd, 375static int mt9v022_s_fmt(struct v4l2_subdev *sd,
376 struct v4l2_mbus_framefmt *mf) 376 struct v4l2_mbus_framefmt *mf)
377{ 377{
378 struct i2c_client *client = sd->priv; 378 struct i2c_client *client = v4l2_get_subdevdata(sd);
379 struct mt9v022 *mt9v022 = to_mt9v022(client); 379 struct mt9v022 *mt9v022 = to_mt9v022(client);
380 struct v4l2_crop a = { 380 struct v4l2_crop a = {
381 .c = { 381 .c = {
@@ -422,7 +422,7 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd,
422static int mt9v022_try_fmt(struct v4l2_subdev *sd, 422static int mt9v022_try_fmt(struct v4l2_subdev *sd,
423 struct v4l2_mbus_framefmt *mf) 423 struct v4l2_mbus_framefmt *mf)
424{ 424{
425 struct i2c_client *client = sd->priv; 425 struct i2c_client *client = v4l2_get_subdevdata(sd);
426 struct mt9v022 *mt9v022 = to_mt9v022(client); 426 struct mt9v022 *mt9v022 = to_mt9v022(client);
427 const struct mt9v022_datafmt *fmt; 427 const struct mt9v022_datafmt *fmt;
428 int align = mf->code == V4L2_MBUS_FMT_SBGGR8_1X8 || 428 int align = mf->code == V4L2_MBUS_FMT_SBGGR8_1X8 ||
@@ -448,7 +448,7 @@ static int mt9v022_try_fmt(struct v4l2_subdev *sd,
448static int mt9v022_g_chip_ident(struct v4l2_subdev *sd, 448static int mt9v022_g_chip_ident(struct v4l2_subdev *sd,
449 struct v4l2_dbg_chip_ident *id) 449 struct v4l2_dbg_chip_ident *id)
450{ 450{
451 struct i2c_client *client = sd->priv; 451 struct i2c_client *client = v4l2_get_subdevdata(sd);
452 struct mt9v022 *mt9v022 = to_mt9v022(client); 452 struct mt9v022 *mt9v022 = to_mt9v022(client);
453 453
454 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 454 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
@@ -467,7 +467,7 @@ static int mt9v022_g_chip_ident(struct v4l2_subdev *sd,
467static int mt9v022_g_register(struct v4l2_subdev *sd, 467static int mt9v022_g_register(struct v4l2_subdev *sd,
468 struct v4l2_dbg_register *reg) 468 struct v4l2_dbg_register *reg)
469{ 469{
470 struct i2c_client *client = sd->priv; 470 struct i2c_client *client = v4l2_get_subdevdata(sd);
471 471
472 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 472 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
473 return -EINVAL; 473 return -EINVAL;
@@ -487,7 +487,7 @@ static int mt9v022_g_register(struct v4l2_subdev *sd,
487static int mt9v022_s_register(struct v4l2_subdev *sd, 487static int mt9v022_s_register(struct v4l2_subdev *sd,
488 struct v4l2_dbg_register *reg) 488 struct v4l2_dbg_register *reg)
489{ 489{
490 struct i2c_client *client = sd->priv; 490 struct i2c_client *client = v4l2_get_subdevdata(sd);
491 491
492 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 492 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff)
493 return -EINVAL; 493 return -EINVAL;
@@ -565,7 +565,7 @@ static struct soc_camera_ops mt9v022_ops = {
565 565
566static int mt9v022_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 566static int mt9v022_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
567{ 567{
568 struct i2c_client *client = sd->priv; 568 struct i2c_client *client = v4l2_get_subdevdata(sd);
569 const struct v4l2_queryctrl *qctrl; 569 const struct v4l2_queryctrl *qctrl;
570 unsigned long range; 570 unsigned long range;
571 int data; 571 int data;
@@ -622,7 +622,7 @@ static int mt9v022_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
622static int mt9v022_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 622static int mt9v022_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
623{ 623{
624 int data; 624 int data;
625 struct i2c_client *client = sd->priv; 625 struct i2c_client *client = v4l2_get_subdevdata(sd);
626 const struct v4l2_queryctrl *qctrl; 626 const struct v4l2_queryctrl *qctrl;
627 627
628 qctrl = soc_camera_find_qctrl(&mt9v022_ops, ctrl->id); 628 qctrl = soc_camera_find_qctrl(&mt9v022_ops, ctrl->id);
@@ -817,7 +817,7 @@ static void mt9v022_video_remove(struct soc_camera_device *icd)
817 817
818static int mt9v022_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) 818static int mt9v022_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines)
819{ 819{
820 struct i2c_client *client = sd->priv; 820 struct i2c_client *client = v4l2_get_subdevdata(sd);
821 struct mt9v022 *mt9v022 = to_mt9v022(client); 821 struct mt9v022 *mt9v022 = to_mt9v022(client);
822 822
823 *lines = mt9v022->y_skip_top; 823 *lines = mt9v022->y_skip_top;
@@ -838,7 +838,7 @@ static struct v4l2_subdev_core_ops mt9v022_subdev_core_ops = {
838static int mt9v022_enum_fmt(struct v4l2_subdev *sd, unsigned int index, 838static int mt9v022_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
839 enum v4l2_mbus_pixelcode *code) 839 enum v4l2_mbus_pixelcode *code)
840{ 840{
841 struct i2c_client *client = sd->priv; 841 struct i2c_client *client = v4l2_get_subdevdata(sd);
842 struct mt9v022 *mt9v022 = to_mt9v022(client); 842 struct mt9v022 *mt9v022 = to_mt9v022(client);
843 843
844 if (index >= mt9v022->num_fmts) 844 if (index >= mt9v022->num_fmts)
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index 25eb5d637eea..a84b770352f9 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -599,7 +599,7 @@ static int ov772x_reset(struct i2c_client *client)
599 599
600static int ov772x_s_stream(struct v4l2_subdev *sd, int enable) 600static int ov772x_s_stream(struct v4l2_subdev *sd, int enable)
601{ 601{
602 struct i2c_client *client = sd->priv; 602 struct i2c_client *client = v4l2_get_subdevdata(sd);
603 struct ov772x_priv *priv = to_ov772x(client); 603 struct ov772x_priv *priv = to_ov772x(client);
604 604
605 if (!enable) { 605 if (!enable) {
@@ -645,7 +645,7 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
645 645
646static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 646static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
647{ 647{
648 struct i2c_client *client = sd->priv; 648 struct i2c_client *client = v4l2_get_subdevdata(sd);
649 struct ov772x_priv *priv = to_ov772x(client); 649 struct ov772x_priv *priv = to_ov772x(client);
650 650
651 switch (ctrl->id) { 651 switch (ctrl->id) {
@@ -664,7 +664,7 @@ static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
664 664
665static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 665static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
666{ 666{
667 struct i2c_client *client = sd->priv; 667 struct i2c_client *client = v4l2_get_subdevdata(sd);
668 struct ov772x_priv *priv = to_ov772x(client); 668 struct ov772x_priv *priv = to_ov772x(client);
669 int ret = 0; 669 int ret = 0;
670 u8 val; 670 u8 val;
@@ -715,7 +715,7 @@ static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
715static int ov772x_g_chip_ident(struct v4l2_subdev *sd, 715static int ov772x_g_chip_ident(struct v4l2_subdev *sd,
716 struct v4l2_dbg_chip_ident *id) 716 struct v4l2_dbg_chip_ident *id)
717{ 717{
718 struct i2c_client *client = sd->priv; 718 struct i2c_client *client = v4l2_get_subdevdata(sd);
719 struct ov772x_priv *priv = to_ov772x(client); 719 struct ov772x_priv *priv = to_ov772x(client);
720 720
721 id->ident = priv->model; 721 id->ident = priv->model;
@@ -728,7 +728,7 @@ static int ov772x_g_chip_ident(struct v4l2_subdev *sd,
728static int ov772x_g_register(struct v4l2_subdev *sd, 728static int ov772x_g_register(struct v4l2_subdev *sd,
729 struct v4l2_dbg_register *reg) 729 struct v4l2_dbg_register *reg)
730{ 730{
731 struct i2c_client *client = sd->priv; 731 struct i2c_client *client = v4l2_get_subdevdata(sd);
732 int ret; 732 int ret;
733 733
734 reg->size = 1; 734 reg->size = 1;
@@ -747,7 +747,7 @@ static int ov772x_g_register(struct v4l2_subdev *sd,
747static int ov772x_s_register(struct v4l2_subdev *sd, 747static int ov772x_s_register(struct v4l2_subdev *sd,
748 struct v4l2_dbg_register *reg) 748 struct v4l2_dbg_register *reg)
749{ 749{
750 struct i2c_client *client = sd->priv; 750 struct i2c_client *client = v4l2_get_subdevdata(sd);
751 751
752 if (reg->reg > 0xff || 752 if (reg->reg > 0xff ||
753 reg->val > 0xff) 753 reg->val > 0xff)
@@ -954,7 +954,7 @@ static int ov772x_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
954static int ov772x_g_fmt(struct v4l2_subdev *sd, 954static int ov772x_g_fmt(struct v4l2_subdev *sd,
955 struct v4l2_mbus_framefmt *mf) 955 struct v4l2_mbus_framefmt *mf)
956{ 956{
957 struct i2c_client *client = sd->priv; 957 struct i2c_client *client = v4l2_get_subdevdata(sd);
958 struct ov772x_priv *priv = to_ov772x(client); 958 struct ov772x_priv *priv = to_ov772x(client);
959 959
960 if (!priv->win || !priv->cfmt) { 960 if (!priv->win || !priv->cfmt) {
@@ -977,7 +977,7 @@ static int ov772x_g_fmt(struct v4l2_subdev *sd,
977static int ov772x_s_fmt(struct v4l2_subdev *sd, 977static int ov772x_s_fmt(struct v4l2_subdev *sd,
978 struct v4l2_mbus_framefmt *mf) 978 struct v4l2_mbus_framefmt *mf)
979{ 979{
980 struct i2c_client *client = sd->priv; 980 struct i2c_client *client = v4l2_get_subdevdata(sd);
981 struct ov772x_priv *priv = to_ov772x(client); 981 struct ov772x_priv *priv = to_ov772x(client);
982 int ret = ov772x_set_params(client, &mf->width, &mf->height, 982 int ret = ov772x_set_params(client, &mf->width, &mf->height,
983 mf->code); 983 mf->code);
@@ -991,7 +991,7 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd,
991static int ov772x_try_fmt(struct v4l2_subdev *sd, 991static int ov772x_try_fmt(struct v4l2_subdev *sd,
992 struct v4l2_mbus_framefmt *mf) 992 struct v4l2_mbus_framefmt *mf)
993{ 993{
994 struct i2c_client *client = sd->priv; 994 struct i2c_client *client = v4l2_get_subdevdata(sd);
995 struct ov772x_priv *priv = to_ov772x(client); 995 struct ov772x_priv *priv = to_ov772x(client);
996 const struct ov772x_win_size *win; 996 const struct ov772x_win_size *win;
997 int i; 997 int i;
diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c
index 40cdfab74ccc..99e9e1d3c83b 100644
--- a/drivers/media/video/ov9640.c
+++ b/drivers/media/video/ov9640.c
@@ -308,7 +308,7 @@ static unsigned long ov9640_query_bus_param(struct soc_camera_device *icd)
308/* Get status of additional camera capabilities */ 308/* Get status of additional camera capabilities */
309static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 309static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
310{ 310{
311 struct i2c_client *client = sd->priv; 311 struct i2c_client *client = v4l2_get_subdevdata(sd);
312 struct ov9640_priv *priv = container_of(i2c_get_clientdata(client), 312 struct ov9640_priv *priv = container_of(i2c_get_clientdata(client),
313 struct ov9640_priv, subdev); 313 struct ov9640_priv, subdev);
314 314
@@ -326,7 +326,7 @@ static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
326/* Set status of additional camera capabilities */ 326/* Set status of additional camera capabilities */
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 = sd->priv; 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 = container_of(i2c_get_clientdata(client),
331 struct ov9640_priv, subdev); 331 struct ov9640_priv, subdev);
332 332
@@ -360,7 +360,7 @@ static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
360static int ov9640_g_chip_ident(struct v4l2_subdev *sd, 360static int ov9640_g_chip_ident(struct v4l2_subdev *sd,
361 struct v4l2_dbg_chip_ident *id) 361 struct v4l2_dbg_chip_ident *id)
362{ 362{
363 struct i2c_client *client = sd->priv; 363 struct i2c_client *client = v4l2_get_subdevdata(sd);
364 struct ov9640_priv *priv = container_of(i2c_get_clientdata(client), 364 struct ov9640_priv *priv = container_of(i2c_get_clientdata(client),
365 struct ov9640_priv, subdev); 365 struct ov9640_priv, subdev);
366 366
@@ -374,7 +374,7 @@ static int ov9640_g_chip_ident(struct v4l2_subdev *sd,
374static int ov9640_get_register(struct v4l2_subdev *sd, 374static int ov9640_get_register(struct v4l2_subdev *sd,
375 struct v4l2_dbg_register *reg) 375 struct v4l2_dbg_register *reg)
376{ 376{
377 struct i2c_client *client = sd->priv; 377 struct i2c_client *client = v4l2_get_subdevdata(sd);
378 int ret; 378 int ret;
379 u8 val; 379 u8 val;
380 380
@@ -395,7 +395,7 @@ static int ov9640_get_register(struct v4l2_subdev *sd,
395static int ov9640_set_register(struct v4l2_subdev *sd, 395static int ov9640_set_register(struct v4l2_subdev *sd,
396 struct v4l2_dbg_register *reg) 396 struct v4l2_dbg_register *reg)
397{ 397{
398 struct i2c_client *client = sd->priv; 398 struct i2c_client *client = v4l2_get_subdevdata(sd);
399 399
400 if (reg->reg & ~0xff || reg->val & ~0xff) 400 if (reg->reg & ~0xff || reg->val & ~0xff)
401 return -EINVAL; 401 return -EINVAL;
@@ -558,7 +558,7 @@ static int ov9640_prog_dflt(struct i2c_client *client)
558static int ov9640_s_fmt(struct v4l2_subdev *sd, 558static int ov9640_s_fmt(struct v4l2_subdev *sd,
559 struct v4l2_mbus_framefmt *mf) 559 struct v4l2_mbus_framefmt *mf)
560{ 560{
561 struct i2c_client *client = sd->priv; 561 struct i2c_client *client = v4l2_get_subdevdata(sd);
562 struct ov9640_reg_alt alts = {0}; 562 struct ov9640_reg_alt alts = {0};
563 enum v4l2_colorspace cspace; 563 enum v4l2_colorspace cspace;
564 enum v4l2_mbus_pixelcode code = mf->code; 564 enum v4l2_mbus_pixelcode code = mf->code;
diff --git a/drivers/media/video/rj54n1cb0c.c b/drivers/media/video/rj54n1cb0c.c
index ce78fff23425..d2fa2d43ff19 100644
--- a/drivers/media/video/rj54n1cb0c.c
+++ b/drivers/media/video/rj54n1cb0c.c
@@ -493,7 +493,7 @@ static int rj54n1_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
493 493
494static int rj54n1_s_stream(struct v4l2_subdev *sd, int enable) 494static int rj54n1_s_stream(struct v4l2_subdev *sd, int enable)
495{ 495{
496 struct i2c_client *client = sd->priv; 496 struct i2c_client *client = v4l2_get_subdevdata(sd);
497 497
498 /* Switch between preview and still shot modes */ 498 /* Switch between preview and still shot modes */
499 return reg_set(client, RJ54N1_STILL_CONTROL, (!enable) << 7, 0x80); 499 return reg_set(client, RJ54N1_STILL_CONTROL, (!enable) << 7, 0x80);
@@ -503,7 +503,7 @@ static int rj54n1_set_bus_param(struct soc_camera_device *icd,
503 unsigned long flags) 503 unsigned long flags)
504{ 504{
505 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 505 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
506 struct i2c_client *client = sd->priv; 506 struct i2c_client *client = v4l2_get_subdevdata(sd);
507 /* Figures 2.5-1 to 2.5-3 - default falling pixclk edge */ 507 /* Figures 2.5-1 to 2.5-3 - default falling pixclk edge */
508 508
509 if (flags & SOCAM_PCLK_SAMPLE_RISING) 509 if (flags & SOCAM_PCLK_SAMPLE_RISING)
@@ -560,7 +560,7 @@ static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h,
560 560
561static int rj54n1_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 561static int rj54n1_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
562{ 562{
563 struct i2c_client *client = sd->priv; 563 struct i2c_client *client = v4l2_get_subdevdata(sd);
564 struct rj54n1 *rj54n1 = to_rj54n1(client); 564 struct rj54n1 *rj54n1 = to_rj54n1(client);
565 struct v4l2_rect *rect = &a->c; 565 struct v4l2_rect *rect = &a->c;
566 int dummy = 0, output_w, output_h, 566 int dummy = 0, output_w, output_h,
@@ -595,7 +595,7 @@ static int rj54n1_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
595 595
596static int rj54n1_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 596static int rj54n1_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
597{ 597{
598 struct i2c_client *client = sd->priv; 598 struct i2c_client *client = v4l2_get_subdevdata(sd);
599 struct rj54n1 *rj54n1 = to_rj54n1(client); 599 struct rj54n1 *rj54n1 = to_rj54n1(client);
600 600
601 a->c = rj54n1->rect; 601 a->c = rj54n1->rect;
@@ -621,7 +621,7 @@ static int rj54n1_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
621static int rj54n1_g_fmt(struct v4l2_subdev *sd, 621static int rj54n1_g_fmt(struct v4l2_subdev *sd,
622 struct v4l2_mbus_framefmt *mf) 622 struct v4l2_mbus_framefmt *mf)
623{ 623{
624 struct i2c_client *client = sd->priv; 624 struct i2c_client *client = v4l2_get_subdevdata(sd);
625 struct rj54n1 *rj54n1 = to_rj54n1(client); 625 struct rj54n1 *rj54n1 = to_rj54n1(client);
626 626
627 mf->code = rj54n1->fmt->code; 627 mf->code = rj54n1->fmt->code;
@@ -641,7 +641,7 @@ static int rj54n1_g_fmt(struct v4l2_subdev *sd,
641static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h, 641static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h,
642 s32 *out_w, s32 *out_h) 642 s32 *out_w, s32 *out_h)
643{ 643{
644 struct i2c_client *client = sd->priv; 644 struct i2c_client *client = v4l2_get_subdevdata(sd);
645 struct rj54n1 *rj54n1 = to_rj54n1(client); 645 struct rj54n1 *rj54n1 = to_rj54n1(client);
646 unsigned int skip, resize, input_w = *in_w, input_h = *in_h, 646 unsigned int skip, resize, input_w = *in_w, input_h = *in_h,
647 output_w = *out_w, output_h = *out_h; 647 output_w = *out_w, output_h = *out_h;
@@ -983,7 +983,7 @@ static int rj54n1_reg_init(struct i2c_client *client)
983static int rj54n1_try_fmt(struct v4l2_subdev *sd, 983static int rj54n1_try_fmt(struct v4l2_subdev *sd,
984 struct v4l2_mbus_framefmt *mf) 984 struct v4l2_mbus_framefmt *mf)
985{ 985{
986 struct i2c_client *client = sd->priv; 986 struct i2c_client *client = v4l2_get_subdevdata(sd);
987 struct rj54n1 *rj54n1 = to_rj54n1(client); 987 struct rj54n1 *rj54n1 = to_rj54n1(client);
988 const struct rj54n1_datafmt *fmt; 988 const struct rj54n1_datafmt *fmt;
989 int align = mf->code == V4L2_MBUS_FMT_SBGGR10_1X10 || 989 int align = mf->code == V4L2_MBUS_FMT_SBGGR10_1X10 ||
@@ -1014,7 +1014,7 @@ static int rj54n1_try_fmt(struct v4l2_subdev *sd,
1014static int rj54n1_s_fmt(struct v4l2_subdev *sd, 1014static int rj54n1_s_fmt(struct v4l2_subdev *sd,
1015 struct v4l2_mbus_framefmt *mf) 1015 struct v4l2_mbus_framefmt *mf)
1016{ 1016{
1017 struct i2c_client *client = sd->priv; 1017 struct i2c_client *client = v4l2_get_subdevdata(sd);
1018 struct rj54n1 *rj54n1 = to_rj54n1(client); 1018 struct rj54n1 *rj54n1 = to_rj54n1(client);
1019 const struct rj54n1_datafmt *fmt; 1019 const struct rj54n1_datafmt *fmt;
1020 int output_w, output_h, max_w, max_h, 1020 int output_w, output_h, max_w, max_h,
@@ -1145,7 +1145,7 @@ static int rj54n1_s_fmt(struct v4l2_subdev *sd,
1145static int rj54n1_g_chip_ident(struct v4l2_subdev *sd, 1145static int rj54n1_g_chip_ident(struct v4l2_subdev *sd,
1146 struct v4l2_dbg_chip_ident *id) 1146 struct v4l2_dbg_chip_ident *id)
1147{ 1147{
1148 struct i2c_client *client = sd->priv; 1148 struct i2c_client *client = v4l2_get_subdevdata(sd);
1149 1149
1150 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 1150 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
1151 return -EINVAL; 1151 return -EINVAL;
@@ -1163,7 +1163,7 @@ static int rj54n1_g_chip_ident(struct v4l2_subdev *sd,
1163static int rj54n1_g_register(struct v4l2_subdev *sd, 1163static int rj54n1_g_register(struct v4l2_subdev *sd,
1164 struct v4l2_dbg_register *reg) 1164 struct v4l2_dbg_register *reg)
1165{ 1165{
1166 struct i2c_client *client = sd->priv; 1166 struct i2c_client *client = v4l2_get_subdevdata(sd);
1167 1167
1168 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || 1168 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR ||
1169 reg->reg < 0x400 || reg->reg > 0x1fff) 1169 reg->reg < 0x400 || reg->reg > 0x1fff)
@@ -1185,7 +1185,7 @@ static int rj54n1_g_register(struct v4l2_subdev *sd,
1185static int rj54n1_s_register(struct v4l2_subdev *sd, 1185static int rj54n1_s_register(struct v4l2_subdev *sd,
1186 struct v4l2_dbg_register *reg) 1186 struct v4l2_dbg_register *reg)
1187{ 1187{
1188 struct i2c_client *client = sd->priv; 1188 struct i2c_client *client = v4l2_get_subdevdata(sd);
1189 1189
1190 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || 1190 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR ||
1191 reg->reg < 0x400 || reg->reg > 0x1fff) 1191 reg->reg < 0x400 || reg->reg > 0x1fff)
@@ -1248,7 +1248,7 @@ static struct soc_camera_ops rj54n1_ops = {
1248 1248
1249static int rj54n1_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 1249static int rj54n1_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
1250{ 1250{
1251 struct i2c_client *client = sd->priv; 1251 struct i2c_client *client = v4l2_get_subdevdata(sd);
1252 struct rj54n1 *rj54n1 = to_rj54n1(client); 1252 struct rj54n1 *rj54n1 = to_rj54n1(client);
1253 int data; 1253 int data;
1254 1254
@@ -1283,7 +1283,7 @@ static int rj54n1_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
1283static int rj54n1_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 1283static int rj54n1_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
1284{ 1284{
1285 int data; 1285 int data;
1286 struct i2c_client *client = sd->priv; 1286 struct i2c_client *client = v4l2_get_subdevdata(sd);
1287 struct rj54n1 *rj54n1 = to_rj54n1(client); 1287 struct rj54n1 *rj54n1 = to_rj54n1(client);
1288 const struct v4l2_queryctrl *qctrl; 1288 const struct v4l2_queryctrl *qctrl;
1289 1289
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index a499cacec1f3..a55d6dc4c6bd 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -902,7 +902,7 @@ static int soc_camera_init_i2c(struct soc_camera_device *icd,
902 if (!subdev) 902 if (!subdev)
903 goto ei2cnd; 903 goto ei2cnd;
904 904
905 client = subdev->priv; 905 client = v4l2_get_subdevdata(subdev);
906 906
907 /* Use to_i2c_client(dev) to recover the i2c client */ 907 /* Use to_i2c_client(dev) to recover the i2c client */
908 dev_set_drvdata(&icd->dev, &client->dev); 908 dev_set_drvdata(&icd->dev, &client->dev);
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index a727962781a3..0347bbe36459 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -469,7 +469,7 @@ tw9910_select_norm(struct soc_camera_device *icd, u32 width, u32 height)
469 */ 469 */
470static int tw9910_s_stream(struct v4l2_subdev *sd, int enable) 470static int tw9910_s_stream(struct v4l2_subdev *sd, int enable)
471{ 471{
472 struct i2c_client *client = sd->priv; 472 struct i2c_client *client = v4l2_get_subdevdata(sd);
473 struct tw9910_priv *priv = to_tw9910(client); 473 struct tw9910_priv *priv = to_tw9910(client);
474 u8 val; 474 u8 val;
475 int ret; 475 int ret;
@@ -511,7 +511,7 @@ static int tw9910_set_bus_param(struct soc_camera_device *icd,
511 unsigned long flags) 511 unsigned long flags)
512{ 512{
513 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); 513 struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
514 struct i2c_client *client = sd->priv; 514 struct i2c_client *client = v4l2_get_subdevdata(sd);
515 u8 val = VSSL_VVALID | HSSL_DVALID; 515 u8 val = VSSL_VVALID | HSSL_DVALID;
516 516
517 /* 517 /*
@@ -565,7 +565,7 @@ static int tw9910_enum_input(struct soc_camera_device *icd,
565static int tw9910_g_chip_ident(struct v4l2_subdev *sd, 565static int tw9910_g_chip_ident(struct v4l2_subdev *sd,
566 struct v4l2_dbg_chip_ident *id) 566 struct v4l2_dbg_chip_ident *id)
567{ 567{
568 struct i2c_client *client = sd->priv; 568 struct i2c_client *client = v4l2_get_subdevdata(sd);
569 struct tw9910_priv *priv = to_tw9910(client); 569 struct tw9910_priv *priv = to_tw9910(client);
570 570
571 id->ident = V4L2_IDENT_TW9910; 571 id->ident = V4L2_IDENT_TW9910;
@@ -578,7 +578,7 @@ static int tw9910_g_chip_ident(struct v4l2_subdev *sd,
578static int tw9910_g_register(struct v4l2_subdev *sd, 578static int tw9910_g_register(struct v4l2_subdev *sd,
579 struct v4l2_dbg_register *reg) 579 struct v4l2_dbg_register *reg)
580{ 580{
581 struct i2c_client *client = sd->priv; 581 struct i2c_client *client = v4l2_get_subdevdata(sd);
582 int ret; 582 int ret;
583 583
584 if (reg->reg > 0xff) 584 if (reg->reg > 0xff)
@@ -600,7 +600,7 @@ static int tw9910_g_register(struct v4l2_subdev *sd,
600static int tw9910_s_register(struct v4l2_subdev *sd, 600static int tw9910_s_register(struct v4l2_subdev *sd,
601 struct v4l2_dbg_register *reg) 601 struct v4l2_dbg_register *reg)
602{ 602{
603 struct i2c_client *client = sd->priv; 603 struct i2c_client *client = v4l2_get_subdevdata(sd);
604 604
605 if (reg->reg > 0xff || 605 if (reg->reg > 0xff ||
606 reg->val > 0xff) 606 reg->val > 0xff)
@@ -613,7 +613,7 @@ static int tw9910_s_register(struct v4l2_subdev *sd,
613static int tw9910_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 613static int tw9910_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
614{ 614{
615 struct v4l2_rect *rect = &a->c; 615 struct v4l2_rect *rect = &a->c;
616 struct i2c_client *client = sd->priv; 616 struct i2c_client *client = v4l2_get_subdevdata(sd);
617 struct tw9910_priv *priv = to_tw9910(client); 617 struct tw9910_priv *priv = to_tw9910(client);
618 struct soc_camera_device *icd = client->dev.platform_data; 618 struct soc_camera_device *icd = client->dev.platform_data;
619 int ret = -EINVAL; 619 int ret = -EINVAL;
@@ -701,7 +701,7 @@ tw9910_set_fmt_error:
701 701
702static int tw9910_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 702static int tw9910_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
703{ 703{
704 struct i2c_client *client = sd->priv; 704 struct i2c_client *client = v4l2_get_subdevdata(sd);
705 struct tw9910_priv *priv = to_tw9910(client); 705 struct tw9910_priv *priv = to_tw9910(client);
706 706
707 if (!priv->scale) { 707 if (!priv->scale) {
@@ -748,7 +748,7 @@ static int tw9910_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
748static int tw9910_g_fmt(struct v4l2_subdev *sd, 748static int tw9910_g_fmt(struct v4l2_subdev *sd,
749 struct v4l2_mbus_framefmt *mf) 749 struct v4l2_mbus_framefmt *mf)
750{ 750{
751 struct i2c_client *client = sd->priv; 751 struct i2c_client *client = v4l2_get_subdevdata(sd);
752 struct tw9910_priv *priv = to_tw9910(client); 752 struct tw9910_priv *priv = to_tw9910(client);
753 753
754 if (!priv->scale) { 754 if (!priv->scale) {
@@ -778,7 +778,7 @@ static int tw9910_g_fmt(struct v4l2_subdev *sd,
778static int tw9910_s_fmt(struct v4l2_subdev *sd, 778static int tw9910_s_fmt(struct v4l2_subdev *sd,
779 struct v4l2_mbus_framefmt *mf) 779 struct v4l2_mbus_framefmt *mf)
780{ 780{
781 struct i2c_client *client = sd->priv; 781 struct i2c_client *client = v4l2_get_subdevdata(sd);
782 struct tw9910_priv *priv = to_tw9910(client); 782 struct tw9910_priv *priv = to_tw9910(client);
783 /* See tw9910_s_crop() - no proper cropping support */ 783 /* See tw9910_s_crop() - no proper cropping support */
784 struct v4l2_crop a = { 784 struct v4l2_crop a = {
@@ -813,7 +813,7 @@ static int tw9910_s_fmt(struct v4l2_subdev *sd,
813static int tw9910_try_fmt(struct v4l2_subdev *sd, 813static int tw9910_try_fmt(struct v4l2_subdev *sd,
814 struct v4l2_mbus_framefmt *mf) 814 struct v4l2_mbus_framefmt *mf)
815{ 815{
816 struct i2c_client *client = sd->priv; 816 struct i2c_client *client = v4l2_get_subdevdata(sd);
817 struct soc_camera_device *icd = client->dev.platform_data; 817 struct soc_camera_device *icd = client->dev.platform_data;
818 const struct tw9910_scale_ctrl *scale; 818 const struct tw9910_scale_ctrl *scale;
819 819