cpufreq: use memcpy() to copy policy
cpufreq_get_policy() is useful if the pointer to policy isn't available in advance. But if it is available, then there is no need to call cpufreq_get_policy(). Directly use memcpy() to copy the policy. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
6bfb7c7434
commit
8fa5b631f3
|
@ -606,9 +606,7 @@ static ssize_t store_##file_name \
|
||||||
int ret, temp; \
|
int ret, temp; \
|
||||||
struct cpufreq_policy new_policy; \
|
struct cpufreq_policy new_policy; \
|
||||||
\
|
\
|
||||||
ret = cpufreq_get_policy(&new_policy, policy->cpu); \
|
memcpy(&new_policy, policy, sizeof(*policy)); \
|
||||||
if (ret) \
|
|
||||||
return -EINVAL; \
|
|
||||||
\
|
\
|
||||||
ret = sscanf(buf, "%u", &new_policy.object); \
|
ret = sscanf(buf, "%u", &new_policy.object); \
|
||||||
if (ret != 1) \
|
if (ret != 1) \
|
||||||
|
@ -662,9 +660,7 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy,
|
||||||
char str_governor[16];
|
char str_governor[16];
|
||||||
struct cpufreq_policy new_policy;
|
struct cpufreq_policy new_policy;
|
||||||
|
|
||||||
ret = cpufreq_get_policy(&new_policy, policy->cpu);
|
memcpy(&new_policy, policy, sizeof(*policy));
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = sscanf(buf, "%15s", str_governor);
|
ret = sscanf(buf, "%15s", str_governor);
|
||||||
if (ret != 1)
|
if (ret != 1)
|
||||||
|
|
Loading…
Reference in New Issue