From patchwork Thu Oct 19 17:05:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 116419 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp721911qgn; Thu, 19 Oct 2017 10:08:54 -0700 (PDT) X-Received: by 10.159.246.23 with SMTP id b23mr2009904pls.60.1508432934477; Thu, 19 Oct 2017 10:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508432934; cv=none; d=google.com; s=arc-20160816; b=Cw6FiZ7fVTS06CCN8dSEmaKlCqtmu5kj4PeDNUcg0br1vsiZxc07WTGDZOmBtCRDa8 cU8VA+PPpAfmwEYclpbKZxn3tuhMow7evPYeZ1c0je96v1m7JMQi5oBlpwJsB8gvAjK9 qGataTPQ5QwCRv9VfeKCCjf3Fqy8VC3QtLyION5eA7eG67n0As5OCVqEm0CWlf3O3OrK yYOKzwGuZJOKZgNINCNSEpm0u/F+iyk5T86LHXnGXdAPs26xxQKpac8bzkX03/2TlAi6 7l+HDslOfjXRnrvTF1BXSv55cXG8vc/79ITQfSKNMUrswWRiuqxxPJZdYEveUDXoOVER p7Kw== 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=ml7oe/0YASyeXw6/R0x/YhaVd3BkPfM0Dt8qWCr5GTg=; b=xXJW9oBRnp4hq7s60muWdLNYSoUlrvGyLm+xeuno5ujgT4nUOaqoYD9BIArAL/wB97 YIWqMqV8Cj85CFclAEvDkg+jo5/stUNT9GdaW7oPUBUwnK16ycKcyKqts5Tb5POt5yLg jFjOIXShGlWji2uS20fCNtva06YMNIlq1nGN3eMYwHzYbNOnIzCfKoqf210wZQfwK3qF PbnU5aRxOF1tLws+gkYOFwzGIzIPVcuKu20Zk/5NnKwSfV8+4U+8mngvwr0C87jCuq6w mwBI1rLzJZeI8DbDmf3W8s3qVM2sV+WwEWmnRuNiSiqSaYDl3Z2NyBMmMb8Woqs0RJcJ zQeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MMD8Ts2m; 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 l11si4409160pgq.28.2017.10.19.10.08.54; Thu, 19 Oct 2017 10:08:54 -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=MMD8Ts2m; 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 S1755131AbdJSRIw (ORCPT + 27 others); Thu, 19 Oct 2017 13:08:52 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:47725 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755101AbdJSRIt (ORCPT ); Thu, 19 Oct 2017 13:08:49 -0400 Received: by mail-wm0-f68.google.com with SMTP id t69so17363591wmt.2 for ; Thu, 19 Oct 2017 10:08:48 -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=ml7oe/0YASyeXw6/R0x/YhaVd3BkPfM0Dt8qWCr5GTg=; b=MMD8Ts2m85jDApV5Au8lq3JOBzvpbORTmHIeayr7bbFnAdyiJYkU3tXkND+t56AAx7 eC5QzKoFxYe+0c3iKkT+oikjyaXJImowl1Az0tvc3SmJKNKKPjW9GaJyHgnaMZWLcJzO VWeMieJDjJboLleu/LgscXp+yhkkHfRwgmYAc= 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=ml7oe/0YASyeXw6/R0x/YhaVd3BkPfM0Dt8qWCr5GTg=; b=qmymbQgq8gT/aqw+k+h/qsI45jML3t++YuoVokPFe2de/jcDulLIctZAESFWrDhzMc /ru0qAQ7Ccm+S/YKP1xqcigEHP5ooWp4KYv/KyCoiqKyj2D/T2efdhMonEV2VCrQeeX+ 8QyAU81ZZjurvWnh/SBNRE5iLXLZX3VnTm1rClsDpWsEyzwkI1cv9ChnFUj2iin5K+nz mjtZTU+Q/Wj5/wbI5c/AT8R7dc6ZzfnV30+LUeLt12P/7V7Qo132RobO+6c6WErMxgy6 J036DQzovzIbAjDJQf3tFc0rDS0Ij2d+hFmh3MOduQJKySv7pIzef4T0n2mrAj17yMD1 vCxg== X-Gm-Message-State: AMCzsaU83BCzP6oyZqe9gZzHSCi++WuStq01/Yqfc3t1++/g2NlZgY+1 A/9ooZQUxAHKPkZTujBBFadnKQ== X-Google-Smtp-Source: ABhQp+QmVpluCm0pph+AaO7Mh9cvtXr80LMv0XyAn7vfJZ2/BWmjha/PiJamcBdHGnqAdsHhVI5YQg== X-Received: by 10.28.45.9 with SMTP id t9mr2331808wmt.94.1508432927846; Thu, 19 Oct 2017 10:08:47 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:51c7:d9b7:e14b:6840]) by smtp.gmail.com with ESMTPSA id g16sm14277394wrd.72.2017.10.19.10.08.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Oct 2017 10:08:47 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/18] thermal/drivers/hisi: Remove mutex_lock in the code Date: Thu, 19 Oct 2017 19:05:55 +0200 Message-Id: <1508432760-17847-13-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508432760-17847-1-git-send-email-daniel.lezcano@linaro.org> References: <6ac48f08-7fe6-92e9-0801-6ed3bcd05ff1@linaro.org> <1508432760-17847-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 b77ca19..8d1a8be 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);