From patchwork Wed Aug 30 08:47:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 111287 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp595576qge; Wed, 30 Aug 2017 01:49:25 -0700 (PDT) X-Received: by 10.84.217.143 with SMTP id p15mr1095139pli.160.1504082965391; Wed, 30 Aug 2017 01:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504082965; cv=none; d=google.com; s=arc-20160816; b=OqtTNfW30OV/digkoBgyuk4o6IRcirHQ3QHqTZrXN/QmpPR2T2Ba+Q6O32G79yFIYi sR8kW8uDm/bV6kUSu014JEilWheGmi5u5p1Ult+QE1mBs9yEM+W4awUx17JBxAYzOsiN 8v4vgn2kYeInCpTtpMqAxfO9rEtwXF2UtGED8+juIny236J1652Jm2brAvPHldPzHU+N OoSbJ4z2ksI2YXxnt8u9iEsFvGMjkDA2pEdPuOW/0t5tFky/RBekCesCRHOhUfjg7g5p sOHcOYSBdW+JsGiN0EnBhcVHuf+2MnQzOrL0XrhNEugIzhsuYOCEJZcEBrNQUNBibFLh n2aQ== 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=wwiB2f2240ZA8RntlKIwM3sfl30uKc7bI1Zm6/mVJzI=; b=JbqOY0+yej7+5Lge5dBIf58/CkPG8ylgurOQfDEws2yu0eiBHwppSrK/tFAdqgS94W oNgJNckTBpF99wOhz+VDGW2Nid7pia/0bVsvAWZYUXdeN3evagqN6l3FZnKvew/JvhF2 HfvrkytSgIl4cpbVgDuYgflljncn9JoyX75yFjMCUjPEYLSwdObg0apnJWA7A1fz8bED QaIoX5WCDYymaEWtv+IZVcBlZO/8FVGDf5Mf4W519kE/xziDho6qLTgLRnkJ8Hb81P5c 27PpPxPHWso9F0vIzVW2aF6mdqB8G48MB3y9L+z3F2g9VY+bpZ7VyvbISQtarn/BdFCc uXpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b0FkjWao; 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 d79si3968449pfj.466.2017.08.30.01.49.25; Wed, 30 Aug 2017 01:49:25 -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=b0FkjWao; 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 S1751771AbdH3ItW (ORCPT + 26 others); Wed, 30 Aug 2017 04:49:22 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:38412 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751622AbdH3ItE (ORCPT ); Wed, 30 Aug 2017 04:49:04 -0400 Received: by mail-wr0-f179.google.com with SMTP id 40so15985435wrv.5 for ; Wed, 30 Aug 2017 01:49:04 -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=wwiB2f2240ZA8RntlKIwM3sfl30uKc7bI1Zm6/mVJzI=; b=b0FkjWaoghCRVJeZLAthLSwQNG8M7KwA//r/7HAfiFroT8TS664Rea+0q8Xu5V8ahg cWSZR1JZQXbU1eO8ApQSOVGBkKk+ihgGsWukJW26XBwF/R427CQHD4fqKS1cxuCobuYG 6ub9+EM4s/ZLWCIh6271POC1aJiJNSGF69FC8= 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=wwiB2f2240ZA8RntlKIwM3sfl30uKc7bI1Zm6/mVJzI=; b=eLLYfI+b9LHvkrpF0KdsDcxijULi2epkpgXquQ9MnvjoFodPHPDWN5p1PzI5VVuq0G 7ag+35gSQFrT/WHqMBZH7XX9/WAHh0oybRYiahFGMw4zn4K/TxOQVyQfLmxOlmy+jWRt tZD/hIiWSx9Lz8kDxBN6UpnCF5wAqyu6AJrsFFKHR7NkgUThbfi5up0xIFP3iEZHsOzx 6n3U76Bmx97qfQFVkxHDXCmE3jLT5Lyh76uJars3HJQrWdVSlckLGooCPWKg0tMqoTP1 YDV1wp6tk9cuRgIwaPgsucqStNuXBxDWbZPDEPvt1gYQn9Szk+ZLA7fs5gyJlKeDJZ/s jBkw== X-Gm-Message-State: AHYfb5g+UzJY6ajMM9Csf9AAgnspo97jRnUKe7Hx5uT9hCFKc8mdJkE7 1J4Xmbad1cYhhooB X-Received: by 10.223.136.196 with SMTP id g4mr547467wrg.100.1504082943573; Wed, 30 Aug 2017 01:49:03 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:b0b0:ba2b:b9fd:8a33]) by smtp.gmail.com with ESMTPSA id q24sm4032811wrc.26.2017.08.30.01.49.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Aug 2017 01:49:02 -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 (open list) Subject: [PATCH 13/13] thermal/drivers/hisi: Remove mutex_lock in the code Date: Wed, 30 Aug 2017 10:47:37 +0200 Message-Id: <1504082857-21702-13-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504082857-21702-1-git-send-email-daniel.lezcano@linaro.org> References: <1504082857-21702-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 --- 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 b1b086ab..b9e8ee2 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -51,7 +51,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; @@ -196,14 +195,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) @@ -340,7 +335,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);