]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/msm/dpu: remove unused dpu_hw_blk features
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Sat, 15 May 2021 19:09:06 +0000 (22:09 +0300)
committerRob Clark <robdclark@chromium.org>
Wed, 23 Jun 2021 14:33:54 +0000 (07:33 -0700)
Remove all unused dpu_hw_blk features and functions:
- dpu_hw_blk_get()/_put() and respective refcounting,
- global list of all dpu_hw_blk instances,
- dpu_hw_blk_ops and empty implementation inside each hw_blk subdriver.

This leaves dpu_hw_blk as a placeholder with just type and index.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20210515190909.1809050-2-dmitry.baryshkov@linaro.org
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.h
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c

index 819b26e660b9cfad5d459cd78b6be6c8ce49afc2..abad043f35f5c519c29bfb8615b0ed13f4d1e8a7 100644 (file)
 #include "dpu_hw_mdss.h"
 #include "dpu_hw_blk.h"
 
-/* Serialization lock for dpu_hw_blk_list */
-static DEFINE_MUTEX(dpu_hw_blk_lock);
-
-/* List of all hw block objects */
-static LIST_HEAD(dpu_hw_blk_list);
-
 /**
  * dpu_hw_blk_init - initialize hw block object
  * @hw_blk: pointer to hw block object
  * @type: hw block type - enum dpu_hw_blk_type
  * @id: instance id of the hw block
- * @ops: Pointer to block operations
  */
-void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id,
-               struct dpu_hw_blk_ops *ops)
+void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id)
 {
-       INIT_LIST_HEAD(&hw_blk->list);
        hw_blk->type = type;
        hw_blk->id = id;
-       atomic_set(&hw_blk->refcount, 0);
-
-       if (ops)
-               hw_blk->ops = *ops;
-
-       mutex_lock(&dpu_hw_blk_lock);
-       list_add(&hw_blk->list, &dpu_hw_blk_list);
-       mutex_unlock(&dpu_hw_blk_lock);
 }
 
 /**
@@ -51,89 +34,4 @@ void dpu_hw_blk_destroy(struct dpu_hw_blk *hw_blk)
                pr_err("invalid parameters\n");
                return;
        }
-
-       if (atomic_read(&hw_blk->refcount))
-               pr_err("hw_blk:%d.%d invalid refcount\n", hw_blk->type,
-                               hw_blk->id);
-
-       mutex_lock(&dpu_hw_blk_lock);
-       list_del(&hw_blk->list);
-       mutex_unlock(&dpu_hw_blk_lock);
-}
-
-/**
- * dpu_hw_blk_get - get hw_blk from free pool
- * @hw_blk: if specified, increment reference count only
- * @type: if hw_blk is not specified, allocate the next available of this type
- * @id: if specified (>= 0), allocate the given instance of the above type
- * return: pointer to hw block object
- */
-struct dpu_hw_blk *dpu_hw_blk_get(struct dpu_hw_blk *hw_blk, u32 type, int id)
-{
-       struct dpu_hw_blk *curr;
-       int rc, refcount;
-
-       if (!hw_blk) {
-               mutex_lock(&dpu_hw_blk_lock);
-               list_for_each_entry(curr, &dpu_hw_blk_list, list) {
-                       if ((curr->type != type) ||
-                                       (id >= 0 && curr->id != id) ||
-                                       (id < 0 &&
-                                               atomic_read(&curr->refcount)))
-                               continue;
-
-                       hw_blk = curr;
-                       break;
-               }
-               mutex_unlock(&dpu_hw_blk_lock);
-       }
-
-       if (!hw_blk) {
-               pr_debug("no hw_blk:%d\n", type);
-               return NULL;
-       }
-
-       refcount = atomic_inc_return(&hw_blk->refcount);
-
-       if (refcount == 1 && hw_blk->ops.start) {
-               rc = hw_blk->ops.start(hw_blk);
-               if (rc) {
-                       pr_err("failed to start  hw_blk:%d rc:%d\n", type, rc);
-                       goto error_start;
-               }
-       }
-
-       pr_debug("hw_blk:%d.%d refcount:%d\n", hw_blk->type,
-                       hw_blk->id, refcount);
-       return hw_blk;
-
-error_start:
-       dpu_hw_blk_put(hw_blk);
-       return ERR_PTR(rc);
-}
-
-/**
- * dpu_hw_blk_put - put hw_blk to free pool if decremented refcount is zero
- * @hw_blk: hw block to be freed
- */
-void dpu_hw_blk_put(struct dpu_hw_blk *hw_blk)
-{
-       if (!hw_blk) {
-               pr_err("invalid parameters\n");
-               return;
-       }
-
-       pr_debug("hw_blk:%d.%d refcount:%d\n", hw_blk->type, hw_blk->id,
-                       atomic_read(&hw_blk->refcount));
-
-       if (!atomic_read(&hw_blk->refcount)) {
-               pr_err("hw_blk:%d.%d invalid put\n", hw_blk->type, hw_blk->id);
-               return;
-       }
-
-       if (atomic_dec_return(&hw_blk->refcount))
-               return;
-
-       if (hw_blk->ops.stop)
-               hw_blk->ops.stop(hw_blk);
 }
