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: 11945863 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40A69C64E8A for ; Wed, 2 Dec 2020 12:08:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D405122203 for ; Wed, 2 Dec 2020 12:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728021AbgLBMH7 (ORCPT ); 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-Google-Smtp-Source: ABdhPJx86cxBM9BKeDFB0Z8T50befSXGthi4QGt1wI9arwTytWwW982hrDf9Cob/3fi6dEhpP37FxA== 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 Reported-by: kernel test robot Reported-by: kernel test robot --- 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(-) 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: 11945865 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1A5DC83012 for ; Wed, 2 Dec 2020 12:08:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDCD0221FE for ; Wed, 2 Dec 2020 12:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728009AbgLBMIA (ORCPT ); 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-Google-Smtp-Source: ABdhPJwaIUOTKsm41DdVvpj96ALshPKT0Yf32c4g5vUFDjRkYQ/LU2+levso9Z0tstsb7HLbSaLS2g== 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(-) 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: 11945869 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 341FDC83018 for ; Wed, 2 Dec 2020 12:08:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE5F222203 for ; Wed, 2 Dec 2020 12:08:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729457AbgLBMIs (ORCPT ); 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-Google-Smtp-Source: ABdhPJyVV9LngqpFKQFLuB1i33MBGVebiM9WuqJV0kr00aFtWoz1g78HEIrjzt/861ILbYDFIBdj1A== 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(-) 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: 11945867 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AC30C83012 for ; Wed, 2 Dec 2020 12:08:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABF58221FE for ; Wed, 2 Dec 2020 12:08:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726589AbgLBMIk (ORCPT ); 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-Google-Smtp-Source: ABdhPJz7giszMZVL+Yi+OTAotH7TKAvAwMIsuAd2yQXIzPX7xkQsA8YkzHgf2hSL4ww4wyeagQ+pEQ== 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 Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/thermal/thermal_core.h | 2 -- drivers/thermal/thermal_sysfs.c | 2 +- include/linux/thermal.h | 7 ------- 3 files changed, 1 insertion(+), 10 deletions(-) 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;