RE: [PATCHv2 06/14] Thermal: Add a policy sysfs attribute

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

 



> > +static ssize_t
> > +policy_show(struct device *dev, struct device_attribute *devattr, char
> > +*buf) {
> > +	struct thermal_zone_device *tz = to_thermal_zone(dev);
> > +	struct thermal_zone_params *tzp = tz->tzp;
> > +
> > +	if (!tzp)
> > +		return sprintf(buf, "step_wise(default)\n");
> > +
> > +	switch (tzp->throttle_policy) {
> > +	case THERMAL_FAIR_SHARE:
> > +		return sprintf(buf, "fair_share\n");
> > +	case THERMAL_STEP_WISE:
> > +		return sprintf(buf, "step_wise\n");
> > +	case THERMAL_USER_SPACE:
> > +		return sprintf(buf, "user_space\n");
> > +	default:
> > +		return sprintf(buf, "unknown\n");
> > +	}
> > +}
> > +
> >  static DEVICE_ATTR(type, 0444, type_show, NULL);  static
> > DEVICE_ATTR(temp, 0444, temp_show, NULL);  static DEVICE_ATTR(mode,
> > 0644, mode_show, mode_store);  static DEVICE_ATTR(passive, S_IRUGO |
> > S_IWUSR, passive_show, passive_store);
> > +static DEVICE_ATTR(throttle_policy, S_IRUGO, policy_show, NULL);
> >
> >  /* sys I/F for cooling device */
> >  #define to_cooling_device(_dev)	\
> > @@ -1349,10 +1371,16 @@ static int retrieve_zone_params(struct
> > thermal_zone_device *tz)
> >
> >  	/* It is not an error to not have any platform data */
> >  	ret = get_platform_thermal_params(tz);
> > -	if (ret)
> > +	if (ret) {
> >  		tz->tzp = NULL;
> > +		return 0;
> > +	}
> >
> > -	return 0;
> > +	ret = device_create_file(&tz->device, &dev_attr_throttle_policy);
> > +	if (ret)
> > +		dev_err(&tz->device, "creating policy attr failed:%d\n",
> > ret);
> > +
> > +	return ret;
> >  }
> >
> >  /**
> 
> We should remove this attribute in thermal_zone_device_unregister();

Oh yes, missed it :-(
Will fix in v3..

Thanks for the catch,
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