diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-07-11 04:00:47 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-07-11 04:00:47 +0000 |
commit | e25282f466cd32ed6faac087432d1cf68d75cfe5 (patch) | |
tree | 1a4e23ec00c08a6fa5cb762eef0e5271cf80f4d4 | |
parent | edfc1be3062ec88f7d52de3c66732f8829037083 (diff) |
Make use of recent drm_linux.h additions to further reduce the
diff to linux.
ok kettenis@
-rw-r--r-- | sys/dev/pci/drm/drm_crtc.h | 5 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_crtc_helper.c | 30 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_linux.h | 9 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/atom.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon.h | 6 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_benchmark.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_fence.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_pm.c | 55 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_ring.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo.c | 38 | ||||
-rw-r--r-- | sys/dev/pci/drm/ttm/ttm_bo_driver.h | 5 |
11 files changed, 73 insertions, 109 deletions
diff --git a/sys/dev/pci/drm/drm_crtc.h b/sys/dev/pci/drm/drm_crtc.h index 2ad7a148884..7488ad270f4 100644 --- a/sys/dev/pci/drm/drm_crtc.h +++ b/sys/dev/pci/drm/drm_crtc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_crtc.h,v 1.3 2015/02/10 03:39:41 jsg Exp $ */ +/* $OpenBSD: drm_crtc.h,v 1.4 2015/07/11 04:00:46 jsg Exp $ */ /* * Copyright © 2006 Keith Packard * Copyright © 2007-2008 Dave Airlie @@ -795,8 +795,7 @@ struct drm_mode_config { /* output poll support */ bool poll_enabled; bool poll_running; - struct timeout output_poll_to; - struct task poll_task; + struct delayed_work output_poll_work; /* pointers to standard properties */ struct list_head property_blob_list; diff --git a/sys/dev/pci/drm/drm_crtc_helper.c b/sys/dev/pci/drm/drm_crtc_helper.c index 20fb6f2cb87..11e6ffd7ff6 100644 --- a/sys/dev/pci/drm/drm_crtc_helper.c +++ b/sys/dev/pci/drm/drm_crtc_helper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_crtc_helper.c,v 1.12 2015/04/18 11:05:32 jsg Exp $ */ +/* $OpenBSD: drm_crtc_helper.c,v 1.13 2015/07/11 04:00:46 jsg Exp $ */ /* * Copyright (c) 2006-2008 Intel Corporation * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> @@ -966,10 +966,11 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev) } EXPORT_SYMBOL(drm_kms_helper_hotplug_event); -#define DRM_OUTPUT_POLL_SECONDS 10 -static void drm_output_poll_execute(void *arg1) +#define DRM_OUTPUT_POLL_PERIOD (10*HZ) +static void output_poll_execute(struct work_struct *work) { - struct drm_device *dev = (struct drm_device *)arg1; + struct delayed_work *delayed_work = to_delayed_work(work); + struct drm_device *dev = container_of(delayed_work, struct drm_device, mode_config.output_poll_work); struct drm_connector *connector; enum drm_connector_status old_status; bool repoll = false, changed = false; @@ -1014,24 +1015,14 @@ static void drm_output_poll_execute(void *arg1) drm_kms_helper_hotplug_event(dev); if (repoll) - timeout_add_sec(&dev->mode_config.output_poll_to, - DRM_OUTPUT_POLL_SECONDS); -} - -static void -drm_output_poll_tick(void *arg) -{ - struct drm_device *dev = arg; - - task_add(systq, &dev->mode_config.poll_task); + schedule_delayed_work(delayed_work, DRM_OUTPUT_POLL_PERIOD); } void drm_kms_helper_poll_disable(struct drm_device *dev) { if (!dev->mode_config.poll_enabled) return; - timeout_del(&dev->mode_config.output_poll_to); - task_del(systq, &dev->mode_config.poll_task); + cancel_delayed_work_sync(&dev->mode_config.output_poll_work); } EXPORT_SYMBOL(drm_kms_helper_poll_disable); @@ -1050,16 +1041,13 @@ void drm_kms_helper_poll_enable(struct drm_device *dev) } if (poll) - timeout_add_sec(&dev->mode_config.output_poll_to, - DRM_OUTPUT_POLL_SECONDS); + schedule_delayed_work(&dev->mode_config.output_poll_work, DRM_OUTPUT_POLL_PERIOD); } EXPORT_SYMBOL(drm_kms_helper_poll_enable); void drm_kms_helper_poll_init(struct drm_device *dev) { - task_set(&dev->mode_config.poll_task, drm_output_poll_execute, dev); - timeout_set(&dev->mode_config.output_poll_to, drm_output_poll_tick, - dev); + INIT_DELAYED_WORK(&dev->mode_config.output_poll_work, output_poll_execute); dev->mode_config.poll_enabled = true; drm_kms_helper_poll_enable(dev); diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index 34750f93305..78915bdb558 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.31 2015/06/26 15:22:23 kettenis Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.32 2015/07/11 04:00:46 jsg Exp $ */ /* * Copyright (c) 2013, 2014 Mark Kettenis * @@ -399,11 +399,12 @@ cancel_delayed_work(struct delayed_work *dwork) return task_del(dwork->tq, &dwork->work.task); } -static inline void +static inline bool cancel_delayed_work_sync(struct delayed_work *dwork) { - timeout_del(&dwork->to); - task_del(dwork->tq, &dwork->work.task); + if (timeout_del(&dwork->to)) + return true; + return task_del(dwork->tq, &dwork->work.task); } #define NSEC_PER_USEC 1000L diff --git a/sys/dev/pci/drm/radeon/atom.c b/sys/dev/pci/drm/radeon/atom.c index 8082801a89b..c9507421d11 100644 --- a/sys/dev/pci/drm/radeon/atom.c +++ b/sys/dev/pci/drm/radeon/atom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atom.c,v 1.7 2015/04/18 14:47:34 jsg Exp $ */ +/* $OpenBSD: atom.c,v 1.8 2015/07/11 04:00:46 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * @@ -731,7 +731,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) SDEBUG(" target: 0x%04X\n", target); if (execute) { if (ctx->last_jump == (ctx->start + target)) { - cjiffies = ticks; + cjiffies = jiffies; if (time_after(cjiffies, ctx->last_jump_jiffies)) { cjiffies -= ctx->last_jump_jiffies; if ((jiffies_to_msecs(cjiffies) > 5000)) { @@ -740,11 +740,11 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg) } } else { /* jiffies wrap around we will just wait a little longer */ - ctx->last_jump_jiffies = ticks; + ctx->last_jump_jiffies = jiffies; } } else { ctx->last_jump = ctx->start + target; - ctx->last_jump_jiffies = ticks; + ctx->last_jump_jiffies = jiffies; } *ptr = ctx->start + target; } diff --git a/sys/dev/pci/drm/radeon/radeon.h b/sys/dev/pci/drm/radeon/radeon.h index 47fbdcff9cc..2c86169e46b 100644 --- a/sys/dev/pci/drm/radeon/radeon.h +++ b/sys/dev/pci/drm/radeon/radeon.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon.h,v 1.15 2015/04/18 14:47:35 jsg Exp $ */ +/* $OpenBSD: radeon.h,v 1.16 2015/07/11 04:00:46 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -1098,9 +1098,7 @@ struct radeon_pm { /* selected pm method */ enum radeon_pm_method pm_method; /* dynpm power management */ - struct task dynpm_idle_task; - struct timeout dynpm_idle_to; - + struct delayed_work dynpm_idle_work; enum radeon_dynpm_state dynpm_state; enum radeon_dynpm_action dynpm_planned_action; unsigned long dynpm_action_timeout; diff --git a/sys/dev/pci/drm/radeon/radeon_benchmark.c b/sys/dev/pci/drm/radeon/radeon_benchmark.c index d3d9118ccd6..574586a28ce 100644 --- a/sys/dev/pci/drm/radeon/radeon_benchmark.c +++ b/sys/dev/pci/drm/radeon/radeon_benchmark.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_benchmark.c,v 1.4 2015/04/18 14:47:35 jsg Exp $ */ +/* $OpenBSD: radeon_benchmark.c,v 1.5 2015/07/11 04:00:46 jsg Exp $ */ /* * Copyright 2009 Jerome Glisse. * @@ -42,7 +42,7 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size, struct radeon_fence *fence = NULL; int i, r; - start_jiffies = ticks; + start_jiffies = jiffies; for (i = 0; i < n; i++) { switch (flag) { case RADEON_BENCHMARK_COPY_DMA: @@ -66,7 +66,7 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size, goto exit_do_move; radeon_fence_unref(&fence); } - end_jiffies = ticks; + end_jiffies = jiffies; r = jiffies_to_msecs(end_jiffies - start_jiffies); exit_do_move: diff --git a/sys/dev/pci/drm/radeon/radeon_fence.c b/sys/dev/pci/drm/radeon/radeon_fence.c index cbad412301e..50159d83f3b 100644 --- a/sys/dev/pci/drm/radeon/radeon_fence.c +++ b/sys/dev/pci/drm/radeon/radeon_fence.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_fence.c,v 1.8 2015/04/18 14:47:35 jsg Exp $ */ +/* $OpenBSD: radeon_fence.c,v 1.9 2015/07/11 04:00:46 jsg Exp $ */ /* * Copyright 2009 Jerome Glisse. * All Rights Reserved. @@ -182,7 +182,7 @@ void radeon_fence_process(struct radeon_device *rdev, int ring) } while (atomic64_xchg(&rdev->fence_drv[ring].last_seq, seq) > seq); if (wake) { - rdev->fence_drv[ring].last_activity = ticks; + rdev->fence_drv[ring].last_activity = jiffies; wake_up_all(&rdev->fence_queue); } } @@ -283,7 +283,7 @@ static int radeon_fence_wait_seq(struct radeon_device *rdev, u64 target_seq, return -EBUSY; } - timeout = ticks - RADEON_FENCE_JIFFIES_TIMEOUT; + timeout = jiffies - RADEON_FENCE_JIFFIES_TIMEOUT; if (time_after(rdev->fence_drv[ring].last_activity, timeout)) { /* the normal case, timeout is somewhere before last_activity */ timeout = rdev->fence_drv[ring].last_activity - timeout; @@ -349,7 +349,7 @@ static int radeon_fence_wait_seq(struct radeon_device *rdev, u64 target_seq, /* change last activity so nobody else think there is a lockup */ for (i = 0; i < RADEON_NUM_RINGS; ++i) { - rdev->fence_drv[i].last_activity = ticks; + rdev->fence_drv[i].last_activity = jiffies; } /* mark the ring as not ready any more */ @@ -455,7 +455,7 @@ static int radeon_fence_wait_any_seq(struct radeon_device *rdev, } while (!radeon_fence_any_seq_signaled(rdev, target_seq)) { - timeout = ticks - RADEON_FENCE_JIFFIES_TIMEOUT; + timeout = jiffies - RADEON_FENCE_JIFFIES_TIMEOUT; if (time_after(last_activity, timeout)) { /* the normal case, timeout is somewhere before last_activity */ timeout = last_activity - timeout; @@ -522,7 +522,7 @@ static int radeon_fence_wait_any_seq(struct radeon_device *rdev, /* change last activity so nobody else think there is a lockup */ for (i = 0; i < RADEON_NUM_RINGS; ++i) { - rdev->fence_drv[i].last_activity = ticks; + rdev->fence_drv[i].last_activity = jiffies; } /* mark the ring as not ready any more */ @@ -815,7 +815,7 @@ static void radeon_fence_driver_init_ring(struct radeon_device *rdev, int ring) for (i = 0; i < RADEON_NUM_RINGS; ++i) rdev->fence_drv[ring].sync_seq[i] = 0; atomic64_set(&rdev->fence_drv[ring].last_seq, 0); - rdev->fence_drv[ring].last_activity = ticks; + rdev->fence_drv[ring].last_activity = jiffies; rdev->fence_drv[ring].initialized = false; } diff --git a/sys/dev/pci/drm/radeon/radeon_pm.c b/sys/dev/pci/drm/radeon/radeon_pm.c index 94514578f66..36d9f0be18f 100644 --- a/sys/dev/pci/drm/radeon/radeon_pm.c +++ b/sys/dev/pci/drm/radeon/radeon_pm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_pm.c,v 1.12 2015/04/18 14:47:35 jsg Exp $ */ +/* $OpenBSD: radeon_pm.c,v 1.13 2015/07/11 04:00:46 jsg Exp $ */ /* * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -40,8 +40,7 @@ static const char *radeon_pm_state_type_name[5] = { }; #endif -static void radeon_dynpm_idle_work_handler(void *); -static void radeon_dynpm_idle_tick(void *); +static void radeon_dynpm_idle_work_handler(struct work_struct *work); static int radeon_debugfs_pm_init(struct radeon_device *rdev); static bool radeon_pm_in_vbl(struct radeon_device *rdev); static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish); @@ -414,8 +413,7 @@ static ssize_t radeon_set_pm_method(struct device *dev, rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; rdev->pm.pm_method = PM_METHOD_PROFILE; mutex_unlock(&rdev->pm.mutex); - timeout_del(&rdev->pm.dynpm_idle_to); - task_del(systq, &rdev->pm.dynpm_idle_task); + cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); } else { count = -EINVAL; goto fail; @@ -545,8 +543,7 @@ void radeon_pm_suspend(struct radeon_device *rdev) } mutex_unlock(&rdev->pm.mutex); - timeout_del(&rdev->pm.dynpm_idle_to); - task_del(systq, &rdev->pm.dynpm_idle_task); + cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); } void radeon_pm_resume(struct radeon_device *rdev) @@ -579,7 +576,8 @@ void radeon_pm_resume(struct radeon_device *rdev) if (rdev->pm.pm_method == PM_METHOD_DYNPM && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) { rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; - timeout_add_msec(&rdev->pm.dynpm_idle_to, RADEON_IDLE_LOOP_MS); + schedule_delayed_work(&rdev->pm.dynpm_idle_work, + msecs_to_jiffies(RADEON_IDLE_LOOP_MS)); } mutex_unlock(&rdev->pm.mutex); radeon_pm_compute_clocks(rdev); @@ -631,9 +629,7 @@ int radeon_pm_init(struct radeon_device *rdev) if (ret) return ret; - task_set(&rdev->pm.dynpm_idle_task, radeon_dynpm_idle_work_handler, - rdev); - timeout_set(&rdev->pm.dynpm_idle_to, radeon_dynpm_idle_tick, rdev); + INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler); if (rdev->pm.num_power_states > 1) { #ifdef notyet @@ -673,8 +669,7 @@ void radeon_pm_fini(struct radeon_device *rdev) } mutex_unlock(&rdev->pm.mutex); - timeout_del(&rdev->pm.dynpm_idle_to); - task_del(systq, &rdev->pm.dynpm_idle_task); + cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); #ifdef notyet device_remove_file(rdev->dev, &dev_attr_power_profile); @@ -717,8 +712,7 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev) if (rdev->pm.dynpm_state != DYNPM_STATE_DISABLED) { if (rdev->pm.active_crtc_count > 1) { if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE) { - timeout_del(&rdev->pm.dynpm_idle_to); - task_del(systq, &rdev->pm.dynpm_idle_task); + cancel_delayed_work(&rdev->pm.dynpm_idle_work); rdev->pm.dynpm_state = DYNPM_STATE_PAUSED; rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT; @@ -736,16 +730,17 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev) radeon_pm_get_dynpm_state(rdev); radeon_pm_set_clocks(rdev); - timeout_add_msec(&rdev->pm.dynpm_idle_to, RADEON_IDLE_LOOP_MS); + schedule_delayed_work(&rdev->pm.dynpm_idle_work, + msecs_to_jiffies(RADEON_IDLE_LOOP_MS)); } else if (rdev->pm.dynpm_state == DYNPM_STATE_PAUSED) { rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; - timeout_add_msec(&rdev->pm.dynpm_idle_to, RADEON_IDLE_LOOP_MS); + schedule_delayed_work(&rdev->pm.dynpm_idle_work, + msecs_to_jiffies(RADEON_IDLE_LOOP_MS)); DRM_DEBUG_DRIVER("radeon: dynamic power management activated\n"); } } else { /* count == 0 */ if (rdev->pm.dynpm_state != DYNPM_STATE_MINIMUM) { - timeout_del(&rdev->pm.dynpm_idle_to); - task_del(systq, &rdev->pm.dynpm_idle_task); + cancel_delayed_work(&rdev->pm.dynpm_idle_work); rdev->pm.dynpm_state = DYNPM_STATE_MINIMUM; rdev->pm.dynpm_planned_action = DYNPM_ACTION_MINIMUM; @@ -792,17 +787,12 @@ static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish return in_vbl; } -static void radeon_dynpm_idle_tick(void *arg) +static void radeon_dynpm_idle_work_handler(struct work_struct *work) { - struct radeon_device *rdev = arg; - - task_add(systq, &rdev->pm.dynpm_idle_task); -} - -static void radeon_dynpm_idle_work_handler(void *arg1) -{ - struct radeon_device *rdev = arg1; + struct radeon_device *rdev; int resched; + rdev = container_of(work, struct radeon_device, + pm.dynpm_idle_work.work); resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); mutex_lock(&rdev->pm.mutex); @@ -827,7 +817,7 @@ static void radeon_dynpm_idle_work_handler(void *arg1) rdev->pm.dynpm_can_upclock) { rdev->pm.dynpm_planned_action = DYNPM_ACTION_UPCLOCK; - rdev->pm.dynpm_action_timeout = ticks + + rdev->pm.dynpm_action_timeout = jiffies + msecs_to_jiffies(RADEON_RECLOCK_DELAY_MS); } } else if (not_processed == 0) { /* should downclock */ @@ -837,7 +827,7 @@ static void radeon_dynpm_idle_work_handler(void *arg1) rdev->pm.dynpm_can_downclock) { rdev->pm.dynpm_planned_action = DYNPM_ACTION_DOWNCLOCK; - rdev->pm.dynpm_action_timeout = ticks + + rdev->pm.dynpm_action_timeout = jiffies + msecs_to_jiffies(RADEON_RECLOCK_DELAY_MS); } } @@ -846,12 +836,13 @@ static void radeon_dynpm_idle_work_handler(void *arg1) * to false since we want to wait for vbl to avoid flicker. */ if (rdev->pm.dynpm_planned_action != DYNPM_ACTION_NONE && - ticks - rdev->pm.dynpm_action_timeout > 0) { + jiffies > rdev->pm.dynpm_action_timeout) { radeon_pm_get_dynpm_state(rdev); radeon_pm_set_clocks(rdev); } - timeout_add_msec(&rdev->pm.dynpm_idle_to, RADEON_IDLE_LOOP_MS); + schedule_delayed_work(&rdev->pm.dynpm_idle_work, + msecs_to_jiffies(RADEON_IDLE_LOOP_MS)); } mutex_unlock(&rdev->pm.mutex); ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); diff --git a/sys/dev/pci/drm/radeon/radeon_ring.c b/sys/dev/pci/drm/radeon/radeon_ring.c index 47e66ff0ce5..97abc38bf29 100644 --- a/sys/dev/pci/drm/radeon/radeon_ring.c +++ b/sys/dev/pci/drm/radeon/radeon_ring.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_ring.c,v 1.7 2015/04/18 14:47:35 jsg Exp $ */ +/* $OpenBSD: radeon_ring.c,v 1.8 2015/07/11 04:00:46 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -525,7 +525,7 @@ void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring * void radeon_ring_lockup_update(struct radeon_ring *ring) { ring->last_rptr = ring->rptr; - ring->last_activity = ticks; + ring->last_activity = jiffies; } /** @@ -553,7 +553,7 @@ bool radeon_ring_test_lockup(struct radeon_device *rdev, struct radeon_ring *rin unsigned long cjiffies, elapsed; uint32_t rptr; - cjiffies = ticks; + cjiffies = jiffies; if (!time_after(cjiffies, ring->last_activity)) { /* likely a wrap around */ radeon_ring_lockup_update(ring); diff --git a/sys/dev/pci/drm/ttm/ttm_bo.c b/sys/dev/pci/drm/ttm/ttm_bo.c index 535e5369baf..205c2d48cbb 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo.c +++ b/sys/dev/pci/drm/ttm/ttm_bo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_bo.c,v 1.15 2015/04/12 03:54:10 jsg Exp $ */ +/* $OpenBSD: ttm_bo.c,v 1.16 2015/07/11 04:00:46 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA @@ -43,7 +43,6 @@ static int ttm_bo_setup_vm(struct ttm_buffer_object *bo); static int ttm_bo_swapout(struct ttm_mem_shrink *shrink); static void ttm_bo_global_kobj_release(struct ttm_bo_global *glob); -void ttm_bo_delayed_workqueue(void *); int ttm_bo_move_buffer(struct ttm_buffer_object *, struct ttm_placement *, bool, bool); @@ -553,8 +552,8 @@ static void ttm_bo_cleanup_refs_or_queue(struct ttm_buffer_object *bo) driver->sync_obj_flush(sync_obj); driver->sync_obj_unref(&sync_obj); } - timeout_add(&bdev->to, - ((hz / 100) < 1) ? 1 : hz / 100); + schedule_delayed_work(&bdev->wq, + ((HZ / 100) < 1) ? 1 : HZ / 100); } /** @@ -705,21 +704,14 @@ out: return ret; } -static void ttm_bo_delayed_tick(void *arg) +static void ttm_bo_delayed_workqueue(struct work_struct *work) { - struct ttm_bo_device *bdev = arg; - - task_add(systq, &bdev->task); -} - -void -ttm_bo_delayed_workqueue(void *arg1) -{ - struct ttm_bo_device *bdev = arg1; + struct ttm_bo_device *bdev = + container_of(work, struct ttm_bo_device, wq.work); if (ttm_bo_delayed_delete(bdev, false)) { - timeout_add(&bdev->to, - ((hz / 100) < 1) ? 1 : hz / 100); + schedule_delayed_work(&bdev->wq, + ((HZ / 100) < 1) ? 1 : HZ / 100); } } @@ -756,17 +748,15 @@ EXPORT_SYMBOL(ttm_bo_unref); int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev) { - timeout_del(&bdev->to); - task_del(systq, &bdev->task); - return 0; + return cancel_delayed_work_sync(&bdev->wq); } EXPORT_SYMBOL(ttm_bo_lock_delayed_workqueue); void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched) { if (resched) - timeout_add(&bdev->to, - ((hz / 100) < 1) ? 1 : hz / 100); + schedule_delayed_work(&bdev->wq, + ((HZ / 100) < 1) ? 1 : HZ / 100); } EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue); @@ -1541,8 +1531,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) list_del(&bdev->device_list); mutex_unlock(&glob->device_list_mutex); - timeout_del(&bdev->to); - task_del(systq, &bdev->task); + cancel_delayed_work_sync(&bdev->wq); while (ttm_bo_delayed_delete(bdev, true)) ; @@ -1590,8 +1579,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, if (unlikely(ret != 0)) goto out_no_addr_mm; - task_set(&bdev->task, ttm_bo_delayed_workqueue, bdev); - timeout_set(&bdev->to, ttm_bo_delayed_tick, bdev); + INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue); INIT_LIST_HEAD(&bdev->ddestroy); bdev->dev_mapping = NULL; bdev->glob = glob; diff --git a/sys/dev/pci/drm/ttm/ttm_bo_driver.h b/sys/dev/pci/drm/ttm/ttm_bo_driver.h index fbf083a2b53..806ac99b4b6 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_driver.h +++ b/sys/dev/pci/drm/ttm/ttm_bo_driver.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ttm_bo_driver.h,v 1.5 2015/04/18 14:47:35 jsg Exp $ */ +/* $OpenBSD: ttm_bo_driver.h,v 1.6 2015/07/11 04:00:46 jsg Exp $ */ /************************************************************************** * * Copyright (c) 2006-2009 Vmware, Inc., Palo Alto, CA., USA @@ -564,8 +564,7 @@ struct ttm_bo_device { * Internal protection. */ - struct task task; - struct timeout to; + struct delayed_work wq; bool need_dma32; }; |