From patchwork Tue Sep 15 12:49:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Wang X-Patchwork-Id: 53639 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 799B122A22 for ; Tue, 15 Sep 2015 12:48:56 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf7807142wic.1 for ; Tue, 15 Sep 2015 05:48:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=SLC+LAb9siALseAFiyzJGW7da6DnayuoXb3cQ0VBCS4=; b=K0V8mfpnIXj/068Lld2VOe3OSC2PK0cIUiawwuLYIbbvQK0N4Bogj/2Xb8m+vJsUGr XsByLeLSCIC78tUpejWUlmKKRz5u5EhzpyC8qUT48FkCxFikdsZ8IF4IyVY4pPZUUhf0 oN9VPnxWACBC+yc47DGVavn+JXzjpBcRIUAZJlWWQ2l4T4AgCndeHKIa8uyW+GAOl+59 G2BhiORcQFsuFQhynUbRCSHC3WVeGtllET4NPheEJpDbaG5H9HJGnT2d6sniI8DG2dXh aO4S0uuTWUOdER21VEEvLlENxkLwwgGFHMpxemEit3XJbe/rpPafT8Hx5FwZ3RpN67SN cx6g== X-Gm-Message-State: ALoCoQn2nfGI2IJiY9AQ7gBYVZrv7UZdSEj5oesb5oK6bTgT+YPbAU1jQWvevcoiMkXm5+DsLzz9 X-Received: by 10.112.158.202 with SMTP id ww10mr4311648lbb.13.1442321335783; Tue, 15 Sep 2015 05:48:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.10 with SMTP id z10ls355948lae.88.gmail; Tue, 15 Sep 2015 05:48:55 -0700 (PDT) X-Received: by 10.112.16.67 with SMTP id e3mr20714893lbd.5.1442321335655; Tue, 15 Sep 2015 05:48:55 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id rd4si13349309lac.177.2015.09.15.05.48.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 05:48:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbmp1 with SMTP id mp1so84335470lbb.1 for ; Tue, 15 Sep 2015 05:48:55 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr20617525lbb.112.1442321335489; Tue, 15 Sep 2015 05:48:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1783146lbq; Tue, 15 Sep 2015 05:48:54 -0700 (PDT) X-Received: by 10.107.137.69 with SMTP id l66mr34003033iod.60.1442321334250; Tue, 15 Sep 2015 05:48:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g141si8767290iog.91.2015.09.15.05.48.53; Tue, 15 Sep 2015 05:48:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752353AbbIOMsw (ORCPT + 7 others); Tue, 15 Sep 2015 08:48:52 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:49534 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751816AbbIOMsw (ORCPT ); Tue, 15 Sep 2015 08:48:52 -0400 Received: from 172.24.1.49 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.49]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CSJ48635; Tue, 15 Sep 2015 20:43:36 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Tue, 15 Sep 2015 20:43:23 +0800 From: Zhou Wang To: Bjorn Helgaas , , , Arnd Bergmann , , , , , , , , , , CC: , , , , , , , , , Zhou Wang Subject: [PATCH v9 2/6] ARM/PCI: remove align_resource in pci_sys_data Date: Tue, 15 Sep 2015 20:49:17 +0800 Message-ID: <1442321361-174300-3-git-send-email-wangzhou1@hisilicon.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442321361-174300-1-git-send-email-wangzhou1@hisilicon.com> References: <1442321361-174300-1-git-send-email-wangzhou1@hisilicon.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: gabriele paoloni This patch is needed in order to unify the PCIe designware framework for ARM and ARM64 architectures. In the PCIe designware unification process we are calling pci_create_root_bus() passing a "sysdata" parameter that is the same for both ARM and ARM64 and is of type "struct pcie_port*". In the ARM case this will cause a problem with the function pcibios_align_resource(); in fact this will cast "dev->sysdata" to "struct pci_sys_data*", whereas designware had passed a "struct pcie_port*" pointer. This patch solves the issue by removing "align_resource" from "pci_sys_data" struct and defining a static global function pointer in "bios32.c" Signed-off-by: Gabriele Paoloni Signed-off-by: Zhou Wang Acked-by: Pratyush Anand --- arch/arm/include/asm/mach/pci.h | 6 ------ arch/arm/kernel/bios32.c | 12 ++++++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h index 8857d28..0070e85 100644 --- a/arch/arm/include/asm/mach/pci.h +++ b/arch/arm/include/asm/mach/pci.h @@ -52,12 +52,6 @@ struct pci_sys_data { u8 (*swizzle)(struct pci_dev *, u8 *); /* IRQ mapping */ int (*map_irq)(const struct pci_dev *, u8, u8); - /* Resource alignement requirements */ - resource_size_t (*align_resource)(struct pci_dev *dev, - const struct resource *res, - resource_size_t start, - resource_size_t size, - resource_size_t align); void *private_data; /* platform controller private data */ }; diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index 874e182..6551d28 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -17,6 +17,11 @@ #include static int debug_pci; +static resource_size_t (*align_resource)(struct pci_dev *dev, + const struct resource *res, + resource_size_t start, + resource_size_t size, + resource_size_t align) = NULL; /* * We can't use pci_get_device() here since we are @@ -456,7 +461,7 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, sys->busnr = busnr; sys->swizzle = hw->swizzle; sys->map_irq = hw->map_irq; - sys->align_resource = hw->align_resource; + align_resource = hw->align_resource; INIT_LIST_HEAD(&sys->resources); if (hw->private_data) @@ -572,7 +577,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, resource_size_t size, resource_size_t align) { struct pci_dev *dev = data; - struct pci_sys_data *sys = dev->sysdata; resource_size_t start = res->start; if (res->flags & IORESOURCE_IO && start & 0x300) @@ -580,8 +584,8 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, start = (start + align - 1) & ~(align - 1); - if (sys->align_resource) - return sys->align_resource(dev, res, start, size, align); + if (align_resource) + return align_resource(dev, res, start, size, align); return start; }