From patchwork Tue Oct 13 20:02:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 7388451 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E8E009F1B9 for ; Tue, 13 Oct 2015 20:03:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1CB1C207FB for ; Tue, 13 Oct 2015 20:03:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2A1F020793 for ; Tue, 13 Oct 2015 20:03:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751973AbbJMUDV (ORCPT ); Tue, 13 Oct 2015 16:03:21 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:60798 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751834AbbJMUDU (ORCPT ); Tue, 13 Oct 2015 16:03:20 -0400 Received: from wuerfel.localnet ([149.172.15.242]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0MHfXI-1Zinzc1V6a-003J5z; Tue, 13 Oct 2015 22:02:52 +0200 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Kevin Hilman , Ray Jui , Hauke Mehrtens , Tyler Baker , lkml , Olof Johansson , Mark Brown , bcm-kernel-feedback-list@broadcom.com, Linux PCI , Bjorn Helgaas Subject: [PATCH] PCI: iproc: fix 32-bit build error Date: Tue, 13 Oct 2015 22:02:48 +0200 Message-ID: <11199595.GgDE2yo8AA@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1442363962-29805-1-git-send-email-rjui@broadcom.com> <1442363962-29805-8-git-send-email-rjui@broadcom.com> MIME-Version: 1.0 X-Provags-ID: V03:K0:zrfFEn9ul8bbDgVtba275oFPQ4It1bOMAbBQjp6/eGpHN09jbZv vFD4euLsi968r/sAjjKNdvXCtPoqFxDtPK8SYod+TkN3NRDLKV31s6WzgJKMvF/CThqzPrF aTohtvVb3jlOeBRvfhEPLuWOMo1p135TOAnuJIpeN0kDr8cIqD2Rd5TyzKUGfz840WEZbkN YAgZoZko0SJG1jla9611A== X-UI-Out-Filterresults: notjunk:1; V01:K0:OTL6/3yhcjM=:L4INLFTh+2GIDehHiIIdG5 OZr8VQBkj+TNTSGRaug4FgBUyQMKUJxsnytA3whYZGyyR552mTu2I7lToHySts9bWTO7K8cei 1xJr2iXDbDonbEqdcuhQqDkFkSNq/YyczjWoJEIc4FiMQmnjC7+v/pK7eDtvTn/IH83Ckt4Dq aTHR6+ELEDI8bBHdnqMUffajX/W5v5RFUhMahDS11gHfpwAZzMQpIDDImMCZ3uQDITdg6ISZb tFUgxzMTLB5RtPIz7wcEP7L/hJqeHwzFXNlNwxgVRd5tb63JGuwHNE4QvQlm9FICp0hcSkzfe Vx6WJYSUt+gRd/sA1we5xcaV3ZoyedvPpnZj9FZsupwzI15OQ21f+ECmJuOeg8asQDkbiuFT5 Ux2ncRRK+WvYhW2xtdAb+YuUVrwbhH0c0SIXRsHLEH+77xY6Kxpcz9iAVKU654A1u5S9GLDO3 tM+FYh1dlu2cI8Cme4S/K8SaR5qHmn2vpv8CT6ZcomOcQHJcOwBLzZBxiQMS/SRBS24JjAePr BQDPcRu1YPus62PFrcEB7TAJ2T7nXZrJYZGK4kKmuxKeSHv4Z5sxOFhZFx7dB5sIlF5qmWVdf nG7aFwVvLsXFhfeXBrMTWb/+JbD2aVnfRj8VQjmMry1/Ylxv5aBxujXGDehQfOfOSl+RVNBGy cz1EryRjhPjfF75fTNN4CcrwQt/zh878eL1356FEl8jdP7j29TeG2M7H7jRjG3+sePAUS2Bg0 qq8zOPLJI83dzz3D Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The iproc PCI driver tries to figure out whether the MMIO window has a valid size, but does this using a 64-bit modulo operation, which is not allowed on 32-bit kernels and leads to a link error: drivers/built-in.o: In function `iproc_pcie_setup': :(.text+0x4b798): undefined reference to `__aeabi_uldivmod' This works around that error by using the div64_u64() function provided by the kernel. While this is an expensive operation, it is harmless because we only call it during the probing of the driver. Signed-off-by: Arnd Bergmann Fixes: 0ab99ca8eb6c ("PCI: iproc: Fix compile warnings") Tested-by: Kevin Hilman Acked-by: Ray Jui --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index f3481ddff344..abcb4be2ee19 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c @@ -235,12 +235,13 @@ static void iproc_pcie_enable(struct iproc_pcie *pcie) * * axi_addr -> iproc_pcie_address -> OARR -> OMAP -> pci_address */ -static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr, +int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr, u64 pci_addr, resource_size_t size) { struct iproc_pcie_ob *ob = &pcie->ob; unsigned i; u64 max_size = (u64)ob->window_size * MAX_NUM_OB_WINDOWS; + u64 remainder; if (size > max_size) { dev_err(pcie->dev, @@ -249,7 +250,8 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr, return -EINVAL; } - if (size % ob->window_size) { + div64_u64_rem(size, ob->window_size, &remainder); + if (remainder) { dev_err(pcie->dev, "res size %pap needs to be multiple of window size %pap\n", &size, &ob->window_size);