[Nouveau] [PATCH v4 30/37] clk: seperate the locking from the implementation in nvkm_clk_update

Karol Herbst nouveau at karolherbst.de
Mon Apr 18 19:14:04 UTC 2016


Signed-off-by: Karol Herbst <nouveau at karolherbst.de>
---
 drm/nouveau/nvkm/subdev/clk/base.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
index 7f86e41..d6f239f 100644
--- a/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drm/nouveau/nvkm/subdev/clk/base.c
@@ -319,14 +319,11 @@ nvkm_pstate_prog(struct nvkm_clk *clk, int pstateid)
 }
 
 static void
-nvkm_clk_update_work(struct work_struct *work)
+nvkm_clk_update_impl(struct nvkm_clk *clk)
 {
-	struct nvkm_clk *clk = container_of(work, typeof(*clk), work);
 	struct nvkm_subdev *subdev = &clk->subdev;
 	int pstate, ret;
 
-	if (!atomic_xchg(&clk->waiting, 0))
-		return;
 	clk->pwrsrc = power_supply_is_system_supplied();
 
 	if (clk->pstate)
@@ -350,6 +347,17 @@ nvkm_clk_update_work(struct work_struct *work)
 		nvkm_error(subdev, "error setting pstate %d: %d\n",
 			   pstate, ret);
 	}
+}
+
+static void
+nvkm_clk_update_work(struct work_struct *work)
+{
+	struct nvkm_clk *clk = container_of(work, typeof(*clk), work);
+
+	if (!atomic_xchg(&clk->waiting, 0))
+		return;
+
+	nvkm_clk_update_impl(clk);
 
 	wake_up_all(&clk->wait);
 	nvkm_notify_get(&clk->pwrsrc_ntfy);
-- 
2.8.1



More information about the Nouveau mailing list