@@ -205,7 +205,7 @@ static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
205205
206206 /*
207207 * The caller provides a supported format, as verified per
208- * call to icd->try_fmt ()
208+ * call to .try_mbus_fmt ()
209209 */
210210 if (!ret )
211211 ret = reg_write (client , MT9M001_COLUMN_START , rect .left );
@@ -474,19 +474,14 @@ static int mt9m001_s_ctrl(struct v4l2_ctrl *ctrl)
474474 * Interface active, can use i2c. If it fails, it can indeed mean, that
475475 * this wasn't our capture interface, so, we wait for the right one
476476 */
477- static int mt9m001_video_probe (struct soc_camera_device * icd ,
477+ static int mt9m001_video_probe (struct soc_camera_link * icl ,
478478 struct i2c_client * client )
479479{
480480 struct mt9m001 * mt9m001 = to_mt9m001 (client );
481- struct soc_camera_link * icl = to_soc_camera_link (icd );
482481 s32 data ;
483482 unsigned long flags ;
484483 int ret ;
485484
486- /* We must have a parent by now. And it cannot be a wrong one. */
487- BUG_ON (!icd -> parent ||
488- to_soc_camera_host (icd -> parent )-> nr != icd -> iface );
489-
490485 /* Enable the chip */
491486 data = reg_write (client , MT9M001_CHIP_ENABLE , 1 );
492487 dev_dbg (& client -> dev , "write: %d\n" , data );
@@ -544,12 +539,8 @@ static int mt9m001_video_probe(struct soc_camera_device *icd,
544539 return v4l2_ctrl_handler_setup (& mt9m001 -> hdl );
545540}
546541
547- static void mt9m001_video_remove (struct soc_camera_device * icd )
542+ static void mt9m001_video_remove (struct soc_camera_link * icl )
548543{
549- struct soc_camera_link * icl = to_soc_camera_link (icd );
550-
551- dev_dbg (icd -> pdev , "Video removed: %p, %p\n" ,
552- icd -> parent , icd -> vdev );
553544 if (icl -> free_bus )
554545 icl -> free_bus (icl );
555546}
@@ -594,8 +585,7 @@ static int mt9m001_g_mbus_config(struct v4l2_subdev *sd,
594585 struct v4l2_mbus_config * cfg )
595586{
596587 struct i2c_client * client = v4l2_get_subdevdata (sd );
597- struct soc_camera_device * icd = client -> dev .platform_data ;
598- struct soc_camera_link * icl = to_soc_camera_link (icd );
588+ struct soc_camera_link * icl = soc_camera_i2c_to_link (client );
599589
600590 /* MT9M001 has all capture_format parameters fixed */
601591 cfg -> flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
@@ -610,9 +600,9 @@ static int mt9m001_g_mbus_config(struct v4l2_subdev *sd,
610600static int mt9m001_s_mbus_config (struct v4l2_subdev * sd ,
611601 const struct v4l2_mbus_config * cfg )
612602{
613- struct i2c_client * client = v4l2_get_subdevdata (sd );
614- struct soc_camera_device * icd = client -> dev . platform_data ;
615- struct soc_camera_link * icl = to_soc_camera_link ( icd );
603+ const struct i2c_client * client = v4l2_get_subdevdata (sd );
604+ struct soc_camera_device * icd = soc_camera_from_i2c ( client ) ;
605+ struct soc_camera_link * icl = soc_camera_i2c_to_link ( client );
616606 /*
617607 * Cannot use icd->current_fmt->host_fmt->bits_per_sample, because that
618608 * is the number of bits, that the host has to sample, not the number of
@@ -658,17 +648,10 @@ static int mt9m001_probe(struct i2c_client *client,
658648 const struct i2c_device_id * did )
659649{
660650 struct mt9m001 * mt9m001 ;
661- struct soc_camera_device * icd = client -> dev .platform_data ;
662651 struct i2c_adapter * adapter = to_i2c_adapter (client -> dev .parent );
663- struct soc_camera_link * icl ;
652+ struct soc_camera_link * icl = soc_camera_i2c_to_link ( client ) ;
664653 int ret ;
665654
666- if (!icd ) {
667- dev_err (& client -> dev , "MT9M001: missing soc-camera data!\n" );
668- return - EINVAL ;
669- }
670-
671- icl = to_soc_camera_link (icd );
672655 if (!icl ) {
673656 dev_err (& client -> dev , "MT9M001 driver needs platform data\n" );
674657 return - EINVAL ;
@@ -716,7 +699,7 @@ static int mt9m001_probe(struct i2c_client *client,
716699 mt9m001 -> rect .width = MT9M001_MAX_WIDTH ;
717700 mt9m001 -> rect .height = MT9M001_MAX_HEIGHT ;
718701
719- ret = mt9m001_video_probe (icd , client );
702+ ret = mt9m001_video_probe (icl , client );
720703 if (ret ) {
721704 v4l2_ctrl_handler_free (& mt9m001 -> hdl );
722705 kfree (mt9m001 );
@@ -728,11 +711,11 @@ static int mt9m001_probe(struct i2c_client *client,
728711static int mt9m001_remove (struct i2c_client * client )
729712{
730713 struct mt9m001 * mt9m001 = to_mt9m001 (client );
731- struct soc_camera_device * icd = client -> dev . platform_data ;
714+ struct soc_camera_link * icl = soc_camera_i2c_to_link ( client ) ;
732715
733716 v4l2_device_unregister_subdev (& mt9m001 -> subdev );
734717 v4l2_ctrl_handler_free (& mt9m001 -> hdl );
735- mt9m001_video_remove (icd );
718+ mt9m001_video_remove (icl );
736719 kfree (mt9m001 );
737720
738721 return 0 ;
0 commit comments