diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-09-21 14:16:30 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-03 16:28:58 -0400 |
commit | 14178aa57ce6ac4f05b4df8ea9e010486ce83a76 (patch) | |
tree | 992b8ae46ddad4f16c0d5d7b8fa3ab2a84b4e50e /drivers/media/video/mt9m111.c | |
parent | 09362ec25c3f42d00a4008d0622bfbca68e540f5 (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 'drivers/media/video/mt9m111.c')
-rw-r--r-- | drivers/media/video/mt9m111.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index 8cacbf01684..9feeb0cb672 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c | |||
@@ -784,19 +784,12 @@ static int mt9m111_init(struct mt9m111 *mt9m111) | |||
784 | * Interface active, can use i2c. If it fails, it can indeed mean, that | 784 | * Interface active, can use i2c. If it fails, it can indeed mean, that |
785 | * this wasn't our capture interface, so, we wait for the right one | 785 | * this wasn't our capture interface, so, we wait for the right one |
786 | */ | 786 | */ |
787 | static int mt9m111_video_probe(struct soc_camera_device *icd, | 787 | static int mt9m111_video_probe(struct i2c_client *client) |
788 | struct i2c_client *client) | ||
789 | { | 788 | { |
790 | struct mt9m111 *mt9m111 = to_mt9m111(client); | 789 | struct mt9m111 *mt9m111 = to_mt9m111(client); |
791 | s32 data; | 790 | s32 data; |
792 | int ret; | 791 | int ret; |
793 | 792 | ||
794 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
795 | BUG_ON(!icd->parent || | ||
796 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
797 | |||
798 | mt9m111->lastpage = -1; | ||
799 | |||
800 | data = reg_read(CHIP_VERSION); | 793 | data = reg_read(CHIP_VERSION); |
801 | 794 | ||
802 | switch (data) { | 795 | switch (data) { |
@@ -883,8 +876,7 @@ static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, | |||
883 | struct v4l2_mbus_config *cfg) | 876 | struct v4l2_mbus_config *cfg) |
884 | { | 877 | { |
885 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 878 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
886 | struct soc_camera_device *icd = client->dev.platform_data; | 879 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
887 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
888 | 880 | ||
889 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | | 881 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | |
890 | V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | | 882 | V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | |
@@ -915,17 +907,10 @@ static int mt9m111_probe(struct i2c_client *client, | |||
915 | const struct i2c_device_id *did) | 907 | const struct i2c_device_id *did) |
916 | { | 908 | { |
917 | struct mt9m111 *mt9m111; | 909 | struct mt9m111 *mt9m111; |
918 | struct soc_camera_device *icd = client->dev.platform_data; | ||
919 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 910 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
920 | struct soc_camera_link *icl; | 911 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
921 | int ret; | 912 | int ret; |
922 | 913 | ||
923 | if (!icd) { | ||
924 | dev_err(&client->dev, "mt9m111: soc-camera data missing!\n"); | ||
925 | return -EINVAL; | ||
926 | } | ||
927 | |||
928 | icl = to_soc_camera_link(icd); | ||
929 | if (!icl) { | 914 | if (!icl) { |
930 | dev_err(&client->dev, "mt9m111: driver needs platform data\n"); | 915 | dev_err(&client->dev, "mt9m111: driver needs platform data\n"); |
931 | return -EINVAL; | 916 | return -EINVAL; |
@@ -968,8 +953,9 @@ static int mt9m111_probe(struct i2c_client *client, | |||
968 | mt9m111->rect.width = MT9M111_MAX_WIDTH; | 953 | mt9m111->rect.width = MT9M111_MAX_WIDTH; |
969 | mt9m111->rect.height = MT9M111_MAX_HEIGHT; | 954 | mt9m111->rect.height = MT9M111_MAX_HEIGHT; |
970 | mt9m111->fmt = &mt9m111_colour_fmts[0]; | 955 | mt9m111->fmt = &mt9m111_colour_fmts[0]; |
956 | mt9m111->lastpage = -1; | ||
971 | 957 | ||
972 | ret = mt9m111_video_probe(icd, client); | 958 | ret = mt9m111_video_probe(client); |
973 | if (ret) { | 959 | if (ret) { |
974 | v4l2_ctrl_handler_free(&mt9m111->hdl); | 960 | v4l2_ctrl_handler_free(&mt9m111->hdl); |
975 | kfree(mt9m111); | 961 | kfree(mt9m111); |