Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp423315ybt; Wed, 24 Jun 2020 02:39:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze5OsJJrkKYRtpNtFE7gqq08ElVGthSyTbRSsqYrns6R4LlolCCoeCUd1U3YFQ88v5z32e X-Received: by 2002:aa7:d987:: with SMTP id u7mr20409078eds.116.1592991593741; Wed, 24 Jun 2020 02:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592991593; cv=none; d=google.com; s=arc-20160816; b=CFI58JB3GPxqmngu76SJaZ2EwfQ8A/vOcKw0YFu0NHFwCIi2wE2/gYpfGHRqFfpG30 DhNQ5PNSEGZSrcK+eiYcMT2ayOZ8646hLiy+Rki4kQ6qxM1Os6Ltia5Xhri3cDLh+QfH ltYXi0bg0kMLU4Gd+ZEqWhZqW/oQyoFPhzxVHlTnfEwraeTSeYUWzpjiW0n6ZhBb9Uji TLH0Lxw4pLFPqFBxf5PYrHp2lm89HFPjFdgku5vB58l5QLHzCKfR8+pWg0DoaGuUuMyA QPhLucaj/3JuFhkp+HbotHL4m2AIJDRNjxce0C6OQ9S09rZ/rTYTrgl2n+Sjr9Lrpp98 psZA== 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=9pTBGlOaDXUW+NcRIdEvrseTLrOWVNwTObt7dXRD848=; b=jegrl+h0PkgmcbxiXC1HJJKnOpWTg7OZEUo4G7AyQ98soOuwyZsYBeEcJ+ox3Gix5k oRQ2cjFga2G0T1idONXeHR8ESMgDwzYwHh0nKhBaYhMtMChlqIoXdUA+dclHb5tOaEht sSyZGhzrRFuyMkjU9W6/2P9llZfYxkD8cx9nXEhUbGYI3a7NTbwlJJiO2uy8MlUUVdDr WN+A0ckdugQ/Qh75y3lCYDKq7qysg5yO2C2oTR8uQA5Q+IDq+RjD23kMQE7kS60YieEk dmsKpDru2Vi0IGovYcY/3w5ljHob9W7tCve6TaQVJPNIq20CAogRfGIGAVf1O2tYRMzS I+dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ejeW96VR; 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 n9si333874eja.529.2020.06.24.02.39.19; Wed, 24 Jun 2020 02:39:53 -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=ejeW96VR; 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 S2389697AbgFXJif (ORCPT + 99 others); Wed, 24 Jun 2020 05:38:35 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:57036 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388031AbgFXJie (ORCPT ); Wed, 24 Jun 2020 05:38:34 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200624093830euoutp01e323434da08f93c0e0c61d01791cdced~bcVa00iom1808518085euoutp01l; Wed, 24 Jun 2020 09:38:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200624093830euoutp01e323434da08f93c0e0c61d01791cdced~bcVa00iom1808518085euoutp01l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1592991510; bh=9pTBGlOaDXUW+NcRIdEvrseTLrOWVNwTObt7dXRD848=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=ejeW96VRUfWKVetl6ZNG4BuesZCcr+ld1rLUFf94PgFbNn4+45Tzy7llWZ1+Xo58t o1pjphztop/w3gLCAqD3b8iWx5n00sU3Pi205TScRZTLMa2fOqvStrgEnIBRr//7oC h3a4WDo1yaWPGUq/lRgytQwRPcR1TYysM0gwaytg= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200624093830eucas1p1971dfe292df7766ce9417b2f3908f1fc~bcVanoNhL2828028280eucas1p1J; Wed, 24 Jun 2020 09:38:30 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 2F.BB.05997.61F13FE5; Wed, 24 Jun 2020 10:38:30 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200624093829eucas1p2954a62270260216a849d4fe205e9c21a~bcVaOCk_H1540115401eucas1p2v; Wed, 24 Jun 2020 09:38:29 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200624093829eusmtrp17885e4059727ea87f6afd15a3982d552~bcVaMkxx62344323443eusmtrp1H; Wed, 24 Jun 2020 09:38:29 +0000 (GMT) X-AuditID: cbfec7f4-677ff7000000176d-be-5ef31f166ccd Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id CD.D0.06017.51F13FE5; Wed, 24 Jun 2020 10:38:29 +0100 (BST) Received: from [106.120.51.71] (unknown [106.120.51.71]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200624093826eusmtip13394060a77a06b8b8f2d583a9d4921e8~bcVWxcATH0455504555eusmtip1M; Wed, 24 Jun 2020 09:38:26 +0000 (GMT) Subject: Re: [PATCH v4 02/11] thermal: Store thermal mode in a dedicated enum 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: <076c3999-f6fa-cc12-7ede-433ccc3e82b6@samsung.com> Date: Wed, 24 Jun 2020 11:38:25 +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-3-andrzej.p@collabora.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Ta0yTZxjd+90hq/ssKG9UwtJEFs3GZS7Zk80Zpsv8lhlvi3FZHFuHX4BI EVvAOc0mmwo0XASmaMcQkEFbwWGBQqFjCwwYKRZwgckCs9WKZVgnlF1gAmv5IOPfec5zznue 8+PlSHk+u45LTE4V1cnKJAUTSJm7ZvpeWB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ys/2p0uH3n3kcb1l+9dn76i01NKys3emf3DlYcrpO3aYvVHs1frTmOi7Ge ki2es+9cOdDZS1nVzbISdNkwVGOPtrhmLLPZE3mBwuGs3b7tWxZnVdQf3PpJR3fojY1/nng1 eiNYuE3Z+nvFl5WdI5r9a2rDCkoo1qlWkUZB9z+wh1hStQMAAA== X-CMS-MailID: 20200624093829eucas1p2954a62270260216a849d4fe205e9c21a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200528192138eucas1p1f0e641f46080d52ae4d459745398ef03 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200528192138eucas1p1f0e641f46080d52ae4d459745398ef03 References: <20200528192051.28034-1-andrzej.p@collabora.com> <20200528192051.28034-3-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 storing mode in struct thermal_zone_device. > > Signed-off-by: Andrzej Pietrasiewicz Reviewed-by: Bartlomiej Zolnierkiewicz Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics > --- > drivers/acpi/thermal.c | 27 +++++++++---------- > drivers/platform/x86/acerhdf.c | 8 ++++-- > .../intel/int340x_thermal/int3400_thermal.c | 18 +++++-------- > 3 files changed, 25 insertions(+), 28 deletions(-) > > diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c > index 6de8066ca1e7..fb46070c66d8 100644 > --- a/drivers/acpi/thermal.c > +++ b/drivers/acpi/thermal.c > @@ -172,7 +172,7 @@ struct acpi_thermal { > struct acpi_thermal_trips trips; > struct acpi_handle_list devices; > struct thermal_zone_device *thermal_zone; > - int tz_enabled; > + enum thermal_device_mode mode; > int kelvin_offset; /* in millidegrees */ > struct work_struct thermal_check_work; > }; > @@ -500,7 +500,7 @@ static void acpi_thermal_check(void *data) > { > struct acpi_thermal *tz = data; > > - if (!tz->tz_enabled) > + if (tz->mode != THERMAL_DEVICE_ENABLED) > return; > > thermal_zone_device_update(tz->thermal_zone, > @@ -534,8 +534,7 @@ static int thermal_get_mode(struct thermal_zone_device *thermal, > if (!tz) > return -EINVAL; > > - *mode = tz->tz_enabled ? THERMAL_DEVICE_ENABLED : > - THERMAL_DEVICE_DISABLED; > + *mode = tz->mode; > > return 0; > } > @@ -544,27 +543,25 @@ static int thermal_set_mode(struct thermal_zone_device *thermal, > enum thermal_device_mode mode) > { > struct acpi_thermal *tz = thermal->devdata; > - int enable; > > if (!tz) > return -EINVAL; > > + if (mode != THERMAL_DEVICE_DISABLED && > + mode != THERMAL_DEVICE_ENABLED) > + return -EINVAL; > /* > * enable/disable thermal management from ACPI thermal driver > */ > - if (mode == THERMAL_DEVICE_ENABLED) > - enable = 1; > - else if (mode == THERMAL_DEVICE_DISABLED) { > - enable = 0; > + if (mode == THERMAL_DEVICE_DISABLED) > pr_warn("thermal zone will be disabled\n"); > - } else > - return -EINVAL; > > - if (enable != tz->tz_enabled) { > - tz->tz_enabled = enable; > + if (mode != tz->mode) { > + tz->mode = mode; > ACPI_DEBUG_PRINT((ACPI_DB_INFO, > "%s kernel ACPI thermal control\n", > - tz->tz_enabled ? "Enable" : "Disable")); > + tz->mode == THERMAL_DEVICE_ENABLED ? > + "Enable" : "Disable")); > acpi_thermal_check(tz); > } > return 0; > @@ -915,7 +912,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) > goto remove_dev_link; > } > > - tz->tz_enabled = 1; > + tz->mode = THERMAL_DEVICE_ENABLED; > > dev_info(&tz->device->dev, "registered as thermal_zone%d\n", > tz->thermal_zone->id); > diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c > index 8cc86f4e3ac1..830a8b060e74 100644 > --- a/drivers/platform/x86/acerhdf.c > +++ b/drivers/platform/x86/acerhdf.c > @@ -68,6 +68,7 @@ static int kernelmode = 1; > #else > static int kernelmode; > #endif > +static enum thermal_device_mode thermal_mode; > > static unsigned int interval = 10; > static unsigned int fanon = 60000; > @@ -397,6 +398,7 @@ static inline void acerhdf_revert_to_bios_mode(void) > { > acerhdf_change_fanstate(ACERHDF_FAN_AUTO); > kernelmode = 0; > + thermal_mode = THERMAL_DEVICE_DISABLED; > if (thz_dev) > thz_dev->polling_delay = 0; > pr_notice("kernel mode fan control OFF\n"); > @@ -404,6 +406,7 @@ static inline void acerhdf_revert_to_bios_mode(void) > static inline void acerhdf_enable_kernelmode(void) > { > kernelmode = 1; > + thermal_mode = THERMAL_DEVICE_ENABLED; > > thz_dev->polling_delay = interval*1000; > thermal_zone_device_update(thz_dev, THERMAL_EVENT_UNSPECIFIED); > @@ -416,8 +419,7 @@ static int acerhdf_get_mode(struct thermal_zone_device *thermal, > if (verbose) > pr_notice("kernel mode fan control %d\n", kernelmode); > > - *mode = (kernelmode) ? THERMAL_DEVICE_ENABLED > - : THERMAL_DEVICE_DISABLED; > + *mode = thermal_mode; > > return 0; > } > @@ -739,6 +741,8 @@ static int __init acerhdf_register_thermal(void) > if (IS_ERR(cl_dev)) > return -EINVAL; > > + thermal_mode = kernelmode ? > + THERMAL_DEVICE_ENABLED : THERMAL_DEVICE_DISABLED; > thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL, > &acerhdf_dev_ops, > &acerhdf_zone_params, 0, > diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > index 0b3a62655843..e84faaadff87 100644 > --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c > @@ -48,7 +48,7 @@ struct int3400_thermal_priv { > struct acpi_device *adev; > struct platform_device *pdev; > struct thermal_zone_device *thermal; > - int mode; > + enum thermal_device_mode mode; > int art_count; > struct art *arts; > int trt_count; > @@ -395,24 +395,20 @@ static int int3400_thermal_set_mode(struct thermal_zone_device *thermal, > enum thermal_device_mode mode) > { > struct int3400_thermal_priv *priv = thermal->devdata; > - bool enable; > int result = 0; > > if (!priv) > return -EINVAL; > > - if (mode == THERMAL_DEVICE_ENABLED) > - enable = true; > - else if (mode == THERMAL_DEVICE_DISABLED) > - enable = false; > - else > + if (mode != THERMAL_DEVICE_ENABLED && > + mode != THERMAL_DEVICE_DISABLED) > return -EINVAL; > > - if (enable != priv->mode) { > - priv->mode = enable; > + if (mode != priv->mode) { > + priv->mode = mode; > result = int3400_thermal_run_osc(priv->adev->handle, > - priv->current_uuid_index, > - enable); > + priv->current_uuid_index, > + mode == THERMAL_DEVICE_ENABLED); > } > > evaluate_odvp(priv); >