index 2bf737f8dd1b80432144640774ea75a95a456794..fb3be9a36a506d2d839385ff60feb62d8212230d 100644 (file)
@@ -7,19 +7,9 @@
 
 #include <linux/types.h>
 #include <linux/list.h>
-#include <linux/atomic.h>
 
 struct dpu_hw_blk;
 
-/**
- * struct dpu_hw_blk_ops - common hardware block operations
- * @start: start operation on first get
- * @stop: stop operation on last put
- */
-struct dpu_hw_blk_ops {
-       int (*start)(struct dpu_hw_blk *);
-       void (*stop)(struct dpu_hw_blk *);
-};
 
 /**
  * struct dpu_hw_blk - definition of hardware block object
@@ -29,17 +19,10 @@ struct dpu_hw_blk_ops {
  * @refcount: reference/usage count
  */
 struct dpu_hw_blk {
-       struct list_head list;
        u32 type;
        int id;
-       atomic_t refcount;
-       struct dpu_hw_blk_ops ops;
 };
 
-void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id,
-               struct dpu_hw_blk_ops *ops);
+void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id);
 void dpu_hw_blk_destroy(struct dpu_hw_blk *hw_blk);
-
-struct dpu_hw_blk *dpu_hw_blk_get(struct dpu_hw_blk *hw_blk, u32 type, int id);
-void dpu_hw_blk_put(struct dpu_hw_blk *hw_blk);
 #endif /*_DPU_HW_BLK_H */
index 2d4645e01ebf6ef70b8443b3ae79fc79c4f93b6b..04a2c4b9a3576ffdc67f79d5a0074e8e60ed0436 100644 (file)
@@ -589,8 +589,6 @@ static void _setup_ctl_ops(struct dpu_hw_ctl_ops *ops,
                ops->set_active_pipes = dpu_hw_ctl_set_fetch_pipe_active;
 };
 
-static struct dpu_hw_blk_ops dpu_hw_ops;
-
 struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx,
                void __iomem *addr,
                const struct dpu_mdss_cfg *m)
@@ -615,7 +613,7 @@ struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx,
        c->mixer_count = m->mixer_count;
        c->mixer_hw_caps = m->mixer;
 
-       dpu_hw_blk_init(&c->base, DPU_HW_BLK_CTL, idx, &dpu_hw_ops);
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_CTL, idx);
 
        return c;
 }
index e42f901a7de5c6f68be1f5920b9a0963a41de6c3..d2f1045a736a02e248b2e23cd433a0387cffc09e 100644 (file)
@@ -85,8 +85,6 @@ static const struct dpu_dspp_cfg *_dspp_offset(enum dpu_dspp dspp,
        return ERR_PTR(-EINVAL);
 }
 
-static struct dpu_hw_blk_ops dpu_hw_ops;
-
 struct dpu_hw_dspp *dpu_hw_dspp_init(enum dpu_dspp idx,
                        void __iomem *addr,
                        const struct dpu_mdss_cfg *m)
@@ -112,7 +110,7 @@ struct dpu_hw_dspp *dpu_hw_dspp_init(enum dpu_dspp idx,
        c->cap = cfg;
        _setup_dspp_ops(c, c->cap->features);
 
-       dpu_hw_blk_init(&c->base, DPU_HW_BLK_DSPP, idx, &dpu_hw_ops);
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_DSPP, idx);
 
        return c;
 }
index 1599e3f49a4f58237a2cb16740b17f4f77226d35..6ffe976017169b95c481ba330f152f1905e7113d 100644 (file)
@@ -299,8 +299,6 @@ static void _setup_intf_ops(struct dpu_hw_intf_ops *ops,
                ops->bind_pingpong_blk = dpu_hw_intf_bind_pingpong_blk;
 }
 
-static struct dpu_hw_blk_ops dpu_hw_ops;
-
 struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx,
                void __iomem *addr,
                const struct dpu_mdss_cfg *m)
@@ -327,7 +325,7 @@ struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx,
        c->mdss = m;
        _setup_intf_ops(&c->ops, c->cap->features);
 
-       dpu_hw_blk_init(&c->base, DPU_HW_BLK_INTF, idx, &dpu_hw_ops);
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_INTF, idx);
 
        return c;
 }
