From patchwork Mon Aug 3 03:06:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51835 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 1CD9F229FD for ; Mon, 3 Aug 2015 03:07:05 +0000 (UTC) Received: by wixh2 with SMTP id h2sf24771796wix.0 for ; Sun, 02 Aug 2015 20:07:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=GAEtZDHVYfESBu3jicLZBIhB8jGi1spCKqWVfi9eqSA=; b=O1JRRSE5+QcL0yda4hd6xkYj3kye/okLYznNsqHMZ/gKKpKRdRbvgT4xeVfBxyICsq M0ukzg3PyJBogbS45WLNX0JaYwcYGQWq2R9tydv56ld7BF0b2Do4VtrDUTUezfJMQYU2 Z/uPcPDds1uA4K75hZN2fCtMUIXjsKGx4sWWm3sLSg93jxjQddrDhERwStQ5Sc3kOJBo 9EX+H6nDbV1fdFWkmra6wZsv1Jjt+ixUGbszVcM5GNXXa+ERcY1alEFmfq3OGcbOc6xF lh/RbxUuPpygjLkJEkhB5qR3FCYX82KloanK8C9RpuadXzL2sD5tWxWCVT2GuVn4MSd8 0mVw== X-Gm-Message-State: ALoCoQmlTvIy9MMH1B4aQfMc94GfIoMSdiEEq8PtTetzcWDrGLnCTmekXAJ2nju1lPDrfwfF4Rt7 X-Received: by 10.112.122.42 with SMTP id lp10mr4795018lbb.5.1438571224358; Sun, 02 Aug 2015 20:07:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.195 with SMTP id ao3ls566736lac.53.gmail; Sun, 02 Aug 2015 20:07:04 -0700 (PDT) X-Received: by 10.152.21.132 with SMTP id v4mr14539845lae.18.1438571224171; Sun, 02 Aug 2015 20:07:04 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id lc3si10818683lab.50.2015.08.02.20.07.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Aug 2015 20:07:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by labow3 with SMTP id ow3so7498250lab.1 for ; Sun, 02 Aug 2015 20:07:03 -0700 (PDT) X-Received: by 10.152.120.135 with SMTP id lc7mr14332312lab.41.1438571223897; Sun, 02 Aug 2015 20:07:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1626604lba; Sun, 2 Aug 2015 20:07:02 -0700 (PDT) X-Received: by 10.68.252.225 with SMTP id zv1mr18855844pbc.45.1438571221850; Sun, 02 Aug 2015 20:07:01 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tb2si23989280pab.75.2015.08.02.20.07.00; Sun, 02 Aug 2015 20:07:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752715AbbHCDGq (ORCPT + 28 others); Sun, 2 Aug 2015 23:06:46 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:36807 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752672AbbHCDGn (ORCPT ); Sun, 2 Aug 2015 23:06:43 -0400 Received: by pdco4 with SMTP id o4so2292584pdc.3 for ; Sun, 02 Aug 2015 20:06:43 -0700 (PDT) X-Received: by 10.70.91.38 with SMTP id cb6mr12361654pdb.104.1438571203113; Sun, 02 Aug 2015 20:06:43 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id aw16sm3959806pac.29.2015.08.02.20.06.41 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 02 Aug 2015 20:06:42 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/7] cpufreq: use memcpy() to copy policy Date: Mon, 3 Aug 2015 08:36:15 +0530 Message-Id: <28169f7e8afdd4c3697c672c804a826dd86cb773.1438571116.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- drivers/cpufreq/cpufreq.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 293f47b814bf..86d69416821b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -606,9 +606,7 @@ static ssize_t store_##file_name \ int ret, temp; \ struct cpufreq_policy new_policy; \ \ - ret = cpufreq_get_policy(&new_policy, policy->cpu); \ - if (ret) \ - return -EINVAL; \ + memcpy(&new_policy, policy, sizeof(*policy)); \ \ ret = sscanf(buf, "%u", &new_policy.object); \ if (ret != 1) \ @@ -662,9 +660,7 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy, char str_governor[16]; struct cpufreq_policy new_policy; - ret = cpufreq_get_policy(&new_policy, policy->cpu); - if (ret) - return ret; + memcpy(&new_policy, policy, sizeof(*policy)); ret = sscanf(buf, "%15s", str_governor); if (ret != 1)