From patchwork Thu Dec 5 11:57:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 3287721 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE120C0D4A for ; Thu, 5 Dec 2013 11:58:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6E6D204EC for ; Thu, 5 Dec 2013 11:58:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8ECEE204EA for ; Thu, 5 Dec 2013 11:58:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755961Ab3LEL61 (ORCPT ); Thu, 5 Dec 2013 06:58:27 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:18029 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755656Ab3LEL60 (ORCPT ); Thu, 5 Dec 2013 06:58:26 -0500 Received: from 172.24.2.119 (EHLO szxeml209-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BNV92808; Thu, 05 Dec 2013 19:58:21 +0800 (CST) Received: from SZXEML406-HUB.china.huawei.com (10.82.67.93) by szxeml209-edg.china.huawei.com (172.24.2.184) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 5 Dec 2013 19:58:05 +0800 Received: from localhost (10.135.76.69) by szxeml406-hub.china.huawei.com (10.82.67.93) with Microsoft SMTP Server id 14.3.158.1; Thu, 5 Dec 2013 19:58:00 +0800 From: Yijing Wang To: Bjorn Helgaas , "David S. Miller" CC: , , , Yijing Wang , "Hanjun Guo" Subject: [PATCH 4/9] sparc/pci: Use dev_is_pci() to check whether it is pci device Date: Thu, 5 Dec 2013 19:57:58 +0800 Message-ID: <1386244678-19028-1-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.11.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.135.76.69] X-CFilter-Loop: Reflected 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, 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 Use PCI standard marco dev_is_pci() instead of directly compare pci_bus_type to check whether it is pci device. Signed-off-by: Yijing Wang --- arch/sparc/include/asm/dma-mapping.h | 10 ++++------ arch/sparc/kernel/iommu.c | 2 +- arch/sparc/kernel/ioport.c | 4 +--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 05fe53f..751c299 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h @@ -4,6 +4,7 @@ #include #include #include +#include #define DMA_ERROR_CODE (~(dma_addr_t)0x0) @@ -16,14 +17,13 @@ extern struct dma_map_ops *dma_ops; extern struct dma_map_ops *leon_dma_ops; extern struct dma_map_ops pci32_dma_ops; -extern struct bus_type pci_bus_type; static inline struct dma_map_ops *get_dma_ops(struct device *dev) { -#if defined(CONFIG_SPARC32) && defined(CONFIG_PCI) +#if defined(CONFIG_SPARC32) if (sparc_cpu_model == sparc_leon) return leon_dma_ops; - else if (dev->bus == &pci_bus_type) + else if (dev_is_pci(dev)) return &pci32_dma_ops; #endif return dma_ops; @@ -65,14 +65,12 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) static inline int dma_set_mask(struct device *dev, u64 mask) { -#ifdef CONFIG_PCI - if (dev->bus == &pci_bus_type) { + if (dev_is_pci(dev)) { if (!dev->dma_mask || !dma_supported(dev, mask)) return -EINVAL; *dev->dma_mask = mask; return 0; } -#endif return -EINVAL; } diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c index 070ed14..76663b0 100644 --- a/arch/sparc/kernel/iommu.c +++ b/arch/sparc/kernel/iommu.c @@ -854,7 +854,7 @@ int dma_supported(struct device *dev, u64 device_mask) return 1; #ifdef CONFIG_PCI - if (dev->bus == &pci_bus_type) + if (dev_is_pci(dev)) return pci64_dma_supported(to_pci_dev(dev), device_mask); #endif diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 2096468..0ead3cd 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c @@ -666,10 +666,8 @@ EXPORT_SYMBOL(dma_ops); */ int dma_supported(struct device *dev, u64 mask) { -#ifdef CONFIG_PCI - if (dev->bus == &pci_bus_type) + if (dev_is_pci(dev)) return 1; -#endif return 0; } EXPORT_SYMBOL(dma_supported);