From patchwork Wed Dec 2 12:06:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 335982 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp865408ejs; Wed, 2 Dec 2020 04:08:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJJ8aDpF4pVelnKRgcYeRBIZ5+O99KoZ7UOOAm6F+IBFNzEoeLuGeA4070HVDEG5mXHHHM X-Received: by 2002:a05:6402:1714:: with SMTP id y20mr2218733edu.306.1606910888766; Wed, 02 Dec 2020 04:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606910888; cv=none; d=google.com; s=arc-20160816; b=uzt7YJXNseTaW0dM1eo9tzrVPCKvEwikdeogTU05weMF5e3jJ+ZQFht2QnIcHGuR4a XYIZ9SWx5YTP6GjlI8mT3ERf0FUjWdIZ7N/nB0GhHw86OZwPCOncCjm9lDKBk1VRfkUM rw5XSpGT8DAjkkKazi1Qdo6zZ04EtKLY7j3nFJpNgxpxFZiIk+7hwE254EdVVY3bFHE8 3vvCD7gXXmezw6WwHuDHJP0LF+fhC1RfgJsKpf5LbILmev+Oy9+8eeWqaNITILx/i4WS q7bHzxajpNgLzBrfKLU5EBac7iiM8BAYTC2ur9uwKXEqA0bl2VVFwQ9UQZ5k0XB9gxuU bGWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=N0N1NFLUe7mxMhyhl9qWKG4HrWaDY+W8Cz0CyGfPy4Y=; b=Zgpj9HQ8MXRJJaKkoNmuKZpOYywlVRzNLWlMHC0sUuz6N9dBQh0GOFXDGprMpUQckI A2+psT7TBGM689NhbxxA1H/V4yWrnHnDRHmW8mI7azvBDaJoXU3DuIhrerEPaiWSo2RV gkR2FOOLRwjPrHyFXTMd3Rpxl3jE1G9984RIfVp4VxIEbRft57H4vkUR/iwiJObzV1U9 9SUhAaat2zgjGtDhODrsMO/ynUVMl5k1LD/IEtWxm9nOshFpChRoYN9L6vO4CMqnsaba EvI+xWZA4dkWnJVtJyAxzgNguMOl/J9pIq2O07F0tsWlc6e8GjtKtPinL0N9ZDqfW0ST sfqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hSy6vvc4; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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. [23.128.96.18]) by mx.google.com with ESMTP id h14si157566ejt.198.2020.12.02.04.08.08; Wed, 02 Dec 2020 04:08:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-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=@linaro.org header.s=google header.b=hSy6vvc4; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 S1728021AbgLBMH7 (ORCPT + 8 others); Wed, 2 Dec 2020 07:07:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726746AbgLBMH6 (ORCPT ); Wed, 2 Dec 2020 07:07:58 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A78C0613CF for ; Wed, 2 Dec 2020 04:07:18 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id r3so3638736wrt.2 for ; Wed, 02 Dec 2020 04:07:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=N0N1NFLUe7mxMhyhl9qWKG4HrWaDY+W8Cz0CyGfPy4Y=; b=hSy6vvc42xNZgz4wWHl4kIJ+4OtfVSy0bjNkPEsCHY7lkrmWhUTff/ezw9mjHlNCKr t+rkZjQqnEiCo5wNH+vr5CldwI8jrVbaAMmnQeTL1q7lHyCx4KDEQsZlY2ZE/Omw9NH/ tHC/ZmcGiInHlFExLX5uGdEma5XwrG0JKZgzxTdYn7kDvHTOB5NKE+YYxU9UMAJsPi/1 ELCm3Jd8nXlmbb7qnJIUYxnz29vzWVaVt1MF4ORXtIWv1mfi4GFFw5SwhtqfK+xJzXic fEku5zdiQpniSw8ymr+vP1JJjUJvC5JIRAhvdYWBFkO4JFd1Aef0rEf8/W0TgXpPtqOj nh7w== 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; bh=N0N1NFLUe7mxMhyhl9qWKG4HrWaDY+W8Cz0CyGfPy4Y=; b=RuIcf7tQyFVIQVynv9QpFU+Nq13qWZofEhnXtuiHazcfWfGTh+iInklj2OOWXpglak PWzhNEbaWrTjNgY8+7yoHW0peow86OCQDYYkJwptuX8R5dUptmnuYGh5QvHr7iGMQ7RD XHVneFk3UFh7GTVEoz5gMLIzrhSIeXbZyIolHMl1ISWTdtMGU7JGcdRkmZW3SwtmU3Ps Q3uReqIEHE0LC0lZLrITL/RFC8NJ2fXXUxAtJJuWhZMK4htojyt7cqLlrhw6f8sauWC0 kh16IhpajcHMCxogSYa8yDlz37jWi5IOr7NYRdlRFL4JOo9lEpxVlMzQkHX1wvhGtXtN GKNw== X-Gm-Message-State: AOAM530fUrujgWxjwo/yFRnVDha41aWo2k+oLwNefrS1k2CWFu0mAo3S jrrwi5P7s3p62WgnZdnHprlEaw== X-Received: by 2002:a5d:49ce:: with SMTP id t14mr3036168wrs.75.1606910836890; Wed, 02 Dec 2020 04:07:16 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-140-184.adsl.proxad.net. [82.252.140.184]) by smtp.gmail.com with ESMTPSA id c1sm1755132wml.8.2020.12.02.04.07.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 04:07:16 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 1/4] thermal/core: Rename passive_delay and polling_delay with units Date: Wed, 2 Dec 2020 13:06:54 +0100 Message-Id: <20201202120657.1969-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Set the scene to directly store the delays under their jiffies form. Add to the variable name the 'ms' suffix. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 10 +++++----- drivers/thermal/thermal_of.c | 8 ++++---- drivers/thermal/thermal_sysfs.c | 6 +++--- include/linux/thermal.h | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) -- 2.17.1 Reported-by: kernel test robot Reported-by: kernel test robot diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 90e38cc199f4..53f55ceca220 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -317,9 +317,9 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz) mutex_lock(&tz->lock); if (!stop && tz->passive) - thermal_zone_device_set_polling(tz, tz->passive_delay); - else if (!stop && tz->polling_delay) - thermal_zone_device_set_polling(tz, tz->polling_delay); + thermal_zone_device_set_polling(tz, tz->passive_delay_ms); + else if (!stop && tz->polling_delay_ms) + thermal_zone_device_set_polling(tz, tz->polling_delay_ms); else thermal_zone_device_set_polling(tz, 0); @@ -1340,8 +1340,8 @@ thermal_zone_device_register(const char *type, int trips, int mask, tz->device.class = &thermal_class; tz->devdata = devdata; tz->trips = trips; - tz->passive_delay = passive_delay; - tz->polling_delay = polling_delay; + tz->passive_delay_ms = passive_delay; + tz->polling_delay_ms = polling_delay; /* sys I/F */ /* Add nodes that are always present via .groups */ diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 69ef12f852b7..ebec4a8a8b5a 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -865,14 +865,14 @@ __init *thermal_of_build_thermal_zone(struct device_node *np) pr_err("%pOFn: missing polling-delay-passive property\n", np); goto free_tz; } - tz->passive_delay = prop; + tz->passive_delay_ms = prop; ret = of_property_read_u32(np, "polling-delay", &prop); if (ret < 0) { pr_err("%pOFn: missing polling-delay property\n", np); goto free_tz; } - tz->polling_delay = prop; + tz->polling_delay_ms = prop; /* * REVIST: for now, the thermal framework supports only @@ -1085,8 +1085,8 @@ int __init of_parse_thermal_zones(void) zone = thermal_zone_device_register(child->name, tz->ntrips, mask, tz, ops, tzp, - tz->passive_delay, - tz->polling_delay); + tz->passive_delay_ms, + tz->polling_delay_ms); if (IS_ERR(zone)) { pr_err("Failed to build %pOFn zone %ld\n", child, PTR_ERR(zone)); diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 0866e949339b..f465462d8aa1 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -233,12 +233,12 @@ passive_store(struct device *dev, struct device_attribute *attr, return -EINVAL; if (state && !tz->forced_passive) { - if (!tz->passive_delay) - tz->passive_delay = 1000; + if (!tz->passive_delay_ms) + tz->passive_delay_ms = 1000; thermal_zone_device_rebind_exception(tz, "Processor", sizeof("Processor")); } else if (!state && tz->forced_passive) { - tz->passive_delay = 0; + tz->passive_delay_ms = 0; thermal_zone_device_unbind_exception(tz, "Processor", sizeof("Processor")); } diff --git a/include/linux/thermal.h b/include/linux/thermal.h index d07ea27e72a9..230d451bf335 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -116,9 +116,9 @@ struct thermal_cooling_device { * @devdata: private pointer for device private data * @trips: number of trip points the thermal zone supports * @trips_disabled; bitmap for disabled trips - * @passive_delay: number of milliseconds to wait between polls when + * @passive_delay_ms: number of milliseconds to wait between polls when * performing passive cooling. - * @polling_delay: number of milliseconds to wait between polls when + * @polling_delay_ms: number of milliseconds to wait between polls when * checking whether trip points have been crossed (0 for * interrupt driven systems) * @temperature: current temperature. This is only for core code, @@ -159,8 +159,8 @@ struct thermal_zone_device { void *devdata; int trips; unsigned long trips_disabled; /* bitmap for disabled trips */ - int passive_delay; - int polling_delay; + int passive_delay_ms; + int polling_delay_ms; int temperature; int last_temperature; int emul_temperature; From patchwork Wed Dec 2 12:06:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 335983 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp865436ejs; Wed, 2 Dec 2020 04:08:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOCtY5xihdr+Yrvl3fTE+1nT4Mm4OLF2Xpg/Iuh6qDM07BGxboAKt3iv6Hf8DsYUxlM3m9 X-Received: by 2002:a17:906:7118:: with SMTP id x24mr1952772ejj.333.1606910890851; Wed, 02 Dec 2020 04:08:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606910890; cv=none; d=google.com; s=arc-20160816; b=GxlI9wGAJKiwMp+AX5DNHjn256/NtVe2cOkZhxOc6p8wBbqnhD373bNaGTds+4XiLr NTH0uAjzfLnrndOMkQyDIjyPBOG8NLMoOSTpaJxS73liHg19FDfRDFOSpzLpGei5ptag k3YZdbFtqYRIOmr10BHQGFDFeyMvgBSFwAQzYw8FlEYC0hJrTB6r/j/6CApaJNXLg79T xVjFFFcC60QwnHR0wsClvHiSJge/BhJpgrubKDx9D31SWIqM2E4n9b3yGfbsa29+AB4N viiILDAloQzYICnGr48g4UXpD0FTEe4zyGXTNYVR3/dhu+hg6uf5CsfNqaQ4VdzEDyUd GtoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=UIDq+KW00cXiRWlv/JAzZ8+RBZbAH3GMyxtATb0Dmi4=; b=JGK3vmD/yFQVl8a0HZNoHeHGtZea14dB9fZvAtwZRkMLDxcvHufI3sqsPHA5LoN3HW er7y7HjT79uKK664AECw+wq9QYBtjGuAZ1CYxH/yUu5Eh0SQVmMct/yf1w5Zs/lM1zfd X42vUvwEK37+YYpEbF29qJ029OXm06Nlez42s/9jTBdGoM1meuX/S3A6Gm1w4qLGZEKd QBvzXNyzlJXzGpPvwUs6qDxdkR09m8iubXgQrNiQnloRziBJq7BfDOLK1U+2i0yWB+Hg 8HIXaW24BnTmfQ2rrtaYHK7bknYStvnZfSrHUpDqy1TiTUC6f11R5lDOguiGmjUxnGGx Fr2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mXiAtgM0; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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. [23.128.96.18]) by mx.google.com with ESMTP id h14si157566ejt.198.2020.12.02.04.08.10; Wed, 02 Dec 2020 04:08:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-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=@linaro.org header.s=google header.b=mXiAtgM0; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 S1728009AbgLBMIA (ORCPT + 8 others); Wed, 2 Dec 2020 07:08:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729515AbgLBMIA (ORCPT ); Wed, 2 Dec 2020 07:08:00 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAC1EC0617A7 for ; Wed, 2 Dec 2020 04:07:19 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id s8so3585126wrw.10 for ; Wed, 02 Dec 2020 04:07:19 -0800 (PST) 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=UIDq+KW00cXiRWlv/JAzZ8+RBZbAH3GMyxtATb0Dmi4=; b=mXiAtgM0W/LxjZMo+BhxY/PMo8HDvF95Z9Ow1zW7TsE2y180u+oF56zehpf2tNgeQQ YXJBf7G0CJDXKeOV7NCHASKya27I0q9iIPF74dgSzhVzV/rgWoVXwwWVHt3ViyS+t4gO eysDa3SvVI9/UJZ8jCFPP4KtSrGD5NyVzxeTHJ00HBJAFKXG4LYEuRZ50tPa2gy0YiAo I3WjXZ1Z5bVTwYUteZxOjqLdhOF2poPenoV2lFHK56cuHeX2EK2TfVHm5LvvRcBQZppK V1G/eZkTpVtq/jWhIsmAKS9cTeWONvVl5IHozGecjNOucBC2z9ZI871WoORJdwueDoFg c4ag== 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=UIDq+KW00cXiRWlv/JAzZ8+RBZbAH3GMyxtATb0Dmi4=; b=g0+jbsi+7jYf20y+pr/bdTjgRrqiAKO46xbDTMGF0lvW4zKTcXEqmwpGT/vyjzFnxN BXglnJDG9NAbXz2+JB0A+WgRdGKrc+Fc6JYdhJsMzXWb/ib1ANimOY+o3HmvH2AbB36h IlOaigBD7O0rivfQsEsiLzdd6DeUz8GUD3acx6WXI3xRBrAUNHnh6+A9vUCtGBr/0ETB WJ45NQ8H01H/dLAIkhOHhyppeJ7oUvRkIbzXRUITC1cMKzKq5VoJzgZeFTZvjBnWw7Q8 lboU30YdRhEDgNZAT4ZXfw/IRg1wHsnTgBhiKU+3cgkhLgsD3mQo1TRobCuPzH7D36+o vZbA== X-Gm-Message-State: AOAM533u8nH6RegfSgjslUgW2gGTRZ1ijsToq9/svBbdonlG250eWcvd HO44Jsv3UGSgDQAanqLKkW9GtON5SvZSWQ== X-Received: by 2002:adf:dd0e:: with SMTP id a14mr3071026wrm.36.1606910838314; Wed, 02 Dec 2020 04:07:18 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-140-184.adsl.proxad.net. [82.252.140.184]) by smtp.gmail.com with ESMTPSA id c1sm1755132wml.8.2020.12.02.04.07.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 04:07:17 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 2/4] thermal/core: Precompute the jiffies Date: Wed, 2 Dec 2020 13:06:55 +0100 Message-Id: <20201202120657.1969-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202120657.1969-1-daniel.lezcano@linaro.org> References: <20201202120657.1969-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The delays are stored in ms units and when the polling function is called this delay is converted into jiffies at each call. Instead of doing the conversion again and again, compute the jiffies at init time and use the value directly when setting the polling. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 5 +++-- drivers/thermal/thermal_core.h | 18 ++++++++++++++++++ drivers/thermal/thermal_sysfs.c | 4 ++-- include/linux/thermal.h | 7 +++++++ 4 files changed, 30 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 53f55ceca220..3111ca2c87a1 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1340,8 +1340,9 @@ thermal_zone_device_register(const char *type, int trips, int mask, tz->device.class = &thermal_class; tz->devdata = devdata; tz->trips = trips; - tz->passive_delay_ms = passive_delay; - tz->polling_delay_ms = polling_delay; + + thermal_zone_set_passive_delay(tz, passive_delay); + thermal_zone_set_polling_delay(tz, polling_delay); /* sys I/F */ /* Add nodes that are always present via .groups */ diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 8df600fa7b79..2c9551ed5ef8 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -128,6 +128,24 @@ int thermal_build_list_of_policies(char *buf); /* Helpers */ void thermal_zone_set_trips(struct thermal_zone_device *tz); +static inline void thermal_zone_set_passive_delay( + struct thermal_zone_device *tz, int delay_ms) +{ + tz->passive_delay_ms = delay_ms; + tz->passive_delay_jiffies = msecs_to_jiffies(delay_ms); + if (delay_ms > 1000) + tz->passive_delay_jiffies = round_jiffies(tz->passive_delay_jiffies); +} + +static inline void thermal_zone_set_polling_delay( + struct thermal_zone_device *tz, int delay_ms) +{ + tz->polling_delay_ms = delay_ms; + tz->polling_delay_jiffies = msecs_to_jiffies(delay_ms); + if (delay_ms > 1000) + tz->polling_delay_jiffies = round_jiffies(tz->polling_delay_jiffies); +} + /* sysfs I/F */ int thermal_zone_create_device_groups(struct thermal_zone_device *, int); void thermal_zone_destroy_device_groups(struct thermal_zone_device *); diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index f465462d8aa1..9598b288a0a1 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -234,11 +234,11 @@ passive_store(struct device *dev, struct device_attribute *attr, if (state && !tz->forced_passive) { if (!tz->passive_delay_ms) - tz->passive_delay_ms = 1000; + thermal_zone_set_passive_delay(tz, 1000); thermal_zone_device_rebind_exception(tz, "Processor", sizeof("Processor")); } else if (!state && tz->forced_passive) { - tz->passive_delay_ms = 0; + thermal_zone_set_passive_delay(tz, 0); thermal_zone_device_unbind_exception(tz, "Processor", sizeof("Processor")); } diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 230d451bf335..5dd9bdb6c6ad 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -118,9 +118,14 @@ struct thermal_cooling_device { * @trips_disabled; bitmap for disabled trips * @passive_delay_ms: number of milliseconds to wait between polls when * performing passive cooling. + * @passive_delay_jiffies: number of jiffies to wait between polls when + * performing passive cooling. * @polling_delay_ms: number of milliseconds to wait between polls when * checking whether trip points have been crossed (0 for * interrupt driven systems) + * @polling_delay_jiffies: number of jiffies to wait between polls when + * checking whether trip points have been crossed (0 for + * interrupt driven systems) * @temperature: current temperature. This is only for core code, * drivers should use thermal_zone_get_temp() to get the * current temperature @@ -161,6 +166,8 @@ struct thermal_zone_device { unsigned long trips_disabled; /* bitmap for disabled trips */ int passive_delay_ms; int polling_delay_ms; + int passive_delay_jiffies; + int polling_delay_jiffies; int temperature; int last_temperature; int emul_temperature; From patchwork Wed Dec 2 12:06:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 335986 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp866873ejs; Wed, 2 Dec 2020 04:10:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7anaiWBpojjsoAnFlv0wB+T4QICJVdb079aO6/T3OdLP4Vx3wH4SvWd2Kp7wtVwB3LX5Z X-Received: by 2002:a05:6402:c1c:: with SMTP id co28mr2207420edb.287.1606911012272; Wed, 02 Dec 2020 04:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606911012; cv=none; d=google.com; s=arc-20160816; b=DtVwLqzs+74BjrHW09vKdufdCrrEGYWXRvB++/vyTJrAkK5+1GdaGEfCQzLllbTJAg M9/n53GlTutb6+Zz3ZZRo/DPx/8hv7ZznEjK36d0U0lMH4m80NxGWWr/FdNxhDgZXb7t HDpI6Khies1kb9FIMTi6pQ2Ga/GpkD9bKKSN5HCOjXM1eAOu4iHz6co6u7di/CJkLjbt mI5eirg1PUX103n1DwXKGC7hCAzmhUrjfylGJHsH1GFp8JlsEeN+a70DQDVxcvvw0n8/ 9N2sFxVeNu1fYtCVIaMII1hY10ujbz5uCe1JH/9h5MXkRkaZcrDREVp/nUUkb1gTbWOp pFcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=tJ0R6+v3eDzrBmGIX3GXY/fGfGw8OCjkiLlbM8B6B9o=; b=r+691XSmeljgXsvQKvP18H/XrFvmbBUmMjqxcAMqp4PDrZyWVoE90tlJuV3bRq0Prr enCHHUr9kMAtXCD9leqti2ZZJtsKnqVKjcwVHd6txxyc+oQA21Ovl7H5+0hu2yz39F/j BZvBVqAXBtWs0rgQN9H4BWCmLYBFMchRuVU/+iomJG0TvdI0DT7/upQ0xnL2KgGSme3V jusFxvoXeI/qms/swmnMrWOvlOqqfrFSiLS8+cmEWSNuCtlqbfnsmBz1+WRglVIZFqBD QzEYxVzVDMG5ZgxaFSqIx6MrYqdRx60K7dBagDDFmAs+RB6vuQ9TQN5N423reeLs2OTi NDrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vfptUf5I; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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. [23.128.96.18]) by mx.google.com with ESMTP id y16si878628edw.601.2020.12.02.04.10.12; Wed, 02 Dec 2020 04:10:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-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=@linaro.org header.s=google header.b=vfptUf5I; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 S1729457AbgLBMIs (ORCPT + 8 others); Wed, 2 Dec 2020 07:08:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726562AbgLBMIp (ORCPT ); Wed, 2 Dec 2020 07:08:45 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE480C061A48 for ; Wed, 2 Dec 2020 04:07:20 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id z7so3637825wrn.3 for ; Wed, 02 Dec 2020 04:07:20 -0800 (PST) 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=tJ0R6+v3eDzrBmGIX3GXY/fGfGw8OCjkiLlbM8B6B9o=; b=vfptUf5IkKYkxbzItlOYECG9qv59hYSXmZBoOJ1La3FcAa+KmxnKb0RRyMxspcne3P 6LtxeQPXbBqX+5s3Fm/YX/MGoyEeCjd+O7PJGRAsvgYrnM+gWB+PzZ5wN7kMEJ/Rhvod 2SEY/egivugsKPlbzLmhFPq4fp4a1TGbLJZt9E7WkOjVj82EWZcNLnV2FtYmVRX2vXK2 ybE+H/yE2+pyfnhoWld1fzl1B+JAgG3BnCgvnyj81iLuvanxO088MyTg8lfh3SGWgNdq Knca8rrlRIMNTBxmUUs9wwy9XCZ2Anwl+crFlPbZwhFqhc52uJY0QGR0ZeawyJnq2aaV AhUA== 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=tJ0R6+v3eDzrBmGIX3GXY/fGfGw8OCjkiLlbM8B6B9o=; b=iP7BoVKLkpI/k6Bt5o2719bcE8ozR1kzj2hPvUOsyxSXVZ2zA7YJQwFWeBX9LoapFe BOn2gGt4t8h31NxxHv1d5EgvNo25pwmpLw6fD+EQu28t6Q9LWGt8ZFgWwm19/yeubt0Z 4WtF9JzKBe5ARxAzdMJXwRBvCFh7vYMj2cB9aRN6BQrQbdHIpgClBKBdPh0inE4IoPPn DVWUGMomia/XV7zbYoMa4PbcZcduBg1ft9kKCLeVNQn9e1FhmJJsJFVFfKAVgz5RBjYe DwhvGQ92u8q+8Zr0ouONhEHR7tnhmZsquKT47YpJ6DrV+LFUghFxT9ZkCc2HM2/Aub9D BpjQ== X-Gm-Message-State: AOAM530wXuaVHY12gxE2MFe99TKKet7tglo0kyr+IYiLI6hjinRoU201 35hpkXnYyEK1fiZTCK6zTV3zCA== X-Received: by 2002:adf:e481:: with SMTP id i1mr2969550wrm.282.1606910839458; Wed, 02 Dec 2020 04:07:19 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-140-184.adsl.proxad.net. [82.252.140.184]) by smtp.gmail.com with ESMTPSA id c1sm1755132wml.8.2020.12.02.04.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 04:07:18 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 3/4] thermal/core: Use precomputed jiffies for the polling Date: Wed, 2 Dec 2020 13:06:56 +0100 Message-Id: <20201202120657.1969-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202120657.1969-1-daniel.lezcano@linaro.org> References: <20201202120657.1969-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The delays are also stored in jiffies based unit. Use them instead of the ms. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 3111ca2c87a1..237480429ba9 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -291,14 +291,9 @@ static int __init thermal_register_governors(void) static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, int delay) { - if (delay > 1000) + if (delay) mod_delayed_work(system_freezable_power_efficient_wq, - &tz->poll_queue, - round_jiffies(msecs_to_jiffies(delay))); - else if (delay) - mod_delayed_work(system_freezable_power_efficient_wq, - &tz->poll_queue, - msecs_to_jiffies(delay)); + &tz->poll_queue, delay); else cancel_delayed_work(&tz->poll_queue); } @@ -317,9 +312,9 @@ static void monitor_thermal_zone(struct thermal_zone_device *tz) mutex_lock(&tz->lock); if (!stop && tz->passive) - thermal_zone_device_set_polling(tz, tz->passive_delay_ms); + thermal_zone_device_set_polling(tz, tz->passive_delay_jiffies); else if (!stop && tz->polling_delay_ms) - thermal_zone_device_set_polling(tz, tz->polling_delay_ms); + thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies); else thermal_zone_device_set_polling(tz, 0); From patchwork Wed Dec 2 12:06:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 335985 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp866819ejs; Wed, 2 Dec 2020 04:10:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRqUpDyEN47dmuMfDC5FNSXL7EvfHdmC3DUbZlFeZVYuC+Sv+ZDEuM01i7L+SiDMpv0XlO X-Received: by 2002:a17:906:ae14:: with SMTP id le20mr1997842ejb.451.1606911009477; Wed, 02 Dec 2020 04:10:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606911009; cv=none; d=google.com; s=arc-20160816; b=Jw+nXwJ/dXomF/uhXE+HdpN8SKeuP+tGboZyInbj9Bm5z0Z5pNFsghz178cs7MHi5s shtpYmHb0+X6E6IRMYy3ex9i/Qsxvxdvnq6qtYYR94zI5ZSFR751LXmqQaYL/FVwsty+ 1w3r8CZ54b1AEEWDlq4dYJ3XxLHNYH/N5jevNpAQi9vJuKK7XAAkFCnV5YKwmpH42LMn d61bWUhUB1fhQNLq5lzvrzy5iEZo47xMOwgFMYwBIdivT5gJRq+ZqvYx90NPxSk3xfV1 qXce3iwBB1DGqIyQprMzsPOeMgCxtd+dDn4tWcRhVPyFl/MqUtPxOsuZCU7gZmsgSLfX e9Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=KfWzWNO1cYwi4Mxtl+r98rc1kSAeUgl37X9y9wjblMk=; b=RuuPKIb6dsbgFTwgh75oem6eC9qIkfWALmaveotJu7cuZtFoNpmXiWJXijaqpnwii3 xYE+d1qD5kpVcgNBLZoReOE1WOk3V9QYPAff6b/xoaSVwU/vc5ULU+XCriJQPK6bAmSu rELhrbLXF9u3TgxZsDTXl4dhEYyDGJL8iSwbC8hzPp7PrFn18ofPBczMmQPWLs9PX9PU ZD3a2Aaltu1NFhpZ0KyVzAkwOOsDnMmZ80j6/kVmVSRyvvmkiGZaAhV8m4BXOHckFi7g 2PHCMirKKciTWBoGq44BZX43pxA9QCnodskyj++tY/PqGSP8TclWi8CjPO9V7rV4kce2 /jVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZLYPHgLO; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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. [23.128.96.18]) by mx.google.com with ESMTP id y16si878628edw.601.2020.12.02.04.10.09; Wed, 02 Dec 2020 04:10:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-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=@linaro.org header.s=google header.b=ZLYPHgLO; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 S1726589AbgLBMIk (ORCPT + 8 others); Wed, 2 Dec 2020 07:08:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727102AbgLBMIj (ORCPT ); Wed, 2 Dec 2020 07:08:39 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BC2AC061A4A for ; Wed, 2 Dec 2020 04:07:22 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id u12so3657862wrt.0 for ; Wed, 02 Dec 2020 04:07:22 -0800 (PST) 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=KfWzWNO1cYwi4Mxtl+r98rc1kSAeUgl37X9y9wjblMk=; b=ZLYPHgLO5O71tb8yepC2YgPKRYZSYSjZE+fjbYze84gYnOSJT2b5CQQYg6VH/AxEGZ cWHv8dGtIE7CC2+pKVT9BqMRvLiqhhJC24o1Gh43OZG/D1AvFUc6jYH39PxY43KbQwP9 boyXvsibBPINYL9mD2TBx4chRP3Bou38ru1S2nDnLNFz8x3pcU9fU1WBRYDRyvWAnVqN bhsYfCnrYCaVyCInBmjie/WLFLyXC9MmON8Ao7q364BbjhXobJpG+5fSIxmEQTaVwoM9 ShW6CcIjtYPU7Qgw1g3hv+x1VtvVKG6qmxCkrPwiROq7Ba/BrK5WFcNP6dBAuwQlBJLU IeYA== 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=KfWzWNO1cYwi4Mxtl+r98rc1kSAeUgl37X9y9wjblMk=; b=KqrnAnCl44UrwoVSuJhUl2Dcz77m7pxXKjyNxU2pOGkaGihK6nQ4GVUJTDhnCV2fUE mKi+a7Or531pz8fcU/z5+3ykQvhMOi5dxvY5W9GWbrl7h6uNEjgmKobcP+J1tRDCWpHN /QE4trOVuTLjjWBt2vM8VJu+pOVlRvvqJGTmtfLFaxiWzpWoczcgB++VJ0ATDc0xwcvN Md4ScmkvB6yBY6BefjlPKWPinSJ8dAo/cHQ8L92XUWtL/wLdIxv1oifuf61BJ2FLSVDX QBf3ckkB7Ngn0kzC4RrGw7RSXdiOqPDCd+S/tZEtCBEQJbP88Cuo6HuAgG41lXC+7lsS Z7pw== X-Gm-Message-State: AOAM533MiPgSlBF6NFo7wRftF8OGcFcBYy2SSYR4/VPW9kLRMdWd3B43 3e8fXbEgdJn9dnMXIcFvxUz7/A== X-Received: by 2002:adf:dec8:: with SMTP id i8mr3019340wrn.86.1606910840802; Wed, 02 Dec 2020 04:07:20 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-140-184.adsl.proxad.net. [82.252.140.184]) by smtp.gmail.com with ESMTPSA id c1sm1755132wml.8.2020.12.02.04.07.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 04:07:20 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amitk@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 4/4] thermal/core: Remove ms based delay fields Date: Wed, 2 Dec 2020 13:06:57 +0100 Message-Id: <20201202120657.1969-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202120657.1969-1-daniel.lezcano@linaro.org> References: <20201202120657.1969-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The code does no longer use the ms unit based fields to set the delays as they are replaced by the jiffies. Remove them. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.h | 2 -- drivers/thermal/thermal_sysfs.c | 2 +- include/linux/thermal.h | 7 ------- 3 files changed, 1 insertion(+), 10 deletions(-) -- 2.17.1 Reported-by: kernel test robot Reported-by: kernel test robot diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index 2c9551ed5ef8..5baa308ee7a5 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -131,7 +131,6 @@ void thermal_zone_set_trips(struct thermal_zone_device *tz); static inline void thermal_zone_set_passive_delay( struct thermal_zone_device *tz, int delay_ms) { - tz->passive_delay_ms = delay_ms; tz->passive_delay_jiffies = msecs_to_jiffies(delay_ms); if (delay_ms > 1000) tz->passive_delay_jiffies = round_jiffies(tz->passive_delay_jiffies); @@ -140,7 +139,6 @@ static inline void thermal_zone_set_passive_delay( static inline void thermal_zone_set_polling_delay( struct thermal_zone_device *tz, int delay_ms) { - tz->polling_delay_ms = delay_ms; tz->polling_delay_jiffies = msecs_to_jiffies(delay_ms); if (delay_ms > 1000) tz->polling_delay_jiffies = round_jiffies(tz->polling_delay_jiffies); diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c index 9598b288a0a1..8532b1dd0608 100644 --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -233,7 +233,7 @@ passive_store(struct device *dev, struct device_attribute *attr, return -EINVAL; if (state && !tz->forced_passive) { - if (!tz->passive_delay_ms) + if (!tz->passive_delay_jiffies) thermal_zone_set_passive_delay(tz, 1000); thermal_zone_device_rebind_exception(tz, "Processor", sizeof("Processor")); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 5dd9bdb6c6ad..f23a388ded15 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -116,13 +116,8 @@ struct thermal_cooling_device { * @devdata: private pointer for device private data * @trips: number of trip points the thermal zone supports * @trips_disabled; bitmap for disabled trips - * @passive_delay_ms: number of milliseconds to wait between polls when - * performing passive cooling. * @passive_delay_jiffies: number of jiffies to wait between polls when * performing passive cooling. - * @polling_delay_ms: number of milliseconds to wait between polls when - * checking whether trip points have been crossed (0 for - * interrupt driven systems) * @polling_delay_jiffies: number of jiffies to wait between polls when * checking whether trip points have been crossed (0 for * interrupt driven systems) @@ -164,8 +159,6 @@ struct thermal_zone_device { void *devdata; int trips; unsigned long trips_disabled; /* bitmap for disabled trips */ - int passive_delay_ms; - int polling_delay_ms; int passive_delay_jiffies; int polling_delay_jiffies; int temperature;