linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nouveau: fix nv40_perfctr_next() cleanup regression
@ 2016-03-14 14:24 Arnd Bergmann
  2016-03-16  4:55 ` Ben Skeggs
  2016-03-16 19:34 ` Samuel Pitoiset
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-03-14 14:24 UTC (permalink / raw)
  To: David Airlie
  Cc: Arnd Bergmann, Ben Skeggs, Samuel Pitoiset, dri-devel, linux-kernel

gcc-6 warns about code in the nouveau driver that is obviously silly:

drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c: In function 'nv40_perfctr_next':
drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c:62:19: warning: self-comparison always evaluats to false [-Wtautological-compare]
  if (pm->sequence != pm->sequence) {

The behavior was accidentally introduced in a patch described as "This is
purely preparation for upcoming commits, there should be no code changes here.".
As far as I can tell, that was true for the rest of that patch except for
this one function, which has been changed to a NOP.

This patch restores the original behavior.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 8c1aeaa13954 ("drm/nouveau/pm: cosmetic changes")
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
index 4bef72a9d106..3fda594700e0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
@@ -59,9 +59,11 @@ static void
 nv40_perfctr_next(struct nvkm_pm *pm, struct nvkm_perfdom *dom)
 {
 	struct nvkm_device *device = pm->engine.subdev.device;
-	if (pm->sequence != pm->sequence) {
+	struct nv40_pm *nv40pm = container_of(pm, struct nv40_pm, base);
+
+	if (nv40pm->sequence != pm->sequence) {
 		nvkm_wr32(device, 0x400084, 0x00000020);
-		pm->sequence = pm->sequence;
+		nv40pm->sequence = pm->sequence;
 	}
 }
 
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nouveau: fix nv40_perfctr_next() cleanup regression
  2016-03-14 14:24 [PATCH] nouveau: fix nv40_perfctr_next() cleanup regression Arnd Bergmann
@ 2016-03-16  4:55 ` Ben Skeggs
  2016-03-16 19:34 ` Samuel Pitoiset
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Skeggs @ 2016-03-16  4:55 UTC (permalink / raw)
  To: Arnd Bergmann, David Airlie; +Cc: Samuel Pitoiset, dri-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

On 03/15/2016 12:24 AM, Arnd Bergmann wrote:
> gcc-6 warns about code in the nouveau driver that is obviously silly:
> 
> drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c: In function 'nv40_perfctr_next':
> drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c:62:19: warning: self-comparison always evaluats to false [-Wtautological-compare]
>   if (pm->sequence != pm->sequence) {
> 
> The behavior was accidentally introduced in a patch described as "This is
> purely preparation for upcoming commits, there should be no code changes here.".
> As far as I can tell, that was true for the rest of that patch except for
> this one function, which has been changed to a NOP.
> 
> This patch restores the original behavior.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 8c1aeaa13954 ("drm/nouveau/pm: cosmetic changes")
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>

> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
> index 4bef72a9d106..3fda594700e0 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
> @@ -59,9 +59,11 @@ static void
>  nv40_perfctr_next(struct nvkm_pm *pm, struct nvkm_perfdom *dom)
>  {
>  	struct nvkm_device *device = pm->engine.subdev.device;
> -	if (pm->sequence != pm->sequence) {
> +	struct nv40_pm *nv40pm = container_of(pm, struct nv40_pm, base);
> +
> +	if (nv40pm->sequence != pm->sequence) {
>  		nvkm_wr32(device, 0x400084, 0x00000020);
> -		pm->sequence = pm->sequence;
> +		nv40pm->sequence = pm->sequence;
>  	}
>  }
>  
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nouveau: fix nv40_perfctr_next() cleanup regression
  2016-03-14 14:24 [PATCH] nouveau: fix nv40_perfctr_next() cleanup regression Arnd Bergmann
  2016-03-16  4:55 ` Ben Skeggs
@ 2016-03-16 19:34 ` Samuel Pitoiset
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Pitoiset @ 2016-03-16 19:34 UTC (permalink / raw)
  To: Arnd Bergmann, David Airlie; +Cc: Ben Skeggs, dri-devel, linux-kernel

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>

On 03/14/2016 03:24 PM, Arnd Bergmann wrote:
> gcc-6 warns about code in the nouveau driver that is obviously silly:
>
> drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c: In function 'nv40_perfctr_next':
> drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c:62:19: warning: self-comparison always evaluats to false [-Wtautological-compare]
>    if (pm->sequence != pm->sequence) {
>
> The behavior was accidentally introduced in a patch described as "This is
> purely preparation for upcoming commits, there should be no code changes here.".
> As far as I can tell, that was true for the rest of that patch except for
> this one function, which has been changed to a NOP.
>
> This patch restores the original behavior.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 8c1aeaa13954 ("drm/nouveau/pm: cosmetic changes")
> ---
>   drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
> index 4bef72a9d106..3fda594700e0 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c
> @@ -59,9 +59,11 @@ static void
>   nv40_perfctr_next(struct nvkm_pm *pm, struct nvkm_perfdom *dom)
>   {
>   	struct nvkm_device *device = pm->engine.subdev.device;
> -	if (pm->sequence != pm->sequence) {
> +	struct nv40_pm *nv40pm = container_of(pm, struct nv40_pm, base);
> +
> +	if (nv40pm->sequence != pm->sequence) {
>   		nvkm_wr32(device, 0x400084, 0x00000020);
> -		pm->sequence = pm->sequence;
> +		nv40pm->sequence = pm->sequence;
>   	}
>   }
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-16 19:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-14 14:24 [PATCH] nouveau: fix nv40_perfctr_next() cleanup regression Arnd Bergmann
2016-03-16  4:55 ` Ben Skeggs
2016-03-16 19:34 ` Samuel Pitoiset

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).