drm/msm/dpu: Cleanup callers of dpu_hw_blk_init
authorJordan Crouse <jcrouse@codeaurora.org>
Mon, 3 Dec 2018 22:47:18 +0000 (15:47 -0700)
committerRob Clark <robdclark@gmail.com>
Tue, 11 Dec 2018 18:10:17 +0000 (13:10 -0500)
Outside of superfluous parameter checks the dpu_hw_blk_init()
doesn't have any failure paths. Switch it over to be a void
function and we can remove error handling paths in all the functions
that call it. While we're in those functions remove unneeded
initialization for a static variable.

v3: No changes
v2: Removed a cleanup intended for a different patch

Reviewed-by: Sean Paul <sean@poorly.run>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rob Clark <robdclark@gmail.com>
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_intf.c
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.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 58d29e43faefde4f8608b0464c43b5ce47ab1fa6..92f1c4241b9aace6ad51a3de18030c7b7e2684d9 100644 (file)
@@ -30,16 +30,10 @@ static LIST_HEAD(dpu_hw_blk_list);
  * @type: hw block type - enum dpu_hw_blk_type
  * @id: instance id of the hw block
  * @ops: Pointer to block operations
- * return: 0 if success; error code otherwise
  */
-int dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id,
+void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id,
                struct dpu_hw_blk_ops *ops)
 {
-       if (!hw_blk) {
-               pr_err("invalid parameters\n");
-               return -EINVAL;
-       }
-
        INIT_LIST_HEAD(&hw_blk->list);
        hw_blk->type = type;
        hw_blk->id = id;
@@ -51,8 +45,6 @@ int dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id,
        mutex_lock(&dpu_hw_blk_lock);
        list_add(&hw_blk->list, &dpu_hw_blk_list);
        mutex_unlock(&dpu_hw_blk_lock);
-
-       return 0;
 }
 
 /**
index 0f4ca8af1ec5a5738f78651c6230a84ead11d725..1934c2f7e8fa684ca7ad0bf5740823c5b7e381c1 100644 (file)
@@ -44,7 +44,7 @@ struct dpu_hw_blk {
        struct dpu_hw_blk_ops ops;
 };
 
-int dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id,
+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_destroy(struct dpu_hw_blk *hw_blk);
 
index 4aab04335c6df0ae99d803f4689e13c322ba8466..1068b4b7940f02c59ea7884a604f6ebbde6ae9cb 100644 (file)
@@ -483,10 +483,7 @@ static void _setup_ctl_ops(struct dpu_hw_ctl_ops *ops,
        ops->get_bitmask_intf = dpu_hw_ctl_get_bitmask_intf;
 };
 
-static struct dpu_hw_blk_ops dpu_hw_ops = {
-       .start = NULL,
-       .stop = NULL,
-};
+static struct dpu_hw_blk_ops dpu_hw_ops;
 
 struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx,
                void __iomem *addr,
@@ -494,7 +491,6 @@ struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx,
 {
        struct dpu_hw_ctl *c;
        struct dpu_ctl_cfg *cfg;
-       int rc;
 
        c = kzalloc(sizeof(*c), GFP_KERNEL);
        if (!c)
@@ -513,18 +509,9 @@ struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx,
        c->mixer_count = m->mixer_count;
        c->mixer_hw_caps = m->mixer;
 
-       rc = dpu_hw_blk_init(&c->base, DPU_HW_BLK_CTL, idx, &dpu_hw_ops);
-       if (rc) {
-               DPU_ERROR("failed to init hw blk %d\n", rc);
-               goto blk_init_error;
-       }
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_CTL, idx, &dpu_hw_ops);
 
        return c;
-
-blk_init_error:
-       kzfree(c);
-
-       return ERR_PTR(rc);
 }
 
 void dpu_hw_ctl_destroy(struct dpu_hw_ctl *ctx)
index 695d27a730e89cd3156ee200b40ada69d0b49081..f6a83daa385b2123df7c7f6acaf71c3d7430ade0 100644 (file)
@@ -264,10 +264,7 @@ static void _setup_intf_ops(struct dpu_hw_intf_ops *ops,
        ops->get_line_count = dpu_hw_intf_get_line_count;
 }
 
-static struct dpu_hw_blk_ops dpu_hw_ops = {
-       .start = NULL,
-       .stop = NULL,
-};
+static struct dpu_hw_blk_ops dpu_hw_ops;
 
 struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx,
                void __iomem *addr,
@@ -275,7 +272,6 @@ struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx,
 {
        struct dpu_hw_intf *c;
        struct dpu_intf_cfg *cfg;
-       int rc;
 
        c = kzalloc(sizeof(*c), GFP_KERNEL);
        if (!c)
@@ -296,18 +292,9 @@ struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx,
        c->mdss = m;
        _setup_intf_ops(&c->ops, c->cap->features);
 
-       rc = dpu_hw_blk_init(&c->base, DPU_HW_BLK_INTF, idx, &dpu_hw_ops);
-       if (rc) {
-               DPU_ERROR("failed to init hw blk %d\n", rc);
-               goto blk_init_error;
-       }
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_INTF, idx, &dpu_hw_ops);
 
        return c;
-
-blk_init_error:
-       kzfree(c);
-
-       return ERR_PTR(rc);
 }
 
 void dpu_hw_intf_destroy(struct dpu_hw_intf *intf)
index c76b5cc949fb97bb941c4bddc9315c9216d20126..9f342af2aba738f27cac4344470f4d7bf0ca4328 100644 (file)
@@ -175,10 +175,7 @@ static void _setup_mixer_ops(struct dpu_mdss_cfg *m,
        ops->setup_gc = dpu_hw_lm_gc;
 };
 
-static struct dpu_hw_blk_ops dpu_hw_ops = {
-       .start = NULL,
-       .stop = NULL,
-};
+static struct dpu_hw_blk_ops dpu_hw_ops;
 
 struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx,
                void __iomem *addr,
@@ -186,7 +183,6 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx,
 {
        struct dpu_hw_mixer *c;
        struct dpu_lm_cfg *cfg;
-       int rc;
 
        c = kzalloc(sizeof(*c), GFP_KERNEL);
        if (!c)
@@ -203,18 +199,9 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx,
        c->cap = cfg;
        _setup_mixer_ops(m, &c->ops, c->cap->features);
 
-       rc = dpu_hw_blk_init(&c->base, DPU_HW_BLK_LM, idx, &dpu_hw_ops);
-       if (rc) {
-               DPU_ERROR("failed to init hw blk %d\n", rc);
-               goto blk_init_error;
-       }
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_LM, idx, &dpu_hw_ops);
 
        return c;
-
-blk_init_error:
-       kzfree(c);
-
-       return ERR_PTR(rc);
 }
 
 void dpu_hw_lm_destroy(struct dpu_hw_mixer *lm)
index cfc93816078f168206977b8f63dfe1c1da26a03c..3bdf47ed1845166811e9885eaaaa9a116456699b 100644 (file)
@@ -199,10 +199,7 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong_ops *ops,
        ops->get_line_count = dpu_hw_pp_get_line_count;
 };
 
-static struct dpu_hw_blk_ops dpu_hw_ops = {
-       .start = NULL,
-       .stop = NULL,
-};
+static struct dpu_hw_blk_ops dpu_hw_ops;
 
 struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,
                void __iomem *addr,
@@ -210,7 +207,6 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,
 {
        struct dpu_hw_pingpong *c;
        struct dpu_pingpong_cfg *cfg;
-       int rc;
 
        c = kzalloc(sizeof(*c), GFP_KERNEL);
        if (!c)
@@ -226,18 +222,9 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,
        c->caps = cfg;
        _setup_pingpong_ops(&c->ops, c->caps);
 
-       rc = dpu_hw_blk_init(&c->base, DPU_HW_BLK_PINGPONG, idx, &dpu_hw_ops);
-       if (rc) {
-               DPU_ERROR("failed to init hw blk %d\n", rc);
-               goto blk_init_error;
-       }
+       dpu_hw_blk_init(&c->base, DPU_HW_BLK_PINGPONG, idx, &dpu_hw_ops);
 
        return c;
-
-blk_init_error:
-       kzfree(c);
-
-       return ERR_PTR(rc);
 }
 
 void dpu_hw_pingpong_destroy(struct dpu_hw_pingpong *pp)
index 8297963d2c4cf224f2e9909af26eb550ecd08efd..3ebdf292d8f28efabc0a662b82b31602b971d40b 100644 (file)
@@ -696,10 +696,7 @@ static struct dpu_sspp_cfg *_sspp_offset(enum dpu_sspp sspp,
        return ERR_PTR(-ENOMEM);
 }
 
-static struct dpu_hw_blk_ops dpu_hw_ops = {
-       .start = NULL,
-       .stop = NULL,
-};
+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,
@@ -707,7 +704,6 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
 {
        struct dpu_hw_pipe *hw_pipe;
        struct dpu_sspp_cfg *cfg;
-       int rc;
 
        if (!addr || !catalog)
                return ERR_PTR(-EINVAL);
@@ -729,18 +725,9 @@ 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);
 
-       rc = dpu_hw_blk_init(&hw_pipe->base, DPU_HW_BLK_SSPP, idx, &dpu_hw_ops);
-       if (rc) {
-               DPU_ERROR("failed to init hw blk %d\n", rc);
-               goto blk_init_error;
-       }
+       dpu_hw_blk_init(&hw_pipe->base, DPU_HW_BLK_SSPP, idx, &dpu_hw_ops);
 
        return hw_pipe;
-
-blk_init_error:
-       kzfree(hw_pipe);
-
-       return ERR_PTR(rc);
 }
 
 void dpu_hw_sspp_destroy(struct dpu_hw_pipe *ctx)
index f7e0f661a8bbe31a33e2be9e1fc12e5a4608442a..a041597bb849f79bb9577dda684a3a6db6e78918 100644 (file)
@@ -321,10 +321,7 @@ 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 = {
-       .start = NULL,
-       .stop = NULL,
-};
+static struct dpu_hw_blk_ops dpu_hw_ops;
 
 struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,
                void __iomem *addr,
@@ -332,7 +329,6 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,
 {
        struct dpu_hw_mdp *mdp;
        const struct dpu_mdp_cfg *cfg;
-       int rc;
 
        if (!addr || !m)
                return ERR_PTR(-EINVAL);
@@ -354,18 +350,9 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,
        mdp->caps = cfg;
        _setup_mdp_ops(&mdp->ops, mdp->caps->features);
 
-       rc = dpu_hw_blk_init(&mdp->base, DPU_HW_BLK_TOP, idx, &dpu_hw_ops);
-       if (rc) {
-               DPU_ERROR("failed to init hw blk %d\n", rc);
-               goto blk_init_error;
-       }
+       dpu_hw_blk_init(&mdp->base, DPU_HW_BLK_TOP, idx, &dpu_hw_ops);
 
        return mdp;
-
-blk_init_error:
-       kzfree(mdp);
-
-       return ERR_PTR(rc);
 }
 
 void dpu_hw_mdp_destroy(struct dpu_hw_mdp *mdp)