RE: [PATCH 10/13] Thermal: Remove throttling logic out of thermal_sys.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rui,

[cut.]
> > +static void notify_user_space(struct thermal_zone_device *tz, int trip)
> > +{
> > +	mutex_lock(&tz->lock);
> > +
> > +	kobject_uevent(&tz->device.kobj, KOBJ_CHANGE);
> > +
> > +	mutex_unlock(&tz->lock);
> > +}
> > +
> > +static void handle_non_critical_trips(struct thermal_zone_device *tz,
> > +			int trip, enum thermal_trip_type trip_type)
> > +{
> > +	int throttle_policy = THERMAL_STEP_WISE;
> > +
> > +	if (tz->tzp)
> > +		throttle_policy = tz->tzp->throttle_policy;
> > +
> > +	switch (throttle_policy) {
> > +	case THERMAL_FAIR_SHARE:
> > +		fair_share_throttle(tz, trip);
> > +		break;
> > +	case THERMAL_STEP_WISE:
> > +		step_wise_throttle(tz, trip);
> > +		break;
> > +	case THERMAL_USER_SPACE:
> > +		notify_user_space(tz, trip);
> > +		break;
> > +	}
> 
> this is a little different from what I thought.
> IMO, each policy should register its pointer to the thermal framework.
> and tz->tzp points to the pointer of the policy using.
> and then, in handle_non_critical_trips(), the code would be like this:
> if(tz->tzp)
> 	tz->tzp->throttle(tz, trip);
> 
> But this is also okay for now, because we have only one callback for
> each policy.

I completely agree with you here. When I was doing my initial development,
I found that some policies need two arguments/ some need three etc..
That’s why could not do a function pointer implementation.

Will try to fix it up in the next version of the patches.

Thank you,
Durga
��.n��������+%������w��{.n�����{�����ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux