Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2bc46b3a authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] media/pci: convert drivers to use the new vb2_queue dev field



Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Cc: Federico Vaga <federico.vaga@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 0e2f5118
Loading
Loading
Loading
Loading
+0 −9
Original line number Original line Diff line number Diff line
@@ -691,17 +691,10 @@ static int cobalt_probe(struct pci_dev *pci_dev,
	cobalt->pci_dev = pci_dev;
	cobalt->pci_dev = pci_dev;
	cobalt->instance = i;
	cobalt->instance = i;


	cobalt->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);
	if (IS_ERR(cobalt->alloc_ctx)) {
		kfree(cobalt);
		return -ENOMEM;
	}

	retval = v4l2_device_register(&pci_dev->dev, &cobalt->v4l2_dev);
	retval = v4l2_device_register(&pci_dev->dev, &cobalt->v4l2_dev);
	if (retval) {
	if (retval) {
		pr_err("cobalt: v4l2_device_register of card %d failed\n",
		pr_err("cobalt: v4l2_device_register of card %d failed\n",
				cobalt->instance);
				cobalt->instance);
		vb2_dma_sg_cleanup_ctx(cobalt->alloc_ctx);
		kfree(cobalt);
		kfree(cobalt);
		return retval;
		return retval;
	}
	}
@@ -782,7 +775,6 @@ static int cobalt_probe(struct pci_dev *pci_dev,
	cobalt_err("error %d on initialization\n", retval);
	cobalt_err("error %d on initialization\n", retval);


	v4l2_device_unregister(&cobalt->v4l2_dev);
	v4l2_device_unregister(&cobalt->v4l2_dev);
	vb2_dma_sg_cleanup_ctx(cobalt->alloc_ctx);
	kfree(cobalt);
	kfree(cobalt);
	return retval;
	return retval;
}
}
@@ -818,7 +810,6 @@ static void cobalt_remove(struct pci_dev *pci_dev)
	cobalt_info("removed cobalt card\n");
	cobalt_info("removed cobalt card\n");


	v4l2_device_unregister(v4l2_dev);
	v4l2_device_unregister(v4l2_dev);
	vb2_dma_sg_cleanup_ctx(cobalt->alloc_ctx);
	kfree(cobalt);
	kfree(cobalt);
}
}


+0 −1
Original line number Original line Diff line number Diff line
@@ -262,7 +262,6 @@ struct cobalt {
	int instance;
	int instance;
	struct pci_dev *pci_dev;
	struct pci_dev *pci_dev;
	struct v4l2_device v4l2_dev;
	struct v4l2_device v4l2_dev;
	void *alloc_ctx;


	void __iomem *bar0, *bar1;
	void __iomem *bar0, *bar1;


+1 −1
Original line number Original line Diff line number Diff line
@@ -54,7 +54,6 @@ static int cobalt_queue_setup(struct vb2_queue *q,
		*num_buffers = 3;
		*num_buffers = 3;
	if (*num_buffers > NR_BUFS)
	if (*num_buffers > NR_BUFS)
		*num_buffers = NR_BUFS;
		*num_buffers = NR_BUFS;
	alloc_ctxs[0] = s->cobalt->alloc_ctx;
	if (*num_planes)
	if (*num_planes)
		return sizes[0] < size ? -EINVAL : 0;
		return sizes[0] < size ? -EINVAL : 0;
	*num_planes = 1;
	*num_planes = 1;
@@ -1224,6 +1223,7 @@ static int cobalt_node_register(struct cobalt *cobalt, int node)
	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
	q->min_buffers_needed = 2;
	q->min_buffers_needed = 2;
	q->lock = &s->lock;
	q->lock = &s->lock;
	q->dev = &cobalt->pci_dev->dev;
	vdev->queue = q;
	vdev->queue = q;


	video_set_drvdata(vdev, s);
	video_set_drvdata(vdev, s);
+0 −1
Original line number Original line Diff line number Diff line
@@ -1148,7 +1148,6 @@ static int queue_setup(struct vb2_queue *q,
	dev->ts1.ts_packet_count = mpeglines;
	dev->ts1.ts_packet_count = mpeglines;
	*num_planes = 1;
	*num_planes = 1;
	sizes[0] = mpeglinesize * mpeglines;
	sizes[0] = mpeglinesize * mpeglines;
	alloc_ctxs[0] = dev->alloc_ctx;
	*num_buffers = mpegbufs;
	*num_buffers = mpegbufs;
	return 0;
	return 0;
}
}
+1 −9
Original line number Original line Diff line number Diff line
@@ -2005,14 +2005,9 @@ static int cx23885_initdev(struct pci_dev *pci_dev,
	err = pci_set_dma_mask(pci_dev, 0xffffffff);
	err = pci_set_dma_mask(pci_dev, 0xffffffff);
	if (err) {
	if (err) {
		printk("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);
		printk("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name);
		goto fail_context;
		goto fail_ctrl;
	}
	}


	dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);
	if (IS_ERR(dev->alloc_ctx)) {
		err = PTR_ERR(dev->alloc_ctx);
		goto fail_context;
	}
	err = request_irq(pci_dev->irq, cx23885_irq,
	err = request_irq(pci_dev->irq, cx23885_irq,
			  IRQF_SHARED, dev->name, dev);
			  IRQF_SHARED, dev->name, dev);
	if (err < 0) {
	if (err < 0) {
@@ -2041,8 +2036,6 @@ static int cx23885_initdev(struct pci_dev *pci_dev,
	return 0;
	return 0;


fail_irq:
fail_irq:
	vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
fail_context:
	cx23885_dev_unregister(dev);
	cx23885_dev_unregister(dev);
fail_ctrl:
fail_ctrl:
	v4l2_ctrl_handler_free(hdl);
	v4l2_ctrl_handler_free(hdl);
@@ -2068,7 +2061,6 @@ static void cx23885_finidev(struct pci_dev *pci_dev)
	pci_disable_device(pci_dev);
	pci_disable_device(pci_dev);


	cx23885_dev_unregister(dev);
	cx23885_dev_unregister(dev);
	vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
	v4l2_ctrl_handler_free(&dev->ctrl_handler);
	v4l2_ctrl_handler_free(&dev->ctrl_handler);
	v4l2_device_unregister(v4l2_dev);
	v4l2_device_unregister(v4l2_dev);
	kfree(dev);
	kfree(dev);
Loading