From patchwork Tue Apr 24 22:35:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 134200 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp120096lji; Tue, 24 Apr 2018 15:35:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx48iRoYE/gqAv2UzdcGEi4mPhL28tB7Xf2xBRzG3i2tDISt0f4LvhX63WeKl59F7d9XscSxP X-Received: by 10.99.0.4 with SMTP id 4mr21354146pga.107.1524609342713; Tue, 24 Apr 2018 15:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524609342; cv=none; d=google.com; s=arc-20160816; b=GGlKgQwkxyEyQyav6gTx4Qw3pxuvaR0PJE8ycjs4ak3FBr/Xhb/V31bpxHeyALL58R iuc5k3IxOexOdyT9SO7lelOGhqyrjB1+6T8CHg535uAp+xSvJk4tKtH8DwwS8j4BFKZE RCXtvmw2hamZVEJitkII59aVyBlfRl6x3aQUu2lqg4HgjmZLMxYyzf+anR+RChDXAj+1 WOG44ppua0gnf/kMMyQ4FvwdRNxJyWCa+/YXAz16AsZhgMuByRokuMwKK0JreJsm+Spy S4sOurntbA897TRYVQtsEH/VwkxbAPHDRFy7kElb/GDLdxex4U+Rns4RuJAJoAIMTU/s qV3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=D4OT7Y7CTOdU0C5+C/yDyyFAxnnx7PGIHj0a+tQZEDk=; b=IkfWqZWGAQHWfC6KzMNNh2zC5SFDKLcbxnzBEON7CyzyAnlvFQYjzQKjQUmD5UwMJ+ Xk1zLwxLYnozMSQOd5/J38CkdUjcgVXyBp/gwPMUA9wyWuDJD0Jw5M86bWcmhuB/8SkP Jsas1Dg+NLJpsZgu0Nc258E9uET/kC6cbwqtZrZFQt2/JdjEpCkjUi12KxNs5sctZsxs Yob9t/D1JtfwgkB60lSkOLxzSF1JFWaAYcQ4o4CDPhpdSK69Sz2WvDKUlbFBwrNKU6lo lXEbSPtXdoatyi6faB6/JqZ7J6ZAceiUA2/4fSXV19lFdiFyN+84TTv2dwCjTE7Pumic yR/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aq+9Brm1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si12317959pgn.152.2018.04.24.15.35.42; Tue, 24 Apr 2018 15:35:42 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aq+9Brm1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751236AbeDXWfi (ORCPT + 11 others); Tue, 24 Apr 2018 18:35:38 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34124 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbeDXWf3 (ORCPT ); Tue, 24 Apr 2018 18:35:29 -0400 Received: by mail-pf0-f194.google.com with SMTP id a14so2947043pfi.1 for ; Tue, 24 Apr 2018 15:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=D4OT7Y7CTOdU0C5+C/yDyyFAxnnx7PGIHj0a+tQZEDk=; b=Aq+9Brm1w6a+/qTv8Uygkx8qLfM6YQhxPbupK1ThgB4YGybkxFqmE4AVjv2VY0VcPY Nn4YcSp7eedZ8b5+TygF0g5j+jJLieoCf28qErxmX1uP/b6bd6GvYXx9lrydzbVekVbP ACzK26oEWEGgfTM+gUs2KmUjC4rQkTzoalEIE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D4OT7Y7CTOdU0C5+C/yDyyFAxnnx7PGIHj0a+tQZEDk=; b=tw0sHLdoyC0wodRf1i3cyNA5X8g6rhnvsvaY099bYmPpfu2lygU+jlK/Nzu5VLB7SC LLCoeCVoaNuQLVcLJg/OhtunbPlKEUrG+CWIIlr/SfPEPY/Vx7U9sYg4s0U5KGhL5+1X sFsAs9p1m/CSVcWJb2GJfEsL3jnVH+ot7mF2Cb/nS8vExGW+JJVlu0e38ywb0/kY1U1h ChQnBv1esA7Orvq5Orvzlql0+iQ7CH2wlITGOgXpePncHdjHr03DsL+MWoXV9VFdyUWb PTEXfWWk8g11j64UZChOcMGDWejqykAGP+/mjO0/86yXACTlYLTbe2wjSBymLCEJcgF7 VpEA== X-Gm-Message-State: ALQs6tBaPc6TKMHbAulxTaSs39QCz8Pzsc741SiOcHknGkMAol26aCg9 iauFLmDnvvr83OLnhi40Je2JdQ== X-Received: by 10.101.68.129 with SMTP id l1mr21777630pgq.239.1524609328938; Tue, 24 Apr 2018 15:35:28 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id w26sm35856621pfi.17.2018.04.24.15.35.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 15:35:28 -0700 (PDT) From: Bjorn Andersson To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] PM / devfreq: Remove unnecessary locking Date: Tue, 24 Apr 2018 15:35:19 -0700 Message-Id: <20180424223521.28193-5-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180424223521.28193-1-bjorn.andersson@linaro.org> References: <20180424223521.28193-1-bjorn.andersson@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The devfreq lock is used to prevent concurrent access to the devfreq object, but as all operations leading up to the registration of the devfreq device are local to devfreq_add_device() there's no reason to hold the lock. Signed-off-by: Bjorn Andersson --- drivers/devfreq/devfreq.c | 8 -------- 1 file changed, 8 deletions(-) -- 2.16.2 diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 2e50f5d9d92a..70588dc2032c 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -584,7 +584,6 @@ struct devfreq *devfreq_add_device(struct device *dev, } mutex_init(&devfreq->lock); - mutex_lock(&devfreq->lock); devfreq->dev.parent = dev; devfreq->dev.class = devfreq_class; devfreq->dev.release = devfreq_dev_release; @@ -596,16 +595,13 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->nb.notifier_call = devfreq_notifier_call; if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { - mutex_unlock(&devfreq->lock); err = set_freq_table(devfreq); if (err < 0) goto err_dev; - mutex_lock(&devfreq->lock); } devfreq->min_freq = find_available_min_freq(devfreq); if (!devfreq->min_freq) { - mutex_unlock(&devfreq->lock); err = -EINVAL; goto err_dev; } @@ -613,7 +609,6 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->max_freq = find_available_max_freq(devfreq); if (!devfreq->max_freq) { - mutex_unlock(&devfreq->lock); err = -EINVAL; goto err_dev; } @@ -635,12 +630,9 @@ struct devfreq *devfreq_add_device(struct device *dev, atomic_inc_return(&devfreq_no)); err = device_register(&devfreq->dev); if (err) { - mutex_unlock(&devfreq->lock); goto err_dev; } - mutex_unlock(&devfreq->lock); - mutex_lock(&devfreq_list_lock); list_add(&devfreq->node, &devfreq_list);