driver inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10043 ---------------------------------------------------------------------- In order to allow cache lock callbacks for various types of soc component, checks against existence of the callbacks should be removed.s Signed-off-by: Yushan Wang <wangyushan12@huawei.com> Signed-off-by: Hongye Lin <linhongye@h-partners.com> --- .../soc/hisilicon/hisi_soc_cache_framework.c | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/drivers/soc/hisilicon/hisi_soc_cache_framework.c b/drivers/soc/hisilicon/hisi_soc_cache_framework.c index 669caff157dc..d1c24a0ef828 100644 --- a/drivers/soc/hisilicon/hisi_soc_cache_framework.c +++ b/drivers/soc/hisilicon/hisi_soc_cache_framework.c @@ -70,6 +70,10 @@ static int hisi_soc_cache_lock(int cpu, phys_addr_t addr, size_t size) list_for_each_entry(inst, head, node) { if (!cpumask_test_cpu(cpu, &inst->comp->affinity_mask)) continue; + + if (!inst->comp->ops->do_lock) + continue; + ret = inst->comp->ops->do_lock(inst->comp, addr, size); if (ret) return ret; @@ -78,6 +82,10 @@ static int hisi_soc_cache_lock(int cpu, phys_addr_t addr, size_t size) list_for_each_entry(inst, head, node) { if (!cpumask_test_cpu(cpu, &inst->comp->affinity_mask)) continue; + + if (!inst->comp->ops->poll_lock_done) + continue; + ret = inst->comp->ops->poll_lock_done(inst->comp, addr, size); if (ret) return ret; @@ -103,6 +111,10 @@ static int hisi_soc_cache_unlock(int cpu, phys_addr_t addr) list_for_each_entry(inst, head, node) { if (!cpumask_test_cpu(cpu, &inst->comp->affinity_mask)) continue; + + if (!inst->comp->ops->do_unlock) + continue; + ret = inst->comp->ops->do_unlock(inst->comp, addr); if (ret) return ret; @@ -111,6 +123,10 @@ static int hisi_soc_cache_unlock(int cpu, phys_addr_t addr) list_for_each_entry(inst, head, node) { if (!cpumask_test_cpu(cpu, &inst->comp->affinity_mask)) continue; + + if (!inst->comp->ops->poll_unlock_done) + continue; + ret = inst->comp->ops->poll_unlock_done(inst->comp, addr); if (ret) return ret; @@ -119,38 +135,10 @@ static int hisi_soc_cache_unlock(int cpu, phys_addr_t addr) return ret; } -static int hisi_soc_cache_inst_check(const struct hisi_soc_comp *comp, - enum hisi_soc_comp_type comp_type) -{ - struct hisi_soc_comp_ops *ops = comp->ops; - - /* Different types of component could have different ops. */ - switch (comp_type) { - case HISI_SOC_L3C: - if (!ops->do_lock || !ops->poll_lock_done - || !ops->do_unlock || !ops->poll_unlock_done) - return -EINVAL; - break; - case HISI_SOC_HHA: - if (!comp->ops->do_maintain || !comp->ops->poll_maintain_done) - return -EINVAL; - break; - default: - return -EINVAL; - } - - return 0; -} - static int hisi_soc_cache_inst_add(struct hisi_soc_comp *comp, enum hisi_soc_comp_type comp_type) { struct hisi_soc_comp_inst *comp_inst; - int ret; - - ret = hisi_soc_cache_inst_check(comp, comp_type); - if (ret) - return ret; comp_inst = kzalloc(sizeof(*comp_inst), GFP_KERNEL); if (!comp_inst) -- 2.33.0