[PATCH] drm/legacy: remove some pci legacy code if not needed.
Dave Airlie
airlied at gmail.com
Wed Apr 24 03:42:56 UTC 2019
From: Dave Airlie <airlied at redhat.com>
The legacy device list and pci legacy init/exit don't need to
be built if not supporting legacy.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
drivers/gpu/drm/drm_pci.c | 8 ++++++--
include/drm/drm_device.h | 10 +++-------
include/drm/drm_pci.h | 2 ++
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 693748ad8b88..a61ef7baba72 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -265,9 +265,10 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
/* No locking needed since shadow-attach is single-threaded since it may
* only be called from the per-driver module init hook. */
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
if (drm_core_check_feature(dev, DRIVER_LEGACY))
list_add_tail(&dev->legacy_dev_list, &driver->legacy_dev_list);
-
+#endif
return 0;
err_agp:
@@ -279,6 +280,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
}
EXPORT_SYMBOL(drm_get_pci_dev);
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
/**
* drm_legacy_pci_init - shadow-attach a legacy DRM PCI driver
* @driver: DRM device driver
@@ -325,7 +327,7 @@ int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
return 0;
}
EXPORT_SYMBOL(drm_legacy_pci_init);
-
+#endif
#else
void drm_pci_agp_destroy(struct drm_device *dev) {}
@@ -337,6 +339,7 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
}
#endif
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
/**
* drm_legacy_pci_exit - unregister shadow-attach legacy DRM driver
* @driver: DRM device driver
@@ -362,3 +365,4 @@ void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
DRM_INFO("Module unloaded\n");
}
EXPORT_SYMBOL(drm_legacy_pci_exit);
+#endif
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 7f9ef709b2b6..11daabd8ccbc 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -50,13 +50,6 @@ enum switch_power_state {
* may contain multiple heads.
*/
struct drm_device {
- /**
- * @legacy_dev_list:
- *
- * List of devices per driver for stealth attach cleanup
- */
- struct list_head legacy_dev_list;
-
/** @if_version: Highest interface version set */
int if_version;
@@ -307,6 +300,9 @@ struct drm_device {
/* Everything below here is for legacy driver, never use! */
/* private: */
#if IS_ENABLED(CONFIG_DRM_LEGACY)
+ /* List of devices per driver for stealth attach cleanup */
+ struct list_head legacy_dev_list;
+
/* Context handle management - linked list of context handles */
struct list_head ctxlist;
diff --git a/include/drm/drm_pci.h b/include/drm/drm_pci.h
index 8181e9e7cf1d..36b3f2689e16 100644
--- a/include/drm/drm_pci.h
+++ b/include/drm/drm_pci.h
@@ -43,8 +43,10 @@ struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size,
size_t align);
void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah);
+#if IS_ENABLED(CONFIG_DRM_LEGACY)
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);
+#endif
#ifdef CONFIG_PCI
int drm_get_pci_dev(struct pci_dev *pdev,
const struct pci_device_id *ent,
--
2.21.0
More information about the dri-devel
mailing list