diff mbox series

[06/25] drm/msm/dpu: clean up redundant hw type

Message ID 1539059262-8326-7-git-send-email-jsanka@codeaurora.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show
Series reserve RM resources in CRTC state | expand

Commit Message

Jeykumar Sankaran Oct. 9, 2018, 4:27 a.m. UTC
struct dpu_hw_blk has hw block type info. Remove duplicate
type tracking in struct dpu_rm_hw_blk.

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

Comments

Sean Paul Oct. 9, 2018, 8:32 p.m. UTC | #1
On Mon, Oct 08, 2018 at 09:27:23PM -0700, Jeykumar Sankaran wrote:
> struct dpu_hw_blk has hw block type info. Remove duplicate
> type tracking in struct dpu_rm_hw_blk.
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> index 5ce89b9..377def7 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> @@ -38,14 +38,12 @@ struct dpu_rm_requirements {
>  /**
>   * struct dpu_rm_hw_blk - hardware block tracking list member
>   * @list:	List head for list of all hardware blocks tracking items
> - * @type:	Type of hardware block this structure tracks
>   * @id:		Hardware ID number, within it's own space, ie. LM_X
>   * @enc_id:	Encoder id to which this blk is binded
>   * @hw:		Pointer to the hardware register access object for this block
>   */
>  struct dpu_rm_hw_blk {
>  	struct list_head list;
> -	enum dpu_hw_blk_type type;
>  	uint32_t id;
>  	uint32_t enc_id;
>  	struct dpu_hw_blk *hw;
> @@ -86,12 +84,6 @@ static bool _dpu_rm_get_hw_locked(struct dpu_rm *rm, struct dpu_rm_hw_iter *i)
>  	i->blk = list_prepare_entry(i->blk, blk_list, list);
>  
>  	list_for_each_entry_continue(i->blk, blk_list, list) {
> -		if (i->blk->type != i->type) {
> -			DPU_ERROR("found incorrect block type %d on %d list\n",
> -					i->blk->type, i->type);
> -			return false;
> -		}
> -
>  		if (i->enc_id == i->blk->enc_id) {
>  			i->hw = i->blk->hw;
>  			DPU_DEBUG("found type %d id %d for enc %d\n",
> @@ -151,7 +143,7 @@ int dpu_rm_destroy(struct dpu_rm *rm)
>  		list_for_each_entry_safe(hw_cur, hw_nxt, &rm->hw_blks[type],
>  				list) {
>  			list_del(&hw_cur->list);
> -			_dpu_rm_hw_destroy(hw_cur->type, hw_cur->hw);
> +			_dpu_rm_hw_destroy(type, hw_cur->hw);
>  			kfree(hw_cur);
>  		}
>  	}
> @@ -213,7 +205,6 @@ static int _dpu_rm_hw_blk_create(
>  		return -ENOMEM;
>  	}
>  
> -	blk->type = type;
>  	blk->id = id;
>  	blk->hw = hw;
>  	blk->enc_id = 0;
> @@ -458,7 +449,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, uint32_t enc_id,
>  		lm[i]->enc_id = enc_id;
>  		pp[i]->enc_id = enc_id;
>  
> -		trace_dpu_rm_reserve_lms(lm[i]->id, lm[i]->type, enc_id,
> +		trace_dpu_rm_reserve_lms(lm[i]->id, DPU_HW_BLK_LM, enc_id,
>  					 pp[i]->id);
>  	}
>  
> @@ -510,7 +501,7 @@ static int _dpu_rm_reserve_ctls(
>  
>  	for (i = 0; i < ARRAY_SIZE(ctls) && i < num_ctls; i++) {
>  		ctls[i]->enc_id = enc_id;
> -		trace_dpu_rm_reserve_ctls(ctls[i]->id, ctls[i]->type,
> +		trace_dpu_rm_reserve_ctls(ctls[i]->id, DPU_HW_BLK_CTL,
>  					  enc_id);
>  	}
>  
> @@ -538,7 +529,7 @@ static int _dpu_rm_reserve_intf(
>  		}
>  
>  		iter.blk->enc_id = enc_id;
> -		trace_dpu_rm_reserve_intf(iter.blk->id, iter.blk->type,
> +		trace_dpu_rm_reserve_intf(iter.blk->id, DPU_HW_BLK_INTF,

You should probably just remove the argument from the trace statements since
it's redundant.

Sean

>  					  enc_id);
>  		break;
>  	}
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
kernel test robot Oct. 10, 2018, 12:40 a.m. UTC | #2
Hi Jeykumar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robclark/msm-next]
[also build test ERROR on next-20181009]
[cannot apply to v4.19-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jeykumar-Sankaran/reserve-RM-resources-in-CRTC-state/20181010-031051
base:   git://people.freedesktop.org/~robclark/linux msm-next
config: arm64-allmodconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm64 

Note: the linux-review/Jeykumar-Sankaran/reserve-RM-resources-in-CRTC-state/20181010-031051 HEAD c098339a791502c4a3732a304890f36240874372 builds fine.
      It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

   In file included from include/drm/drm_mm.h:49:0,
                    from include/drm/drmP.h:73,
                    from drivers/gpu/drm/msm/msm_drv.h:39,
                    from drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h:22,
                    from drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c:16:
   drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c: In function '_dpu_rm_release_reservation':
>> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c:622:11: error: 'struct dpu_rm_hw_blk' has no member named 'type'
           blk->type, blk->id);
              ^
   include/drm/drm_print.h:352:30: note: in definition of macro 'DRM_DEBUG'
     drm_dbg(DRM_UT_CORE, fmt, ##__VA_ARGS__)
                                 ^~~~~~~~~~~
>> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c:621:5: note: in expansion of macro 'DPU_DEBUG'
        DPU_DEBUG("rel enc %d %d %d\n", enc_id,
        ^~~~~~~~~
   In file included from include/linux/printk.h:336:0,
                    from include/linux/kernel.h:14,
                    from drivers/gpu/drm/msm/msm_drv.h:22,
                    from drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h:22,
                    from drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c:16:
>> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c:622:11: error: 'struct dpu_rm_hw_blk' has no member named 'type'
           blk->type, blk->id);
              ^
   include/linux/dynamic_debug.h:128:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
>> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h:48:4: note: in expansion of macro 'pr_debug'
       pr_debug(fmt, ##__VA_ARGS__);                      \
       ^~~~~~~~
>> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c:621:5: note: in expansion of macro 'DPU_DEBUG'
        DPU_DEBUG("rel enc %d %d %d\n", enc_id,
        ^~~~~~~~~

vim +622 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c

25fdd593 Jeykumar Sankaran 2018-06-27  611  
0ff27752 Jeykumar Sankaran 2018-10-08  612  static void _dpu_rm_release_reservation(struct dpu_rm *rm, uint32_t enc_id)
25fdd593 Jeykumar Sankaran 2018-06-27  613  {
25fdd593 Jeykumar Sankaran 2018-06-27  614  	struct dpu_rm_hw_blk *blk;
25fdd593 Jeykumar Sankaran 2018-06-27  615  	enum dpu_hw_blk_type type;
25fdd593 Jeykumar Sankaran 2018-06-27  616  
25fdd593 Jeykumar Sankaran 2018-06-27  617  	for (type = 0; type < DPU_HW_BLK_MAX; type++) {
25fdd593 Jeykumar Sankaran 2018-06-27  618  		list_for_each_entry(blk, &rm->hw_blks[type], list) {
0ff27752 Jeykumar Sankaran 2018-10-08  619  			if (blk->enc_id == enc_id) {
0ff27752 Jeykumar Sankaran 2018-10-08  620  				blk->enc_id = 0;
0ff27752 Jeykumar Sankaran 2018-10-08 @621  				DPU_DEBUG("rel enc %d %d %d\n", enc_id,
25fdd593 Jeykumar Sankaran 2018-06-27 @622  					  blk->type, blk->id);
25fdd593 Jeykumar Sankaran 2018-06-27  623  			}
25fdd593 Jeykumar Sankaran 2018-06-27  624  		}
25fdd593 Jeykumar Sankaran 2018-06-27  625  	}
25fdd593 Jeykumar Sankaran 2018-06-27  626  }
25fdd593 Jeykumar Sankaran 2018-06-27  627  

:::::: The code at line 622 was first introduced by commit
:::::: 25fdd5933e4c0f5fe2ea5cd59994f8ac5fbe90ef drm/msm: Add SDM845 DPU support

:::::: TO: Jeykumar Sankaran <jsanka@codeaurora.org>
:::::: CC: Sean Paul <seanpaul@chromium.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
index 5ce89b9..377def7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
@@ -38,14 +38,12 @@  struct dpu_rm_requirements {
 /**
  * struct dpu_rm_hw_blk - hardware block tracking list member
  * @list:	List head for list of all hardware blocks tracking items
- * @type:	Type of hardware block this structure tracks
  * @id:		Hardware ID number, within it's own space, ie. LM_X
  * @enc_id:	Encoder id to which this blk is binded
  * @hw:		Pointer to the hardware register access object for this block
  */
 struct dpu_rm_hw_blk {
 	struct list_head list;
-	enum dpu_hw_blk_type type;
 	uint32_t id;
 	uint32_t enc_id;
 	struct dpu_hw_blk *hw;
@@ -86,12 +84,6 @@  static bool _dpu_rm_get_hw_locked(struct dpu_rm *rm, struct dpu_rm_hw_iter *i)
 	i->blk = list_prepare_entry(i->blk, blk_list, list);
 
 	list_for_each_entry_continue(i->blk, blk_list, list) {
-		if (i->blk->type != i->type) {
-			DPU_ERROR("found incorrect block type %d on %d list\n",
-					i->blk->type, i->type);
-			return false;
-		}
-
 		if (i->enc_id == i->blk->enc_id) {
 			i->hw = i->blk->hw;
 			DPU_DEBUG("found type %d id %d for enc %d\n",
@@ -151,7 +143,7 @@  int dpu_rm_destroy(struct dpu_rm *rm)
 		list_for_each_entry_safe(hw_cur, hw_nxt, &rm->hw_blks[type],
 				list) {
 			list_del(&hw_cur->list);
-			_dpu_rm_hw_destroy(hw_cur->type, hw_cur->hw);
+			_dpu_rm_hw_destroy(type, hw_cur->hw);
 			kfree(hw_cur);
 		}
 	}
@@ -213,7 +205,6 @@  static int _dpu_rm_hw_blk_create(
 		return -ENOMEM;
 	}
 
-	blk->type = type;
 	blk->id = id;
 	blk->hw = hw;
 	blk->enc_id = 0;
@@ -458,7 +449,7 @@  static int _dpu_rm_reserve_lms(struct dpu_rm *rm, uint32_t enc_id,
 		lm[i]->enc_id = enc_id;
 		pp[i]->enc_id = enc_id;
 
-		trace_dpu_rm_reserve_lms(lm[i]->id, lm[i]->type, enc_id,
+		trace_dpu_rm_reserve_lms(lm[i]->id, DPU_HW_BLK_LM, enc_id,
 					 pp[i]->id);
 	}
 
@@ -510,7 +501,7 @@  static int _dpu_rm_reserve_ctls(
 
 	for (i = 0; i < ARRAY_SIZE(ctls) && i < num_ctls; i++) {
 		ctls[i]->enc_id = enc_id;
-		trace_dpu_rm_reserve_ctls(ctls[i]->id, ctls[i]->type,
+		trace_dpu_rm_reserve_ctls(ctls[i]->id, DPU_HW_BLK_CTL,
 					  enc_id);
 	}
 
@@ -538,7 +529,7 @@  static int _dpu_rm_reserve_intf(
 		}
 
 		iter.blk->enc_id = enc_id;
-		trace_dpu_rm_reserve_intf(iter.blk->id, iter.blk->type,
+		trace_dpu_rm_reserve_intf(iter.blk->id, DPU_HW_BLK_INTF,
 					  enc_id);
 		break;
 	}