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
This commit is contained in:
@ -941,9 +941,7 @@ void drm_dev_unregister(struct drm_device *dev)
|
|||||||
if (dev->driver->unload)
|
if (dev->driver->unload)
|
||||||
dev->driver->unload(dev);
|
dev->driver->unload(dev);
|
||||||
|
|
||||||
if (dev->agp)
|
drm_legacy_pci_agp_destroy(dev);
|
||||||
drm_pci_agp_destroy(dev);
|
|
||||||
|
|
||||||
drm_legacy_rmmaps(dev);
|
drm_legacy_rmmaps(dev);
|
||||||
|
|
||||||
remove_compat_control_link(dev);
|
remove_compat_control_link(dev);
|
||||||
|
@ -56,7 +56,6 @@ void drm_lastclose(struct drm_device *dev);
|
|||||||
/* drm_pci.c */
|
/* drm_pci.c */
|
||||||
int drm_legacy_irq_by_busid(struct drm_device *dev, void *data,
|
int drm_legacy_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);
|
|
||||||
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
|
#else
|
||||||
@ -67,10 +66,6 @@ static inline int drm_legacy_irq_by_busid(struct drm_device *dev, void *data,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void drm_pci_agp_destroy(struct drm_device *dev)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int drm_pci_set_busid(struct drm_device *dev,
|
static inline int drm_pci_set_busid(struct drm_device *dev,
|
||||||
struct drm_master *master)
|
struct drm_master *master)
|
||||||
{
|
{
|
||||||
|
@ -211,4 +211,10 @@ void drm_master_legacy_init(struct drm_master *master);
|
|||||||
static inline void drm_master_legacy_init(struct drm_master *master) {}
|
static inline void drm_master_legacy_init(struct drm_master *master) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_DRM_LEGACY) && IS_ENABLED(CONFIG_PCI)
|
||||||
|
void drm_legacy_pci_agp_destroy(struct drm_device *dev);
|
||||||
|
#else
|
||||||
|
static inline void drm_legacy_pci_agp_destroy(struct drm_device *dev) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __DRM_LEGACY_H__ */
|
#endif /* __DRM_LEGACY_H__ */
|
||||||
|
@ -119,7 +119,9 @@ int drm_legacy_irq_by_busid(struct drm_device *dev, void *data,
|
|||||||
return drm_pci_irq_by_busid(dev, p);
|
return drm_pci_irq_by_busid(dev, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drm_pci_agp_destroy(struct drm_device *dev)
|
#ifdef CONFIG_DRM_LEGACY
|
||||||
|
|
||||||
|
void drm_legacy_pci_agp_destroy(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
if (dev->agp) {
|
if (dev->agp) {
|
||||||
arch_phys_wc_del(dev->agp->agp_mtrr);
|
arch_phys_wc_del(dev->agp->agp_mtrr);
|
||||||
@ -129,9 +131,7 @@ void drm_pci_agp_destroy(struct drm_device *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DRM_LEGACY
|
static void drm_legacy_pci_agp_init(struct drm_device *dev)
|
||||||
|
|
||||||
static void drm_pci_agp_init(struct drm_device *dev)
|
|
||||||
{
|
{
|
||||||
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
|
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
|
||||||
if (pci_find_capability(to_pci_dev(dev->dev), PCI_CAP_ID_AGP))
|
if (pci_find_capability(to_pci_dev(dev->dev), PCI_CAP_ID_AGP))
|
||||||
@ -145,9 +145,9 @@ static void drm_pci_agp_init(struct drm_device *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_get_pci_dev(struct pci_dev *pdev,
|
static int drm_legacy_get_pci_dev(struct pci_dev *pdev,
|
||||||
const struct pci_device_id *ent,
|
const struct pci_device_id *ent,
|
||||||
const struct drm_driver *driver)
|
const struct drm_driver *driver)
|
||||||
{
|
{
|
||||||
struct drm_device *dev;
|
struct drm_device *dev;
|
||||||
int ret;
|
int ret;
|
||||||
@ -169,7 +169,7 @@ static int drm_get_pci_dev(struct pci_dev *pdev,
|
|||||||
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
if (drm_core_check_feature(dev, DRIVER_MODESET))
|
||||||
pci_set_drvdata(pdev, dev);
|
pci_set_drvdata(pdev, dev);
|
||||||
|
|
||||||
drm_pci_agp_init(dev);
|
drm_legacy_pci_agp_init(dev);
|
||||||
|
|
||||||
ret = drm_dev_register(dev, ent->driver_data);
|
ret = drm_dev_register(dev, ent->driver_data);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -184,7 +184,7 @@ static int drm_get_pci_dev(struct pci_dev *pdev,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_agp:
|
err_agp:
|
||||||
drm_pci_agp_destroy(dev);
|
drm_legacy_pci_agp_destroy(dev);
|
||||||
pci_disable_device(pdev);
|
pci_disable_device(pdev);
|
||||||
err_free:
|
err_free:
|
||||||
drm_dev_put(dev);
|
drm_dev_put(dev);
|
||||||
@ -231,7 +231,7 @@ int drm_legacy_pci_init(const struct drm_driver *driver,
|
|||||||
|
|
||||||
/* stealth mode requires a manual probe */
|
/* stealth mode requires a manual probe */
|
||||||
pci_dev_get(pdev);
|
pci_dev_get(pdev);
|
||||||
drm_get_pci_dev(pdev, pid, driver);
|
drm_legacy_get_pci_dev(pdev, pid, driver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user