From patchwork Thu Aug 24 01:42:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 9918865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2522A603FA for ; Thu, 24 Aug 2017 01:44:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1616D28ADA for ; Thu, 24 Aug 2017 01:44:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B01C28AE3; Thu, 24 Aug 2017 01:44:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C3EB28AE6 for ; Thu, 24 Aug 2017 01:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751788AbdHXBol (ORCPT ); Wed, 23 Aug 2017 21:44:41 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:45170 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbdHXBnC (ORCPT ); Wed, 23 Aug 2017 21:43:02 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20170824014300epoutp0444705eba021266650157f611d4ca8db7~dpLx-Wpmk1376613766epoutp044; Thu, 24 Aug 2017 01:43:00 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.40.70]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20170824014259epcas1p1b9d25c8f5b0f578d242990f3f9066c24~dpLxr2IcH3044730447epcas1p18; Thu, 24 Aug 2017 01:42:59 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 4D.FF.10950.32F2E995; Thu, 24 Aug 2017 10:42:59 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20170824014259epcas2p33d211dd0f29ebee0fc2fd7415d8294d9~dpLxVlyKd1159411594epcas2p3V; Thu, 24 Aug 2017 01:42:59 +0000 (GMT) X-AuditID: b6c32a45-f79466d000002ac6-34-599e2f23012c Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id AA.38.10338.32F2E995; Thu, 24 Aug 2017 10:42:59 +0900 (KST) Received: from localhost.localdomain ([10.113.62.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OV600BON23MQ710@mmp2.samsung.com>; Thu, 24 Aug 2017 10:42:59 +0900 (KST) From: Chanwoo Choi To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com Cc: rafael.j.wysocki@intel.com, chanwoo@kernel.org, inki.dae@samsung.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 02/12] PM / devfreq: Fix locking range for making the frequency table Date: Thu, 24 Aug 2017 10:42:49 +0900 Message-id: <1503538979-22693-3-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1503538979-22693-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLKsWRmVeSWpSXmKPExsWy7bCmha6y/rxIgyNvtS0m3rjCYnH9y3NW i0n3J7BYnG16w25xedccNovPvUcYLW43rmCze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aLBRsfMTpweize85LJY9OqTjaPvi2r GD0+b5ILYInisklJzcksSy3St0vgylj1+T1TwRbOijvtc9kbGBs5uhg5OSQETCRmfX7I2sXI xSEksI5RomfSYijnB6PEjuPr2EGq2AS0JPa/uMEGYosI+Elsn7+eEaSIWWAWo8SRO//AEsIC 4RJN3U+ZQWwWAVWJ3637WEFsXgFXiXXPfrNArJOT+LDnEdhQTgE3iZanXWBxIaCaPX1HGScw 8ixgZFjFKJlaUJybnltsVGCUl1quV5yYW1yal66XnJ+7iREYUtsOa/XvYHy8JP4QowAHoxIP 74WFcyOFWBPLiitzDzFKcDArifDuVZ8XKcSbklhZlVqUH19UmpNafIhRmoNFSZw3s29GpJBA emJJanZqakFqEUyWiYNTqoHRqzehaZnKvvdXT1VM7L294Lh/lPDync7t+z/5cFgYReUoXtHl z+0QczO93fhE0Ur3jscqESteqbdbtBS3Ht6643NFovSiUsF/nJPFG/x1BW73XjzpWvZ9iR2/ gWfwY0G1PR/uFerw3MnjnJz+RKlwb8AasfW68cKMWw9kvl/Pt1lVlPXpxZVKLMUZiYZazEXF iQDdF64OJQIAAA== X-CMS-MailID: 20170824014259epcas2p33d211dd0f29ebee0fc2fd7415d8294d9 X-Msg-Generator: CA X-Sender-IP: 182.195.42.143 X-Local-Sender: =?UTF-8?B?7LWc7LCs7JqwG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbU2VuaW9yIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?Q2hhbndvbyBDaG9pG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtTZW5pb3IgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1RFTEUbQzEwVjgxMTE=?= CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170824014259epcas2p33d211dd0f29ebee0fc2fd7415d8294d9 X-RootMTR: 20170824014259epcas2p33d211dd0f29ebee0fc2fd7415d8294d9 References: <1503538979-22693-1-git-send-email-cw00.choi@samsung.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Even if the freq_table is included in the struct devfreq, the commit 0ec09ac2cebe ("PM / devfreq: Set the freq_table of devfreq device") set the frequency table outside the mutex locking. So, this patch initializes the frequency table within the mutex locking. Cc: stable@vger.kernel.org Fixes: 0ec09ac2cebe ("PM / devfreq: Set the freq_table of devfreq device") Signed-off-by: Chanwoo Choi --- drivers/devfreq/devfreq.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index a1c4ee818614..3c5ccb96e165 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -553,11 +553,8 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->data = data; devfreq->nb.notifier_call = devfreq_notifier_call; - if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { - mutex_unlock(&devfreq->lock); + if (!devfreq->profile->max_state && !devfreq->profile->freq_table) devfreq_set_freq_table(devfreq); - mutex_lock(&devfreq->lock); - } dev_set_name(&devfreq->dev, "devfreq%d", atomic_inc_return(&devfreq_no));