index 6ac0b5a0e057364d9387abe936b34fe95f123b46..554bb881de3a5b975a2330a9e7424df36407bb63 100644 (file)
@@ -160,8 +160,6 @@ static void _setup_mixer_ops(const struct dpu_mdss_cfg *m,
        ops->setup_border_color = dpu_hw_lm_setup_border_color;
 }
 
-static struct dpu_hw_blk_ops dpu_hw_ops;
-
 struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx,
                void __iomem *addr,
                const struct dpu_mdss_cfg *m)
@@ -184,7 +182,7 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx,
        c->cap = cfg;
        _setup_mixer_ops(m, &c->ops, c->cap->features);
 
-       dpu_hw_blk_init(&c->base, DPU_HW_BLK_LM, idx, &dpu_hw_ops);
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_LM, idx);
 
        return c;
 }
index 720813e5a8ae811662a64edc64b7f62ecf025fff..863229dd0140161a74e7d3bbd6eb27233e2d5d80 100644 (file)
@@ -58,8 +58,6 @@ static void _setup_merge_3d_ops(struct dpu_hw_merge_3d *c,
        c->ops.setup_3d_mode = dpu_hw_merge_3d_setup_3d_mode;
 };
 
-static struct dpu_hw_blk_ops dpu_hw_ops;
-
 struct dpu_hw_merge_3d *dpu_hw_merge_3d_init(enum dpu_merge_3d idx,
                void __iomem *addr,
                const struct dpu_mdss_cfg *m)
@@ -81,7 +79,7 @@ struct dpu_hw_merge_3d *dpu_hw_merge_3d_init(enum dpu_merge_3d idx,
        c->caps = cfg;
        _setup_merge_3d_ops(c, c->caps->features);
 
-       dpu_hw_blk_init(&c->base, DPU_HW_BLK_MERGE_3D, idx, &dpu_hw_ops);
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_MERGE_3D, idx);
 
        return c;
 }
index 245a7a62b5c68eb942581beb7f3bee4e679caa21..334d5b28f533fcb15df2dae52b65244ccaab781c 100644 (file)
@@ -261,8 +261,6 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong *c,
                c->ops.setup_dither = dpu_hw_pp_setup_dither;
 };
 
-static struct dpu_hw_blk_ops dpu_hw_ops;
-
 struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,
                void __iomem *addr,
                const struct dpu_mdss_cfg *m)
@@ -284,7 +282,7 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,
        c->caps = cfg;
        _setup_pingpong_ops(c, c->caps->features);
 
-       dpu_hw_blk_init(&c->base, DPU_HW_BLK_PINGPONG, idx, &dpu_hw_ops);
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_PINGPONG, idx);
 
        return c;
 }
index 34d81aa1604103afb76f5327f3af0e461837f017..ceb2488ea270ebe8bf2abf21d8130c5611fa3991 100644 (file)
@@ -706,8 +706,6 @@ static const struct dpu_sspp_cfg *_sspp_offset(enum dpu_sspp sspp,
        return ERR_PTR(-ENOMEM);
 }
 
-static struct dpu_hw_blk_ops dpu_hw_ops;
-
 struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
                void __iomem *addr, struct dpu_mdss_cfg *catalog,
                bool is_virtual_pipe)
@@ -735,7 +733,7 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
        hw_pipe->cap = cfg;
        _setup_layer_ops(hw_pipe, hw_pipe->cap->features);
 
-       dpu_hw_blk_init(&hw_pipe->base, DPU_HW_BLK_SSPP, idx, &dpu_hw_ops);
+       dpu_hw_blk_init(&hw_pipe->base, DPU_HW_BLK_SSPP, idx);
 
        return hw_pipe;
 }
index 01b76766a9a811dfc4e5ca32ac267ec7fe8db08d..5d2c33ec1de7e9394cb1a5669da23cda6f82d875 100644 (file)
@@ -295,8 +295,6 @@ static const struct dpu_mdp_cfg *_top_offset(enum dpu_mdp mdp,
        return ERR_PTR(-EINVAL);
 }
 
-static struct dpu_hw_blk_ops dpu_hw_ops;
-
 struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,
                void __iomem *addr,
                const struct dpu_mdss_cfg *m)
@@ -324,7 +322,7 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,
        mdp->caps = cfg;
        _setup_mdp_ops(&mdp->ops, mdp->caps->features);
 
-       dpu_hw_blk_init(&mdp->base, DPU_HW_BLK_TOP, idx, &dpu_hw_ops);
+       dpu_hw_blk_init(&mdp->base, DPU_HW_BLK_TOP, idx);
 
        return mdp;
 }