From patchwork Mon Sep 4 19:56:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 111610 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp1935546qge; Mon, 4 Sep 2017 12:58:13 -0700 (PDT) X-Received: by 10.84.241.201 with SMTP id t9mr1694071plm.61.1504555093242; Mon, 04 Sep 2017 12:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504555093; cv=none; d=google.com; s=arc-20160816; b=ewZdLbn3Nqli80pKvunTssluUQ8c88mHVJrWQwdUMYI0Kmsm0oiiJzm1a3BVCJdvVT RWSEb5Ok/6q5FO6n7gSEnGFtdkcib5/CapB1fDM/z0IpUTwIz09kTVtQ6eG51cJb6KMM Y4Ohecg9ktZgkNOIlRWDn73YU1HdnBHA/udPGV1MICioGrGk9LsxUCBZf9p8Vi8G3siy R1PaNZjfOJgwN33pexdeIEQUbdWh6OAhX4tzexIH7URiG6jIVkv/zqbhmLxFEquYpNvH 0N6hHdIRUY2D7QX7Jz7993SZVfdbE1bKWXpffwNsnz077x1evh6eujW/a8qRlvUih/PW Sp5A== 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=+nJSSViYhQ4UTCVfIRdiFp+QWXQz5Jty49sMbZPbkdQ=; b=bMR7ZhoVUSBrLQCQ62KYzljgymTZZOo7gtZKUyuXSWH8jjmetoQGFsmb8jUDs2K5qi wrWdDj5/Cy+peOxy1x+XKJRDq+TRn1870+MXMCpuRNWqp8aJIhGDGIqlfA0WlBByZLvj 1Rs0PHB/s34orkxLkmMdcSBjcCViEUafUOVGTimKAisQOwx/yPg84O0g14dwPcmSvydy KhJSUQPklTlyQPTbAFywBwee5L40RkafXhSuD6uND0VxEKi83UCCCSm2hikWWZZb5gxq RnjQPjrgXcA4kE8IkcIsGCmBNh5r+gBYa1/B7n7EK1Tiho9dNEQYDtS8UUbCSQEWgMh/ SAyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fEEs5PL9; 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 x3si5784702plb.754.2017.09.04.12.58.12; Mon, 04 Sep 2017 12:58:13 -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=fEEs5PL9; 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 S1754140AbdIDT6K (ORCPT + 26 others); Mon, 4 Sep 2017 15:58:10 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:37097 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754073AbdIDT5y (ORCPT ); Mon, 4 Sep 2017 15:57:54 -0400 Received: by mail-wm0-f50.google.com with SMTP id u26so8560547wma.0 for ; Mon, 04 Sep 2017 12:57:54 -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=+nJSSViYhQ4UTCVfIRdiFp+QWXQz5Jty49sMbZPbkdQ=; b=fEEs5PL9POPOjzuDj2ofyFZW/wZ2CzSLH954nnqRXY0eEJHjEJU2Ep63UbdK+kTvee 4yIZe05x4mq0iPVMUHs5/BloNEueL4L5s0eeXmEqDjMJ4Ffgf+RWFkuhXMddXL1CyBYX 1Tu38BS0VOVa12NxZ7AWR1I0Yn+RiQi4qM3Vw= 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=+nJSSViYhQ4UTCVfIRdiFp+QWXQz5Jty49sMbZPbkdQ=; b=ptgyPYPZLb3SPFMRjgp7xLuCfYZPw36hv9Jv67llMNHqaPdfDi0r2AuOebOLAk7b+u 39bh4GPwkWdT9EZiDH0CUA/c4rwzNRwWe2V1r6LkBsP2e1UbY3g8R5s5BUfOpQFIElay 9/SBCTWZ5hyRLlqQja/Agiv9/mFgj/zQLdIibtDhbAdMw8pFG5buTMPtWr4OoGiGqB1x 4BlicREKOWQ4mzGyOGCyy4McJTzGIt8qFFe3zeHDW9j90wushQmkpxzKzI1EKJjpldhl 0/9lj08osr8jLJECctb6g07RurUq1rUT/gd5kf7ggSyz6iPywkiIq4wx32i/TJqqW19q t46w== X-Gm-Message-State: AHPjjUiuVkK8Pi5FGNEcA8oP9pEs3haBVxPRrY4tLA4jmUXXLQTReaOo 2HmRjMbizpSOKFeG X-Google-Smtp-Source: ADKCNb74NHypE3JsEjhqmlamD3XoWJlyZcBi2wNsTRcAVf3mSSVTvYAa+hDArVk8viiTP2YdnX8t/w== X-Received: by 10.28.8.8 with SMTP id 8mr955673wmi.58.1504555073166; Mon, 04 Sep 2017 12:57:53 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:f567:7c41:be9d:9286]) by smtp.gmail.com with ESMTPSA id 23sm10798976wrt.44.2017.09.04.12.57.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Sep 2017 12:57:52 -0700 (PDT) From: Daniel Lezcano To: rui.zhang@intel.com, edubezval@gmail.com Cc: daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, kevin.wangtao@linaro.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 13/13] thermal/drivers/hisi: Remove mutex_lock in the code Date: Mon, 4 Sep 2017 21:56:12 +0200 Message-Id: <1504554972-2624-13-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504554972-2624-1-git-send-email-daniel.lezcano@linaro.org> References: <1504554972-2624-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 cce3d10..39f4627 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);