Commit 5c7a0bb0 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/pci: Only build drm_pci.c if CONFIG_PCI is set

Non-PCI systems should not build PCI helpers. Set up source code, header
file and Makefile accordingly.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191203100406.9674-2-tzimmermann@suse.de
parent 99a37551
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
drm-y := drm_auth.o drm_cache.o \ drm-y := drm_auth.o drm_cache.o \
drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
drm_memory.o drm_drv.o drm_pci.o \ drm_memory.o drm_drv.o \
drm_sysfs.o drm_hashtab.o drm_mm.o \ drm_sysfs.o drm_hashtab.o drm_mm.o \
drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \ drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \
drm_encoder_slave.o \ drm_encoder_slave.o \
...@@ -28,6 +28,7 @@ drm-$(CONFIG_DRM_GEM_SHMEM_HELPER) += drm_gem_shmem_helper.o ...@@ -28,6 +28,7 @@ drm-$(CONFIG_DRM_GEM_SHMEM_HELPER) += drm_gem_shmem_helper.o
drm-$(CONFIG_DRM_PANEL) += drm_panel.o drm-$(CONFIG_DRM_PANEL) += drm_panel.o
drm-$(CONFIG_OF) += drm_of.o drm-$(CONFIG_OF) += drm_of.o
drm-$(CONFIG_AGP) += drm_agpsupport.o drm-$(CONFIG_AGP) += drm_agpsupport.o
drm-$(CONFIG_PCI) += drm_pci.o
drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o
drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
......
...@@ -45,12 +45,34 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor); ...@@ -45,12 +45,34 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor);
void drm_file_free(struct drm_file *file); void drm_file_free(struct drm_file *file);
void drm_lastclose(struct drm_device *dev); void drm_lastclose(struct drm_device *dev);
#ifdef CONFIG_PCI
/* drm_pci.c */ /* drm_pci.c */
int drm_irq_by_busid(struct drm_device *dev, void *data, int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
void drm_pci_agp_destroy(struct drm_device *dev); void drm_pci_agp_destroy(struct drm_device *dev);
int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master); int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master);
#else
static inline int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
return -EINVAL;
}
static inline void drm_pci_agp_destroy(struct drm_device *dev)
{
}
static inline int drm_pci_set_busid(struct drm_device *dev,
struct drm_master *master)
{
return -EINVAL;
}
#endif
/* drm_prime.c */ /* drm_prime.c */
int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
......
...@@ -125,8 +125,6 @@ void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) ...@@ -125,8 +125,6 @@ void drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah)
EXPORT_SYMBOL(drm_pci_free); EXPORT_SYMBOL(drm_pci_free);
#ifdef CONFIG_PCI
static int drm_get_pci_domain(struct drm_device *dev) static int drm_get_pci_domain(struct drm_device *dev)
{ {
#ifndef __alpha__ #ifndef __alpha__
...@@ -331,17 +329,6 @@ int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) ...@@ -331,17 +329,6 @@ int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
} }
EXPORT_SYMBOL(drm_legacy_pci_init); EXPORT_SYMBOL(drm_legacy_pci_init);
#else
void drm_pci_agp_destroy(struct drm_device *dev) {}
int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
return -EINVAL;
}
#endif
/** /**
* drm_legacy_pci_exit - unregister shadow-attach legacy DRM driver * drm_legacy_pci_exit - unregister shadow-attach legacy DRM driver
* @driver: DRM device driver * @driver: DRM device driver
......
...@@ -38,24 +38,52 @@ struct drm_dma_handle; ...@@ -38,24 +38,52 @@ struct drm_dma_handle;
struct drm_device; struct drm_device;
struct drm_driver; struct drm_driver;
struct drm_master; struct drm_master;
struct pci_device;
#ifdef CONFIG_PCI
struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size, struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size,
size_t align); size_t align);
void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah); void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
#ifdef CONFIG_PCI
int drm_get_pci_dev(struct pci_dev *pdev, int drm_get_pci_dev(struct pci_dev *pdev,
const struct pci_device_id *ent, const struct pci_device_id *ent,
struct drm_driver *driver); struct drm_driver *driver);
int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
#else #else
static inline struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev,
size_t size, size_t align)
{
return NULL;
}
static inline void drm_pci_free(struct drm_device *dev,
struct drm_dma_handle *dmah)
{
}
static inline int drm_get_pci_dev(struct pci_dev *pdev, static inline int drm_get_pci_dev(struct pci_dev *pdev,
const struct pci_device_id *ent, const struct pci_device_id *ent,
struct drm_driver *driver) struct drm_driver *driver)
{ {
return -ENOSYS; return -ENOSYS;
} }
static inline int drm_legacy_pci_init(struct drm_driver *driver,
struct pci_driver *pdriver)
{
return -EINVAL;
}
static inline void drm_legacy_pci_exit(struct drm_driver *driver,
struct pci_driver *pdriver)
{
}
#endif #endif
#endif /* _DRM_PCI_H_ */ #endif /* _DRM_PCI_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment