drm/nouveau/dp: fix bad comparison in dp_link_train_commit()
authorXi Wang <xi.wang@gmail.com>
Fri, 3 Feb 2012 16:13:55 +0000 (11:13 -0500)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 13 Mar 2012 07:14:58 +0000 (17:14 +1000)
The comparison (lpre == DP_TRAIN_PRE_EMPHASIS_9_5) is always false:
lpre is initialized as (lane & 0x0c) >> 2, which is at most 3, while
DP_TRAIN_PRE_EMPHASIS_9_5 is defined as (3 << 3).

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_dp.c

index 9b93b703ceabaacaf9a3ba1f7326e77d1fe6a773..c51c68b045a84d4c8f646164e12400c2935f2df0 100644 (file)
@@ -432,7 +432,7 @@ dp_link_train_commit(struct drm_device *dev, struct dp_state *dp)
                dp->conf[i] = (lpre << 3) | lvsw;
                if (lvsw == DP_TRAIN_VOLTAGE_SWING_1200)
                        dp->conf[i] |= DP_TRAIN_MAX_SWING_REACHED;
-               if (lpre == DP_TRAIN_PRE_EMPHASIS_9_5)
+               if ((lpre << 3) == DP_TRAIN_PRE_EMPHASIS_9_5)
                        dp->conf[i] |= DP_TRAIN_MAX_PRE_EMPHASIS_REACHED;
 
                NV_DEBUG_KMS(dev, "config lane %d %02x\n", i, dp->conf[i]);