Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Mark PCI AGP helpers as legacy

DRM's AGP helpers for PCI are only required by legacy drivers. Put them
behind CONFIG_DRM_LEGACY and add the _legacy_ infix.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210507185709.22797-4-tzimmermann@suse.de

+17 -18
+1 -3
drivers/gpu/drm/drm_drv.c
··· 941 941 if (dev->driver->unload) 942 942 dev->driver->unload(dev); 943 943 944 - if (dev->agp) 945 - drm_pci_agp_destroy(dev); 946 - 944 + drm_legacy_pci_agp_destroy(dev); 947 945 drm_legacy_rmmaps(dev); 948 946 949 947 remove_compat_control_link(dev);
-5
drivers/gpu/drm/drm_internal.h
··· 56 56 /* drm_pci.c */ 57 57 int drm_legacy_irq_by_busid(struct drm_device *dev, void *data, 58 58 struct drm_file *file_priv); 59 - void drm_pci_agp_destroy(struct drm_device *dev); 60 59 int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master); 61 60 62 61 #else ··· 64 65 struct drm_file *file_priv) 65 66 { 66 67 return -EINVAL; 67 - } 68 - 69 - static inline void drm_pci_agp_destroy(struct drm_device *dev) 70 - { 71 68 } 72 69 73 70 static inline int drm_pci_set_busid(struct drm_device *dev,
+6
drivers/gpu/drm/drm_legacy.h
··· 211 211 static inline void drm_master_legacy_init(struct drm_master *master) {} 212 212 #endif 213 213 214 + #if IS_ENABLED(CONFIG_DRM_LEGACY) && IS_ENABLED(CONFIG_PCI) 215 + void drm_legacy_pci_agp_destroy(struct drm_device *dev); 216 + #else 217 + static inline void drm_legacy_pci_agp_destroy(struct drm_device *dev) {} 218 + #endif 219 + 214 220 #endif /* __DRM_LEGACY_H__ */
+10 -10
drivers/gpu/drm/drm_pci.c
··· 119 119 return drm_pci_irq_by_busid(dev, p); 120 120 } 121 121 122 - void drm_pci_agp_destroy(struct drm_device *dev) 122 + #ifdef CONFIG_DRM_LEGACY 123 + 124 + void drm_legacy_pci_agp_destroy(struct drm_device *dev) 123 125 { 124 126 if (dev->agp) { 125 127 arch_phys_wc_del(dev->agp->agp_mtrr); ··· 131 129 } 132 130 } 133 131 134 - #ifdef CONFIG_DRM_LEGACY 135 - 136 - static void drm_pci_agp_init(struct drm_device *dev) 132 + static void drm_legacy_pci_agp_init(struct drm_device *dev) 137 133 { 138 134 if (drm_core_check_feature(dev, DRIVER_USE_AGP)) { 139 135 if (pci_find_capability(to_pci_dev(dev->dev), PCI_CAP_ID_AGP)) ··· 145 145 } 146 146 } 147 147 148 - static int drm_get_pci_dev(struct pci_dev *pdev, 149 - const struct pci_device_id *ent, 150 - const struct drm_driver *driver) 148 + static int drm_legacy_get_pci_dev(struct pci_dev *pdev, 149 + const struct pci_device_id *ent, 150 + const struct drm_driver *driver) 151 151 { 152 152 struct drm_device *dev; 153 153 int ret; ··· 169 169 if (drm_core_check_feature(dev, DRIVER_MODESET)) 170 170 pci_set_drvdata(pdev, dev); 171 171 172 - drm_pci_agp_init(dev); 172 + drm_legacy_pci_agp_init(dev); 173 173 174 174 ret = drm_dev_register(dev, ent->driver_data); 175 175 if (ret) ··· 184 184 return 0; 185 185 186 186 err_agp: 187 - drm_pci_agp_destroy(dev); 187 + drm_legacy_pci_agp_destroy(dev); 188 188 pci_disable_device(pdev); 189 189 err_free: 190 190 drm_dev_put(dev); ··· 231 231 232 232 /* stealth mode requires a manual probe */ 233 233 pci_dev_get(pdev); 234 - drm_get_pci_dev(pdev, pid, driver); 234 + drm_legacy_get_pci_dev(pdev, pid, driver); 235 235 } 236 236 } 237 237 return 0;