summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/intel/ipu3/ipu3-cio2.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-10-28 16:55:20 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-11-25 09:49:57 +0100
commita25ba1021a6275941c44c639ad76a83248182022 (patch)
treeee9a72c2410549bba60e4b6438b7ff655f656f21 /drivers/media/pci/intel/ipu3/ipu3-cio2.c
parent9463e07df8e0f93931e32c6f415d3f82bda63f35 (diff)
downloadlinux-a25ba1021a6275941c44c639ad76a83248182022.tar.bz2
media: ipu3-cio2: Use macros from mm.h
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> Reviewed-by: Bingbu Cao <bingbu.cao@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/pci/intel/ipu3/ipu3-cio2.c')
-rw-r--r--drivers/media/pci/intel/ipu3/ipu3-cio2.c6
1 files 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 d060cfe473d8..4fc36b5a8090 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -14,6 +14,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>
@@ -194,9 +195,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) ?: PAGE_SIZE;
+ entry[1].second_entry.last_page_available_bytes = remaining - 1;
/* Fill FBPT */
remaining = length;
i = 0;