Linux Media Controller development
 help / color / mirror / Atom feed
* Re: [PATCH v1] media: ipu3-cio2: Use macros from mm.h
@ 2020-10-29 20:16 Andy Shevchenko
  2020-10-29 22:08 ` Sakari Ailus
  2020-10-30  2:01 ` Cao, Bingbu
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-10-29 20:16 UTC (permalink / raw)
  To: Bingbu Cao
  Cc: Yong Zhi, Sakari Ailus, Bingbu Cao, linux-media, Tianshu Qiu,
	Mauro Carvalho Chehab

On Wed, Oct 28, 2020 at 04:11:05PM +0800, Bingbu Cao wrote:
> Andy, thanks for your patch.

> Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>

Thanks!

> On 10/28/20 2:14 AM, Andy Shevchenko wrote:

> > -	entry[1].second_entry.last_page_available_bytes =
> > -			(remaining & ~PAGE_MASK) ?
> > -				(remaining & ~PAGE_MASK) - 1 : PAGE_SIZE - 1;
> > +	remaining = offset_in_page(remaining);
> > +	entry[1].second_entry.last_page_available_bytes = (remaining ?: PAGE_SIZE) - 1;
> 
> Not really about this change, is there some coding style update? This line obviously over 80
> chars, but the latest script did not report warning.

There is a relaxation in the script, but now it's ambiguous with the documentation.
I just realized I can rewrite this as:

	remaining = offset_in_page(remaining) ?: PAGE_SIZE;
	entry[1].second_entry.last_page_available_bytes = remaining - 1;

Would it work for you?

> >  	/* Fill FBPT */
> >  	remaining = length;
> >  	i = 0;

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH v1] media: ipu3-cio2: Use macros from mm.h
@ 2020-10-27 18:14 Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-10-27 18:14 UTC (permalink / raw)
  To: Yong Zhi, Sakari Ailus, Bingbu Cao, linux-media, Tianshu Qiu,
	Mauro Carvalho Chehab
  Cc: Andy Shevchenko

There are few nice macros in mm.h, some of which we may use here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index d4b575813300..3ef5cf46647c 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -15,6 +15,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/iopoll.h>
+#include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pfn.h>
@@ -190,9 +191,8 @@ static void cio2_fbpt_entry_init_buf(struct cio2_device *cio2,
 	 * 4095 (PAGE_SIZE - 1) means every single byte in the last page
 	 * is available for DMA transfer.
 	 */
-	entry[1].second_entry.last_page_available_bytes =
-			(remaining & ~PAGE_MASK) ?
-				(remaining & ~PAGE_MASK) - 1 : PAGE_SIZE - 1;
+	remaining = offset_in_page(remaining);
+	entry[1].second_entry.last_page_available_bytes = (remaining ?: PAGE_SIZE) - 1;
 	/* Fill FBPT */
 	remaining = length;
 	i = 0;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-30  2:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-29 20:16 [PATCH v1] media: ipu3-cio2: Use macros from mm.h Andy Shevchenko
2020-10-29 22:08 ` Sakari Ailus
2020-10-29 23:06   ` Andy Shevchenko
2020-10-29 23:10     ` Sakari Ailus
2020-10-30  2:01 ` Cao, Bingbu
  -- strict thread matches above, loose matches on Subject: below --
2020-10-27 18:14 Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox