Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24848aec authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: msm_bus: Misc fixes and code clean up"

parents 4f702d4e babfac6c
Loading
Loading
Loading
Loading
+0 −85
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@ struct handle_type {
};

static struct handle_type handle_list;
static LIST_HEAD(input_list);
static LIST_HEAD(apply_list);
static LIST_HEAD(commit_list);
static LIST_HEAD(late_init_clist);
static LIST_HEAD(query_list);
@@ -780,77 +778,9 @@ static void aggregate_bus_query_req(struct msm_bus_node_device_type *bus_dev,
	return;
}

static void del_inp_list(struct list_head *list)
{
	struct rule_update_path_info *rule_node;
	struct rule_update_path_info *rule_node_tmp;

	list_for_each_entry_safe(rule_node, rule_node_tmp, list, link) {
		list_del(&rule_node->link);
		rule_node->added = false;
	}
}

static void del_op_list(struct list_head *list)
{
	struct rule_apply_rcm_info *rule;
	struct rule_apply_rcm_info *rule_tmp;

	list_for_each_entry_safe(rule, rule_tmp, list, link)
		list_del(&rule->link);
}

static int msm_bus_apply_rules(struct list_head *list, bool after_clk_commit)
{
	struct rule_apply_rcm_info *rule;
	struct device *dev = NULL;
	struct msm_bus_node_device_type *dev_info = NULL;
	int ret = 0;

	list_for_each_entry(rule, list, link) {
		if (!rule)
			continue;

		if (rule && (rule->after_clk_commit != after_clk_commit))
			continue;

		dev = bus_find_device(&msm_bus_type, NULL,
				(void *) &rule->id,
				msm_bus_device_match_adhoc);

		if (!dev) {
			MSM_BUS_ERR("Can't find dev node for %d", rule->id);
			continue;
		}
		dev_info = to_msm_bus_node(dev);

		ret = msm_bus_enable_limiter(dev_info, rule->throttle,
							rule->lim_bw);
		if (ret)
			MSM_BUS_ERR("Failed to set limiter for %d", rule->id);
	}

	return ret;
}

static void commit_data(void)
{
	bool rules_registered = msm_rule_are_rules_registered();

	if (rules_registered) {
		msm_rules_update_path(&input_list, &apply_list);
		msm_bus_apply_rules(&apply_list, false);
	}

	msm_bus_commit_data(&commit_list);

	if (rules_registered) {
		msm_bus_apply_rules(&apply_list, true);
		del_inp_list(&input_list);
		del_op_list(&apply_list);
	}
	INIT_LIST_HEAD(&input_list);
	INIT_LIST_HEAD(&apply_list);
	INIT_LIST_HEAD(&commit_list);
}

