From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]:14078 "EHLO omzsmtpe03.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932227AbdDDTeP (ORCPT ); Tue, 4 Apr 2017 15:34:15 -0400 From: alexander.levin@verizon.com To: "gregkh@linuxfoundation.org" CC: "stable@vger.kernel.org" Subject: [PATCH for 4.9 62/98] drm/mga: remove device_is_agp callback Date: Tue, 4 Apr 2017 19:32:25 +0000 Message-ID: <20170404193158.19041-63-alexander.levin@verizon.com> References: <20170404193158.19041-1-alexander.levin@verizon.com> In-Reply-To: <20170404193158.19041-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Daniel Vetter [ Upstream commit 858b2c1bf820ebfba89c5e2867ab882bdb5b2f5a ] It's only for a device quirk, and we might as well do that in the load callback. Acked-by: Alex Deucher Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/20170125062657.19270-10-= daniel.vetter@ffwll.ch Signed-off-by: Sasha Levin --- drivers/gpu/drm/mga/mga_dma.c | 20 +++++++++++++++++++- drivers/gpu/drm/mga/mga_drv.c | 37 ------------------------------------- 2 files changed, 19 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c index 1f2f9ca..4556e2b 100644 --- a/drivers/gpu/drm/mga/mga_dma.c +++ b/drivers/gpu/drm/mga/mga_dma.c @@ -392,6 +392,24 @@ int mga_driver_load(struct drm_device *dev, unsigned l= ong flags) drm_mga_private_t *dev_priv; int ret; =20 + /* There are PCI versions of the G450. These cards have the + * same PCI ID as the AGP G450, but have an additional PCI-to-PCI + * bridge chip. We detect these cards, which are not currently + * supported by this driver, by looking at the device ID of the + * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the + * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the + * device. + */ + if ((dev->pdev->device =3D=3D 0x0525) && dev->pdev->bus->self + && (dev->pdev->bus->self->vendor =3D=3D 0x3388) + && (dev->pdev->bus->self->device =3D=3D 0x0021) + && dev->agp) { + /* FIXME: This should be quirked in the pci core, but oh well + * the hw probably stopped existing. */ + arch_phys_wc_del(dev->agp->agp_mtrr); + kfree(dev->agp); + dev->agp =3D NULL; + } dev_priv =3D kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL); if (!dev_priv) return -ENOMEM; @@ -698,7 +716,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *= dev, static int mga_do_dma_bootstrap(struct drm_device *dev, drm_mga_dma_bootstrap_t *dma_bs) { - const int is_agp =3D (dma_bs->agp_mode !=3D 0) && drm_pci_device_is_agp(d= ev); + const int is_agp =3D (dma_bs->agp_mode !=3D 0) && dev->agp; int err; drm_mga_private_t *const dev_priv =3D (drm_mga_private_t *) dev->dev_private; diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c index 25b2a1a..63ba0699 100644 --- a/drivers/gpu/drm/mga/mga_drv.c +++ b/drivers/gpu/drm/mga/mga_drv.c @@ -37,8 +37,6 @@ =20 #include =20 -static int mga_driver_device_is_agp(struct drm_device *dev); - static struct pci_device_id pciidlist[] =3D { mga_PCI_IDS }; @@ -66,7 +64,6 @@ static struct drm_driver driver =3D { .lastclose =3D mga_driver_lastclose, .set_busid =3D drm_pci_set_busid, .dma_quiescent =3D mga_driver_dma_quiescent, - .device_is_agp =3D mga_driver_device_is_agp, .get_vblank_counter =3D mga_get_vblank_counter, .enable_vblank =3D mga_enable_vblank, .disable_vblank =3D mga_disable_vblank, @@ -107,37 +104,3 @@ module_exit(mga_exit); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL and additional rights"); - -/** - * Determine if the device really is AGP or not. - * - * In addition to the usual tests performed by \c drm_device_is_agp, this - * function detects PCI G450 cards that appear to the system exactly like - * AGP G450 cards. - * - * \param dev The device to be tested. - * - * \returns - * If the device is a PCI G450, zero is returned. Otherwise 2 is returned= . - */ -static int mga_driver_device_is_agp(struct drm_device *dev) -{ - const struct pci_dev *const pdev =3D dev->pdev; - - /* There are PCI versions of the G450. These cards have the - * same PCI ID as the AGP G450, but have an additional PCI-to-PCI - * bridge chip. We detect these cards, which are not currently - * supported by this driver, by looking at the device ID of the - * bus the "card" is on. If vendor is 0x3388 (Hint Corp) and the - * device is 0x0021 (HB6 Universal PCI-PCI bridge), we reject the - * device. - */ - - if ((pdev->device =3D=3D 0x0525) && pdev->bus->self - && (pdev->bus->self->vendor =3D=3D 0x3388) - && (pdev->bus->self->device =3D=3D 0x0021)) { - return 0; - } - - return 2; -} --=20 2.9.3