drm/msm/dpu: stop embedding dpu_hw_blk into dpu_hw_intf
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 21 Jan 2022 21:06:16 +0000 (00:06 +0300)
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Fri, 18 Feb 2022 17:15:11 +0000 (20:15 +0300)
Now as dpu_hw_intf is not hanled by dpu_rm_get_assigned_resources, there
is no point in embedding the (empty) struct dpu_hw_blk into dpu_hw_intf
(and using typecasts between dpu_hw_blk and dpu_hw_intf). Drop it and
use dpu_hw_intf directly.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Link: https://lore.kernel.org/r/20220121210618.3482550-5-dmitry.baryshkov@linaro.org
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.h
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h

index 3568be8..230d122 100644 (file)
@@ -78,7 +78,6 @@ struct dpu_hw_intf_ops {
 };
 
 struct dpu_hw_intf {
-       struct dpu_hw_blk base;
        struct dpu_hw_blk_reg_map hw;
 
        /* intf */
@@ -91,16 +90,6 @@ struct dpu_hw_intf {
 };
 
 /**
- * to_dpu_hw_intf - convert base object dpu_hw_base to container
- * @hw: Pointer to base hardware block
- * return: Pointer to hardware block container
- */
-static inline struct dpu_hw_intf *to_dpu_hw_intf(struct dpu_hw_blk *hw)
-{
-       return container_of(hw, struct dpu_hw_intf, base);
-}
-
-/**
  * dpu_hw_intf_init(): Initializes the intf driver for the passed
  * interface idx.
  * @idx:  interface index for which driver object is required
index 8df21a4..96554e9 100644 (file)
@@ -74,14 +74,8 @@ int dpu_rm_destroy(struct dpu_rm *rm)
                        dpu_hw_ctl_destroy(hw);
                }
        }
-       for (i = 0; i < ARRAY_SIZE(rm->intf_blks); i++) {
-               struct dpu_hw_intf *hw;
-
-               if (rm->intf_blks[i]) {
-                       hw = to_dpu_hw_intf(rm->intf_blks[i]);
-                       dpu_hw_intf_destroy(hw);
-               }
-       }
+       for (i = 0; i < ARRAY_SIZE(rm->hw_intf); i++)
+               dpu_hw_intf_destroy(rm->hw_intf[i]);
 
        return 0;
 }
@@ -179,7 +173,7 @@ int dpu_rm_init(struct dpu_rm *rm,
                        DPU_ERROR("failed intf object creation: err %d\n", rc);
                        goto fail;
                }
-               rm->intf_blks[intf->id - INTF_0] = &hw->base;
+               rm->hw_intf[intf->id - INTF_0] = hw;
        }
 
        for (i = 0; i < cat->ctl_count; i++) {
@@ -593,8 +587,3 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm,
 
        return num_blks;
 }
-
-struct dpu_hw_intf *dpu_rm_get_intf(struct dpu_rm *rm, enum dpu_intf intf_idx)
-{
-       return to_dpu_hw_intf(rm->intf_blks[intf_idx - INTF_0]);
-}
index ee50f66..9b13200 100644 (file)
@@ -18,14 +18,14 @@ struct dpu_global_state;
  * @pingpong_blks: array of pingpong hardware resources
  * @mixer_blks: array of layer mixer hardware resources
  * @ctl_blks: array of ctl hardware resources
- * @intf_blks: array of intf hardware resources
+ * @hw_intf: array of intf hardware resources
  * @dspp_blks: array of dspp hardware resources
  */
 struct dpu_rm {
        struct dpu_hw_blk *pingpong_blks[PINGPONG_MAX - PINGPONG_0];
        struct dpu_hw_blk *mixer_blks[LM_MAX - LM_0];
        struct dpu_hw_blk *ctl_blks[CTL_MAX - CTL_0];
-       struct dpu_hw_blk *intf_blks[INTF_MAX - INTF_0];
+       struct dpu_hw_intf *hw_intf[INTF_MAX - INTF_0];
        struct dpu_hw_blk *dspp_blks[DSPP_MAX - DSPP_0];
        struct dpu_hw_blk *merge_3d_blks[MERGE_3D_MAX - MERGE_3D_0];
 };
@@ -90,7 +90,10 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm,
  * @rm: DPU Resource Manager handle
  * @intf_idx: INTF's index
  */
-struct dpu_hw_intf *dpu_rm_get_intf(struct dpu_rm *rm, enum dpu_intf intf_idx);
+static inline struct dpu_hw_intf *dpu_rm_get_intf(struct dpu_rm *rm, enum dpu_intf intf_idx)
+{
+       return rm->hw_intf[intf_idx - INTF_0];
+}
 
 #endif /* __DPU_RM_H__ */