@@ -909,8 +839,6 @@ static int update_path(struct device *src_dev, int dest, uint64_t act_req_ib,
	struct msm_bus_node_device_type *dev_info = NULL;
	int curr_idx;
	int ret = 0;
	struct rule_update_path_info *rule_node;
	bool rules_registered = msm_rule_are_rules_registered();

	if (IS_ERR_OR_NULL(src_dev)) {
		MSM_BUS_ERR("%s: No source device", __func__);
@@ -958,19 +886,6 @@ static int update_path(struct device *src_dev, int dest, uint64_t act_req_ib,

		add_node_to_clist(dev_info);

		if (rules_registered) {
			rule_node = &dev_info->node_info->rule;
			rule_node->id = dev_info->node_info->id;
			rule_node->ib = dev_info->node_bw[ACTIVE_CTX].max_ib;
			rule_node->ab = dev_info->node_bw[ACTIVE_CTX].sum_ab;
			rule_node->clk =
				dev_info->node_bw[ACTIVE_CTX].cur_clk_hz;
			if (!rule_node->added) {
				list_add_tail(&rule_node->link, &input_list);
				rule_node->added = true;
			}
		}

		next_dev = lnode->next_dev;
		curr_idx = lnode->next;
	}
+25 −3
Original line number Diff line number Diff line
@@ -596,8 +596,16 @@ int msm_bus_commit_data(struct list_head *clist)
	}

	n_active = kcalloc(cnt_vcd+1, sizeof(int), GFP_KERNEL);
	if (!n_active)
		return -ENOMEM;

	n_wake = kcalloc(cnt_vcd+1, sizeof(int), GFP_KERNEL);
	if (!n_wake)
		return -ENOMEM;

	n_sleep = kcalloc(cnt_vcd+1, sizeof(int), GFP_KERNEL);
	if (!n_sleep)
		return -ENOMEM;

	if (cnt_active)
		cmdlist_active = kcalloc(cnt_active, sizeof(struct tcs_cmd),
@@ -612,18 +620,32 @@ int msm_bus_commit_data(struct list_head *clist)
				cmdlist_wake, cmdlist_sleep, cur_bcm_clist);

	ret = rpmh_invalidate(cur_mbox);
	if (ret)
		MSM_BUS_ERR("%s: Error invalidating mbox: %d\n",
						__func__, ret);

	if (cur_rsc->rscdev->req_state == RPMH_AWAKE_STATE)
		ret = rpmh_write(cur_mbox, cur_rsc->rscdev->req_state,
						cmdlist_active, cnt_active);
	else
		ret = rpmh_write_passthru(cur_mbox, cur_rsc->rscdev->req_state,
						cmdlist_active, n_active);
	if (ret)
		MSM_BUS_ERR("%s: error sending active/awake sets: %d\n",
						__func__, ret);


	ret = rpmh_write_passthru(cur_mbox, RPMH_WAKE_ONLY_STATE,
						cmdlist_wake, n_wake);
	if (ret)
		MSM_BUS_ERR("%s: error sending wake sets: %d\n",
						__func__, ret);

	ret = rpmh_write_passthru(cur_mbox, RPMH_SLEEP_STATE,
						cmdlist_sleep, n_sleep);
	if (ret)
		MSM_BUS_ERR("%s: error sending sleep sets: %d\n",
						__func__, ret);

	list_for_each_entry_safe(node, node_tmp, clist, link) {
		bcm_clist_clean(node);
@@ -764,7 +786,7 @@ static int msm_bus_disable_node_qos_clk(struct msm_bus_node_device_type *node)
static int msm_bus_enable_node_qos_clk(struct msm_bus_node_device_type *node)
{
	int i;
	int ret;
	int ret = 0;
	long rounded_rate;

	for (i = 0; i < node->num_node_qos_clks; i++) {
@@ -1343,7 +1365,7 @@ static int msm_bus_copy_node_info(struct msm_bus_node_device_type *pdata,
	node_info->bcm_dev_ids = devm_kzalloc(bus_dev,
			sizeof(int) * pdata_node_info->num_bcm_devs,
			GFP_KERNEL);
	if (!node_info->bcm_devs) {
	if (!node_info->bcm_dev_ids) {
		MSM_BUS_ERR("%s:Bus connections alloc failed\n", __func__);
		devm_kfree(bus_dev, node_info->bcm_devs);
		ret = -ENOMEM;
@@ -1367,7 +1389,7 @@ static int msm_bus_copy_node_info(struct msm_bus_node_device_type *pdata,
	node_info->rsc_dev_ids = devm_kzalloc(bus_dev,
			sizeof(int) * pdata_node_info->num_rsc_devs,
			GFP_KERNEL);
	if (!node_info->rsc_devs) {
	if (!node_info->rsc_dev_ids) {
		MSM_BUS_ERR("%s:Bus connections alloc failed\n", __func__);
		devm_kfree(bus_dev, node_info->rsc_devs);
		ret = -ENOMEM;
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ static int *get_arr(struct platform_device *pdev,
	}

	arr = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
	if ((size > 0) && ZERO_OR_NULL_PTR(arr)) {
	if (ZERO_OR_NULL_PTR(arr)) {
		dev_err(&pdev->dev, "Error: Failed to alloc mem for %s\n",
				prop);
		return NULL;