From: Thierry Reding <thierry.reding@gmail.com>
To: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm: Implement drm_get_pci_dev() dummy for !PCI
Date: Tue, 5 Aug 2014 13:41:01 +0200 [thread overview]
Message-ID: <1407238861-14257-1-git-send-email-thierry.reding@gmail.com> (raw)
From: Thierry Reding <treding@nvidia.com>
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 <treding@nvidia.com>
---
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)
{
--
2.0.4
reply other threads:[~2014-08-05 11:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1407238861-14257-1-git-send-email-thierry.reding@gmail.com \
--to=thierry.reding@gmail.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®