Commit ac3dc0c5 authored by Xiangwei Li's avatar Xiangwei Li Committed by Ma Wupeng
Browse files

PM / devfreq: Code modification

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IBC4SJ



--------------------------------

Checking and Rectifying Codes Based on CI.

Signed-off-by: default avatarXiangwei Li <liwei728@huawei.com>
parent 41501856
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -280,9 +280,8 @@ struct devfreq_event_dev *devfreq_event_get_edev_by_dev(struct device *dev)
out:
	mutex_unlock(&devfreq_event_list_lock);

	if (!edev) {
	if (!edev)
		return ERR_PTR(-ENODEV);
	}

	return edev;
}
+4 −5
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ static int ddrc_get_events(struct devfreq_event_dev *edev, struct devfreq_event_
	u64 load;
	int p0, p1, p2;
	static u64 last_load;
	static int period = 0;
	static int period;

	struct hisi_uncore_event_info *info = devfreq_event_get_drvdata(edev);

@@ -47,16 +47,15 @@ static int ddrc_get_events(struct devfreq_event_dev *edev, struct devfreq_event_
		return 0;
	}

	if (period == CORRECT_PERIOD) {
	if (period >= CORRECT_PERIOD) {
		period = 0;
		p0 = last_load * 100 / load;
		p1 = last_load * 100 / info->max_load;
		p2 = load * 100 / info->max_load;

		if (p2 > p1 && p1 > 0 && p2 * 105 / p1 < 100 * 100 / p0) {
		if (p2 > p1 && p1 > 0 && p2 * 105 / p1 < 100 * 100 / p0)
			info->max_load = load;
	}
	}

	info->max_load = max(info->max_load, load);
	edata->load_count = load;
@@ -155,6 +154,6 @@ struct platform_driver hisi_ddrc_event_driver = {

module_platform_driver(hisi_ddrc_event_driver);

MODULE_LICENSE("GPL v2");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Xiangwei Li <liwei728@huawei.com>");
MODULE_DESCRIPTION("Hisi uncore ddrc pmu events driver");
+4 −5
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ static int l3c_get_events(struct devfreq_event_dev *edev, struct devfreq_event_d
	u64 load;
	int p0, p1, p2;
	static u64 last_load;
	static int period = 0;
	static int period;

	struct hisi_uncore_event_info *info = devfreq_event_get_drvdata(edev);

@@ -47,16 +47,15 @@ static int l3c_get_events(struct devfreq_event_dev *edev, struct devfreq_event_d
		return 0;
	}

	if (period == CORRECT_PERIOD) {
	if (period >= CORRECT_PERIOD) {
		period = 0;
		p0 = last_load * 100 / load;
		p1 = last_load * 100 / info->max_load;
		p2 = load * 100 / info->max_load;

		if (p2 > p1 && p1 > 0 && p2 * 105 / p1 < 100 * 100 / p0) {
		if (p2 > p1 && p1 > 0 && p2 * 105 / p1 < 100 * 100 / p0)
			info->max_load = load;
	}
	}

	info->max_load = max(info->max_load, load);
	edata->load_count = load;
@@ -155,6 +154,6 @@ struct platform_driver hisi_l3c_event_driver = {

module_platform_driver(hisi_l3c_event_driver);

MODULE_LICENSE("GPL v2");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Xiangwei Li <liwei728@huawei.com>");
MODULE_DESCRIPTION("Hisi uncore l3c pmu events driver");
+6 −9
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
// SPDX-License-Identifier: GPL-2.0-only
/*
 * HiSilicon uncore devfreq event support
 *
@@ -115,9 +115,8 @@ ssize_t hisi_uncore_event_configs_show(struct device *dev,
	int i;
	struct hisi_uncore_event_info *info = dev_get_drvdata(dev->parent);

	for (i = 0; i < info->config_cnt; ++i) {
	for (i = 0; i < info->config_cnt; ++i)
		sprintf(buf, "%s %lld\n", buf, info->configs[i]);
	}

	return sprintf(buf, "%s\n", buf);
}
@@ -171,9 +170,8 @@ ssize_t hisi_uncore_event_configs_store(struct device *dev,
	kfree(item);

	err = reset_pmu_monitor(info);
	if (err) {
	if (err)
		return err;
	}

	return count;
}
@@ -185,9 +183,8 @@ ssize_t hisi_uncore_event_types_show(struct device *dev,
	int i;
	struct hisi_uncore_event_info *info = dev_get_drvdata(dev->parent);

	for (i = 0; i < info->related_pmu_cnt; ++i) {
	for (i = 0; i < info->related_pmu_cnt; ++i)
		sprintf(buf, "%s %d\n", buf, info->related_pmus[i].type);
	}

	return sprintf(buf, "%s\n", buf);
}
@@ -230,7 +227,7 @@ ssize_t hisi_uncore_event_types_store(struct device *dev,

		err = kstrtou32(item, 10, &info->related_pmus[type_cnt].type);
		if (err) {
			info->related_pmu_cnt = 0;;
			info->related_pmu_cnt = 0;
			return err;
		}

@@ -248,5 +245,5 @@ ssize_t hisi_uncore_event_types_store(struct device *dev,
}
EXPORT_SYMBOL_GPL(hisi_uncore_event_types_store);

MODULE_LICENSE("GPL v2");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Xiangwei Li <liwei728@huawei.com>");
+2 −2
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@
	len; })

#define HISI_UNCORE_EVENT_TYPE_ATTR		  \
			DEVICE_ATTR_RW(hisi_uncore_event_types);
			DEVICE_ATTR_RW(hisi_uncore_event_types)

#define HISI_UNCORE_EVENT_CONFIG_ATTR		  \
			DEVICE_ATTR_RW(hisi_uncore_event_configs);
			DEVICE_ATTR_RW(hisi_uncore_event_configs)

#define EVENT_TYPE_MAX_CNT			(20)
#define EVENT_TYPE_INVALID_VAL		(0xffff)
Loading