Commit 8b0a8b1b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mauro Carvalho Chehab
Browse files

media: ipu3-cio2: Introduce to_cio2_buffer() helper macro



Provide to_cio2_buffer() helper macro and convert users to make
code easier to read.

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 66ec7a97
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -823,8 +823,7 @@ static int cio2_vb2_buf_init(struct vb2_buffer *vb)
{
	struct cio2_device *cio2 = vb2_get_drv_priv(vb->vb2_queue);
	struct device *dev = &cio2->pci_dev->dev;
	struct cio2_buffer *b =
		container_of(vb, struct cio2_buffer, vbb.vb2_buf);
	struct cio2_buffer *b = to_cio2_buffer(vb);
	unsigned int pages = PFN_UP(vb->planes[0].length);
	unsigned int lops = DIV_ROUND_UP(pages + 1, CIO2_LOP_ENTRIES);
	struct sg_table *sg;
@@ -881,8 +880,7 @@ static void cio2_vb2_buf_queue(struct vb2_buffer *vb)
	struct device *dev = &cio2->pci_dev->dev;
	struct cio2_queue *q =
		container_of(vb->vb2_queue, struct cio2_queue, vbq);
	struct cio2_buffer *b =
		container_of(vb, struct cio2_buffer, vbb.vb2_buf);
	struct cio2_buffer *b = to_cio2_buffer(vb);
	struct cio2_fbpt_entry *entry;
	unsigned long flags;
	unsigned int i, j, next = q->bufs_next;
@@ -955,8 +953,7 @@ static void cio2_vb2_buf_cleanup(struct vb2_buffer *vb)
{
	struct cio2_device *cio2 = vb2_get_drv_priv(vb->vb2_queue);
	struct device *dev = &cio2->pci_dev->dev;
	struct cio2_buffer *b =
		container_of(vb, struct cio2_buffer, vbb.vb2_buf);
	struct cio2_buffer *b = to_cio2_buffer(vb);
	unsigned int i;

	/* Free LOP table */
+2 −0
Original line number Diff line number Diff line
@@ -338,6 +338,8 @@ struct cio2_buffer {
	unsigned int offset;
};

#define to_cio2_buffer(vb)	container_of(vb, struct cio2_buffer, vbb.vb2_buf)

struct csi2_bus_info {
	u32 port;
	u32 lanes;