From patchwork Tue Oct 27 18:14:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 310979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 137C1C388F9 for ; Tue, 27 Oct 2020 18:14:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD13322265 for ; Tue, 27 Oct 2020 18:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1825808AbgJ0SOJ (ORCPT ); Tue, 27 Oct 2020 14:14:09 -0400 Received: from mga03.intel.com ([134.134.136.65]:35785 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756492AbgJ0SOI (ORCPT ); Tue, 27 Oct 2020 14:14:08 -0400 IronPort-SDR: ZAfaEY1+D8H8kqLf4IiqWoNlYj/sBPEz9oqiEMEiiFIyqjLggDwhOzwrotx6fRfzI0MofH5hez HgKnMX9yhYYg== X-IronPort-AV: E=McAfee;i="6000,8403,9787"; a="168234149" X-IronPort-AV: E=Sophos;i="5.77,424,1596524400"; d="scan'208";a="168234149" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2020 11:14:07 -0700 IronPort-SDR: Kr/cnUwOXEUdOiiYEzvC3lEQpNhyTu7gp55zNNQ/sbt2GudugD/eNN7wvQZ+1I7qfGrqeIJlH8 tW50TzCGYMyA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,424,1596524400"; d="scan'208";a="350370917" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 27 Oct 2020 11:14:05 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id BB49C179; Tue, 27 Oct 2020 20:14:04 +0200 (EET) From: Andy Shevchenko To: Yong Zhi , Sakari Ailus , Bingbu Cao , linux-media@vger.kernel.org, Tianshu Qiu , Mauro Carvalho Chehab Cc: Andy Shevchenko Subject: [PATCH v1] media: ipu3-cio2: Use macros from mm.h Date: Tue, 27 Oct 2020 20:14:04 +0200 Message-Id: <20201027181404.20996-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are few nice macros in mm.h, some of which we may use here. Signed-off-by: Andy Shevchenko --- 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 #include #include +#include #include #include #include @@ -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;