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=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 63F3AC433E2 for ; Mon, 29 Jun 2020 21:46:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 433ED20656 for ; Mon, 29 Jun 2020 21:46:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=verdurent-com.20150623.gappssmtp.com header.i=@verdurent-com.20150623.gappssmtp.com header.b="UI0fGaRC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727840AbgF2Vqy (ORCPT ); Mon, 29 Jun 2020 17:46:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727798AbgF2Shp (ORCPT ); Mon, 29 Jun 2020 14:37:45 -0400 Received: from mail-vs1-xe43.google.com (mail-vs1-xe43.google.com [IPv6:2607:f8b0:4864:20::e43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B0E6C00F829 for ; Mon, 29 Jun 2020 05:46:51 -0700 (PDT) Received: by mail-vs1-xe43.google.com with SMTP id f24so9165813vsg.1 for ; Mon, 29 Jun 2020 05:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3mjyd6r9Z8NRgSnG+P9PSoNzsHa0OVoXa5dJDxRkCYk=; b=UI0fGaRCmq5A6fZ2aN3n8WBb3g7VvOCURSeOI/vJzfqMe8q0IkabtA9TAG27ldXDI4 z+qW6f7rvAAhml7TWg3s6TCc3UwBj8qbwNL/MoBsGqaL93xt/lMkkNwHR7FZDnRdUe26 IJTGZwp8wFrDid5i4wCANbEQxqmks/buB/LqOLygjOkSAS569gUFnJm1iu7wSqU6J4mi WaUPsQa5oFkBDxtSoUnrhRPFtXhTMn7YFowZMtA/btLIDP7fV053z75lagCKW3U3sf9y A8ESITsuDw5aZvkzmvkyodLVZ6crbpaei0phkK3XLxRzXsByhgG8E5nSjNXa6qVAk8Nh 57xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3mjyd6r9Z8NRgSnG+P9PSoNzsHa0OVoXa5dJDxRkCYk=; b=mqaJwZIoIZC1mTXDiXN7K5bdLuK3+SDW1v8k6EYkCcLqhdxLbZdCsDW7zSgsaMgkur FiPApuFb0yeIQC2tGHIAwMpJKt+QZmMYcaPYODcr6RAWMIaBzpEWD8pgwAZGZk9Jwecs 0WhdwEilFO2MHak3Y4+H9UCTg6FVE0Se3uipY4XSIfcI5qUJYQ1Z0MPLAEFQ5FVRtl52 zF2FbBj9vqd/1bDBuTfkrrkAA0WSlQr4DKbB/5whd79KP/T9HGtYER0UxBmkQp+1rT1L Uy3ONwiMQl2SdQF1SZNyhNvxuMOMJeOjtu2jA7A7HG8LhgLPVgJ47DDFUfVbgvbl2mfV kSFw== X-Gm-Message-State: AOAM5310SWTaWvmLubBQSZrHmAJdb7bNZnnmLD8Sv7ECeg8JYhUz++vR R+kKmt0n4SgoK2ycjVKQUttxm0qxLFLDcPiieEVa8g== X-Google-Smtp-Source: ABdhPJy1QcNgfU4ZI0hGPqS1qMQ8m9mfv0gvwG3ncZShGHd/Tn9b42wi7vNTUL7hBQwk2F/xnYQAVj7TYIYTHORozvE= X-Received: by 2002:a67:ea98:: with SMTP id f24mr10128329vso.159.1593434810843; Mon, 29 Jun 2020 05:46:50 -0700 (PDT) MIME-Version: 1.0 References: <20200629122925.21729-1-andrzej.p@collabora.com> <20200629122925.21729-10-andrzej.p@collabora.com> In-Reply-To: <20200629122925.21729-10-andrzej.p@collabora.com> From: Amit Kucheria Date: Mon, 29 Jun 2020 18:16:39 +0530 Message-ID: Subject: Re: [PATCH v7 09/11] thermal: core: Stop polling DISABLED thermal devices To: Andrzej Pietrasiewicz Cc: Linux PM list , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, platform-driver-x86@vger.kernel.org, lakml , linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, "Rafael J . Wysocki" , Len Brown , Vishal Kulkarni , "David S . Miller" , Jiri Pirko , Ido Schimmel , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , Peter Kaestle , Darren Hart , Andy Shevchenko , Sebastian Reichel , Miquel Raynal , Daniel Lezcano , Support Opensource , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Heiko Stuebner , Orson Zhai , Baolin Wang , Chunyan Zhang , Zhang Rui , Allison Randal , Enrico Weigelt , Gayatri Kammela , Thomas Gleixner , Bartlomiej Zolnierkiewicz , kernel@collabora.com Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Mon, Jun 29, 2020 at 6:00 PM Andrzej Pietrasiewicz wrote: > > Polling DISABLED devices is not desired, as all such "disabled" devices > are meant to be handled by userspace. This patch introduces and uses > should_stop_polling() to decide whether the device should be polled or not. > > Signed-off-by: Andrzej Pietrasiewicz > Reviewed-by: Bartlomiej Zolnierkiewicz Reviewed-by: Amit Kucheria > --- > drivers/thermal/thermal_core.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index 52d136780577..e613f5c07bad 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -301,13 +301,22 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, > cancel_delayed_work(&tz->poll_queue); > } > > +static inline bool should_stop_polling(struct thermal_zone_device *tz) > +{ > + return !thermal_zone_device_is_enabled(tz); > +} > + > static void monitor_thermal_zone(struct thermal_zone_device *tz) > { > + bool stop; > + > + stop = should_stop_polling(tz); > + > mutex_lock(&tz->lock); > > - if (tz->passive) > + if (!stop && tz->passive) > thermal_zone_device_set_polling(tz, tz->passive_delay); > - else if (tz->polling_delay) > + else if (!stop && tz->polling_delay) > thermal_zone_device_set_polling(tz, tz->polling_delay); > else > thermal_zone_device_set_polling(tz, 0); > @@ -517,6 +526,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, > { > int count; > > + if (should_stop_polling(tz)) > + return; > + > if (atomic_read(&in_suspend)) > return; > > -- > 2.17.1 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Amit Kucheria Subject: Re: [PATCH v7 09/11] thermal: core: Stop polling DISABLED thermal devices Date: Mon, 29 Jun 2020 18:16:39 +0530 Message-ID: References: <20200629122925.21729-1-andrzej.p@collabora.com> <20200629122925.21729-10-andrzej.p@collabora.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: <20200629122925.21729-10-andrzej.p@collabora.com> Sender: linux-renesas-soc-owner@vger.kernel.org To: Andrzej Pietrasiewicz Cc: Linux PM list , linux-acpi@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, platform-driver-x86@vger.kernel.org, lakml , linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, "Rafael J . Wysocki" , Len Brown , Vishal Kulkarni , "David S . Miller" , Jiri Pirko , Ido Schimmel , Johannes Berg , Emmanuel Grumbach , Luca Coelho , Intel Linux Wireless , Kalle Valo , Peter Kaestle , Darr List-Id: platform-driver-x86.vger.kernel.org On Mon, Jun 29, 2020 at 6:00 PM Andrzej Pietrasiewicz wrote: > > Polling DISABLED devices is not desired, as all such "disabled" devices > are meant to be handled by userspace. This patch introduces and uses > should_stop_polling() to decide whether the device should be polled or not. > > Signed-off-by: Andrzej Pietrasiewicz > Reviewed-by: Bartlomiej Zolnierkiewicz Reviewed-by: Amit Kucheria > --- > drivers/thermal/thermal_core.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index 52d136780577..e613f5c07bad 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -301,13 +301,22 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, > cancel_delayed_work(&tz->poll_queue); > } > > +static inline bool should_stop_polling(struct thermal_zone_device *tz) > +{ > + return !thermal_zone_device_is_enabled(tz); > +} > + > static void monitor_thermal_zone(struct thermal_zone_device *tz) > { > + bool stop; > + > + stop = should_stop_polling(tz); > + > mutex_lock(&tz->lock); > > - if (tz->passive) > + if (!stop && tz->passive) > thermal_zone_device_set_polling(tz, tz->passive_delay); > - else if (tz->polling_delay) > + else if (!stop && tz->polling_delay) > thermal_zone_device_set_polling(tz, tz->polling_delay); > else > thermal_zone_device_set_polling(tz, 0); > @@ -517,6 +526,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, > { > int count; > > + if (should_stop_polling(tz)) > + return; > + > if (atomic_read(&in_suspend)) > return; > > -- > 2.17.1 > 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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 84439C433E0 for ; Mon, 29 Jun 2020 12:48:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FF2C23D22 for ; Mon, 29 Jun 2020 12:48:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NwrWKMGC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=verdurent-com.20150623.gappssmtp.com header.i=@verdurent-com.20150623.gappssmtp.com header.b="UI0fGaRC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FF2C23D22 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=verdurent.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uocnnsRZseIK1iOWsxI54P8zuYW14Yt8mVg6BH8yUPs=; b=NwrWKMGCYKyDai4bGBaQMfCmt Nl9CXCsttQ/r6iCf7ZHd2wiBn6s+5LC0H2oefYAjcwUsEkF3RQ26GPt6YJRUREMCKua3wmnn/28Na 2BCNBMTnSu848ci7DtFhFmG8KciA1S8uyw5SWZBRx+amxfc+pYVE/V0BhoTc1glazH7CchtOtrc5E tn+/7A8Gxi4efOIMc+XvZrlH+wmTt2i9WJQNOxvbnNQhWHDIMeBVKzRa1HticBOrCN/amqVQ5eszh hCpYHvF7X3e2GqnL5THKkVbzkSxVF/yxTo/cT/7qkLcBnJe3KcCfL+kASaw0pyx8xpEnN/1TgYbFW fziDCtIYA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jptBY-0001TQ-LO; Mon, 29 Jun 2020 12:46:56 +0000 Received: from mail-vs1-xe41.google.com ([2607:f8b0:4864:20::e41]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jptBU-0001SD-Ce for linux-arm-kernel@lists.infradead.org; Mon, 29 Jun 2020 12:46:54 +0000 Received: by mail-vs1-xe41.google.com with SMTP id s20so1780305vsq.5 for ; Mon, 29 Jun 2020 05:46:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verdurent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3mjyd6r9Z8NRgSnG+P9PSoNzsHa0OVoXa5dJDxRkCYk=; b=UI0fGaRCmq5A6fZ2aN3n8WBb3g7VvOCURSeOI/vJzfqMe8q0IkabtA9TAG27ldXDI4 z+qW6f7rvAAhml7TWg3s6TCc3UwBj8qbwNL/MoBsGqaL93xt/lMkkNwHR7FZDnRdUe26 IJTGZwp8wFrDid5i4wCANbEQxqmks/buB/LqOLygjOkSAS569gUFnJm1iu7wSqU6J4mi WaUPsQa5oFkBDxtSoUnrhRPFtXhTMn7YFowZMtA/btLIDP7fV053z75lagCKW3U3sf9y A8ESITsuDw5aZvkzmvkyodLVZ6crbpaei0phkK3XLxRzXsByhgG8E5nSjNXa6qVAk8Nh 57xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3mjyd6r9Z8NRgSnG+P9PSoNzsHa0OVoXa5dJDxRkCYk=; b=Ig6xq35yQOh6M2mNoS9yo6KiLG8QYpy7b0XFHRtu5+DH8w7FXQccBIZ2AaQQOHZ2Mb rgQIoI9XGGH0VZmZz8pTNh/1PEG7JwMnboCstodryipCVetObRQJCYz47CMoZC4Bpo71 w6Rsyuv43X9uPMZBX5Bf85fyq6uo+G5HumE5k4C1XEXpPHbWaNgTQsAgJRT9ppFu6CDX PFIMG3nZxLMCxf7Op4BA0pFhf0D9XL4/Xy42uTuE0oJ+U7LKBZBUsTp6hkC0RIMSL/ii 5QAoGC8D+gfBKAV6+Nidwma03icsgz61yQIdysQrSwT4AB+co6/f5PvxPw/0yur+KOdz 1FXA== X-Gm-Message-State: AOAM531WJuuFhU3vW8FVyxavOrsyq1xJe5z6GbROZsgBYVCAP+mAdoDL iCrqJ8ZZVP9BIIUWzlWOIObDKRWcAvDnpZ6Bfca23w== X-Google-Smtp-Source: ABdhPJy1QcNgfU4ZI0hGPqS1qMQ8m9mfv0gvwG3ncZShGHd/Tn9b42wi7vNTUL7hBQwk2F/xnYQAVj7TYIYTHORozvE= X-Received: by 2002:a67:ea98:: with SMTP id f24mr10128329vso.159.1593434810843; Mon, 29 Jun 2020 05:46:50 -0700 (PDT) MIME-Version: 1.0 References: <20200629122925.21729-1-andrzej.p@collabora.com> <20200629122925.21729-10-andrzej.p@collabora.com> In-Reply-To: <20200629122925.21729-10-andrzej.p@collabora.com> From: Amit Kucheria Date: Mon, 29 Jun 2020 18:16:39 +0530 Message-ID: Subject: Re: [PATCH v7 09/11] thermal: core: Stop polling DISABLED thermal devices To: Andrzej Pietrasiewicz X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, Emmanuel Grumbach , Heiko Stuebner , Peter Kaestle , platform-driver-x86@vger.kernel.org, Vishal Kulkarni , Luca Coelho , Miquel Raynal , kernel@collabora.com, Fabio Estevam , linux-rockchip@lists.infradead.org, Chunyan Zhang , Intel Linux Wireless , Allison Randal , NXP Linux Team , linux-acpi@vger.kernel.org, lakml , Darren Hart , Zhang Rui , Gayatri Kammela , Len Brown , Johannes Berg , Linux PM list , Sascha Hauer , Ido Schimmel , Baolin Wang , Jiri Pirko , Orson Zhai , Thomas Gleixner , Kalle Valo , Support Opensource , Enrico Weigelt , Daniel Lezcano , netdev@vger.kernel.org, "Rafael J . Wysocki" , Sebastian Reichel , linux-renesas-soc@vger.kernel.org, Bartlomiej Zolnierkiewicz , Pengutronix Kernel Team , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Shawn Guo , "David S . Miller" , Andy Shevchenko Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 29, 2020 at 6:00 PM Andrzej Pietrasiewicz wrote: > > Polling DISABLED devices is not desired, as all such "disabled" devices > are meant to be handled by userspace. This patch introduces and uses > should_stop_polling() to decide whether the device should be polled or not. > > Signed-off-by: Andrzej Pietrasiewicz > Reviewed-by: Bartlomiej Zolnierkiewicz Reviewed-by: Amit Kucheria > --- > drivers/thermal/thermal_core.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index 52d136780577..e613f5c07bad 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -301,13 +301,22 @@ static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, > cancel_delayed_work(&tz->poll_queue); > } > > +static inline bool should_stop_polling(struct thermal_zone_device *tz) > +{ > + return !thermal_zone_device_is_enabled(tz); > +} > + > static void monitor_thermal_zone(struct thermal_zone_device *tz) > { > + bool stop; > + > + stop = should_stop_polling(tz); > + > mutex_lock(&tz->lock); > > - if (tz->passive) > + if (!stop && tz->passive) > thermal_zone_device_set_polling(tz, tz->passive_delay); > - else if (tz->polling_delay) > + else if (!stop && tz->polling_delay) > thermal_zone_device_set_polling(tz, tz->polling_delay); > else > thermal_zone_device_set_polling(tz, 0); > @@ -517,6 +526,9 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, > { > int count; > > + if (should_stop_polling(tz)) > + return; > + > if (atomic_read(&in_suspend)) > return; > > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel