diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-06-01 01:56:22 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-07-12 20:12:58 -0400 |
commit | cd0b072f95b3dbee5d7b97f52edc40f00d5d28e1 (patch) | |
tree | 0b61d8f5f84c6d95ed240feff242c694a81e91bf /drivers | |
parent | b833ac26f1f1c8e8d9149d83dbdd91432f2807d5 (diff) |
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: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_dma.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_mem.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 79 |
4 files changed, 38 insertions, 71 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index 65c441a1999f..2e3c6caa97ee 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
@@ -92,11 +92,9 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
92 | return ret; | 92 | return ret; |
93 | 93 | ||
94 | /* Map M2MF notifier object - fbcon. */ | 94 | /* Map M2MF notifier object - fbcon. */ |
95 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 95 | ret = nouveau_bo_map(chan->notifier_bo); |
96 | ret = nouveau_bo_map(chan->notifier_bo); | 96 | if (ret) |
97 | if (ret) | 97 | return ret; |
98 | return ret; | ||
99 | } | ||
100 | 98 | ||
101 | /* Insert NOPS for NOUVEAU_DMA_SKIPS */ | 99 | /* Insert NOPS for NOUVEAU_DMA_SKIPS */ |
102 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); | 100 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 2dd7d19eb99b..6edfc23e6285 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -155,9 +155,6 @@ nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
155 | struct drm_crtc *crtc; | 155 | struct drm_crtc *crtc; |
156 | int ret, i; | 156 | int ret, i; |
157 | 157 | ||
158 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | ||
159 | return -ENODEV; | ||
160 | |||
161 | if (pm_state.event == PM_EVENT_PRETHAW) | 158 | if (pm_state.event == PM_EVENT_PRETHAW) |
162 | return 0; | 159 | return 0; |
163 | 160 | ||
@@ -257,9 +254,6 @@ nouveau_pci_resume(struct pci_dev *pdev) | |||
257 | struct drm_crtc *crtc; | 254 | struct drm_crtc *crtc; |
258 | int ret, i; | 255 | int ret, i; |
259 | 256 | ||
260 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | ||
261 | return -ENODEV; | ||
262 | |||
263 | nouveau_fbcon_save_disable_accel(dev); | 257 | nouveau_fbcon_save_disable_accel(dev); |
264 | 258 | ||
265 | NV_INFO(dev, "We're back, enabling device...\n"); | 259 | NV_INFO(dev, "We're back, enabling device...\n"); |
@@ -371,7 +365,8 @@ nouveau_pci_resume(struct pci_dev *pdev) | |||
371 | static struct drm_driver driver = { | 365 | static struct drm_driver driver = { |
372 | .driver_features = | 366 | .driver_features = |
373 | DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | | 367 | DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | |
374 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM, | 368 | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | |
369 | DRIVER_MODESET, | ||
375 | .load = nouveau_load, | 370 | .load = nouveau_load, |
376 | .firstopen = nouveau_firstopen, | 371 | .firstopen = nouveau_firstopen, |
377 | .lastclose = nouveau_lastclose, | 372 | .lastclose = nouveau_lastclose, |
@@ -438,16 +433,18 @@ static int __init nouveau_init(void) | |||
438 | nouveau_modeset = 1; | 433 | nouveau_modeset = 1; |
439 | } | 434 | } |
440 | 435 | ||
441 | if (nouveau_modeset == 1) { | 436 | if (!nouveau_modeset) |
442 | driver.driver_features |= DRIVER_MODESET; | 437 | return 0; |
443 | nouveau_register_dsm_handler(); | ||
444 | } | ||
445 | 438 | ||
439 | nouveau_register_dsm_handler(); | ||
446 | return drm_init(&driver); | 440 | return drm_init(&driver); |
447 | } | 441 | } |
448 | 442 | ||
449 | static void __exit nouveau_exit(void) | 443 | static void __exit nouveau_exit(void) |
450 | { | 444 | { |
445 | if (!nouveau_modeset) | ||
446 | return; | ||
447 | |||
451 | drm_exit(&driver); | 448 | drm_exit(&driver); |
452 | nouveau_unregister_dsm_handler(); | 449 | nouveau_unregister_dsm_handler(); |
453 | } | 450 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 4274281f45ce..bcf7ed32cd1c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -277,8 +277,7 @@ nouveau_mem_close(struct drm_device *dev) | |||
277 | 277 | ||
278 | nouveau_ttm_global_release(dev_priv); | 278 | nouveau_ttm_global_release(dev_priv); |
279 | 279 | ||
280 | if (drm_core_has_AGP(dev) && dev->agp && | 280 | if (drm_core_has_AGP(dev) && dev->agp) { |
281 | drm_core_check_feature(dev, DRIVER_MODESET)) { | ||
282 | struct drm_agp_mem *entry, *tempe; | 281 | struct drm_agp_mem *entry, *tempe; |
283 | 282 | ||
284 | /* Remove AGP resources, but leave dev->agp | 283 | /* Remove AGP resources, but leave dev->agp |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index b02a231d6937..3e241e4a6485 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -425,11 +425,9 @@ nouveau_card_init(struct drm_device *dev) | |||
425 | spin_lock_init(&dev_priv->context_switch_lock); | 425 | spin_lock_init(&dev_priv->context_switch_lock); |
426 | 426 | ||
427 | /* Parse BIOS tables / Run init tables if card not POSTed */ | 427 | /* Parse BIOS tables / Run init tables if card not POSTed */ |
428 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 428 | ret = nouveau_bios_init(dev); |
429 | ret = nouveau_bios_init(dev); | 429 | if (ret) |
430 | if (ret) | 430 | goto out; |
431 | goto out; | ||
432 | } | ||
433 | 431 | ||
434 | ret = nouveau_mem_detect(dev); | 432 | ret = nouveau_mem_detect(dev); |
435 | if (ret) | 433 | if (ret) |
@@ -504,14 +502,12 @@ nouveau_card_init(struct drm_device *dev) | |||
504 | goto out_irq; | 502 | goto out_irq; |
505 | } | 503 | } |
506 | 504 | ||
507 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 505 | if (dev_priv->card_type >= NV_50) |
508 | if (dev_priv->card_type >= NV_50) | 506 | ret = nv50_display_create(dev); |
509 | ret = nv50_display_create(dev); | 507 | else |
510 | else | 508 | ret = nv04_display_create(dev); |
511 | ret = nv04_display_create(dev); | 509 | if (ret) |
512 | if (ret) | 510 | goto out_channel; |
513 | goto out_channel; | ||
514 | } | ||
515 | 511 | ||
516 | ret = nouveau_backlight_init(dev); | 512 | ret = nouveau_backlight_init(dev); |
517 | if (ret) | 513 | if (ret) |
@@ -519,11 +515,8 @@ nouveau_card_init(struct drm_device *dev) | |||
519 | 515 | ||
520 | dev_priv->init_state = NOUVEAU_CARD_INIT_DONE; | 516 | dev_priv->init_state = NOUVEAU_CARD_INIT_DONE; |
521 | 517 | ||
522 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 518 | nouveau_fbcon_init(dev); |
523 | nouveau_fbcon_init(dev); | 519 | drm_kms_helper_poll_init(dev); |
524 | drm_kms_helper_poll_init(dev); | ||
525 | } | ||
526 | |||
527 | return 0; | 520 | return 0; |
528 | 521 | ||
529 | out_channel: | 522 | out_channel: |
@@ -595,8 +588,7 @@ static void nouveau_card_takedown(struct drm_device *dev) | |||
595 | nouveau_mem_close(dev); | 588 | nouveau_mem_close(dev); |
596 | engine->instmem.takedown(dev); | 589 | engine->instmem.takedown(dev); |
597 | 590 | ||
598 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 591 | drm_irq_uninstall(dev); |
599 | drm_irq_uninstall(dev); | ||
600 | 592 | ||
601 | nouveau_gpuobj_late_takedown(dev); | 593 | nouveau_gpuobj_late_takedown(dev); |
602 | nouveau_bios_takedown(dev); | 594 | nouveau_bios_takedown(dev); |
@@ -691,6 +683,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
691 | struct drm_nouveau_private *dev_priv; | 683 | struct drm_nouveau_private *dev_priv; |
692 | uint32_t reg0; | 684 | uint32_t reg0; |
693 | resource_size_t mmio_start_offs; | 685 | resource_size_t mmio_start_offs; |
686 | int ret; | ||
694 | 687 | ||
695 | dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); | 688 | dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); |
696 | if (!dev_priv) | 689 | if (!dev_priv) |
@@ -773,11 +766,9 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
773 | NV_INFO(dev, "Detected an NV%2x generation card (0x%08x)\n", | 766 | NV_INFO(dev, "Detected an NV%2x generation card (0x%08x)\n", |
774 | dev_priv->card_type, reg0); | 767 | dev_priv->card_type, reg0); |
775 | 768 | ||
776 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 769 | ret = nouveau_remove_conflicting_drivers(dev); |
777 | int ret = nouveau_remove_conflicting_drivers(dev); | 770 | if (ret) |
778 | if (ret) | 771 | return ret; |
779 | return ret; | ||
780 | } | ||
781 | 772 | ||
782 | /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */ | 773 | /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */ |
783 | if (dev_priv->card_type >= NV_40) { | 774 | if (dev_priv->card_type >= NV_40) { |
@@ -812,46 +803,28 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
812 | dev_priv->flags |= NV_NFORCE2; | 803 | dev_priv->flags |= NV_NFORCE2; |
813 | 804 | ||
814 | /* For kernel modesetting, init card now and bring up fbcon */ | 805 | /* For kernel modesetting, init card now and bring up fbcon */ |
815 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 806 | ret = nouveau_card_init(dev); |
816 | int ret = nouveau_card_init(dev); | 807 | if (ret) |
817 | if (ret) | 808 | return ret; |
818 | return ret; | ||
819 | } | ||
820 | 809 | ||
821 | return 0; | 810 | return 0; |
822 | } | 811 | } |
823 | 812 | ||
824 | static void nouveau_close(struct drm_device *dev) | ||
825 | { | ||
826 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
827 | |||
828 | /* In the case of an error dev_priv may not be allocated yet */ | ||
829 | if (dev_priv) | ||
830 | nouveau_card_takedown(dev); | ||
831 | } | ||
832 | |||
833 | /* KMS: we need mmio at load time, not when the first drm client opens. */ | ||
834 | void nouveau_lastclose(struct drm_device *dev) | 813 | void nouveau_lastclose(struct drm_device *dev) |
835 | { | 814 | { |
836 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
837 | return; | ||
838 | |||
839 | nouveau_close(dev); | ||
840 | } | 815 | } |
841 | 816 | ||
842 | int nouveau_unload(struct drm_device *dev) | 817 | int nouveau_unload(struct drm_device *dev) |
843 | { | 818 | { |
844 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 819 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
845 | 820 | ||
846 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 821 | drm_kms_helper_poll_fini(dev); |
847 | drm_kms_helper_poll_fini(dev); | 822 | nouveau_fbcon_fini(dev); |
848 | nouveau_fbcon_fini(dev); | 823 | if (dev_priv->card_type >= NV_50) |
849 | if (dev_priv->card_type >= NV_50) | 824 | nv50_display_destroy(dev); |
850 | nv50_display_destroy(dev); | 825 | else |
851 | else | 826 | nv04_display_destroy(dev); |
852 | nv04_display_destroy(dev); | 827 | nouveau_card_takedown(dev); |
853 | nouveau_close(dev); | ||
854 | } | ||
855 | 828 | ||
856 | iounmap(dev_priv->mmio); | 829 | iounmap(dev_priv->mmio); |
857 | iounmap(dev_priv->ramin); | 830 | iounmap(dev_priv->ramin); |