Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp300773ybh; Wed, 15 Jul 2020 02:16:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsctdUqHgbCmprTbPSxXcscBoxv8wn/xdE+kaWTHn+rnBx4yW2qJfeu/oBIBpjg0TsCvgY X-Received: by 2002:a05:6402:cb3:: with SMTP id cn19mr8944499edb.368.1594804564038; Wed, 15 Jul 2020 02:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594804564; cv=none; d=google.com; s=arc-20160816; b=hqB68h++Svm618XeymAAptKVcdRW64ZSgSmoro5T3LAkGaLpa2HFmUjSvAQKhTSy5E 3x3BKARKWYjmyJ3goOcogNQIdw/OHRyyuTu/huadV+md3PaE8Dhgo0AdAbb0GeV3JXIq zVQFByTw1u9ihdUTNsKulVjoRTUd9BHzuQj0mUpUlXUJY9XuFrnvQpw9czcMxJ4QPS0f cWhSvzJdr8kyuavAyNGZ6bxv0FFeV0Bnh3m83ZLeiBpPj5TwGfAjDiMANrEyZrKYZD8j rUWLL7Wq6g51OssTGRCdbAp8YFUV/jN16W/vJ7TfcTBjXXmgNHSTyA5jhPKtGTF/igxH ohug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :ironport-sdr:ironport-sdr; bh=MwC2AdT9DG/qKnVCJqq5BvzN0B8m4QOL96a7AGPoD/s=; b=jE3NmR0uPwtoubTsG7tg2TjJn8VSSxwtDN2SbFTKD/wvmqw2IraBJJDLFn1ufEw9NH 6KTFiAWaJ9Nuxn0+wNOYxeeIuShgzRrcvcHTfdMEt8RGIQ1C7TX0ADCJUyiq39shjAHT D1ZiQ112XzQ+EJZo4PjHcDUP7IVLQoPa+K72TNDfOj4qPNMeV26UPa3MoQFXprUp9Xlc El0VJc8NsB7a3jx+AqQc11vjpbO8go/4Dv8niyHrqF1djXXSRtrMnaUzxvx2plubTIYt fC8kCsqhuOJdB0sQ4K7DRZKJptkU3kyaPrdFZD+DSdazi0n9Ymiwq5q21I+H9rJNvl5c 1VNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t24si942274eds.158.2020.07.15.02.15.41; Wed, 15 Jul 2020 02:16:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729629AbgGOIq5 (ORCPT + 99 others); Wed, 15 Jul 2020 04:46:57 -0400 Received: from mga11.intel.com ([192.55.52.93]:61786 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729377AbgGOIq4 (ORCPT ); Wed, 15 Jul 2020 04:46:56 -0400 IronPort-SDR: AVBd4w/lewG8wnDfAgIeB6mv+zgzyBqn7bjk41JbB9qb2ClgbQ0Vnh8G3dNZXONfW7HAGLrRwh QmrTP2vASdHA== X-IronPort-AV: E=McAfee;i="6000,8403,9682"; a="147113218" X-IronPort-AV: E=Sophos;i="5.75,354,1589266800"; d="scan'208";a="147113218" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2020 01:46:56 -0700 IronPort-SDR: DXexAs8H1P9V9yOFnm7lrcgiUiXuzWp57mJFBrWKsRwwIaSGj+DcHhlB7ITlgE7qWM2rj3LQsj K6bIgPBigxIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,354,1589266800"; d="scan'208";a="299819931" Received: from yren3-mobl.ccr.corp.intel.com ([10.249.174.224]) by orsmga002.jf.intel.com with ESMTP; 15 Jul 2020 01:46:54 -0700 Message-ID: <746420e6b213985518d8b314018e32dc3438e9af.camel@intel.com> Subject: Re: [RFC PATCH 3/4] thermal:core:Add genetlink notifications for monitoring falling temperature From: Zhang Rui To: Thara Gopinath , daniel.lezcano@linaro.org, robh+dt@kernel.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 15 Jul 2020 16:46:53 +0800 In-Reply-To: <20200710135154.181454-4-thara.gopinath@linaro.org> References: <20200710135154.181454-1-thara.gopinath@linaro.org> <20200710135154.181454-4-thara.gopinath@linaro.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-07-10 at 09:51 -0400, Thara Gopinath wrote: > Add notification calls for trip type THERMAL_TRIP_COLD when > temperature > crosses the trip point in either direction. > > Signed-off-by: Thara Gopinath > --- > drivers/thermal/thermal_core.c | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/drivers/thermal/thermal_core.c > b/drivers/thermal/thermal_core.c > index 750a89f0c20a..e2302ca1cd3b 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -429,12 +429,21 @@ static void handle_thermal_trip(struct > thermal_zone_device *tz, int trip) > tz->ops->get_trip_hyst(tz, trip, &hyst); > > if (tz->last_temperature != THERMAL_TEMP_INVALID) { > - if (tz->last_temperature < trip_temp && > - tz->temperature >= trip_temp) > - thermal_notify_tz_trip_up(tz->id, trip); > - if (tz->last_temperature >= trip_temp && > - tz->temperature < (trip_temp - hyst)) > - thermal_notify_tz_trip_down(tz->id, trip); > + if (type == THERMAL_TRIP_COLD) { > + if (tz->last_temperature > trip_temp && > + tz->temperature <= trip_temp) > + thermal_notify_tz_trip_down(tz->id, > trip); trip_type should also be part of the event because trip_down/trip_up for hot trip and cold trip have different meanings. Or can we use some more generic names like trip_on/trip_off? trip_on means the trip point is violated or actions need to be taken for the specific trip points, for both hot and cold trips. I know trip_on/trip_off doesn't represent what I mean clearly, but surely you can find a better name. thanks, rui > + if (tz->last_temperature <= trip_temp && > + tz->temperature > (trip_temp + hyst)) > + thermal_notify_tz_trip_up(tz->id, > trip); > + } else { > + if (tz->last_temperature < trip_temp && > + tz->temperature >= trip_temp) > + thermal_notify_tz_trip_up(tz->id, > trip); > + if (tz->last_temperature >= trip_temp && > + tz->temperature < (trip_temp - hyst)) > + thermal_notify_tz_trip_down(tz->id, > trip); > + } > } > > if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT)