From patchwork Fri Apr 10 22:12:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11483699 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAADE912 for ; Fri, 10 Apr 2020 22:13:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C6292084D for ; Fri, 10 Apr 2020 22:13:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="a9ngXUrN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726740AbgDJWNA (ORCPT ); Fri, 10 Apr 2020 18:13:00 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:35029 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726718AbgDJWNA (ORCPT ); Fri, 10 Apr 2020 18:13:00 -0400 Received: by mail-wr1-f68.google.com with SMTP id g3so3908463wrx.2 for ; Fri, 10 Apr 2020 15:13:00 -0700 (PDT) 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=HV4uxU8XGvUxECd82k3CD/W1J1RbaS0e9zCergn8MI4=; b=a9ngXUrNUt7AiZ+5zUwxR0uT87ropKMeNAXC1eoLoQp619v3ASrMyus+iVrotpNRt6 KyccFKtU+UpVDueWBivYe++GpNKuyV9Hf+aOyB7cW6PBRIIPJM6Qa5eiDQcoU/JHiigk Dg/mrh7YQjVr+vJRIcGxnUFCtJcx2bZbGwxmLy5dX0hxNtPPfM0hY0krCsKL9Nnavd8P FPOIt2Tsfpo0/FSLivtF+MMtKD6r9PBObZgpHZzjIS4qKooYoU7yEff2CH3tLVUJ+Ys3 pS6QEQXkDivQvcnO08OauNGsZ/JnYl1B/Z5RzLXVfIWcuCe3n8XFOdLSk0XIA229LGTU 5jng== 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=HV4uxU8XGvUxECd82k3CD/W1J1RbaS0e9zCergn8MI4=; b=Z+z42KsCL8YwUCacHbITs1prOvfngLvV3I8wxterwtN+OHWVNFREuZjvB7GK0MvJZM ZHW+a/m0PpaVabSJGge888Q9h3rfxRlBz3ALu2jM5AEhi/2NeLCMqwjldfex/3Vbdg62 GHjFeev/rv3wp8JlDaw2jNve0d4Vu0LfVqQLalGODwJ/udS4nWr1gSCvKUJrfMjJ8eS7 XOS2fF0Li+rU2AWprfWb5vLwHN6++5aJzd8yR6wQoxudbjsBdokfsMkRhn0SogRQ7UUW l55f9Xfl9vn5QGnmZJpB0dAzy1Z1aHQwFk1T+oHQiUN2dPGT1bADZyZHvU1xwpWQMxku gQ9g== X-Gm-Message-State: AGi0PuZjNOqzxoPYd/XamYrhUMrN+4aUxsRjHrdTJ5wt+vq/9JaQxH7a +tAsejOJzTgXGiOM5jlCNWaprQ== X-Google-Smtp-Source: APiQypLbWxW37hLgL1D9TRx0HfjG4PrI3ABBsgwJvT4Tbi9Cc5C3TUklYD5szz5QD4O/qQcXuiODSg== X-Received: by 2002:a5d:4d51:: with SMTP id a17mr6704254wru.317.1586556779513; Fri, 10 Apr 2020 15:12:59 -0700 (PDT) Received: from localhost.localdomain (lns-bzn-59-82-252-135-148.adsl.proxad.net. [82.252.135.148]) by smtp.gmail.com with ESMTPSA id b14sm4687952wrw.83.2020.04.10.15.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 15:12:58 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amit.kucheria@verdurent.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH 2/6] thermal: core: Move thermal_cdev_update next to updated=false Date: Sat, 11 Apr 2020 00:12:31 +0200 Message-Id: <20200410221236.6484-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200410221236.6484-1-daniel.lezcano@linaro.org> References: <20200410221236.6484-1-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The call to the thermal_cdev_update() function is done after browsing the thermal instances which sets the updated flag by browsing them again. Instead of doing this, let's move the call right after setting the cooling device 'updated' flag as it is done in the other governors. Signed-off-by: Daniel Lezcano --- drivers/thermal/gov_bang_bang.c | 10 +--------- drivers/thermal/step_wise.c | 10 +--------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c index 991a1c54296d..c292a69845bb 100644 --- a/drivers/thermal/gov_bang_bang.c +++ b/drivers/thermal/gov_bang_bang.c @@ -64,6 +64,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) mutex_lock(&instance->cdev->lock); instance->cdev->updated = false; /* cdev needs update */ mutex_unlock(&instance->cdev->lock); + thermal_cdev_update(instance->cdev); } mutex_unlock(&tz->lock); @@ -98,17 +99,8 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) */ static int bang_bang_control(struct thermal_zone_device *tz, int trip) { - struct thermal_instance *instance; - thermal_zone_trip_update(tz, trip); - mutex_lock(&tz->lock); - - list_for_each_entry(instance, &tz->thermal_instances, tz_node) - thermal_cdev_update(instance->cdev); - - mutex_unlock(&tz->lock); - return 0; } diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c index 2ae7198d3067..298eedac0293 100644 --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c @@ -167,6 +167,7 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) mutex_lock(&instance->cdev->lock); instance->cdev->updated = false; /* cdev needs update */ mutex_unlock(&instance->cdev->lock); + thermal_cdev_update(instance->cdev); } mutex_unlock(&tz->lock); @@ -185,20 +186,11 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) */ static int step_wise_throttle(struct thermal_zone_device *tz, int trip) { - struct thermal_instance *instance; - thermal_zone_trip_update(tz, trip); if (tz->forced_passive) thermal_zone_trip_update(tz, THERMAL_TRIPS_NONE); - mutex_lock(&tz->lock); - - list_for_each_entry(instance, &tz->thermal_instances, tz_node) - thermal_cdev_update(instance->cdev); - - mutex_unlock(&tz->lock); - return 0; } From patchwork Fri Apr 10 22:12:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11483709 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E60CA912 for ; Fri, 10 Apr 2020 22:13:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C06D62145D for ; Fri, 10 Apr 2020 22:13:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Rsi9w/sk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbgDJWNV (ORCPT ); Fri, 10 Apr 2020 18:13:21 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38963 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbgDJWNE (ORCPT ); Fri, 10 Apr 2020 18:13:04 -0400 Received: by mail-wr1-f66.google.com with SMTP id p10so3869185wrt.6 for ; Fri, 10 Apr 2020 15:13:02 -0700 (PDT) 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=oYYsLKLLTRoF1sH0wteLzvtUl/2XjHlGFpOY2S4yWW4=; b=Rsi9w/sk4jmAaC+/eaqQosQyO7xc/rlNe2w8DP14Mb35iZMk0NPn5AUNYPXiL+qnTG fp6+S3HvVmqxQg8I+E6ZOs+vCZ7t5q4T1AdQRwbl3kGdNFrCacfoE/FqiGQI44T4vk+A 1yyK/81c+w4rGhZD1uuv3lttWtbETp7bNvsO3dgFCW9/vqxsVI5VMQYVD+PNmX7gw5O1 bBS5WDSJolTL7rUdj3iAwqefAf/1Z1aFi1TAoiVQ+wp/5wsBg4R9RE0hRyJjKfeZ3XI4 myKJE9yUDQPpLL+sMBm3XzcV6DYod59vgU5N8dh5vLqvekAUXbTFUnzQjDnv8znyr5hZ 2MYw== 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=oYYsLKLLTRoF1sH0wteLzvtUl/2XjHlGFpOY2S4yWW4=; b=npgneODQPzJ5Fia5paOcR447bjMVI7yDoDEDIvL10aYkY7D8IH/l7YS27LFS3VwKvC dtE1ijm0PemMJVoNkkUesYgvWL5b8V/XG/vMFdL5KgeFqqi5bbuJaUw8kZISp6Y/VatL rf4M8/n4fclGT/aHqyXJF0OW0RHsG1VzbqiQAJH+9XSLhBdCkG+fIE26ahG0+ZuhX+Gs sbc5LxV0jmX7RU7xhpGnc9ckmbjKcXeFwlqivoea5Gn6rKm3IWV+S75rvkOjE0W0jJ2H GGIFjJte3a9TCApg5eaMRsu9adythS6GF6xiLRcQOamXG7J8v/7vmhgvkZJI1/FKCZfb BTvQ== X-Gm-Message-State: AGi0PuYIEVLINiDD4kxXOYtpWqHL4eqU0wEe0wtVZCBQxqa8LEOgr16x yAtt5J9gxRqPAQTnHtjTdMB/dCnEXKs= X-Google-Smtp-Source: APiQypIuUAg6+hYPzbRABsJ++pvXZycYR4rL7OJFhdsb0G2Nq1dWnooCyjxwkmSROe/UI15FwmTd0Q== X-Received: by 2002:adf:bc05:: with SMTP id s5mr6553216wrg.70.1586556782064; Fri, 10 Apr 2020 15:13:02 -0700 (PDT) Received: from localhost.localdomain (lns-bzn-59-82-252-135-148.adsl.proxad.net. [82.252.135.148]) by smtp.gmail.com with ESMTPSA id b14sm4687952wrw.83.2020.04.10.15.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 15:13:01 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amit.kucheria@verdurent.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH 3/6] thermal: core: Remove pointless 'updated' boolean Date: Sat, 11 Apr 2020 00:12:32 +0200 Message-Id: <20200410221236.6484-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200410221236.6484-1-daniel.lezcano@linaro.org> References: <20200410221236.6484-1-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The sequence to update the cooling state in the thermal instances is always: mutex_lock(&instance->cdev->lock); instance->cdev->updated = false; mutex_unlock(&instance->cdev->lock); thermal_cdev_update(instance->cdev); So each call to thermal_cdev_update() is prefixed by resetting the updated flag which turns on to be a pointless test in the function itself. Remove the flag. Signed-off-by: Daniel Lezcano --- drivers/thermal/fair_share.c | 3 --- drivers/thermal/gov_bang_bang.c | 3 --- drivers/thermal/power_allocator.c | 3 --- drivers/thermal/step_wise.c | 3 --- drivers/thermal/thermal_core.c | 4 ---- drivers/thermal/thermal_helpers.c | 6 ------ include/linux/thermal.h | 1 - 7 files changed, 23 deletions(-) diff --git a/drivers/thermal/fair_share.c b/drivers/thermal/fair_share.c index aaa07180ab48..718de1f96cb6 100644 --- a/drivers/thermal/fair_share.c +++ b/drivers/thermal/fair_share.c @@ -105,9 +105,6 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip) instance->target = get_target_state(tz, cdev, percentage, cur_trip_level); - mutex_lock(&instance->cdev->lock); - instance->cdev->updated = false; - mutex_unlock(&instance->cdev->lock); thermal_cdev_update(cdev); } return 0; diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c index c292a69845bb..d678a2a0c4d4 100644 --- a/drivers/thermal/gov_bang_bang.c +++ b/drivers/thermal/gov_bang_bang.c @@ -61,9 +61,6 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) dev_dbg(&instance->cdev->device, "target=%d\n", (int)instance->target); - mutex_lock(&instance->cdev->lock); - instance->cdev->updated = false; /* cdev needs update */ - mutex_unlock(&instance->cdev->lock); thermal_cdev_update(instance->cdev); } diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c index 44636475b2a3..f8e4219cf5de 100644 --- a/drivers/thermal/power_allocator.c +++ b/drivers/thermal/power_allocator.c @@ -530,9 +530,6 @@ static void allow_maximum_power(struct thermal_zone_device *tz) continue; instance->target = 0; - mutex_lock(&instance->cdev->lock); - instance->cdev->updated = false; - mutex_unlock(&instance->cdev->lock); thermal_cdev_update(instance->cdev); } mutex_unlock(&tz->lock); diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c index 298eedac0293..9ddff715f3dd 100644 --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c @@ -164,9 +164,6 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) update_passive_instance(tz, trip_type, -1); instance->initialized = true; - mutex_lock(&instance->cdev->lock); - instance->cdev->updated = false; /* cdev needs update */ - mutex_unlock(&instance->cdev->lock); thermal_cdev_update(instance->cdev); } diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index ccd2417cd42e..052f77b0b0ef 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -614,9 +614,6 @@ int power_actor_set_power(struct thermal_cooling_device *cdev, return ret; instance->target = state; - mutex_lock(&cdev->lock); - cdev->updated = false; - mutex_unlock(&cdev->lock); thermal_cdev_update(cdev); return 0; @@ -990,7 +987,6 @@ __thermal_cooling_device_register(struct device_node *np, INIT_LIST_HEAD(&cdev->thermal_instances); cdev->np = np; cdev->ops = ops; - cdev->updated = false; cdev->device.class = &thermal_class; cdev->devdata = devdata; thermal_cooling_device_setup_sysfs(cdev); diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index 59eaf2d0fdb3..85cae31301aa 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -180,11 +180,6 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) unsigned long target = 0; mutex_lock(&cdev->lock); - /* cooling device is updated*/ - if (cdev->updated) { - mutex_unlock(&cdev->lock); - return; - } /* Make sure cdev enters the deepest cooling state */ list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { @@ -199,7 +194,6 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) if (!cdev->ops->set_cur_state(cdev, target)) thermal_cooling_device_stats_update(cdev, target); - cdev->updated = true; mutex_unlock(&cdev->lock); trace_cdev_update(cdev, target); dev_dbg(&cdev->device, "set to state %lu\n", target); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 216185bb3014..08969f0be6a0 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -114,7 +114,6 @@ struct thermal_cooling_device { void *devdata; void *stats; const struct thermal_cooling_device_ops *ops; - bool updated; /* true if the cooling device does not need update */ struct mutex lock; /* protect thermal_instances list */ struct list_head thermal_instances; struct list_head node; From patchwork Fri Apr 10 22:12:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11483707 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4161E15AB for ; Fri, 10 Apr 2020 22:13:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22A252084D for ; Fri, 10 Apr 2020 22:13:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="N/MiSR6N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726780AbgDJWNT (ORCPT ); Fri, 10 Apr 2020 18:13:19 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38966 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726762AbgDJWNG (ORCPT ); Fri, 10 Apr 2020 18:13:06 -0400 Received: by mail-wr1-f67.google.com with SMTP id p10so3869213wrt.6 for ; Fri, 10 Apr 2020 15:13:04 -0700 (PDT) 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=7Mico83Ts6Z9TeO582WyGQ/zwaTm+b6l1oxUTdnb7r8=; b=N/MiSR6NAmnE1ZrkABq4zlrlK8ua6kZyZhYeAeV8XChVqFef8CbClWF+vRARHOEZws uoC+n58vC0vHwYL/PFmDYPIala8qQCtT4xtDLzyFO2fTWbbhoJzzixgZO/IUW1W964cM LrxQl8n1RMbilMAVUhU7nh4PsEbyOikPFu9yk4B3p4HwumyAIB/e6e7GflLnkcZrGBNJ 8Bb2xsyYntBXGkIX/pN7Jf3FMySqgwAAKfh/f5RBq/a97v/+zz1MSNLVuZdBeb/3uYUP ym1CDLh2gWhGJ3EOPXdnLLvX1mqbCdtR6mvHek4d6FFkF4NRVeOFSiphppYQcSly3tjs wBSA== 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=7Mico83Ts6Z9TeO582WyGQ/zwaTm+b6l1oxUTdnb7r8=; b=eXPnQpp+XOaqMltpx/iiSVWU5smKkw4hZlLpumw8jwd+3AiOgt1qIiwKplnNpvShDQ Vcu0FagUlb6V9Aue7u/HQ0qARQEKh7jGgO5sMyKXHGiQpzW2CyR73GpIDEWH1rub2D77 SEim4XLVLFLKk+KKly87L/jfqOjvlVIaiE+lADCFOSfsXTuSHyxLfrpOGt9f0QyUBgwo 3CAQ+M1aXXWaaCgwZCAWb8jJfWV0lsvpjOVXTsqXfb50PkZbiteixRTaiv12Ho6Bvus4 ypykeoy4i4dmaugj+Oor5UpBhhcD3SFGyN9YM1Q5N74O+lGUh9zBIezLtNFvjTW+3osY rhCw== X-Gm-Message-State: AGi0PuavenR4V0oGEDItRrcZAe5tkxCM8q/I8cvb3dVcudVqWX5yGtFc FtOO3+frBZxOS8Hg0nlHOsln4A== X-Google-Smtp-Source: APiQypJAsoxzI6Q0F859Mb3noemMFuNzQMvldjTr5RSJw1zMei5wjai3acaaYh68NVrRQ5pUPrZrsw== X-Received: by 2002:a5d:5688:: with SMTP id f8mr6518986wrv.245.1586556783449; Fri, 10 Apr 2020 15:13:03 -0700 (PDT) Received: from localhost.localdomain (lns-bzn-59-82-252-135-148.adsl.proxad.net. [82.252.135.148]) by smtp.gmail.com with ESMTPSA id b14sm4687952wrw.83.2020.04.10.15.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 15:13:02 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amit.kucheria@verdurent.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH 4/6] thermal: power_allocator: Remove useless test Date: Sat, 11 Apr 2020 00:12:33 +0200 Message-Id: <20200410221236.6484-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200410221236.6484-1-daniel.lezcano@linaro.org> References: <20200410221236.6484-1-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The function power_actor_set_power() does check if the specified cooling device is a power actor. Call the function and handle the return code like what do the other calls to power_actor_* functions. Signed-off-by: Daniel Lezcano --- drivers/thermal/power_allocator.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c index f8e4219cf5de..fd7c8de02250 100644 --- a/drivers/thermal/power_allocator.c +++ b/drivers/thermal/power_allocator.c @@ -427,11 +427,10 @@ static int allocate_power(struct thermal_zone_device *tz, if (instance->trip != trip_max_desired_temperature) continue; - if (!cdev_is_power_actor(instance->cdev)) + if (power_actor_set_power(instance->cdev, instance, + granted_power[i])) continue; - power_actor_set_power(instance->cdev, instance, - granted_power[i]); total_granted_power += granted_power[i]; i++; From patchwork Fri Apr 10 22:12:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11483705 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3686415AB for ; Fri, 10 Apr 2020 22:13:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 171002084D for ; Fri, 10 Apr 2020 22:13:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cwCobIiC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbgDJWNI (ORCPT ); Fri, 10 Apr 2020 18:13:08 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40927 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbgDJWNG (ORCPT ); Fri, 10 Apr 2020 18:13:06 -0400 Received: by mail-wr1-f67.google.com with SMTP id s8so3870953wrt.7 for ; Fri, 10 Apr 2020 15:13:05 -0700 (PDT) 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=llenZ0suLw6do3znZz93SYo8GX9BjIHqcVpMde2jjyQ=; b=cwCobIiCE2a2mjAnkofCunPBk+7umwjxVTgVuitn1olEYefEHvZ249OUkRHdAk7pwz ZcZEI4e7xACErBW0VB0jSW7/OBQQ7T9K3RnPiKvod8K6MCUdr6ioCleJoWt+3cQJpBeT tvOgAE9871nhq6h/UZMh95s3zj9QIQUbJMQTOHiEF0ea3zORrNTnnAIJplXgihfgvF2u cCSo9rK6uNPxp8ee70mp+z+/xfG08RNaL9Uy+C4IK5vvm8sK0onQGf01RyVb0hXVt9M5 Hfau4KzuDNebjzyEUoW2TBCTE9YSLzGncrleGn/Y9HreeXAuuQpQ79AD/QWnVoU6xM8C DQyA== 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=llenZ0suLw6do3znZz93SYo8GX9BjIHqcVpMde2jjyQ=; b=Z5qiY9KrtNzU2N7Pclszoremj+MjANILTMIngokKhKC2/G3jCnsmTydPPfQDIqJMaJ T+JHn0R0R3hlDVmd6pFMgNvHPhLRI/lSC9uioUU/hvYMzxRQWnbSis1fwy0O6QYvzKAN fo/haCusQHD3QpW2/TQ373dwWE2l5G4OMsSK+7ieaauCKDIk3hqlvyH4EtEU+dEDfk8C FjW+syUCxyxKkhdqBrBOjCjsSy2IH8W2+akVKwzvgbfGiqDsJi7zJamSwXPccT+R6CY+ Dygnol6PJw5z5eSV1Gtq7cKdWjA7jZzBLfMqLHJpPlOkYH2+xS8bGZebt/0x7EnOhXOQ CxMA== X-Gm-Message-State: AGi0PuY7BPWoYJ+DJHO59KttXCR5JkiaSRrd2yGJ9vvcGeBA61PUVJN6 r2WeLgpelpCelZRP2xQME7TJLBVddHI= X-Google-Smtp-Source: APiQypL56/ywMxjjn+QWFh16svA+TLTAIFUlP6upenDKZquE4BHfXKiHuGvX23Z7ZGxtydPxiOLMtQ== X-Received: by 2002:adf:9cc8:: with SMTP id h8mr6405064wre.167.1586556784930; Fri, 10 Apr 2020 15:13:04 -0700 (PDT) Received: from localhost.localdomain (lns-bzn-59-82-252-135-148.adsl.proxad.net. [82.252.135.148]) by smtp.gmail.com with ESMTPSA id b14sm4687952wrw.83.2020.04.10.15.13.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 15:13:04 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amit.kucheria@verdurent.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH 5/6] thermal: core: Move the call to thermal_cdev_udpate() to the power allocator Date: Sat, 11 Apr 2020 00:12:34 +0200 Message-Id: <20200410221236.6484-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200410221236.6484-1-daniel.lezcano@linaro.org> References: <20200410221236.6484-1-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org All the calls to the thermal_cdev_update() are in the governors except one in the power_actor_set_power(). Move the update right after the call to power_actor_set_power(), the function will be located in the IPA governor. Signed-off-by: Daniel Lezcano --- drivers/thermal/power_allocator.c | 2 ++ drivers/thermal/thermal_core.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c index fd7c8de02250..339442925dfe 100644 --- a/drivers/thermal/power_allocator.c +++ b/drivers/thermal/power_allocator.c @@ -433,6 +433,8 @@ static int allocate_power(struct thermal_zone_device *tz, total_granted_power += granted_power[i]; + thermal_cdev_update(instance->cdev); + i++; } diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 052f77b0b0ef..a6b8c0240656 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -614,7 +614,6 @@ int power_actor_set_power(struct thermal_cooling_device *cdev, return ret; instance->target = state; - thermal_cdev_update(cdev); return 0; } From patchwork Fri Apr 10 22:12:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11483703 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F9E51871 for ; Fri, 10 Apr 2020 22:13:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E660C2084D for ; Fri, 10 Apr 2020 22:13:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LnkOKzUc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbgDJWNL (ORCPT ); Fri, 10 Apr 2020 18:13:11 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36760 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726794AbgDJWNJ (ORCPT ); Fri, 10 Apr 2020 18:13:09 -0400 Received: by mail-wr1-f67.google.com with SMTP id u13so3393281wrp.3 for ; Fri, 10 Apr 2020 15:13:07 -0700 (PDT) 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=fxaTwkHtjzC50vJJAtVceJtgHQwtXeZqJh88iIfXOtk=; b=LnkOKzUc57woc+efoOdWiBC76HgkeeWvVHT8utSyv4y4uF/vGGV+76MatJbZaG5xOK 7eG3fFoeF6UJfxp6G9Qfme6y+811y2k3jXR8LqNuNtK+wroOdIE0vuGhIf87Qq1jd6b2 Yi+mP9KtwPMl5aTcmTDsDZPNHtJydfZv0f301L5YddAEhFVPf2URdVAFMzDcFHDU+POU sGcQEfxNlLSMGqyHvmuxmX+jUymb+n70labUzE2R/pXSYpEWVaDrcoBShqBwDsWR98f0 Hix3Ob7EkD9gwOHgxZQCdQwsY+iGkOcv8kAUI/vzRfi7XpHM1AL7yyfDQi4tXjg9hvup lV7g== 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=fxaTwkHtjzC50vJJAtVceJtgHQwtXeZqJh88iIfXOtk=; b=ozwwb0wGqPF4BrJaQgYf3P+mesPYHxfw5A7Kwj+Vv+1lS9XAPJD/OSv3BaGAPgP1J3 Khzw/nLU63jZgDRaMo7hNAl4GG+KXChdHKvCKwm6D09sj9IF7DG8Pqb4thARwAn14FT0 LQ7NJRMvQlLZcbFzuEl5vM+gQZm9xTK8XrvAhKt/UntCRttBWH17ez2VybQ6qXgm4QAY p9hAq8RSQwCrmdYBvf6PTKcvIkCB0QnP5SfYYMLNxgEtNs0ooICmGQfxaZLhaKcdaUFK G3nnrx382EtjaPEXGEK+MQiKMoACcGb46j5vwj6owVP0oUYI8bUr91xDjWm5fNhbEWV5 9/1w== X-Gm-Message-State: AGi0PuZYKS95KJSMaaA2DuAU2JnjbPnQ3OKcMQWOEh3XH/xbLK7hTq1z tFHdr7oFp5jf+QqJXw55BLeBhg== X-Google-Smtp-Source: APiQypL3k7Xms3q1e2VlI7EhK1FEiuXF36sTNcFUnL6N6T04029IelnALYNh/iFMvpS4NCovtiUgDg== X-Received: by 2002:adf:97ce:: with SMTP id t14mr4408871wrb.263.1586556786788; Fri, 10 Apr 2020 15:13:06 -0700 (PDT) Received: from localhost.localdomain (lns-bzn-59-82-252-135-148.adsl.proxad.net. [82.252.135.148]) by smtp.gmail.com with ESMTPSA id b14sm4687952wrw.83.2020.04.10.15.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2020 15:13:06 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rui.zhang@intel.com Cc: amit.kucheria@verdurent.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org (open list:THERMAL) Subject: [PATCH 6/6] thermal: core: Make thermal_cdev_update private Date: Sat, 11 Apr 2020 00:12:35 +0200 Message-Id: <20200410221236.6484-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200410221236.6484-1-daniel.lezcano@linaro.org> References: <20200410221236.6484-1-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Move the function thermal_cdev_update as an internal thermal function instead of leaking it around. Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal_core.h | 1 + include/linux/thermal.h | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index c95689586e19..4e271016b7a9 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -120,6 +120,7 @@ int thermal_build_list_of_policies(char *buf); /* Helpers */ void thermal_zone_set_trips(struct thermal_zone_device *tz); +void thermal_cdev_update(struct thermal_cooling_device *cdev); /* sysfs I/F */ int thermal_zone_create_device_groups(struct thermal_zone_device *, int); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 08969f0be6a0..faf7ad031e42 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -413,7 +413,6 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); int thermal_zone_get_slope(struct thermal_zone_device *tz); 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); #else static inline struct thermal_zone_device *thermal_zone_device_register( @@ -457,8 +456,6 @@ static inline int thermal_zone_get_offset( struct thermal_zone_device *tz) { return -ENODEV; } -static inline void thermal_cdev_update(struct thermal_cooling_device *cdev) -{ } static inline void thermal_notify_framework(struct thermal_zone_device *tz, int trip) { }