aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/davinci
diff options
context:
space:
mode:
authorLad, Prabhakar <prabhakar.csengg@gmail.com>2015-03-08 17:57:24 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-02 17:12:43 -0400
commite933c6bc67d8129d184d5add4230eb8250646cb8 (patch)
tree675ac5b948388f50d1c08f32d9639c611c65e8bd /drivers/media/platform/davinci
parent8eef6669d3d4a9a8694bb6703fb81bd17bb9080e (diff)
[media] media: davinci: vpif_display: embed video_device struct in channel_obj
Embed video_device struct (video_dev) in channel_obj and also the Unregister path doesn't need to free the video_device structure, hence, change the video_device.release callback point to video_device_release_empty. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/davinci')
-rw-r--r--drivers/media/platform/davinci/vpif_display.c49
-rw-r--r--drivers/media/platform/davinci/vpif_display.h2
2 files changed, 10 insertions, 41 deletions
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c
index 839c24de1fd8..682e5d578bf7 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -829,7 +829,7 @@ static int vpif_set_output(struct vpif_display_config *vpif_cfg,
829 ch->sd = sd; 829 ch->sd = sd;
830 if (chan_cfg->outputs != NULL) 830 if (chan_cfg->outputs != NULL)
831 /* update tvnorms from the sub device output info */ 831 /* update tvnorms from the sub device output info */
832 ch->video_dev->tvnorms = chan_cfg->outputs[index].output.std; 832 ch->video_dev.tvnorms = chan_cfg->outputs[index].output.std;
833 return 0; 833 return 0;
834} 834}
835 835
@@ -1204,16 +1204,16 @@ static int vpif_probe_complete(void)
1204 ch, &ch->video_dev); 1204 ch, &ch->video_dev);
1205 1205
1206 /* Initialize the video_device structure */ 1206 /* Initialize the video_device structure */
1207 vdev = ch->video_dev; 1207 vdev = &ch->video_dev;
1208 strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name)); 1208 strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name));
1209 vdev->release = video_device_release; 1209 vdev->release = video_device_release_empty;
1210 vdev->fops = &vpif_fops; 1210 vdev->fops = &vpif_fops;
1211 vdev->ioctl_ops = &vpif_ioctl_ops; 1211 vdev->ioctl_ops = &vpif_ioctl_ops;
1212 vdev->v4l2_dev = &vpif_obj.v4l2_dev; 1212 vdev->v4l2_dev = &vpif_obj.v4l2_dev;
1213 vdev->vfl_dir = VFL_DIR_TX; 1213 vdev->vfl_dir = VFL_DIR_TX;
1214 vdev->queue = q; 1214 vdev->queue = q;
1215 vdev->lock = &common->lock; 1215 vdev->lock = &common->lock;
1216 video_set_drvdata(ch->video_dev, ch); 1216 video_set_drvdata(&ch->video_dev, ch);
1217 err = video_register_device(vdev, VFL_TYPE_GRABBER, 1217 err = video_register_device(vdev, VFL_TYPE_GRABBER,
1218 (j ? 3 : 2)); 1218 (j ? 3 : 2));
1219 if (err < 0) 1219 if (err < 0)
@@ -1227,9 +1227,7 @@ probe_out:
1227 ch = vpif_obj.dev[k]; 1227 ch = vpif_obj.dev[k];
1228 common = &ch->common[k]; 1228 common = &ch->common[k];
1229 vb2_dma_contig_cleanup_ctx(common->alloc_ctx); 1229 vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
1230 video_unregister_device(ch->video_dev); 1230 video_unregister_device(&ch->video_dev);
1231 video_device_release(ch->video_dev);
1232 ch->video_dev = NULL;
1233 } 1231 }
1234 return err; 1232 return err;
1235} 1233}
@@ -1246,13 +1244,11 @@ static int vpif_async_complete(struct v4l2_async_notifier *notifier)
1246static __init int vpif_probe(struct platform_device *pdev) 1244static __init int vpif_probe(struct platform_device *pdev)
1247{ 1245{
1248 struct vpif_subdev_info *subdevdata; 1246 struct vpif_subdev_info *subdevdata;
1249 int i, j = 0, err = 0;
1250 int res_idx = 0;
1251 struct i2c_adapter *i2c_adap; 1247 struct i2c_adapter *i2c_adap;
1252 struct channel_obj *ch;
1253 struct video_device *vfd;
1254 struct resource *res; 1248 struct resource *res;
1255 int subdev_count; 1249 int subdev_count;
1250 int res_idx = 0;
1251 int i, err;
1256 1252
1257 vpif_dev = &pdev->dev; 1253 vpif_dev = &pdev->dev;
1258 err = initialize_vpif(); 1254 err = initialize_vpif();
@@ -1281,25 +1277,6 @@ static __init int vpif_probe(struct platform_device *pdev)
1281 res_idx++; 1277 res_idx++;
1282 } 1278 }
1283 1279
1284 for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
1285 /* Get the pointer to the channel object */
1286 ch = vpif_obj.dev[i];
1287
1288 /* Allocate memory for video device */
1289 vfd = video_device_alloc();
1290 if (vfd == NULL) {
1291 for (j = 0; j < i; j++) {
1292 ch = vpif_obj.dev[j];
1293 video_device_release(ch->video_dev);
1294 }
1295 err = -ENOMEM;
1296 goto vpif_unregister;
1297 }
1298
1299 /* Set video_dev to the video device */
1300 ch->video_dev = vfd;
1301 }
1302
1303 vpif_obj.config = pdev->dev.platform_data; 1280 vpif_obj.config = pdev->dev.platform_data;
1304 subdev_count = vpif_obj.config->subdev_count; 1281 subdev_count = vpif_obj.config->subdev_count;
1305 subdevdata = vpif_obj.config->subdevinfo; 1282 subdevdata = vpif_obj.config->subdevinfo;
@@ -1308,7 +1285,7 @@ static __init int vpif_probe(struct platform_device *pdev)
1308 if (vpif_obj.sd == NULL) { 1285 if (vpif_obj.sd == NULL) {
1309 vpif_err("unable to allocate memory for subdevice pointers\n"); 1286 vpif_err("unable to allocate memory for subdevice pointers\n");
1310 err = -ENOMEM; 1287 err = -ENOMEM;
1311 goto vpif_sd_error; 1288 goto vpif_unregister;
1312 } 1289 }
1313 1290
1314 if (!vpif_obj.config->asd_sizes) { 1291 if (!vpif_obj.config->asd_sizes) {
@@ -1348,12 +1325,6 @@ static __init int vpif_probe(struct platform_device *pdev)
1348 1325
1349probe_subdev_out: 1326probe_subdev_out:
1350 kfree(vpif_obj.sd); 1327 kfree(vpif_obj.sd);
1351vpif_sd_error:
1352 for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) {
1353 ch = vpif_obj.dev[i];
1354 /* Note: does nothing if ch->video_dev == NULL */
1355 video_device_release(ch->video_dev);
1356 }
1357vpif_unregister: 1328vpif_unregister:
1358 v4l2_device_unregister(&vpif_obj.v4l2_dev); 1329 v4l2_device_unregister(&vpif_obj.v4l2_dev);
1359 1330
@@ -1379,9 +1350,7 @@ static int vpif_remove(struct platform_device *device)
1379 common = &ch->common[VPIF_VIDEO_INDEX]; 1350 common = &ch->common[VPIF_VIDEO_INDEX];
1380 vb2_dma_contig_cleanup_ctx(common->alloc_ctx); 1351 vb2_dma_contig_cleanup_ctx(common->alloc_ctx);
1381 /* Unregister video device */ 1352 /* Unregister video device */
1382 video_unregister_device(ch->video_dev); 1353 video_unregister_device(&ch->video_dev);
1383
1384 ch->video_dev = NULL;
1385 kfree(vpif_obj.dev[i]); 1354 kfree(vpif_obj.dev[i]);
1386 } 1355 }
1387 1356
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h
index 7b21a7607674..849e0e385f18 100644
--- a/drivers/media/platform/davinci/vpif_display.h
+++ b/drivers/media/platform/davinci/vpif_display.h
@@ -100,7 +100,7 @@ struct common_obj {
100 100
101struct channel_obj { 101struct channel_obj {
102 /* V4l2 specific parameters */ 102 /* V4l2 specific parameters */
103 struct video_device *video_dev; /* Identifies video device for 103 struct video_device video_dev; /* Identifies video device for
104 * this channel */ 104 * this channel */
105 u32 field_id; /* Indicates id of the field 105 u32 field_id; /* Indicates id of the field
106 * which is being displayed */ 106 * which is being displayed */