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: 9996951 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C85E660216 for ; Tue, 10 Oct 2017 18:11:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFB9228701 for ; Tue, 10 Oct 2017 18:11:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4BD828708; Tue, 10 Oct 2017 18:11:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52F6028701 for ; Tue, 10 Oct 2017 18:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932608AbdJJSJp (ORCPT ); Tue, 10 Oct 2017 14:09:45 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:52115 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932591AbdJJSFJ (ORCPT ); Tue, 10 Oct 2017 14:05:09 -0400 Received: by mail-wm0-f43.google.com with SMTP id f4so7717815wme.0 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=J1GFBCJlhIFsNzYMSMf/JM7FIcLHFu4wkZmpQvNPQ77l5+wi4P0VKPPNAY28aRnnC7 epX4nAyl5D34ZN5j3BvHRgzlEHFS9Ilvzq8o3TWiLj+PZrhAh0L+kEwF2XZNw1TC3PYD WYG36c9yianouJSionlmpw4mDRPQWh6WA3t7IYlOO89uzqZW0j/DApwvZ7heFi09PQNW Gemjfout6B1wh0tfDo1RYLYwEzgWCTOMUpH1HJOqfzwOnpxq5U38feB/ZciaEhVYN93A 8MiUg8Fz8k6Eabo4wDGPlHIBX4WkgHYDh48C1bo1E6UwpA+/GAcA4RU8IltXT9gySsXT Xxwg== X-Gm-Message-State: AMCzsaVPxFBCXeAxXzBkuL/o5O1fTANGPBTQQGnv9UEhqFI88IAgJtRp 0RKmtkod98vzWvG+BhUSWSu24Q== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);