Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp429973ybt; Wed, 24 Jun 2020 02:51:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnlH9wlVugoHAYKsltN46YUSU5td5uPKjuPHhvzpyE+ND4ri4Ghjf0livt5j7hQRq+lsjD X-Received: by 2002:a17:906:9394:: with SMTP id l20mr15175690ejx.467.1592992298262; Wed, 24 Jun 2020 02:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592992298; cv=none; d=google.com; s=arc-20160816; b=xmy4vIpepS3nQxXRDbvD35KZG17RSFaxlBdWFfYnEF0jpuLF//w1UkJy+gtm5XMcBZ DapaTowRXy56fKG0jw0YRnYmjK1DMp11p1tWdrRS5QgAJrIOEbjbcRnvRfigUHgPnDCY U1B/eMd4wHmwwcwyO5KWm3oiTBiPDYCpypezVr/gA0Zn4TAJ5hgnJoL6fSkxr7ARu5fH Bi5w1T6GmmNVFB1kVhNju3FjuoX0nswwtwjDcEgqaEbePfja1IivO/u9D1t3jRTuaCDB 95KI5WvvTiG/L+o5BijYHYlYbGp2nesg6/2IRvl8229FCo3KU4Fd/LDpAtV65M2O7DJ/ KX2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter; bh=Hu4Qdif3UbMEKdxlBS9vbnOGmQWb8dRrpdrfFL2pmaQ=; b=pePog+LOL+qfsWknvkt3n8qtD+LzR9N9i4ehCGF6efJfP7Zhfx9+bsc6z973cKfn6L 7vmPX+0Izstkb12RKq/Qe35dyKlDQdJATh4qVzadxb33IC5CiiXbKON5y0vl1ZMojxLq 6GHY0rc1HIeVM3682b2peH6W64vqrFUicVpsYVRLVszbP3G5cIQZxUohcjUbEljP1Dxr Z79RqN7dgUsKEbxRLzXYFlgSt4eSpELa1a+9n2W0h237nGGikt17kIFHCw66nKgC6FUm KMyTXHWC5Qf7myb1RSMCeDDZXiuKBA+bCqGiXKgjkz9ZKDCnT37kWDWUi65IMCwpViRP Ss9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HCv9cG0s; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si11947688ejh.403.2020.06.24.02.51.04; Wed, 24 Jun 2020 02:51:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HCv9cG0s; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390068AbgFXJt0 (ORCPT + 99 others); Wed, 24 Jun 2020 05:49:26 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:33170 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389848AbgFXJtY (ORCPT ); Wed, 24 Jun 2020 05:49:24 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200624094923euoutp019517b3ebaf7c2cefc4e94e6450efd512~bce6nnOGl2557825578euoutp01d; Wed, 24 Jun 2020 09:49:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200624094923euoutp019517b3ebaf7c2cefc4e94e6450efd512~bce6nnOGl2557825578euoutp01d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1592992163; bh=Hu4Qdif3UbMEKdxlBS9vbnOGmQWb8dRrpdrfFL2pmaQ=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=HCv9cG0sZk3QpjU7BIPvsW4VhnEV/o3hbHYvKwjX90H9utnLc+GTgmOCAQZ4dRPKs GlmecvxWR8Ok65hqkwvX3686BXXTcz5wMNqvaVSrKFRyU7/+qwviNAQEIDNne/d9n1 Kj9/ViPz6CcgP+1WBSkDqrS8hzMtOgEEHtgiKY+o= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200624094922eucas1p23cb64e3529eacfecf6c95072f6f4fb9d~bce6ZrHPq2662826628eucas1p2F; Wed, 24 Jun 2020 09:49:22 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 30.A8.06318.2A123FE5; Wed, 24 Jun 2020 10:49:22 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200624094922eucas1p126f9a79810d912cf6f561c5f52153b43~bce55G-2n1796317963eucas1p1n; Wed, 24 Jun 2020 09:49:22 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200624094922eusmtrp14c2ce8276db0a40816209b5b494300ba~bce53sfaG3055130551eusmtrp1C; Wed, 24 Jun 2020 09:49:22 +0000 (GMT) X-AuditID: cbfec7f5-38bff700000018ae-0c-5ef321a2f7ed Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id FB.92.06017.2A123FE5; Wed, 24 Jun 2020 10:49:22 +0100 (BST) Received: from [106.120.51.71] (unknown [106.120.51.71]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200624094920eusmtip1a75817b4fcfe10a797e8912ad5285b16~bce4N31Sj1488214882eusmtip1R; Wed, 24 Jun 2020 09:49:20 +0000 (GMT) Subject: Re: [PATCH v4 06/11] thermal: Add mode helpers To: Andrzej Pietrasiewicz Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, "Rafael J . Wysocki" , Len Brown , Vishal Kulkarni , "David S . Miller" , Jiri Pirko , Ido Schimmel , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , Peter Kaestle , Darren Hart , Andy Shevchenko , Sebastian Reichel , Miquel Raynal , Daniel Lezcano , Amit Kucheria , Support Opensource , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , =?UTF-8?Q?Niklas_S=c3=b6derlund?= , Heiko Stuebner , Orson Zhai , Baolin Wang , Chunyan Zhang , Zhang Rui , Allison Randal , Enrico Weigelt , Gayatri Kammela , Thomas Gleixner , kernel@collabora.com From: Bartlomiej Zolnierkiewicz Message-ID: Date: Wed, 24 Jun 2020 11:49:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200528192051.28034-7-andrzej.p@collabora.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Ta0xTZxjH955bC1vJocD6eiFmnS6DbKJj2Z4MR9Ttw8m+bPu0ZVNcN07Q DKppgc3NZXQRxYKIoKKVSWVqLxLAFiggQwNLq3QUkMC8FFMubq3jILa7YUZZ2wMZ3/7v8//9 83+eD6+UlB+TrJbuURfyGrUqX8nEU+3Oec/LDc+FcjZVf58GlhthCv72zBN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vL52y /1kbKX/XmC6xmyZz1aHy7G13qF187VRJpvAKk7LqvUruxcOOnmAsUhBdf+3c4DvbnukvPjqe fjFl/qbJN97/PH/Z6t33pYoyVGrV60jJoP0XiTnSerUDAAA= X-CMS-MailID: 20200624094922eucas1p126f9a79810d912cf6f561c5f52153b43 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200528192210eucas1p10ac60083d5c2eb6f21b9bcab651b01e5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200528192210eucas1p10ac60083d5c2eb6f21b9bcab651b01e5 References: <20200528192051.28034-1-andrzej.p@collabora.com> <20200528192051.28034-7-andrzej.p@collabora.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 5/28/20 9:20 PM, Andrzej Pietrasiewicz wrote: > Prepare for making the drivers not access tzd's private members. > > Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Bartlomiej Zolnierkiewicz Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics > --- > drivers/thermal/thermal_core.c | 53 ++++++++++++++++++++++++++++++++++ > include/linux/thermal.h | 13 +++++++++ > 2 files changed, 66 insertions(+) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index 14d3b1b94c4f..f2a5c5ee3455 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -459,6 +459,59 @@ static void thermal_zone_device_reset(struct thermal_zone_device *tz) > thermal_zone_device_init(tz); > } > > +int thermal_zone_device_set_mode(struct thermal_zone_device *tz, > + enum thermal_device_mode mode) > +{ > + int ret = 0; > + > + mutex_lock(&tz->lock); > + > + /* do nothing if mode isn't changing */ > + if (mode == tz->mode) { > + mutex_unlock(&tz->lock); > + > + return ret; > + } > + > + if (tz->ops->set_mode) > + ret = tz->ops->set_mode(tz, mode); > + > + if (!ret) > + tz->mode = mode; > + > + mutex_unlock(&tz->lock); > + > + thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); > + > + return ret; > +} > + > +int thermal_zone_device_enable(struct thermal_zone_device *tz) > +{ > + return thermal_zone_device_set_mode(tz, THERMAL_DEVICE_ENABLED); > +} > +EXPORT_SYMBOL(thermal_zone_device_enable); > + > +int thermal_zone_device_disable(struct thermal_zone_device *tz) > +{ > + return thermal_zone_device_set_mode(tz, THERMAL_DEVICE_DISABLED); > +} > +EXPORT_SYMBOL(thermal_zone_device_disable); > + > +int thermal_zone_device_is_enabled(struct thermal_zone_device *tz) > +{ > + enum thermal_device_mode mode; > + > + mutex_lock(&tz->lock); > + > + mode = tz->mode; > + > + mutex_unlock(&tz->lock); > + > + return mode == THERMAL_DEVICE_ENABLED; > +} > +EXPORT_SYMBOL(thermal_zone_device_is_enabled); > + > void thermal_zone_device_update(struct thermal_zone_device *tz, > enum thermal_notify_event event) > { > diff --git a/include/linux/thermal.h b/include/linux/thermal.h > index a808f6fa2777..df013c39ba9b 100644 > --- a/include/linux/thermal.h > +++ b/include/linux/thermal.h > @@ -416,6 +416,9 @@ int thermal_zone_get_offset(struct thermal_zone_device *tz); > > void thermal_cdev_update(struct thermal_cooling_device *); > void thermal_notify_framework(struct thermal_zone_device *, int); > +int thermal_zone_device_enable(struct thermal_zone_device *tz); > +int thermal_zone_device_disable(struct thermal_zone_device *tz); > +int thermal_zone_device_is_enabled(struct thermal_zone_device *tz); > #else > static inline struct thermal_zone_device *thermal_zone_device_register( > const char *type, int trips, int mask, void *devdata, > @@ -463,6 +466,16 @@ static inline void thermal_cdev_update(struct thermal_cooling_device *cdev) > static inline void thermal_notify_framework(struct thermal_zone_device *tz, > int trip) > { } > + > +static inline int thermal_zone_device_enable(struct thermal_zone_device *tz) > +{ return -ENODEV; } > + > +static inline int thermal_zone_device_disable(struct thermal_zone_device *tz) > +{ return -ENODEV; } > + > +static inline int > +thermal_zone_device_is_enabled(struct thermal_zone_device *tz) > +{ return -ENODEV; } > #endif /* CONFIG_THERMAL */ > > #endif /* __THERMAL_H__ */ >