From patchwork Mon Mar 30 14:19:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 11465675 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AC50C159A for ; Mon, 30 Mar 2020 14:22:54 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6EAFE2073B for ; Mon, 30 Mar 2020 14:22:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6EAFE2073B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EB11910FC36E6; Mon, 30 Mar 2020 07:23:43 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.249.212.190; helo=huawei.com; envelope-from=yuehaibing@huawei.com; receiver= Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 202E410FC337F for ; Mon, 30 Mar 2020 07:23:40 -0700 (PDT) Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 6B56F5D28BC866C93547; Mon, 30 Mar 2020 22:22:47 +0800 (CST) Received: from localhost (10.173.223.234) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Mar 2020 22:22:39 +0800 From: YueHaibing To: , , , , , Subject: [PATCH -next] libnvdimm/region: Fix build error Date: Mon, 30 Mar 2020 22:19:43 +0800 Message-ID: <20200330141943.31696-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.173.223.234] X-CFilter-Loop: Reflected Message-ID-Hash: 2PVF6HM6YXPWR7HP56DLDJOJYSWRGTLE X-Message-ID-Hash: 2PVF6HM6YXPWR7HP56DLDJOJYSWRGTLE X-MailFrom: yuehaibing@huawei.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, YueHaibing X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: On CONFIG_PPC32=y build fails: drivers/nvdimm/region_devs.c:1034:14: note: in expansion of macro ‘do_div’ remainder = do_div(per_mapping, mappings); ^~~~~~ In file included from ./arch/powerpc/include/generated/asm/div64.h:1:0, from ./include/linux/kernel.h:18, from ./include/asm-generic/bug.h:19, from ./arch/powerpc/include/asm/bug.h:109, from ./include/linux/bug.h:5, from ./include/linux/scatterlist.h:7, from drivers/nvdimm/region_devs.c:5: ./include/asm-generic/div64.h:243:22: error: passing argument 1 of ‘__div64_32’ from incompatible pointer type [-Werror=incompatible-pointer-types] __rem = __div64_32(&(n), __base); \ Use div_u64 instead of do_div to fix this. Fixes: 2522afb86a8c ("libnvdimm/region: Introduce an 'align' attribute") Signed-off-by: YueHaibing --- drivers/nvdimm/region_devs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index bf239e783940..2291f0649d27 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -564,7 +564,7 @@ static ssize_t align_store(struct device *dev, * space for the namespace. */ dpa = val; - remainder = do_div(dpa, nd_region->ndr_mappings); + remainder = div_u64(dpa, nd_region->ndr_mappings); if (!is_power_of_2(dpa) || dpa < PAGE_SIZE || val > region_size(nd_region) || remainder) return -EINVAL; @@ -1031,7 +1031,7 @@ static unsigned long default_align(struct nd_region *nd_region) mappings = max_t(u16, 1, nd_region->ndr_mappings); per_mapping = align; - remainder = do_div(per_mapping, mappings); + remainder = div_u64(per_mapping, mappings); if (remainder) align *= mappings;