From patchwork Tue May 31 06:31:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 9143573 X-Patchwork-Delegate: rui.zhang@intel.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 9FB0660761 for ; Tue, 31 May 2016 06:36:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93E4F27D17 for ; Tue, 31 May 2016 06:36:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8897A281C1; Tue, 31 May 2016 06:36:24 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 1E66F27D17 for ; Tue, 31 May 2016 06:36:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755594AbcEaGgF (ORCPT ); Tue, 31 May 2016 02:36:05 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:35923 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755696AbcEaGcA (ORCPT ); Tue, 31 May 2016 02:32:00 -0400 Received: by mail-pa0-f68.google.com with SMTP id fg1so23805779pad.3; Mon, 30 May 2016 23:32:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ludo8Es3KsbnKepGcIvmiJW0GbXxdE4PPII3uI50V00=; b=maUaKCKRjrNVH1p0xBMQbm4YUodjADRCuem3BewtV45X4AqFggG3r8UT78fk8GfGer 6DWhrdTrCLA06xvpiY5DJkJGWaZgQT0QBJwAxv980fhvMLVmVH8vdG4AEdb5xjZ/Pyy5 siSO8ScqLazYe0/ct40ARWTwcfHaWDdg3nBPPE78by6eS4HODaWfjL1HQqMNYhpdrsm9 r18tumeJQYGFOb23XN1JfHoG7L+0kNWOUrm2iggk5Ve9UUfHUQ6yvEzOag3N3n9w40DB WJThl+W8hZsyYNG/T5ujZfAypSHxDPmhny61oLldgjHWAPJ2fQxbCdF6H9LOhbiTlmDv LNEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ludo8Es3KsbnKepGcIvmiJW0GbXxdE4PPII3uI50V00=; b=dQZzXKe6GGoFB99F8ogkNEzXct0355cw6kEDJd4Qe2RSALL11JXUjmlWWDNatGIyz6 8tkVNr6raMR5W8MbR76MW+1o2GvjumMASG8tGP/tc4Ue/4Ggv+sqOjXLAcM0q4fXKHpF Ac8SJ6FNznKoYY7K/nI1D5EHMV1T7c1la5niJVAfUPHbD5qg0pfyass0jEiW7WRxM+GZ jt5QJNmw80Gf6cld7yiGd+eYyThkoCY54ByHchePMN7/2pki2fqDBYSfJ77U4DOTGeKf WHnpaYu64K4ZOehtKSmqVCBe3sX43L5QXGg+x3tsOE9LjQzgF6W58oiO+WITwnyhX6Tz DsNw== X-Gm-Message-State: ALyK8tKy/sI5+Heg+w2pWm4fapcXKVxMtTGabPNzRNwJWFBBpxgnRcR18vEy25nk6BMUVA== X-Received: by 10.66.179.135 with SMTP id dg7mr41994704pac.125.1464676319726; Mon, 30 May 2016 23:31:59 -0700 (PDT) Received: from localhost ([2601:b00:c501:3660:7256:81ff:febd:926d]) by smtp.gmail.com with ESMTPSA id uf5sm51801005pac.44.2016.05.30.23.31.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 May 2016 23:31:59 -0700 (PDT) From: Eduardo Valentin To: Rui Zhang Cc: Linux PM , LKML , Eduardo Valentin Subject: [PATCH 03/15] thermal: sysfs: lock tz while on trip_point_type properties Date: Mon, 30 May 2016 23:31:24 -0700 Message-Id: <1464676296-5610-4-git-send-email-edubezval@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1464676296-5610-1-git-send-email-edubezval@gmail.com> References: <1464676296-5610-1-git-send-email-edubezval@gmail.com> 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 Serialized calls to tz.ops in user facing sysfs handler trip_point_type_show() and trip_point_temp_store(). Cc: Zhang Rui Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin --- drivers/thermal/thermal_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 1db2406..b69036e 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -114,7 +114,9 @@ trip_point_type_show(struct device *dev, struct device_attribute *attr, if (sscanf(attr->attr.name, "trip_point_%d_type", &trip) != 1) return -EINVAL; + mutex_lock(&tz->lock); result = tz->ops->get_trip_type(tz, trip, &type); + mutex_unlock(&tz->lock); if (result) return result;