From patchwork Sat Nov 21 03:36:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 57096 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp238064lbb; Fri, 20 Nov 2015 19:37:01 -0800 (PST) X-Received: by 10.98.75.71 with SMTP id y68mr3221229pfa.75.1448077021543; Fri, 20 Nov 2015 19:37:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69si2946274pfc.197.2015.11.20.19.37.01; Fri, 20 Nov 2015 19:37:01 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161082AbbKUDhA (ORCPT + 11 others); Fri, 20 Nov 2015 22:37:00 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:34418 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934857AbbKUDg7 (ORCPT ); Fri, 20 Nov 2015 22:36:59 -0500 Received: by padhx2 with SMTP id hx2so134761067pad.1 for ; Fri, 20 Nov 2015 19:36:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0LOEziYTRR0izHbJctydUff/NoYwPvTXhJeCHV41Bm4=; b=Iqtn+S+nxL/N8ne844jqvF7luX2KBrFnQDByJeRO0HuW7064YCyyzFUn6b0SBk6ELR BFe04AF+GZ0rEAGfKYgQCcPNv9INcPnbvTMKoXno++1WP0nQ71cjNGvcb8VuC/LWCWQx QLzPwE9WAZ+CHRF1VuSreSMyeuhJqlu/yCXBetVokSrP7KQWu99q0ueBD5DDrjrjccHE 3C3h/Rw5OC+dFSDutg7ZoBJdnB4Jw+uSRpBt7JZxa/gSmLbR0OQFsgwQ9yjvfoV5NYnQ 7jA5m/+iA97TmNy/LcqNfk9Z4ZrgrmH/rWtRmVTw4ITLNNNfUmJnE0DOjpyd8i5GZwIc UjJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0LOEziYTRR0izHbJctydUff/NoYwPvTXhJeCHV41Bm4=; b=E6OKfJCJMlqCn7Ure04zzP9HOx6I7CJmfujvuQhgkzxXpaOFUVQ7O7Dw2QayyIbngo uV+Z22sYwCuxmyFjwbGMpm0AjzvcYSikytW9RMFEYAYkCdyMsqr+JNERpDU0Dm5vNb5g NEWNp9uxHG+bdjBi0YngY3UO3Gl9pRUQevmsbBIgwNHAElxCR6TOrq5+WLUsRWtX6f9h Atw0ozjC3gXuFkY9FJiqK7hmxlevmYHVpBZuhMHE9VBlqYpOdee2fmBL8MOel0XdD4BB CyAIG2/Mx8UamZQKdZfri54IuqWOYILoZpdi4nenDLB0kQno29MtZ4URGMQC1mhvBp/0 csJw== X-Gm-Message-State: ALoCoQlnhPqFW41Dknm9G9yY4wpPgx1WMyyGxYD39X7UJzia0kmWue275mJW3Rju2hcksLDP+o8J X-Received: by 10.68.183.1 with SMTP id ei1mr22992391pbc.107.1448077019060; Fri, 20 Nov 2015 19:36:59 -0800 (PST) Received: from localhost ([122.167.29.19]) by smtp.gmail.com with ESMTPSA id ij3sm1475287pbb.62.2015.11.20.19.36.57 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 20 Nov 2015 19:36:58 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , srinivas.pandruvada@linux.intel.com Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH V2] cpufreq: Always remove sysfs cpuX/cpufreq link on ->remove_dev() Date: Sat, 21 Nov 2015 09:06:49 +0530 Message-Id: X-Mailer: git-send-email 2.6.2.198.g614a2ac In-Reply-To: <1448074212.3450.4.camel@linux.intel.com> References: <1448074212.3450.4.camel@linux.intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Subsys interface's ->remove_dev() is called when the cpufreq driver is unregistering or the CPU is getting physically removed. We keep removing the cpuX/cpufreq link for all CPUs except the last one, which is a mistake as all CPUs contain a link now. Because of this, one CPU from each policy will still contain a link (to an already removed policyX directory), after the cpufreq driver is unregistered. Fix that by removing the link first and then only see if the policy is required to be freed. That will make sure that no links are left out. Fixes: 96bdda61f58b ("cpufreq: create cpu/cpufreq/policyX directories") Reported-by: Srinivas Pandruvada Signed-off-by: Viresh Kumar --- [v2] Drop the unnecessary 'return', sorry about that :( drivers/cpufreq/cpufreq.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.6.2.198.g614a2ac -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 7c48e7316d91..a83c995a62df 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1401,13 +1401,10 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) } cpumask_clear_cpu(cpu, policy->real_cpus); + remove_cpu_dev_symlink(policy, cpu); - if (cpumask_empty(policy->real_cpus)) { + if (cpumask_empty(policy->real_cpus)) cpufreq_policy_free(policy, true); - return; - } - - remove_cpu_dev_symlink(policy, cpu); } static void handle_update(struct work_struct *work)