ACPI: add ACPI device sysfs interface
cover ACPI: add ACPI device sysfs interface
Add sysfs interface for ACPI devices.
This patch set adds sysfs interface for ACPI EC, Fan, Power_resource, Processor and Thermal_zone devices.
Patch 01 add some helper macros and functions.
Patch 02/03/04 add sysfs interface for ACPI EC, Fan and Power_resource devices.
Patch 05/06/07 are for ACPI Porcessor (core/throttling/thermal). Sysfs interfaces for ACPI Processor Power/Performance state control are already available via cpu_freq and cpu_idle driver.
Sysfs interface for ACPI thermal_zone device is added in Patch 08.
More details are offered in each patch.
Any comments are appreciated. :)
Thanks,
Rui.
Quoted 1 line · Zhang Rui
Add sysfs interface for ACPI devices.
While doing the ibm-acpi sysfs work (not submitted yet), I have found I need something like this to properly parse simple ulongs from sysfs:
static int parse_strtoul(const char *buf,
unsigned long max, unsigned long *value)
{
char *endp;
*value = simple_strtoul(buf, &endp, 0);
while (*endp && isspace(*endp))
endp++;
if (*endp || *value > max)
return -EINVAL;
return 0;
}Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
Quoted 8 lines · Henrique de Moraes Holschuh
Quoted 1 line · Zhang Rui
Add sysfs interface for ACPI devices.
While doing the ibm-acpi sysfs work (not submitted yet), I have found I need something like this to properly parse simple ulongs from sysfs:
static int parse_strtoul(const char *buf,
unsigned long max, unsigned long *value)
Quoted 12 lines
{
char *endp;
*value = simple_strtoul(buf, &endp, 0);
while (*endp && isspace(*endp))
endp++;
if (*endp || *value > max)
return -EINVAL;
return 0;
}Sounds nice.
But I think it can work better without the parameter "max". Not all of the .store functions have "max" limit, e.g. the thermal polling_freq, while some of them may need "max" and "min" limit both, like fan state (0/3).
So why not just get the value and let the .store function judge it? :)
Thanks,
Rui.
Quoted 18 lines · Zhang Rui
Quoted 17 lines · Henrique de Moraes Holschuh
Quoted 1 line · Zhang Rui
Add sysfs interface for ACPI devices.
While doing the ibm-acpi sysfs work (not submitted yet), I have found I need something like this to properly parse simple ulongs from sysfs:
static int parse_strtoul(const char *buf,
unsigned long max, unsigned long *value){ char *endp; *value = simple_strtoul(buf, &endp, 0); while (*endp && isspace(*endp)) endp++; if (*endp || *value > max) return -EINVAL;
Quoted 5 lines
Quoted 3 lines
return 0; }Sounds nice.
But I think it can work better without the parameter "max".
Well, it is a generic parser for unsigned longs as I needed them in ibm-acpi, where the minimum value is always zero, and there is always a maximum value. If you don't need "max", just remove it :-)
Signature · 4 lines
"One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh