diff options
| author | Ben Skeggs <bskeggs@redhat.com> | 2010-06-07 01:38:27 -0400 |
|---|---|---|
| committer | Ben Skeggs <bskeggs@redhat.com> | 2010-07-12 20:13:37 -0400 |
| commit | b6d3d8717855c72e541bace5edd0460f2eed6dde (patch) | |
| tree | e631946df11e522caee84fa4c060db237ba26a30 | |
| parent | 646bef2d20accc6ed696a98e38d5f2515b0ff35d (diff) | |
drm/nouveau: remove dev_priv->init_state and friends
Nouveau will no longer load at all if card initialisation fails, so all
these checks are unnecessary.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_channel.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 13 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_gem.c | 9 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_notifier.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_object.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_state.c | 68 |
7 files changed, 25 insertions, 74 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 1371c77295f2..3ca8343c15df 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
| @@ -711,8 +711,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
| 711 | return ret; | 711 | return ret; |
| 712 | 712 | ||
| 713 | /* Software copy if the card isn't up and running yet. */ | 713 | /* Software copy if the card isn't up and running yet. */ |
| 714 | if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE || | 714 | if (!dev_priv->channel) { |
| 715 | !dev_priv->channel) { | ||
| 716 | ret = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); | 715 | ret = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); |
| 717 | goto out; | 716 | goto out; |
| 718 | } | 717 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 06555c7cde50..53daeba4581e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
| @@ -369,8 +369,6 @@ nouveau_ioctl_fifo_alloc(struct drm_device *dev, void *data, | |||
| 369 | struct nouveau_channel *chan; | 369 | struct nouveau_channel *chan; |
| 370 | int ret; | 370 | int ret; |
| 371 | 371 | ||
| 372 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 373 | |||
| 374 | if (dev_priv->engine.graph.accel_blocked) | 372 | if (dev_priv->engine.graph.accel_blocked) |
| 375 | return -ENODEV; | 373 | return -ENODEV; |
| 376 | 374 | ||
| @@ -419,7 +417,6 @@ nouveau_ioctl_fifo_free(struct drm_device *dev, void *data, | |||
| 419 | struct drm_nouveau_channel_free *cfree = data; | 417 | struct drm_nouveau_channel_free *cfree = data; |
| 420 | struct nouveau_channel *chan; | 418 | struct nouveau_channel *chan; |
| 421 | 419 | ||
| 422 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 423 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(cfree->channel, file_priv, chan); | 420 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(cfree->channel, file_priv, chan); |
| 424 | 421 | ||
| 425 | nouveau_channel_free(chan); | 422 | nouveau_channel_free(chan); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 4de342f54fd2..afebd32af203 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
| @@ -492,11 +492,6 @@ enum nouveau_card_type { | |||
| 492 | 492 | ||
| 493 | struct drm_nouveau_private { | 493 | struct drm_nouveau_private { |
| 494 | struct drm_device *dev; | 494 | struct drm_device *dev; |
| 495 | enum { | ||
| 496 | NOUVEAU_CARD_INIT_DOWN, | ||
| 497 | NOUVEAU_CARD_INIT_DONE, | ||
| 498 | NOUVEAU_CARD_INIT_FAILED | ||
| 499 | } init_state; | ||
| 500 | 495 | ||
| 501 | /* the card type, takes NV_* as values */ | 496 | /* the card type, takes NV_* as values */ |
| 502 | enum nouveau_card_type card_type; | 497 | enum nouveau_card_type card_type; |
| @@ -649,14 +644,6 @@ nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pnvbo) | |||
| 649 | return 0; | 644 | return 0; |
| 650 | } | 645 | } |
| 651 | 646 | ||
| 652 | #define NOUVEAU_CHECK_INITIALISED_WITH_RETURN do { \ | ||
| 653 | struct drm_nouveau_private *nv = dev->dev_private; \ | ||
| 654 | if (nv->init_state != NOUVEAU_CARD_INIT_DONE) { \ | ||
| 655 | NV_ERROR(dev, "called without init\n"); \ | ||
| 656 | return -EINVAL; \ | ||
| 657 | } \ | ||
| 658 | } while (0) | ||
| 659 | |||
| 660 | #define NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(id, cl, ch) do { \ | 647 | #define NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(id, cl, ch) do { \ |
| 661 | struct drm_nouveau_private *nv = dev->dev_private; \ | 648 | struct drm_nouveau_private *nv = dev->dev_private; \ |
| 662 | if (!nouveau_channel_owner(dev, (cl), (id))) { \ | 649 | if (!nouveau_channel_owner(dev, (cl), (id))) { \ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 791531bdb2c4..547f2c24c1e7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
| @@ -137,8 +137,6 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, | |||
| 137 | uint32_t flags = 0; | 137 | uint32_t flags = 0; |
| 138 | int ret = 0; | 138 | int ret = 0; |
| 139 | 139 | ||
| 140 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 141 | |||
| 142 | if (unlikely(dev_priv->ttm.bdev.dev_mapping == NULL)) | 140 | if (unlikely(dev_priv->ttm.bdev.dev_mapping == NULL)) |
| 143 | dev_priv->ttm.bdev.dev_mapping = dev_priv->dev->dev_mapping; | 141 | dev_priv->ttm.bdev.dev_mapping = dev_priv->dev->dev_mapping; |
| 144 | 142 | ||
| @@ -580,7 +578,6 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
| 580 | struct nouveau_fence *fence = NULL; | 578 | struct nouveau_fence *fence = NULL; |
| 581 | int i, j, ret = 0, do_reloc = 0; | 579 | int i, j, ret = 0, do_reloc = 0; |
| 582 | 580 | ||
| 583 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 584 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(req->channel, file_priv, chan); | 581 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(req->channel, file_priv, chan); |
| 585 | 582 | ||
| 586 | req->vram_available = dev_priv->fb_aper_free; | 583 | req->vram_available = dev_priv->fb_aper_free; |
| @@ -760,8 +757,6 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data, | |||
| 760 | bool no_wait = !!(req->flags & NOUVEAU_GEM_CPU_PREP_NOWAIT); | 757 | bool no_wait = !!(req->flags & NOUVEAU_GEM_CPU_PREP_NOWAIT); |
| 761 | int ret = -EINVAL; | 758 | int ret = -EINVAL; |
| 762 | 759 | ||
| 763 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 764 | |||
| 765 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); | 760 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); |
| 766 | if (!gem) | 761 | if (!gem) |
| 767 | return ret; | 762 | return ret; |
| @@ -800,8 +795,6 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data, | |||
| 800 | struct nouveau_bo *nvbo; | 795 | struct nouveau_bo *nvbo; |
| 801 | int ret = -EINVAL; | 796 | int ret = -EINVAL; |
| 802 | 797 | ||
| 803 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 804 | |||
| 805 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); | 798 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); |
| 806 | if (!gem) | 799 | if (!gem) |
| 807 | return ret; | 800 | return ret; |
| @@ -827,8 +820,6 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data, | |||
| 827 | struct drm_gem_object *gem; | 820 | struct drm_gem_object *gem; |
| 828 | int ret; | 821 | int ret; |
| 829 | 822 | ||
| 830 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 831 | |||
| 832 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); | 823 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); |
| 833 | if (!gem) | 824 | if (!gem) |
| 834 | return -EINVAL; | 825 | return -EINVAL; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_notifier.c b/drivers/gpu/drm/nouveau/nouveau_notifier.c index 32f7fbd7484d..3ec181ff50ce 100644 --- a/drivers/gpu/drm/nouveau/nouveau_notifier.c +++ b/drivers/gpu/drm/nouveau/nouveau_notifier.c | |||
| @@ -184,7 +184,6 @@ nouveau_ioctl_notifier_alloc(struct drm_device *dev, void *data, | |||
| 184 | struct nouveau_channel *chan; | 184 | struct nouveau_channel *chan; |
| 185 | int ret; | 185 | int ret; |
| 186 | 186 | ||
| 187 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 188 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(na->channel, file_priv, chan); | 187 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(na->channel, file_priv, chan); |
| 189 | 188 | ||
| 190 | ret = nouveau_notifier_alloc(chan, na->handle, na->size, &na->offset); | 189 | ret = nouveau_notifier_alloc(chan, na->handle, na->size, &na->offset); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index d436c3c7f4f5..5624f37e4c75 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
| @@ -1232,7 +1232,6 @@ int nouveau_ioctl_grobj_alloc(struct drm_device *dev, void *data, | |||
| 1232 | struct nouveau_channel *chan; | 1232 | struct nouveau_channel *chan; |
| 1233 | int ret; | 1233 | int ret; |
| 1234 | 1234 | ||
| 1235 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 1236 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(init->channel, file_priv, chan); | 1235 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(init->channel, file_priv, chan); |
| 1237 | 1236 | ||
| 1238 | if (init->handle == ~0) | 1237 | if (init->handle == ~0) |
| @@ -1283,7 +1282,6 @@ int nouveau_ioctl_gpuobj_free(struct drm_device *dev, void *data, | |||
| 1283 | struct nouveau_channel *chan; | 1282 | struct nouveau_channel *chan; |
| 1284 | int ret; | 1283 | int ret; |
| 1285 | 1284 | ||
| 1286 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | ||
| 1287 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(objfree->channel, file_priv, chan); | 1285 | NOUVEAU_GET_USER_CHANNEL_WITH_RETURN(objfree->channel, file_priv, chan); |
| 1288 | 1286 | ||
| 1289 | ret = nouveau_gpuobj_ref_find(chan, objfree->handle, &ref); | 1287 | ret = nouveau_gpuobj_ref_find(chan, objfree->handle, &ref); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 3e241e4a6485..6fd99f10eed6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
| @@ -407,11 +407,6 @@ nouveau_card_init(struct drm_device *dev) | |||
| 407 | struct nouveau_engine *engine; | 407 | struct nouveau_engine *engine; |
| 408 | int ret; | 4 | |
