From patchwork Tue Oct 10 18:02:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 115439 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4042781qgn; Tue, 10 Oct 2017 11:08:45 -0700 (PDT) X-Received: by 10.99.0.4 with SMTP id 4mr13311932pga.417.1507658925192; Tue, 10 Oct 2017 11:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507658925; cv=none; d=google.com; s=arc-20160816; b=Vo23OgLnNu9fu70T9cjnJrY/KXzyFH8Ok4Y4Eb4NV2MnG8ObO9OLUlPritiEtOFV6h hRulmW6w07Mco430IwoRZWrH2/6gW0HTcOVvkv0QNdIPnGq4IEAtk/RXWdfyoWLzXZ5H 7IobRCUNgCQ2VGEXbZTduN1h9KhPkbvmRfbHse+be+sLgYq1DHF2bDJX+mGBDLyuX+vp B7znJaMMu3Oyj6FcOtDjfJZ0EqsGYtfznRYhxBS+pVB5NWxM1JJ6BbJxD676NOp5kXKi poZjLJO6sBKY8JEi2DIc/o8kuIHnTdN92nYp8RJFi/12dBZI59iVFCquW9KDcP6Wpu4s G2UA== 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=1Itw7Hfb8yHlpi+K32kxh++5/5hXqxwckE5cuRg4aMk=; b=L8VOTJFaIjF36tqn1WRTtWwj3A7sxRBMeRYFrwIm0ZpJIFM/ge5CZHIXj7P4FDl9jp 8NatvNoj+1Y7/vYMtTAeXBoOktcovj62TN8hP5llTkpAihdnbp9g3h5XaRdNwjYN2SpD viz4qX26zPDqKmmyhZ1sRc6mQzW7qIV0jMJX8X8ZEkZofk+fQsJfB0aTLys6KtIjyHGG RMQnNkzuqovNe+hQp8Ss3xO2mufsK4X2c84h9nzu1wdQkpJGLOVDuE1dwOL6qbeBYk4U /lMXyRYz2S4G2kCYGNBWHeKxKpXxJ5w4Dzj2jlICvhi6mOr/c58TKF5hDi5jPJXaHMXM XOCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XYK13c53; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 5si9394989plx.272.2017.10.10.11.08.44; Tue, 10 Oct 2017 11:08:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=XYK13c53; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S932783AbdJJSIm (ORCPT + 26 others); Tue, 10 Oct 2017 14:08:42 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:57244 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932592AbdJJSFJ (ORCPT ); Tue, 10 Oct 2017 14:05:09 -0400 Received: by mail-wm0-f51.google.com with SMTP id l68so7685269wmd.5 for ; Tue, 10 Oct 2017 11:05:08 -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=1Itw7Hfb8yHlpi+K32kxh++5/5hXqxwckE5cuRg4aMk=; b=XYK13c53KNw2Dbpv1zdk2PlqQBK1vZ5C7O2dbuud46alIBtsuGifNfSv25Z+QnEGlQ eeNPmsaiO1tJiPUfJkOF71gSZXBM7jBCGeVjACAOZaP49Ly13bLfX8JV7GyTJn1KjraO Ox5FhgcKncfrHzl9HoWUCuxyxThilqDpSpHvc= 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=1Itw7Hfb8yHlpi+K32kxh++5/5hXqxwckE5cuRg4aMk=; b=E6ED4m4lGAO/hfGPHayAPMmTaJsoz8o14G2NOjYlPG1gvs3M5sCUB4c8Ht39rT/vcd knHTb7sc4yji3tyTT8Ro51i1TnQKopAw7V5vFmMm2rHSp+RpBLGz5G01R254f6OJ4R+w VvvLlGQtICFH3mG6/tDd9CgLvSDYD3r3HBl5eKMKm/zgIWhZPRF6K+N0JTb94Oky+oXC rnU57kVi1ea3yAE+iXfAffQUIsJHocM5aXMmxz/nOd5UeBwhhvAz214d+nTUYRz3VIHQ 4BzPs2Zod0yHIvZtK5mBCw+1oVPsYZIpT+nJXHlcTCJ39ReGgRyBurGAseWjLpwapBJU hC9Q== X-Gm-Message-State: AMCzsaUCRRbrjAwEocdzet6GoioQC9ViG45EkZKNmtYXGjt+EY3j289v tPJRwuURCoMvagvY9nul6rvPyw== X-Google-Smtp-Source: AOwi7QAng6uQ1G8BJd+/rvIOPfzbfD0S9OE/gVQtEE4N2k418wwb/vIr+8/+2Y47s3z9xYCA4lx3sQ== X-Received: by 10.223.158.8 with SMTP id u8mr14439552wre.16.1507658707802; Tue, 10 Oct 2017 11:05:07 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:4f9:3ae1:43d2:31ae]) by smtp.gmail.com with ESMTPSA id l73sm12513428wmd.47.2017.10.10.11.05.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 11:05:07 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kevin.wangtao@linaro.org, Leo Yan Subject: [PATCH 13/25] thermal/drivers/hisi: Remove mutex_lock in the code Date: Tue, 10 Oct 2017 20:02:38 +0200 Message-Id: <1507658570-32675-13-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> References: <79a5f10c-0fb7-3e4f-caac-c1625904b137@linaro.org> <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mutex is used to protect against writes in the configuration register. That happens at probe time, with no possible race yet. Then when the module is unloaded and at suspend/resume. When the module is unloaded, it is an userspace operation, thus via a process. Suspending the system goes through the freezer to suspend all the tasks synchronously before continuing. So it is not possible to hit the suspend ops in this driver while we are unloading it. The resume is the same situation than the probe. In other words, even if there are several places where we write the configuration register, there is no situation where we can write it at the same time, so far as I can judge Signed-off-by: Daniel Lezcano Reviewed-by: Leo Yan Tested-by: Leo Yan --- drivers/thermal/hisi_thermal.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.7.4 diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 5b0b5be..241d42c 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -53,7 +53,6 @@ struct hisi_thermal_sensor { }; struct hisi_thermal_data { - struct mutex thermal_lock; /* protects register data */ struct platform_device *pdev; struct clk *clk; struct hisi_thermal_sensor sensor; @@ -200,14 +199,10 @@ static inline void hisi_thermal_hdak_set(void __iomem *addr, int value) static void hisi_thermal_disable_sensor(struct hisi_thermal_data *data) { - mutex_lock(&data->thermal_lock); - /* disable sensor module */ hisi_thermal_enable(data->regs, 0); hisi_thermal_alarm_enable(data->regs, 0); hisi_thermal_reset_enable(data->regs, 0); - - mutex_unlock(&data->thermal_lock); } static int hisi_thermal_get_temp(void *__data, int *temp) @@ -344,7 +339,6 @@ static int hisi_thermal_probe(struct platform_device *pdev) if (!data) return -ENOMEM; - mutex_init(&data->thermal_lock); data->pdev = pdev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0);