From patchwork Tue Aug 5 11:41:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 4678381 Return-Path: X-Original-To: patchwork-dri-devel@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 9BE0DC0338 for ; Tue, 5 Aug 2014 11:41:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE29420125 for ; Tue, 5 Aug 2014 11:41:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E8AE220120 for ; Tue, 5 Aug 2014 11:41:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 470666E1B5; Tue, 5 Aug 2014 04:41:10 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by gabe.freedesktop.org (Postfix) with ESMTP id 35F426E1B5 for ; Tue, 5 Aug 2014 04:41:08 -0700 (PDT) Received: by mail-wg0-f42.google.com with SMTP id l18so855851wgh.1 for ; Tue, 05 Aug 2014 04:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=U7dtX2vYWOlNAlRq0mudAZad/Ugub+Kea0YWMl/SI/Q=; b=ga1+lDETayIQ4B1/EtlK7qvQqeX1g9QK+kvTfRRwaGeVtaXXp9oUf/OXtkUzIlwc95 tdTfHdn0NUsqX8POJ6CvUAdXb+tmCy9GDmBa6bIwin8ROfJaNRZhskNIuhIKq+esI5wl FBwQ9VSp++sItLXrX2D+gbE+jiAxssAY6Mrx3Fz5aYNp6GHAzT10CINlXqp7dA5gHRnX HdVvOz9cdI1C/V8aGLNnmOx5vAfINLRUhaG/uCXJUOhL6HMUArsOCSuygi8p3imvlRXT ZPJCPvdnmRQJ6q46O1NY3VbYpONCTv3zqo4DRwzSAYJd7oWb90amVughBQjNy8iuRCNR sy3Q== X-Received: by 10.181.9.104 with SMTP id dr8mr5366108wid.26.1407238865747; Tue, 05 Aug 2014 04:41:05 -0700 (PDT) Received: from localhost (port-92291.pppoe.wtnet.de. [84.46.72.252]) by mx.google.com with ESMTPSA id d4sm6922972wiy.13.2014.08.05.04.41.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Aug 2014 04:41:05 -0700 (PDT) From: Thierry Reding To: David Airlie Subject: [PATCH] drm: Implement drm_get_pci_dev() dummy for !PCI Date: Tue, 5 Aug 2014 13:41:01 +0200 Message-Id: <1407238861-14257-1-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.0.4 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 From: Thierry Reding Implementing a dummy of this function allows drivers that use it to be built on platforms that don't have PCI. This can happen for example if the nouveau driver is built on Tegra without PCI enabled (or on 64-bit ARM where PCI is not yet implemented). Signed-off-by: Thierry Reding --- include/drm/drmP.h | 9 +++++++++ include/linux/iommu.h | 18 +++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 0e4c13c3cf33..d71a00af1796 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1663,9 +1663,18 @@ void drm_pci_agp_destroy(struct drm_device *dev); extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); +#ifdef CONFIG_PCI extern int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver); +#else +static inline int drm_get_pci_dev(struct pci_dev *pdev, + const struct pci_device_id *ent, + struct drm_driver *driver) +{ + return -ENOSYS; +} +#endif #define DRM_PCIE_SPEED_25 1 #define DRM_PCIE_SPEED_50 2 diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 7118b0c9b1ad..584e0f8b7173 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -44,16 +44,12 @@ typedef int (*iommu_fault_handler_t)(struct iommu_domain *, struct device *, unsigned long, int, void *); struct iommu { + const struct iommu_ops *ops; struct device *dev; struct list_head list; - - const struct iommu_ops *ops; }; -int iommu_add(struct iommu *iommu); -void iommu_remove(struct iommu *iommu); - struct iommu_domain_geometry { dma_addr_t aperture_start; /* First address that can be mapped */ dma_addr_t aperture_end; /* Last address that can be mapped */ @@ -154,6 +150,9 @@ struct iommu_ops { #ifdef CONFIG_IOMMU_API +extern int iommu_add(struct iommu *iommu); +extern void iommu_remove(struct iommu *iommu); + extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); extern bool iommu_present(struct bus_type *bus); extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); @@ -260,6 +259,15 @@ static inline int report_iommu_fault(struct iommu_domain *domain, #else /* CONFIG_IOMMU_API */ +static inline int iommu_add(struct iommu *iommu) +{ + return -ENOSYS; +} + +static inline void iommu_remove(struct iommu *iommu) +{ +} + static inline int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops) {