[Nouveau] [PATCH] drm: nouveau: remove a redundant local variable 'pclks'

2018-09-19 Thread zhong jiang
The local variable 'pclks' is never used after being assigned.
hence it should be redundant and can be removed.

Signed-off-by: zhong jiang 
---
 drivers/gpu/drm/nouveau/dispnv04/arb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/arb.c 
b/drivers/gpu/drm/nouveau/dispnv04/arb.c
index c79160c..cae8f71 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/arb.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/arb.c
@@ -56,7 +56,7 @@ struct nv_sim_state {
 nv04_calc_arb(struct nv_fifo_info *fifo, struct nv_sim_state *arb)
 {
int pagemiss, cas, width, bpp;
-   int nvclks, mclks, pclks, crtpagemiss;
+   int nvclks, mclks, crtpagemiss;
int found, mclk_extra, mclk_loop, cbs, m1, p1;
int mclk_freq, pclk_freq, nvclk_freq;
int us_m, us_n, us_p, crtc_drain_rate;
@@ -71,7 +71,6 @@ struct nv_sim_state {
bpp = arb->bpp;
cbs = 128;
 
-   pclks = 2;
nvclks = 10;
mclks = 13 + cas;
mclk_extra = 3;
-- 
1.7.12.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH] drm: nouveau: use match_string() helper to simplify the code

2018-09-14 Thread zhong jiang
match_string() returns the index of an array for a matching string,
which can be used intead of open coded implementation.

Signed-off-by: zhong jiang 
---
 drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c 
b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
index 6a4ca13..053d794 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c
@@ -641,17 +641,13 @@ static int nv17_tv_create_resources(struct drm_encoder 
*encoder,
struct dcb_output *dcb = nouveau_encoder(encoder)->dcb;
int num_tv_norms = dcb->tvconf.has_component_output ? NUM_TV_NORMS :
NUM_LD_TV_NORMS;
-   int i;
+   int index;
 
if (nouveau_tv_norm) {
-   for (i = 0; i < num_tv_norms; i++) {
-   if (!strcmp(nv17_tv_norm_names[i], nouveau_tv_norm)) {
-   tv_enc->tv_norm = i;
-   break;
-   }
-   }
-
-   if (i == num_tv_norms)
+   index = match_string(nv17_tv_norm_names, num_tv_norms, 
nouveau_tv_norm);
+   if (index >= 0)
+   tv_enc->tv_norm = index;
+   else
NV_WARN(drm, "Invalid TV norm setting \"%s\"\n",
nouveau_tv_norm);
}
-- 
1.7.12.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [PATCH] gpu:nouveau: Do not use unnecessary IS_ERR_VALUE when pm_runtime_* calls

2018-08-23 Thread zhong jiang
Make sure Pm_runtime_* calls does not use unnecessary IS_ERR_VALUE.
when I run pm_runtime.cocci, I find the issue. So just replace it.

Signed-off-by: zhong jiang 
---
 drivers/gpu/drm/nouveau/nouveau_debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c 
b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index 9109b69..9635704 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -161,7 +161,7 @@
}
 
ret = pm_runtime_get_sync(drm->dev);
-   if (IS_ERR_VALUE(ret) && ret != -EACCES)
+   if (ret < 0 && ret != -EACCES)
return ret;
ret = nvif_mthd(ctrl, NVIF_CONTROL_PSTATE_USER, &args, sizeof(args));
pm_runtime_put_autosuspend(drm->dev);
-- 
1.7.12.4

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau