diff mbox

[1/1] thermal: setup monitor only once after handling trips

Message ID 1448424468-18736-1-git-send-email-edubezval@gmail.com (mailing list archive)
State Superseded, archived
Delegated to: Eduardo Valentin
Headers show

Commit Message

Eduardo Valentin Nov. 25, 2015, 4:07 a.m. UTC
Instead of changing the monitoring setup every time after
handling each trip, this patch simplifies the monitoring
setup by moving the setup call to a place where all
trips have been treated already.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
---
 drivers/thermal/thermal_core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Chen Yu Nov. 25, 2015, 7:16 a.m. UTC | #1
SGksDQpPbiBUdWUsIDIwMTUtMTEtMjQgYXQgMjA6MDcgLTA4MDAsIEVkdWFyZG8gVmFsZW50aW4g
d3JvdGU6DQo+IEluc3RlYWQgb2YgY2hhbmdpbmcgdGhlIG1vbml0b3Jpbmcgc2V0dXAgZXZlcnkg
dGltZSBhZnRlcg0KPiBoYW5kbGluZyBlYWNoIHRyaXAsIHRoaXMgcGF0Y2ggc2ltcGxpZmllcyB0
aGUgbW9uaXRvcmluZw0KPiBzZXR1cCBieSBtb3ZpbmcgdGhlIHNldHVwIGNhbGwgdG8gYSBwbGFj
ZSB3aGVyZSBhbGwNCj4gdHJpcHMgaGF2ZSBiZWVuIHRyZWF0ZWQgYWxyZWFkeS4NCj4gDQo+IENj
OiBaaGFuZyBSdWkgPHJ1aS56aGFuZ0BpbnRlbC5jb20+DQo+IENjOiBsaW51eC1wbUB2Z2VyLmtl
cm5lbC5vcmcNCj4gQ2M6IGxpbnV4LWtlcm5lbEB2Z2VyLmtlcm5lbC5vcmcNCj4gU2lnbmVkLW9m
Zi1ieTogRWR1YXJkbyBWYWxlbnRpbiA8ZWR1YmV6dmFsQGdtYWlsLmNvbT4NCj4gLS0tDQo+ICBk
cml2ZXJzL3RoZXJtYWwvdGhlcm1h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GFuZGxlX3RoZXJtYWxfdHJpcCh0eiwgY291bnQpOw0KPiArDQo+ICsJLyoNCj4gKwkgKiBB
bHJpZ2h0LCB3ZSBoYW5kbGVkIHRoaXMgdHJpcCBzdWNjZXNzZnVsbHkuDQpzL3RoZXNlIHRyaXBz
ID8NCj4gKwkgKiBTbywgc3RhcnQgbW9uaXRvcmluZyBhZ2Fpbi4NCj4gKwkgKi8NCj4gKwltb25p
dG9yX3RoZXJtYWxfem9uZSh0eik7DQo+ICB9DQo+ICBFWFBPUlRfU1lNQk9MX0dQTCh0aGVybWFs
X3pvbmVfZGV2aWNlX3VwZGF0ZSk7DQo+ICANCkJUVywgdGhlcm1hbF9ub3RpZnlfZnJhbWV3b3Jr
IG1pZ2h0IG5lZWQgYmUgYWZmZWN0ZWQ/IA0KDQp0aGFua3MsDQpZdQ0K
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eduardo Valentin Nov. 30, 2015, 7:10 p.m. UTC | #2
On Wed, Nov 25, 2015 at 07:16:08AM +0000, Chen, Yu C wrote:
> Hi,
> On Tue, 2015-11-24 at 20:07 -0800, Eduardo Valentin wrote:
> > Instead of changing the monitoring setup every time after
> > handling each trip, this patch simplifies the monitoring
> > setup by moving the setup call to a place where all
> > trips have been treated already.
> > 
> > Cc: Zhang Rui <rui.zhang@intel.com>
> > Cc: linux-pm@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> > ---
> >  drivers/thermal/thermal_core.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> > index d9e525c..6debb54 100644
> > --- a/drivers/thermal/thermal_core.c
> > +++ b/drivers/thermal/thermal_core.c
> > @@ -457,11 +457,6 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
> >  		handle_critical_trips(tz, trip, type);
> >  	else
> >  		handle_non_critical_trips(tz, trip, type);
> > -	/*
> > -	 * Alright, we handled this trip successfully.
> > -	 * So, start monitoring again.
> > -	 */
> > -	monitor_thermal_zone(tz);
> >  }
> >  
> >  /**
> > @@ -547,6 +542,12 @@ void thermal_zone_device_update(struct thermal_zone_device *tz)
> >  
> >  	for (count = 0; count < tz->trips; count++)
> >  		handle_thermal_trip(tz, count);
> > +
> > +	/*
> > +	 * Alright, we handled this trip successfully.
> s/these trips ?

Yeah, I can amend this.

> > +	 * So, start monitoring again.
> > +	 */
> > +	monitor_thermal_zone(tz);
> >  }
> >  EXPORT_SYMBOL_GPL(thermal_zone_device_update);
> >  
> BTW, thermal_notify_framework might need be affected? 

Well, the original code does not call thermal_notify_framework. Calling
it would require a different patch. This one is just to simplify the
monitoring setup.

BR,

> 
> thanks,
> Yu
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d9e525c..6debb54 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -457,11 +457,6 @@  static void handle_thermal_trip(struct thermal_zone_device *tz, int trip)
 		handle_critical_trips(tz, trip, type);
 	else
 		handle_non_critical_trips(tz, trip, type);
-	/*
-	 * Alright, we handled this trip successfully.
-	 * So, start monitoring again.
-	 */
-	monitor_thermal_zone(tz);
 }
 
 /**
@@ -547,6 +542,12 @@  void thermal_zone_device_update(struct thermal_zone_device *tz)
 
 	for (count = 0; count < tz->trips; count++)
 		handle_thermal_trip(tz, count);
+
+	/*
+	 * Alright, we handled this trip successfully.
+	 * So, start monitoring again.
+	 */
+	monitor_thermal_zone(tz);
 }
 EXPORT_SYMBOL_GPL(thermal_zone_device_update);