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

drm/mga: remove device_is_agp callback

It's only for a device quirk, and we might as well do that in the load
callback.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170125062657.19270-10-daniel.vetter@ffwll.ch

+19 -38
+19 -1
drivers/gpu/drm/mga/mga_dma.c
··· 392 392 drm_mga_private_t *dev_priv; 393 393 int ret; 394 394 395 + /* There are PCI versions of the G450. These cards have the 396 + * same PCI ID as the AGP G450, but have an additional PCI-to-PCI 397 + * bridge chip. We detect these cards, which are not currently 398 + * supported by this driver, by looking at the device ID of the 399 + * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the 400 + * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the 401 + * device. 402 + */ 403 + if ((dev->pdev->device == 0x0525) && dev->pdev->bus->self 404 + && (dev->pdev->bus->self->vendor == 0x3388) 405 + && (dev->pdev->bus->self->device == 0x0021) 406 + && dev->agp) { 407 + /* FIXME: This should be quirked in the pci core, but oh well 408 + * the hw probably stopped existing. */ 409 + arch_phys_wc_del(dev->agp->agp_mtrr); 410 + kfree(dev->agp); 411 + dev->agp = NULL; 412 + } 395 413 dev_priv = kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL); 396 414 if (!dev_priv) 397 415 return -ENOMEM; ··· 716 698 static int mga_do_dma_bootstrap(struct drm_device *dev, 717 699 drm_mga_dma_bootstrap_t *dma_bs) 718 700 { 719 - const int is_agp = (dma_bs->agp_mode != 0) && drm_pci_device_is_agp(dev); 701 + const int is_agp = (dma_bs->agp_mode != 0) && dev->agp; 720 702 int err; 721 703 drm_mga_private_t *const dev_priv = 722 704 (drm_mga_private_t *) dev->dev_private;
-37
drivers/gpu/drm/mga/mga_drv.c
··· 37 37 38 38 #include <drm/drm_pciids.h> 39 39 40 - static int mga_driver_device_is_agp(struct drm_device *dev); 41 - 42 40 static struct pci_device_id pciidlist[] = { 43 41 mga_PCI_IDS 44 42 }; ··· 64 66 .lastclose = mga_driver_lastclose, 65 67 .set_busid = drm_pci_set_busid, 66 68 .dma_quiescent = mga_driver_dma_quiescent, 67 - .device_is_agp = mga_driver_device_is_agp, 68 69 .get_vblank_counter = mga_get_vblank_counter, 69 70 .enable_vblank = mga_enable_vblank, 70 71 .disable_vblank = mga_disable_vblank, ··· 104 107 MODULE_AUTHOR(DRIVER_AUTHOR); 105 108 MODULE_DESCRIPTION(DRIVER_DESC); 106 109 MODULE_LICENSE("GPL and additional rights"); 107 - 108 - /** 109 - * Determine if the device really is AGP or not. 110 - * 111 - * In addition to the usual tests performed by \c drm_device_is_agp, this 112 - * function detects PCI G450 cards that appear to the system exactly like 113 - * AGP G450 cards. 114 - * 115 - * \param dev The device to be tested. 116 - * 117 - * \returns 118 - * If the device is a PCI G450, zero is returned. Otherwise 2 is returned. 119 - */ 120 - static int mga_driver_device_is_agp(struct drm_device *dev) 121 - { 122 - const struct pci_dev *const pdev = dev->pdev; 123 - 124 - /* There are PCI versions of the G450. These cards have the 125 - * same PCI ID as the AGP G450, but have an additional PCI-to-PCI 126 - * bridge chip. We detect these cards, which are not currently 127 - * supported by this driver, by looking at the device ID of the 128 - * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the 129 - * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the 130 - * device. 131 - */ 132 - 133 - if ((pdev->device == 0x0525) && pdev->bus->self 134 - && (pdev->bus->self->vendor == 0x3388) 135 - && (pdev->bus->self->device == 0x0021)) { 136 - return 0; 137 - } 138 - 139 - return 2; 140 - }