Skip to contentSkip to conversation

nouveau: fix nv40_perfctr_next() cleanup regression

PATCH In review Arnd Bergmann 3 participants 3 messages Mar 14, 2016 – Mar 16, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nouveau: fix nv40_perfctr_next() cleanup regression

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.

Fixes 8c1aeaa13954 ("drm/nouveau/pm: cosmetic changes")
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c +4 -2
index 4bef72a9d106..3fda594700e0 100644
@@ -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;
 	}
 }
 
Signature · 1 line
2.7.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Arnd Bergmann

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.

Quoted 4 lines

This patch restores the original behavior.

Fixes 8c1aeaa13954 ("drm/nouveau/pm: cosmetic changes")
Quoted 23 lines
---
 drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c +4 -2
index 4bef72a9d106..3fda594700e0 100644
@@ -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;
 	}
 }
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 28 lines · Arnd Bergmann

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.

Fixes 8c1aeaa13954 ("drm/nouveau/pm: cosmetic changes")
---
  drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c +0 -0
index 4bef72a9d106..3fda594700e0 100644
@@ -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;

drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c static void · line 69

Quoted 10 lines
drivers/gpu/drm/nouveau/nvkm/engine/pm/nv40.c +4 -2
-	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;
  	}
  }
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel