diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-01-03 13:35:56 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-13 14:28:33 -0500 |
commit | fd51625d6331c80cd249bd201b012ed5fe4f0476 (patch) | |
tree | 76daf2650f638ce0188507cbb864f6ee60c995e5 | |
parent | 47de201c73fbe435e7b635fa0eb812c7ce68be43 (diff) |
[media] sh_vou: Use video_drvdata()
Replace video_devdata() followed by video_get_drvdata() calls with
video_drvdata().
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/platform/sh_vou.c | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index ab5bca40a5b3..e969fea3c122 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c | |||
@@ -420,8 +420,7 @@ static int sh_vou_enum_fmt_vid_out(struct file *file, void *priv, | |||
420 | static int sh_vou_g_fmt_vid_out(struct file *file, void *priv, | 420 | static int sh_vou_g_fmt_vid_out(struct file *file, void *priv, |
421 | struct v4l2_format *fmt) | 421 | struct v4l2_format *fmt) |
422 | { | 422 | { |
423 | struct video_device *vdev = video_devdata(file); | 423 | struct sh_vou_device *vou_dev = video_drvdata(file); |
424 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
425 | 424 | ||
426 | dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); | 425 | dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); |
427 | 426 | ||
@@ -672,8 +671,7 @@ static void vou_adjust_output(struct sh_vou_geometry *geo, v4l2_std_id std) | |||
672 | static int sh_vou_s_fmt_vid_out(struct file *file, void *priv, | 671 | static int sh_vou_s_fmt_vid_out(struct file *file, void *priv, |
673 | struct v4l2_format *fmt) | 672 | struct v4l2_format *fmt) |
674 | { | 673 | { |
675 | struct video_device *vdev = video_devdata(file); | 674 | struct sh_vou_device *vou_dev = video_drvdata(file); |
676 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
677 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | 675 | struct v4l2_pix_format *pix = &fmt->fmt.pix; |
678 | unsigned int img_height_max; | 676 | unsigned int img_height_max; |
679 | int pix_idx; | 677 | int pix_idx; |
@@ -830,8 +828,7 @@ static int sh_vou_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
830 | static int sh_vou_streamon(struct file *file, void *priv, | 828 | static int sh_vou_streamon(struct file *file, void *priv, |
831 | enum v4l2_buf_type buftype) | 829 | enum v4l2_buf_type buftype) |
832 | { | 830 | { |
833 | struct video_device *vdev = video_devdata(file); | 831 | struct sh_vou_device *vou_dev = video_drvdata(file); |
834 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
835 | struct sh_vou_file *vou_file = priv; | 832 | struct sh_vou_file *vou_file = priv; |
836 | int ret; | 833 | int ret; |
837 | 834 | ||
@@ -849,8 +846,7 @@ static int sh_vou_streamon(struct file *file, void *priv, | |||
849 | static int sh_vou_streamoff(struct file *file, void *priv, | 846 | static int sh_vou_streamoff(struct file *file, void *priv, |
850 | enum v4l2_buf_type buftype) | 847 | enum v4l2_buf_type buftype) |
851 | { | 848 | { |
852 | struct video_device *vdev = video_devdata(file); | 849 | struct sh_vou_device *vou_dev = video_drvdata(file); |
853 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
854 | struct sh_vou_file *vou_file = priv; | 850 | struct sh_vou_file *vou_file = priv; |
855 | 851 | ||
856 | dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); | 852 | dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); |
@@ -882,13 +878,12 @@ static u32 sh_vou_ntsc_mode(enum sh_vou_bus_fmt bus_fmt) | |||
882 | 878 | ||
883 | static int sh_vou_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | 879 | static int sh_vou_s_std(struct file *file, void *priv, v4l2_std_id *std_id) |
884 | { | 880 | { |
885 | struct video_device *vdev = video_devdata(file); | 881 | struct sh_vou_device *vou_dev = video_drvdata(file); |
886 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
887 | int ret; | 882 | int ret; |
888 | 883 | ||
889 | dev_dbg(vou_dev->v4l2_dev.dev, "%s(): 0x%llx\n", __func__, *std_id); | 884 | dev_dbg(vou_dev->v4l2_dev.dev, "%s(): 0x%llx\n", __func__, *std_id); |
890 | 885 | ||
891 | if (*std_id & ~vdev->tvnorms) | 886 | if (*std_id & ~vou_dev->vdev->tvnorms) |
892 | return -EINVAL; | 887 | return -EINVAL; |
893 | 888 | ||
894 | ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, video, | 889 | ret = v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, video, |
@@ -910,8 +905,7 @@ static int sh_vou_s_std(struct file *file, void *priv, v4l2_std_id *std_id) | |||
910 | 905 | ||
911 | static int sh_vou_g_std(struct file *file, void *priv, v4l2_std_id *std) | 906 | static int sh_vou_g_std(struct file *file, void *priv, v4l2_std_id *std) |
912 | { | 907 | { |
913 | struct video_device *vdev = video_devdata(file); | 908 | struct sh_vou_device *vou_dev = video_drvdata(file); |
914 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
915 | 909 | ||
916 | dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); | 910 | dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); |
917 | 911 | ||
@@ -922,8 +916,7 @@ static int sh_vou_g_std(struct file *file, void *priv, v4l2_std_id *std) | |||
922 | 916 | ||
923 | static int sh_vou_g_crop(struct file *file, void *fh, struct v4l2_crop *a) | 917 | static int sh_vou_g_crop(struct file *file, void *fh, struct v4l2_crop *a) |
924 | { | 918 | { |
925 | struct video_device *vdev = video_devdata(file); | 919 | struct sh_vou_device *vou_dev = video_drvdata(file); |
926 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
927 | 920 | ||
928 | dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); | 921 | dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); |
929 | 922 | ||
@@ -937,8 +930,7 @@ static int sh_vou_g_crop(struct file *file, void *fh, struct v4l2_crop *a) | |||
937 | static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) | 930 | static int sh_vou_s_crop(struct file *file, void *fh, const struct v4l2_crop *a) |
938 | { | 931 | { |
939 | struct v4l2_crop a_writable = *a; | 932 | struct v4l2_crop a_writable = *a; |
940 | struct video_device *vdev = video_devdata(file); | 933 | struct sh_vou_device *vou_dev = video_drvdata(file); |
941 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
942 | struct v4l2_rect *rect = &a_writable.c; | 934 | struct v4l2_rect *rect = &a_writable.c; |
943 | struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; | 935 | struct v4l2_crop sd_crop = {.type = V4L2_BUF_TYPE_VIDEO_OUTPUT}; |
944 | struct v4l2_pix_format *pix = &vou_dev->pix; | 936 | struct v4l2_pix_format *pix = &vou_dev->pix; |
@@ -1161,8 +1153,7 @@ static int sh_vou_hw_init(struct sh_vou_device *vou_dev) | |||
1161 | /* File operations */ | 1153 | /* File operations */ |
1162 | static int sh_vou_open(struct file *file) | 1154 | static int sh_vou_open(struct file *file) |
1163 | { | 1155 | { |
1164 | struct video_device *vdev = video_devdata(file); | 1156 | struct sh_vou_device *vou_dev = video_drvdata(file); |
1165 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
1166 | struct sh_vou_file *vou_file = kzalloc(sizeof(struct sh_vou_file), | 1157 | struct sh_vou_file *vou_file = kzalloc(sizeof(struct sh_vou_file), |
1167 | GFP_KERNEL); | 1158 | GFP_KERNEL); |
1168 | 1159 | ||
@@ -1179,11 +1170,11 @@ static int sh_vou_open(struct file *file) | |||
1179 | int ret; | 1170 | int ret; |
1180 | /* First open */ | 1171 | /* First open */ |
1181 | vou_dev->status = SH_VOU_INITIALISING; | 1172 | vou_dev->status = SH_VOU_INITIALISING; |
1182 | pm_runtime_get_sync(vdev->v4l2_dev->dev); | 1173 | pm_runtime_get_sync(vou_dev->v4l2_dev.dev); |
1183 | ret = sh_vou_hw_init(vou_dev); | 1174 | ret = sh_vou_hw_init(vou_dev); |
1184 | if (ret < 0) { | 1175 | if (ret < 0) { |
1185 | atomic_dec(&vou_dev->use_count); | 1176 | atomic_dec(&vou_dev->use_count); |
1186 | pm_runtime_put(vdev->v4l2_dev->dev); | 1177 | pm_runtime_put(vou_dev->v4l2_dev.dev); |
1187 | vou_dev->status = SH_VOU_IDLE; | 1178 | vou_dev->status = SH_VOU_IDLE; |
1188 | mutex_unlock(&vou_dev->fop_lock); | 1179 | mutex_unlock(&vou_dev->fop_lock); |
1189 | return ret; | 1180 | return ret; |
@@ -1194,8 +1185,8 @@ static int sh_vou_open(struct file *file) | |||
1194 | vou_dev->v4l2_dev.dev, &vou_dev->lock, | 1185 | vou_dev->v4l2_dev.dev, &vou_dev->lock, |
1195 | V4L2_BUF_TYPE_VIDEO_OUTPUT, | 1186 | V4L2_BUF_TYPE_VIDEO_OUTPUT, |
1196 | V4L2_FIELD_NONE, | 1187 | V4L2_FIELD_NONE, |
1197 | sizeof(struct videobuf_buffer), vdev, | 1188 | sizeof(struct videobuf_buffer), |
1198 | &vou_dev->fop_lock); | 1189 | vou_dev->vdev, &vou_dev->fop_lock); |
1199 | mutex_unlock(&vou_dev->fop_lock); | 1190 | mutex_unlock(&vou_dev->fop_lock); |
1200 | 1191 | ||
1201 | return 0; | 1192 | return 0; |
@@ -1203,8 +1194,7 @@ static int sh_vou_open(struct file *file) | |||
1203 | 1194 | ||
1204 | static int sh_vou_release(struct file *file) | 1195 | static int sh_vou_release(struct file *file) |
1205 | { | 1196 | { |
1206 | struct video_device *vdev = video_devdata(file); | 1197 | struct sh_vou_device *vou_dev = video_drvdata(file); |
1207 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
1208 | struct sh_vou_file *vou_file = file->private_data; | 1198 | struct sh_vou_file *vou_file = file->private_data; |
1209 | 1199 | ||
1210 | dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); | 1200 | dev_dbg(vou_file->vbq.dev, "%s()\n", __func__); |
@@ -1214,7 +1204,7 @@ static int sh_vou_release(struct file *file) | |||
1214 | /* Last close */ | 1204 | /* Last close */ |
1215 | vou_dev->status = SH_VOU_IDLE; | 1205 | vou_dev->status = SH_VOU_IDLE; |
1216 | sh_vou_reg_a_set(vou_dev, VOUER, 0, 0x101); | 1206 | sh_vou_reg_a_set(vou_dev, VOUER, 0, 0x101); |
1217 | pm_runtime_put(vdev->v4l2_dev->dev); | 1207 | pm_runtime_put(vou_dev->v4l2_dev.dev); |
1218 | mutex_unlock(&vou_dev->fop_lock); | 1208 | mutex_unlock(&vou_dev->fop_lock); |
1219 | } | 1209 | } |
1220 | 1210 | ||
@@ -1226,8 +1216,7 @@ static int sh_vou_release(struct file *file) | |||
1226 | 1216 | ||
1227 | static int sh_vou_mmap(struct file *file, struct vm_area_struct *vma) | 1217 | static int sh_vou_mmap(struct file *file, struct vm_area_struct *vma) |
1228 | { | 1218 | { |
1229 | struct video_device *vdev = video_devdata(file); | 1219 | struct sh_vou_device *vou_dev = video_drvdata(file); |
1230 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
1231 | struct sh_vou_file *vou_file = file->private_data; | 1220 | struct sh_vou_file *vou_file = file->private_data; |
1232 | int ret; | 1221 | int ret; |
1233 | 1222 | ||
@@ -1242,8 +1231,7 @@ static int sh_vou_mmap(struct file *file, struct vm_area_struct *vma) | |||
1242 | 1231 | ||
1243 | static unsigned int sh_vou_poll(struct file *file, poll_table *wait) | 1232 | static unsigned int sh_vou_poll(struct file *file, poll_table *wait) |
1244 | { | 1233 | { |
1245 | struct video_device *vdev = video_devdata(file); | 1234 | struct sh_vou_device *vou_dev = video_drvdata(file); |
1246 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
1247 | struct sh_vou_file *vou_file = file->private_data; | 1235 | struct sh_vou_file *vou_file = file->private_data; |
1248 | unsigned int res; | 1236 | unsigned int res; |
1249 | 1237 | ||
@@ -1258,8 +1246,7 @@ static unsigned int sh_vou_poll(struct file *file, poll_table *wait) | |||
1258 | static int sh_vou_g_chip_ident(struct file *file, void *fh, | 1246 | static int sh_vou_g_chip_ident(struct file *file, void *fh, |
1259 | struct v4l2_dbg_chip_ident *id) | 1247 | struct v4l2_dbg_chip_ident *id) |
1260 | { | 1248 | { |
1261 | struct video_device *vdev = video_devdata(file); | 1249 | struct sh_vou_device *vou_dev = video_drvdata(file); |
1262 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
1263 | 1250 | ||
1264 | return v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, core, g_chip_ident, id); | 1251 | return v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, core, g_chip_ident, id); |
1265 | } | 1252 | } |
@@ -1268,8 +1255,7 @@ static int sh_vou_g_chip_ident(struct file *file, void *fh, | |||
1268 | static int sh_vou_g_register(struct file *file, void *fh, | 1255 | static int sh_vou_g_register(struct file *file, void *fh, |
1269 | struct v4l2_dbg_register *reg) | 1256 | struct v4l2_dbg_register *reg) |
1270 | { | 1257 | { |
1271 | struct video_device *vdev = video_devdata(file); | 1258 | struct sh_vou_device *vou_dev = video_drvdata(file); |
1272 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
1273 | 1259 | ||
1274 | return v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, core, g_register, reg); | 1260 | return v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, core, g_register, reg); |
1275 | } | 1261 | } |
@@ -1277,8 +1263,7 @@ static int sh_vou_g_register(struct file *file, void *fh, | |||
1277 | static int sh_vou_s_register(struct file *file, void *fh, | 1263 | static int sh_vou_s_register(struct file *file, void *fh, |
1278 | struct v4l2_dbg_register *reg) | 1264 | struct v4l2_dbg_register *reg) |
1279 | { | 1265 | { |
1280 | struct video_device *vdev = video_devdata(file); | 1266 | struct sh_vou_device *vou_dev = video_drvdata(file); |
1281 | struct sh_vou_device *vou_dev = video_get_drvdata(vdev); | ||
1282 | 1267 | ||
1283 | return v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, core, s_register, reg); | 1268 | return v4l2_device_call_until_err(&vou_dev->v4l2_dev, 0, core, s_register, reg); |
1284 | } | 1269 | } |