2014-12-20 16:51:31

by Rickard Strandqvist

[permalink] [raw]
Subject: [PATCH] gpu: drm: nouveau: core: subdev: clock: base.c: Remove unused function

Remove the function nouveau_clock_astate() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <[email protected]>
---
drivers/gpu/drm/nouveau/core/include/subdev/clock.h | 1 -
drivers/gpu/drm/nouveau/core/subdev/clock/base.c | 10 ----------
2 files changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
index 36ed035..8577945 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
@@ -159,7 +159,6 @@ int nva3_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
int clk, struct nouveau_pll_vals *);

int nouveau_clock_ustate(struct nouveau_clock *, int req, int pwr);
-int nouveau_clock_astate(struct nouveau_clock *, int req, int rel);
int nouveau_clock_dstate(struct nouveau_clock *, int req, int rel);
int nouveau_clock_tstate(struct nouveau_clock *, int req, int rel);

diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
index e51b72d..b2c852a 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
@@ -430,16 +430,6 @@ nouveau_clock_ustate(struct nouveau_clock *clk, int req, int pwr)
}

int
-nouveau_clock_astate(struct nouveau_clock *clk, int req, int rel)
-{
- if (!rel) clk->astate = req;
- if ( rel) clk->astate += rel;
- clk->astate = min(clk->astate, clk->state_nr - 1);
- clk->astate = max(clk->astate, 0);
- return nouveau_pstate_calc(clk, true);
-}
-
-int
nouveau_clock_tstate(struct nouveau_clock *clk, int req, int rel)
{
if (!rel) clk->tstate = req;
--
1.7.10.4


2014-12-21 02:46:46

by Ben Skeggs

[permalink] [raw]
Subject: Re: [PATCH] gpu: drm: nouveau: core: subdev: clock: base.c: Remove unused function

----- Original Message -----
> From: "Rickard Strandqvist" <[email protected]>
> To: "David Airlie" <[email protected]>, "Ben Skeggs" <[email protected]>
> Cc: "Rickard Strandqvist" <[email protected]>, "Alexandre Courbot" <[email protected]>, "Ilia
> Mirkin" <[email protected]>, [email protected], [email protected]
> Sent: Sunday, 21 December, 2014 2:54:16 AM
> Subject: [PATCH] gpu: drm: nouveau: core: subdev: clock: base.c: Remove unused function
>
> Remove the function nouveau_clock_astate() that is not used anywhere.
No, don't remove this. It's only not used because noone got around to finishing load-based reclocking yet.

NVIDIA has an implementation for the GK20A in the works that uses it.

Ben.

>
> This was partially found by using a static code analysis program called
> cppcheck.
>
> Signed-off-by: Rickard Strandqvist <[email protected]>
> ---
> drivers/gpu/drm/nouveau/core/include/subdev/clock.h | 1 -
> drivers/gpu/drm/nouveau/core/subdev/clock/base.c | 10 ----------
> 2 files changed, 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
> b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
> index 36ed035..8577945 100644
> --- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
> +++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
> @@ -159,7 +159,6 @@ int nva3_clock_pll_calc(struct nouveau_clock *, struct
> nvbios_pll *,
> int clk, struct nouveau_pll_vals *);
>
> int nouveau_clock_ustate(struct nouveau_clock *, int req, int pwr);
> -int nouveau_clock_astate(struct nouveau_clock *, int req, int rel);
> int nouveau_clock_dstate(struct nouveau_clock *, int req, int rel);
> int nouveau_clock_tstate(struct nouveau_clock *, int req, int rel);
>
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
> b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
> index e51b72d..b2c852a 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
> @@ -430,16 +430,6 @@ nouveau_clock_ustate(struct nouveau_clock *clk, int req,
> int pwr)
> }
>
> int
> -nouveau_clock_astate(struct nouveau_clock *clk, int req, int rel)
> -{
> - if (!rel) clk->astate = req;
> - if ( rel) clk->astate += rel;
> - clk->astate = min(clk->astate, clk->state_nr - 1);
> - clk->astate = max(clk->astate, 0);
> - return nouveau_pstate_calc(clk, true);
> -}
> -
> -int
> nouveau_clock_tstate(struct nouveau_clock *clk, int req, int rel)
> {
> if (!rel) clk->tstate = req;
> --
> 1.7.10.4
>
>

2014-12-21 11:24:13

by Rickard Strandqvist

[permalink] [raw]
Subject: Re: [PATCH] gpu: drm: nouveau: core: subdev: clock: base.c: Remove unused function

2014-12-21 3:46 GMT+01:00 Ben Skeggs <[email protected]>:
> ----- Original Message -----
>> From: "Rickard Strandqvist" <[email protected]>
>> To: "David Airlie" <[email protected]>, "Ben Skeggs" <[email protected]>
>> Cc: "Rickard Strandqvist" <[email protected]>, "Alexandre Courbot" <[email protected]>, "Ilia
>> Mirkin" <[email protected]>, [email protected], [email protected]
>> Sent: Sunday, 21 December, 2014 2:54:16 AM
>> Subject: [PATCH] gpu: drm: nouveau: core: subdev: clock: base.c: Remove unused function
>>
>> Remove the function nouveau_clock_astate() that is not used anywhere.
> No, don't remove this. It's only not used because noone got around to finishing load-based reclocking yet.
>
> NVIDIA has an implementation for the GK20A in the works that uses it.
>
> Ben.
>
>>
>> This was partially found by using a static code analysis program called
>> cppcheck.
>>
>> Signed-off-by: Rickard Strandqvist <[email protected]>
>> ---
>> drivers/gpu/drm/nouveau/core/include/subdev/clock.h | 1 -
>> drivers/gpu/drm/nouveau/core/subdev/clock/base.c | 10 ----------
>> 2 files changed, 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
>> b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
>> index 36ed035..8577945 100644
>> --- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
>> +++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
>> @@ -159,7 +159,6 @@ int nva3_clock_pll_calc(struct nouveau_clock *, struct
>> nvbios_pll *,
>> int clk, struct nouveau_pll_vals *);
>>
>> int nouveau_clock_ustate(struct nouveau_clock *, int req, int pwr);
>> -int nouveau_clock_astate(struct nouveau_clock *, int req, int rel);
>> int nouveau_clock_dstate(struct nouveau_clock *, int req, int rel);
>> int nouveau_clock_tstate(struct nouveau_clock *, int req, int rel);
>>
>> diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> index e51b72d..b2c852a 100644
>> --- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> @@ -430,16 +430,6 @@ nouveau_clock_ustate(struct nouveau_clock *clk, int req,
>> int pwr)
>> }
>>
>> int
>> -nouveau_clock_astate(struct nouveau_clock *clk, int req, int rel)
>> -{
>> - if (!rel) clk->astate = req;
>> - if ( rel) clk->astate += rel;
>> - clk->astate = min(clk->astate, clk->state_nr - 1);
>> - clk->astate = max(clk->astate, 0);
>> - return nouveau_pstate_calc(clk, true);
>> -}
>> -
>> -int
>> nouveau_clock_tstate(struct nouveau_clock *clk, int req, int rel)
>> {
>> if (!rel) clk->tstate = req;
>> --
>> 1.7.10.4
>>


Hi

Ok, sorry.
But maybe there should be a comment on the function.

Kind regards
Rickard Strandqvist