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]

 



Hello,

On Mon, Aug 13, 2012 at 08:04:03AM +0000, R, Durgadoss wrote:
> 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.

Cool! I'd also prefer to use the ->ops type of design, if possible.

> 
> Thank you,
> Durga
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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