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

Submitted by Karol Herbst on April 18, 2016, 7:14 p.m.

Details

Message ID 1461006851-5007-31-git-send-email-nouveau@karolherbst.de
State New
Headers show
Series "Volting/Clocking improvements for Fermi and newer" ( rev: 4 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst April 18, 2016, 7:14 p.m.
Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
---
 drm/nouveau/nvkm/subdev/clk/base.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

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);

Comments

sepArate

On 18/04/16 22:14, Karol Herbst wrote:

Would be nice to say what for.

With a better commit message and the typo fixed:

Reviewed-by: Martin Peres <martin.peres@free.fr>
> Signed-off-by: Karol Herbst <nouveau@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);