From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-media@vger.kernel.org, Yong Zhi <yong.zhi@intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Bingbu Cao <bingbu.cao@intel.com>,
Tian Shu Qiu <tian.shu.qiu@intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Subject: Re: [PATCH v2 02/10] media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant
Date: Fri, 9 Oct 2020 04:00:42 +0300 [thread overview]
Message-ID: <20201009010042.GE12857@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200817160734.12402-2-andriy.shevchenko@linux.intel.com>
Hi Andy,
Thank you for the patch.
On Mon, Aug 17, 2020 at 07:07:25PM +0300, Andy Shevchenko wrote:
> This constant is used in several places in the code, define it
> for better maintenance.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: renamed CIO2_MAX_ENTRIES -> CIO2_LOP_ENTRIES (Sakari)
> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 13 +++++--------
> drivers/media/pci/intel/ipu3/ipu3-cio2.h | 3 +++
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> index cb74d49934f1..a89cb3c7e0dc 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -127,7 +127,7 @@ static int cio2_fbpt_init_dummy(struct cio2_device *cio2)
> * List of Pointers(LOP) contains 1024x32b pointers to 4KB page each
> * Initialize each entry to dummy_page bus base address.
> */
> - for (i = 0; i < CIO2_PAGE_SIZE / sizeof(*cio2->dummy_lop); i++)
> + for (i = 0; i < CIO2_LOP_ENTRIES; i++)
> cio2->dummy_lop[i] = cio2->dummy_page_bus_addr >> PAGE_SHIFT;
>
> return 0;
> @@ -160,8 +160,7 @@ static void cio2_fbpt_entry_init_dummy(struct cio2_device *cio2,
> unsigned int i;
>
> entry[0].first_entry.first_page_offset = 0;
> - entry[1].second_entry.num_of_pages =
> - CIO2_PAGE_SIZE / sizeof(u32) * CIO2_MAX_LOPS;
> + entry[1].second_entry.num_of_pages = CIO2_LOP_ENTRIES * CIO2_MAX_LOPS;
> entry[1].second_entry.last_page_available_bytes = CIO2_PAGE_SIZE - 1;
>
> for (i = 0; i < CIO2_MAX_LOPS; i++)
> @@ -201,7 +200,7 @@ static void cio2_fbpt_entry_init_buf(struct cio2_device *cio2,
> i = 0;
> while (remaining > 0) {
> entry->lop_page_addr = b->lop_bus_addr[i] >> PAGE_SHIFT;
> - remaining -= CIO2_PAGE_SIZE / sizeof(u32) * CIO2_PAGE_SIZE;
> + remaining -= CIO2_LOP_ENTRIES * CIO2_PAGE_SIZE;
> entry++;
> i++;
> }
> @@ -841,10 +840,8 @@ static int cio2_vb2_buf_init(struct vb2_buffer *vb)
> struct device *dev = &cio2->pci_dev->dev;
> struct cio2_buffer *b =
> container_of(vb, struct cio2_buffer, vbb.vb2_buf);
> - static const unsigned int entries_per_page =
> - CIO2_PAGE_SIZE / sizeof(u32);
> unsigned int pages = DIV_ROUND_UP(vb->planes[0].length, CIO2_PAGE_SIZE);
> - unsigned int lops = DIV_ROUND_UP(pages + 1, entries_per_page);
> + unsigned int lops = DIV_ROUND_UP(pages + 1, CIO2_LOP_ENTRIES);
> struct sg_table *sg;
> struct sg_dma_page_iter sg_iter;
> unsigned int i, j;
> @@ -878,7 +875,7 @@ static int cio2_vb2_buf_init(struct vb2_buffer *vb)
> break;
> b->lop[i][j] = sg_page_iter_dma_address(&sg_iter) >> PAGE_SHIFT;
> j++;
> - if (j == entries_per_page) {
> + if (j == CIO2_LOP_ENTRIES) {
> i++;
> j = 0;
> }
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.h b/drivers/media/pci/intel/ipu3/ipu3-cio2.h
> index 7caab9b8c2b9..a64a829acc34 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.h
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.h
> @@ -4,6 +4,8 @@
> #ifndef __IPU3_CIO2_H
> #define __IPU3_CIO2_H
>
> +#include <linux/types.h>
> +
> #define CIO2_NAME "ipu3-cio2"
> #define CIO2_DEVICE_NAME "Intel IPU3 CIO2"
> #define CIO2_ENTITY_NAME "ipu3-csi2"
> @@ -17,6 +19,7 @@
> /* 32MB = 8xFBPT_entry */
> #define CIO2_MAX_LOPS 8
> #define CIO2_MAX_BUFFERS (PAGE_SIZE / 16 / CIO2_MAX_LOPS)
> +#define CIO2_LOP_ENTRIES (PAGE_SIZE / sizeof(u32))
Shouldn't this be CIO2_PAGE_SIZE instead of PAGE_SIZE ?
>
> #define CIO2_PAD_SINK 0
> #define CIO2_PAD_SOURCE 1
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2020-10-09 1:01 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 16:07 [PATCH v2 01/10] media: ipu3-cio2: Simplify cleanup code Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 02/10] media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant Andy Shevchenko
2020-10-09 1:00 ` Laurent Pinchart [this message]
2020-10-09 10:11 ` Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 03/10] media: ipu2-cio2: Replace custom definition with PAGE_SIZE Andy Shevchenko
2020-10-09 1:04 ` Laurent Pinchart
2020-10-09 11:42 ` Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 04/10] media: ipu3-cio2: Use macros from pfn.h Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 05/10] media: ipu3-cio2: Replace infinite loop by one with clear exit condition Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 06/10] media: ipu3-cio2: Use readl_poll_timeout() helper Andy Shevchenko
2020-10-09 1:14 ` Laurent Pinchart
2020-08-17 16:07 ` [PATCH v2 07/10] media: ipu3-cio2: Get rid of pci_set_master() duplication Andy Shevchenko
2020-10-09 1:09 ` Laurent Pinchart
2020-08-17 16:07 ` [PATCH v2 08/10] media: ipu3-cio2: Drop bogus check and error message Andy Shevchenko
2020-10-09 1:18 ` Laurent Pinchart
2020-10-09 10:17 ` Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 09/10] media: ipu3-cio2: Drop useless assignments Andy Shevchenko
2020-10-09 1:19 ` Laurent Pinchart
2020-08-17 16:07 ` [PATCH v2 10/10] media: ipu3-cio2: Update Copyright year and fix indentation issues Andy Shevchenko
2020-10-09 1:15 ` Laurent Pinchart
2020-10-09 0:57 ` [PATCH v2 01/10] media: ipu3-cio2: Simplify cleanup code Laurent Pinchart
2020-10-09 10:26 ` Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201009010042.GE12857@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bingbu.cao@intel.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tian.shu.qiu@intel.com \
--cc=yong.zhi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).