From mboxrd@z Thu Jan 1 00:00:00 1970 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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no 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 63F80C2BA2B for ; Thu, 9 Apr 2020 11:10:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 45FC620B1F for ; Thu, 9 Apr 2020 11:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725987AbgDILKN (ORCPT ); Thu, 9 Apr 2020 07:10:13 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:36506 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbgDILKM (ORCPT ); Thu, 9 Apr 2020 07:10:12 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id 81A6D2979A5 Subject: Re: [RFC 0/8] Stop monitoring disabled devices To: Daniel Lezcano , linux-pm@vger.kernel.org Cc: Zhang Rui , "Rafael J . Wysocki" , Len Brown , Jiri Pirko , Ido Schimmel , "David S . Miller" , Peter Kaestle , Darren Hart , Andy Shevchenko , Support Opensource , Amit Kucheria , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Allison Randal , Enrico Weigelt , Gayatri Kammela , Thomas Gleixner , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com References: <20200407174926.23971-1-andrzej.p@collabora.com> <2bc5a902-acde-526a-11a5-2357d899916c@linaro.org> From: Andrzej Pietrasiewicz Message-ID: Date: Thu, 9 Apr 2020 13:10:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <2bc5a902-acde-526a-11a5-2357d899916c@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hi Daniel, W dniu 09.04.2020 o 12:29, Daniel Lezcano pisze: > On 07/04/2020 19:49, Andrzej Pietrasiewicz wrote: >> The current kernel behavior is to keep polling the thermal zone devices >> regardless of their current mode. This is not desired, as all such "disabled" >> devices are meant to be handled by userspace,> so polling them makes no sense. > > Thanks for proposing these changes. > > I've been (quickly) through the series and the description below. I have > the feeling the series makes more complex while the current code which > would deserve a cleanup. > > Why not first: > > - Add a 'mode' field in the thermal zone device > - Kill all set/get_mode callbacks in the drivers which are duplicated code. > - Add a function: > > enum thermal_device_mode thermal_zone_get_mode( *tz) > { > ... > if (tz->ops->get_mode) > return tz->ops->get_mode(); > > return tz->mode; > } > > > int thermal_zone_set_mode(..*tz, enum thermal_device_mode mode) > { > ... > if (tz->ops->set_mode) > return tz->ops->set_mode(tz, mode); > > tz->mode = mode; > > return 0; > } > > static inline thermal_zone_enable(... *tz) > { > thermal_zone_set_mode(tz, THERMAL_DEVICE_ENABLED); > } > > static inline thermal_zone_disable(... *tz) { > thermal_zone_set_mode(tz, THERMAL_DEVICE_DISABLED); > } > > And then when the code is consolidated, use the mode to enable/disable > the polling and continue killing the duplicated code in of-thermal.c and > anywhere else. > > Thanks for feedback. Anyone else? Andrzej