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: 10361145 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 F251960547 for ; Tue, 24 Apr 2018 22:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6FEA28DCC for ; Tue, 24 Apr 2018 22:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8F1C28E40; Tue, 24 Apr 2018 22:35:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, 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 6D62528E37 for ; Tue, 24 Apr 2018 22:35:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751236AbeDXWfi (ORCPT ); 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-Google-Smtp-Source: AIpwx4/vWbic9Mv4Lp4ZdJG8esoofx2zUWtRad2gNKq233seQQuQXcYreASl4r5tcjwSQQJIwuxi3Q== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);