Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp47216ybj; Fri, 8 May 2020 06:15:30 -0700 (PDT) X-Google-Smtp-Source: APiQypIMDrbikQqH8RU3oIYskX+KyshkQK1jnlG8c11YPRmTm88+cRclvjvMgK49wYK5PTzH1Ayp X-Received: by 2002:aa7:c0d1:: with SMTP id j17mr2176343edp.308.1588943730036; Fri, 08 May 2020 06:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588943730; cv=none; d=google.com; s=arc-20160816; b=QUAYQWZmRcI0AHcYI9+6C5vbKxUDN5RxsVPWZs1nh5KfEFrJ9/fIQNTKs9d1D6xLA5 7cMuS0mxzQIiX39z1hHz2bHNlrcnptupJKYOoLZc78qp6YC+8O718/8T18a7PUdBC6+H kkwb3aZflT5Tl936maGLX542EHdS+t9L6SuSORMcG8ebTA4ydQ7sgjUuxjnra/TUDDT7 +I335m2GHVj2ucQtVkC6JAqymFvLmSmCIqYs4BMpeP4IByfmENo0NwWiS9wRqtyyiw8a iL8tnCWXwx0FIkP1Go569XyvbxVxT/DJqV0VipTkgrfEpYxeKU1c7dWF3M07YnJXo0Zi pkfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=rw0gHbYwXSm5cLza+rcBuL1A1VL/vnQ8PgKS/AOmpNw=; b=vE62BT5gNQVUkqcJHiQ9LkO3v0L/k2cDyfs/Iu+IcfhER1qIplVSRxd2weV4cI4DUQ ZrBHugQJORGpcFrLozJn7JNx9B00TkspuxnG3c9BgEADpcDxZtvPMIeOpwv15B9PjLQE dwg78mOtyakCGMqLf+A7qvEnvtwpnhUHlghimAQYZSzCDeRRK6l/woCsSmalCXG3rC5e EGm0i3r7EB35qrx/fiXStfWeO1aNk+tGQaPWxBkYwM2PATZLbsdlPEB1LGsrcqJ9g5i3 a3LxJrzhBuGOuycn6AaGFpG2JTEp3UQftHyfW1rAjI24+VMOw1ZyZr9Nh5lBalnu7EhR z0ug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si946603edn.240.2020.05.08.06.15.06; Fri, 08 May 2020 06:15:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730539AbgEHNNu (ORCPT + 99 others); Fri, 8 May 2020 09:13:50 -0400 Received: from mail-m17613.qiye.163.com ([59.111.176.13]:24509 "EHLO mail-m17613.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728599AbgEHNNr (ORCPT ); Fri, 8 May 2020 09:13:47 -0400 Received: from ubuntu.localdomain (unknown [157.0.31.122]) by mail-m17613.qiye.163.com (Hmail) with ESMTPA id EC4A1482C00; Fri, 8 May 2020 21:13:44 +0800 (CST) From: Bernard Zhao To: Lukasz Luba , Kukjin Kim , Krzysztof Kozlowski , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Bernard Zhao Subject: [PATCH] memory/samsung: reduce unnecessary mutex lock area Date: Fri, 8 May 2020 06:13:38 -0700 Message-Id: <20200508131338.32956-1-bernard@vivo.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZSFVMSU5CQkJDSElKTkhISVlXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6OhQ6Dgw*TTgrMz4*Txc0TDE5 TFEaCj1VSlVKTkNDQk9ITUlOSkxCVTMWGhIXVRkeCRUaCR87DRINFFUYFBZFWVdZEgtZQVlKTkxV S1VISlVKSUlZV1kIAVlBSUpNTjcG X-HM-Tid: 0a71f46b9b9093bakuwsec4a1482c00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Maybe dmc->df->lock is unnecessary to protect function exynos5_dmc_perf_events_check(dmc). If we have to protect, dmc->lock is more better and more effective. Also, it seems not needed to protect "if (ret) & dev_warn" branch. Signed-off-by: Bernard Zhao --- drivers/memory/samsung/exynos5422-dmc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c index 22a43d662833..88e8ac8b5327 100644 --- a/drivers/memory/samsung/exynos5422-dmc.c +++ b/drivers/memory/samsung/exynos5422-dmc.c @@ -1345,16 +1345,14 @@ static irqreturn_t dmc_irq_thread(int irq, void *priv) int res; struct exynos5_dmc *dmc = priv; - mutex_lock(&dmc->df->lock); - exynos5_dmc_perf_events_check(dmc); + mutex_lock(&dmc->df->lock); res = update_devfreq(dmc->df); + mutex_unlock(&dmc->df->lock); if (res) dev_warn(dmc->dev, "devfreq failed with %d\n", res); - mutex_unlock(&dmc->df->lock); - return IRQ_HANDLED; } -- 2.26.2