Commit cd0b072f authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: remove left-over !DRIVER_MODESET paths

It's far preferable to have the driver do nothing at all for "nomodeset".
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent b833ac26
...@@ -92,11 +92,9 @@ nouveau_dma_init(struct nouveau_channel *chan) ...@@ -92,11 +92,9 @@ nouveau_dma_init(struct nouveau_channel *chan)
return ret; return ret;
/* Map M2MF notifier object - fbcon. */ /* Map M2MF notifier object - fbcon. */
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
ret = nouveau_bo_map(chan->notifier_bo); ret = nouveau_bo_map(chan->notifier_bo);
if (ret) if (ret)
return ret; return ret;
}
/* Insert NOPS for NOUVEAU_DMA_SKIPS */ /* Insert NOPS for NOUVEAU_DMA_SKIPS */
ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS);
......
...@@ -155,9 +155,6 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state) ...@@ -155,9 +155,6 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state)
struct drm_crtc *crtc; struct drm_crtc *crtc;
int ret, i; int ret, i;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -ENODEV;
if (pm_state.event == PM_EVENT_PRETHAW) if (pm_state.event == PM_EVENT_PRETHAW)
return 0; return 0;
...@@ -257,9 +254,6 @@ nouveau_pci_resume(struct pci_dev *pdev) ...@@ -257,9 +254,6 @@ nouveau_pci_resume(struct pci_dev *pdev)
struct drm_crtc *crtc; struct drm_crtc *crtc;
int ret, i; int ret, i;
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -ENODEV;
nouveau_fbcon_save_disable_accel(dev); nouveau_fbcon_save_disable_accel(dev);
NV_INFO(dev, "We're back, enabling device...\n"); NV_INFO(dev, "We're back, enabling device...\n");
...@@ -371,7 +365,8 @@ nouveau_pci_resume(struct pci_dev *pdev) ...@@ -371,7 +365,8 @@ nouveau_pci_resume(struct pci_dev *pdev)
static struct drm_driver driver = { static struct drm_driver driver = {
.driver_features = .driver_features =
DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM, DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
DRIVER_MODESET,
.load = nouveau_load, .load = nouveau_load,
.firstopen = nouveau_firstopen, .firstopen = nouveau_firstopen,
.lastclose = nouveau_lastclose, .lastclose = nouveau_lastclose,
...@@ -438,16 +433,18 @@ static int __init nouveau_init(void) ...@@ -438,16 +433,18 @@ static int __init nouveau_init(void)
nouveau_modeset = 1; nouveau_modeset = 1;
} }
if (nouveau_modeset == 1) { if (!nouveau_modeset)
driver.driver_features |= DRIVER_MODESET; return 0;
nouveau_register_dsm_handler();
}
nouveau_register_dsm_handler();
return drm_init(&driver); return drm_init(&driver);
} }
static void __exit nouveau_exit(void) static void __exit nouveau_exit(void)
{ {
if (!nouveau_modeset)
return;
drm_exit(&driver); drm_exit(&driver);
nouveau_unregister_dsm_handler(); nouveau_unregister_dsm_handler();
} }
......
...@@ -277,8 +277,7 @@ nouveau_mem_close(struct drm_device *dev) ...@@ -277,8 +277,7 @@ nouveau_mem_close(struct drm_device *dev)
nouveau_ttm_global_release(dev_priv); nouveau_ttm_global_release(dev_priv);
if (drm_core_has_AGP(dev) && dev->agp && if (drm_core_has_AGP(dev) && dev->agp) {
drm_core_check_feature(dev, DRIVER_MODESET)) {
struct drm_agp_mem *entry, *tempe; struct drm_agp_mem *entry, *tempe;
/* Remove AGP resources, but leave dev->agp /* Remove AGP resources, but leave dev->agp
......
...@@ -425,11 +425,9 @@ nouveau_card_init(struct drm_device *dev) ...@@ -425,11 +425,9 @@ nouveau_card_init(struct drm_device *dev)
spin_lock_init(&dev_priv->context_switch_lock); spin_lock_init(&dev_priv->context_switch_lock);
/* Parse BIOS tables / Run init tables if card not POSTed */ /* Parse BIOS tables / Run init tables if card not POSTed */
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
ret = nouveau_bios_init(dev); ret = nouveau_bios_init(dev);
if (ret) if (ret)
goto out; goto out;
}
ret = nouveau_mem_detect(dev); ret = nouveau_mem_detect(dev);
if (ret) if (ret)
...@@ -504,14 +502,12 @@ nouveau_card_init(struct drm_device *dev) ...@@ -504,14 +502,12 @@ nouveau_card_init(struct drm_device *dev)
goto out_irq; goto out_irq;
} }
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
if (dev_priv->card_type >= NV_50) if (dev_priv->card_type >= NV_50)
ret = nv50_display_create(dev); ret = nv50_display_create(dev);
else else
ret = nv04_display_create(dev); ret = nv04_display_create(dev);
if (ret) if (ret)
goto out_channel; goto out_channel;
}
ret = nouveau_backlight_init(dev); ret = nouveau_backlight_init(dev);
if (ret) if (ret)
...@@ -519,11 +515,8 @@ nouveau_card_init(struct drm_device *dev) ...@@ -519,11 +515,8 @@ nouveau_card_init(struct drm_device *dev)
dev_priv->init_state = NOUVEAU_CARD_INIT_DONE; dev_priv->init_state = NOUVEAU_CARD_INIT_DONE;
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
nouveau_fbcon_init(dev); nouveau_fbcon_init(dev);
drm_kms_helper_poll_init(dev); drm_kms_helper_poll_init(dev);
}
return 0; return 0;
out_channel: out_channel:
...@@ -595,7 +588,6 @@ static void nouveau_card_takedown(struct drm_device *dev) ...@@ -595,7 +588,6 @@ static void nouveau_card_takedown(struct drm_device *dev)
nouveau_mem_close(dev); nouveau_mem_close(dev);
engine->instmem.takedown(dev); engine->instmem.takedown(dev);
if (drm_core_check_feature(dev, DRIVER_MODESET))
drm_irq_uninstall(dev); drm_irq_uninstall(dev);
nouveau_gpuobj_late_takedown(dev); nouveau_gpuobj_late_takedown(dev);
...@@ -691,6 +683,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) ...@@ -691,6 +683,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
struct drm_nouveau_private *dev_priv; struct drm_nouveau_private *dev_priv;
uint32_t reg0; uint32_t reg0;
resource_size_t mmio_start_offs; resource_size_t mmio_start_offs;
int ret;
dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
if (!dev_priv) if (!dev_priv)
...@@ -773,11 +766,9 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) ...@@ -773,11 +766,9 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
NV_INFO(dev, "Detected an NV%2x generation card (0x%08x)\n", NV_INFO(dev, "Detected an NV%2x generation card (0x%08x)\n",
dev_priv->card_type, reg0); dev_priv->card_type, reg0);
if (drm_core_check_feature(dev, DRIVER_MODESET)) { ret = nouveau_remove_conflicting_drivers(dev);
int ret = nouveau_remove_conflicting_drivers(dev);
if (ret) if (ret)
return ret; return ret;
}
/* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */ /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */
if (dev_priv->card_type >= NV_40) { if (dev_priv->card_type >= NV_40) {
...@@ -812,46 +803,28 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) ...@@ -812,46 +803,28 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
dev_priv->flags |= NV_NFORCE2; dev_priv->flags |= NV_NFORCE2;
/* For kernel modesetting, init card now and bring up fbcon */ /* For kernel modesetting, init card now and bring up fbcon */
if (drm_core_check_feature(dev, DRIVER_MODESET)) { ret = nouveau_card_init(dev);
int ret = nouveau_card_init(dev);
if (ret) if (ret)
return ret; return ret;
}
return 0; return 0;
} }
static void nouveau_close(struct drm_device *dev)
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
/* In the case of an error dev_priv may not be allocated yet */
if (dev_priv)
nouveau_card_takedown(dev);
}
/* KMS: we need mmio at load time, not when the first drm client opens. */
void nouveau_lastclose(struct drm_device *dev) void nouveau_lastclose(struct drm_device *dev)
{ {
if (drm_core_check_feature(dev, DRIVER_MODESET))
return;
nouveau_close(dev);
} }
int nouveau_unload(struct drm_device *dev) int nouveau_unload(struct drm_device *dev)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
drm_kms_helper_poll_fini(dev); drm_kms_helper_poll_fini(dev);
nouveau_fbcon_fini(dev); nouveau_fbcon_fini(dev);
if (dev_priv->card_type >= NV_50) if (dev_priv->card_type >= NV_50)
nv50_display_destroy(dev); nv50_display_destroy(dev);
else else
nv04_display_destroy(dev); nv04_display_destroy(dev);
nouveau_close(dev); nouveau_card_takedown(dev);
}
iounmap(dev_priv->mmio); iounmap(dev_priv->mmio);
iounmap(dev_priv->ramin); iounmap(dev_priv->ramin);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment