From patchwork Tue Apr 8 14:15:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 27980 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0D9CF20447 for ; Tue, 8 Apr 2014 14:15:21 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf4337308oac.11 for ; Tue, 08 Apr 2014 07:15:21 -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:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=ptQxB3HbtBKDYz1GR0pwL+szX0theWFgyxssAX2Zw7o=; b=FKAL+Q4vehl6VdFOLuwNwXo8Aij0/RXI55KLkN4///yho0QB1YghbvB7Q7OR339Fd2 lJ/OmN35GThQ4F7zzGi0ercsrsUug/V0sWV9NMHMhUu2yVuu2uD1ZrgoOGkBz6WDWJ1W 0Du/Z7zOTfJWy3QfXXw8PzNz1tSKdRLkpmZBU/fI+yW8SvfUlSF+WJmMS7qY41gELJlL BcZamSvRu9T6KEVBr/O1TBgCa8pA31/pvk3+lnagp8J6cIcWsqaTmIqMDh8KtwJ+84ki 183v+2C3qgc3KaLoy8AR/t4N5wfnhp7MeQmAennb0M4EuVBHJVHp56TnB4gNEpZB+5C9 51BQ== X-Gm-Message-State: ALoCoQmXccfobnsaXvHuoJiwnlCbQu+m89/Bw7fPap43ZE9cXlS+FHLhBzRF+sihcWeJ15TNW6KB X-Received: by 10.182.230.132 with SMTP id sy4mr1904868obc.48.1396966521592; Tue, 08 Apr 2014 07:15:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.76 with SMTP id b70ls210274qgd.97.gmail; Tue, 08 Apr 2014 07:15:21 -0700 (PDT) X-Received: by 10.58.195.202 with SMTP id ig10mr299078vec.33.1396966521344; Tue, 08 Apr 2014 07:15:21 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id kp12si419207veb.66.2014.04.08.07.15.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 07:15:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so791796vcb.20 for ; Tue, 08 Apr 2014 07:15:21 -0700 (PDT) X-Received: by 10.52.243.167 with SMTP id wz7mr31866vdc.47.1396966521270; Tue, 08 Apr 2014 07:15:21 -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.220.12.8 with SMTP id v8csp249205vcv; Tue, 8 Apr 2014 07:15:20 -0700 (PDT) X-Received: by 10.68.228.1 with SMTP id se1mr4923792pbc.43.1396966520263; Tue, 08 Apr 2014 07:15:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sf3si1134751pac.452.2014.04.08.07.15.19; Tue, 08 Apr 2014 07:15:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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 S932115AbaDHOPR (ORCPT + 12 others); Tue, 8 Apr 2014 10:15:17 -0400 Received: from mail-pb0-f49.google.com ([209.85.160.49]:51421 "EHLO mail-pb0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756892AbaDHOPQ (ORCPT ); Tue, 8 Apr 2014 10:15:16 -0400 Received: by mail-pb0-f49.google.com with SMTP id jt11so1078449pbb.8 for ; Tue, 08 Apr 2014 07:15:15 -0700 (PDT) X-Received: by 10.68.132.68 with SMTP id os4mr4832562pbb.129.1396966515427; Tue, 08 Apr 2014 07:15:15 -0700 (PDT) Received: from localhost ([122.167.203.73]) by mx.google.com with ESMTPSA id tk5sm4913181pbc.63.2014.04.08.07.15.12 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 08 Apr 2014 07:15:14 -0700 (PDT) From: Viresh Kumar To: stable@vger.kernel.org Cc: linux-pm@vger.kernel.org, soren.brinkmann@xilinx.com, viresh kumar , "Rafael J. Wysocki" Subject: [PATCH Resend] cpufreq: remove sysfs link when a cpu != policy->cpu, is removed Date: Tue, 8 Apr 2014 19:45:06 +0530 Message-Id: <6964d91db2becfe80658f50584d264708ca7f49e.1396966340.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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=neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , From: viresh kumar commit 6964d91db2becfe80658f50584d264708ca7f49e upstream. Commit 42f921a (cpufreq: remove sysfs files for CPUs which failed to come back after resume) tried to do this but missed this piece of code to fix. Currently we are getting this on suspend/resume: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 877 at fs/sysfs/dir.c:52 sysfs_warn_dup+0x68/0x84() sysfs: cannot create duplicate filename '/devices/system/cpu/cpu1/cpufreq' Modules linked in: brcmfmac brcmutil CPU: 0 PID: 877 Comm: test-rtc-resume Not tainted 3.14.0-rc2-00259-g9398a10cd964 #12 [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x80/0xcc) [] (dump_stack) from [] (warn_slowpath_common+0x64/0x88) [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x30/0x40) [] (warn_slowpath_fmt) from [] (sysfs_warn_dup+0x68/0x84) [] (sysfs_warn_dup) from [] (sysfs_do_create_link_sd+0xb0/0xb8) [] (sysfs_do_create_link_sd) from [] (__cpufreq_add_dev.isra.27+0x2a8/0x814) [] (__cpufreq_add_dev.isra.27) from [] (cpufreq_cpu_callback+0x70/0x8c) [] (cpufreq_cpu_callback) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__cpu_notify+0x28/0x44) [] (__cpu_notify) from [] (_cpu_up+0xf0/0x140) [] (_cpu_up) from [] (enable_nonboot_cpus+0x68/0xb0) [] (enable_nonboot_cpus) from [] (suspend_devices_and_enter+0x198/0x2dc) [] (suspend_devices_and_enter) from [] (pm_suspend+0x174/0x1e8) [] (pm_suspend) from [] (state_store+0x6c/0xbc) [] (state_store) from [] (kobj_attr_store+0x14/0x20) [] (kobj_attr_store) from [] (sysfs_kf_write+0x44/0x48) [] (sysfs_kf_write) from [] (kernfs_fop_write+0xb4/0x14c) [] (kernfs_fop_write) from [] (vfs_write+0xa8/0x180) [] (vfs_write) from [] (SyS_write+0x3c/0x70) [] (SyS_write) from [] (ret_fast_syscall+0x0/0x30) ---[ end trace 76969904b614c18f ]--- Fix this by removing sysfs link for cpufreq directory when cpu removed isn't policy->cpu. Cc: # 3.13.x Revamps: 42f921a (cpufreq: remove sysfs files for CPUs which failed to come back after resume) Reported-and-tested-by: Stephen Warren Signed-off-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 08ca8c9..cb003a6 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1323,8 +1323,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, up_read(&policy->rwsem); if (cpu != policy->cpu) { - if (!frozen) - sysfs_remove_link(&dev->kobj, "cpufreq"); + sysfs_remove_link(&dev->kobj, "cpufreq"); } else if (cpus > 1) { new_cpu = cpufreq_nominate_new_policy_cpu(policy, cpu); if (new_cpu >= 0) {