public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] [-mm] ACPI: add ACPI device sysfs interface
@ 2007-03-20  9:21 Zhang Rui
  2007-03-20 15:31 ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2007-03-20  9:21 UTC (permalink / raw)
  To: linux-acpi; +Cc: lenb

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/8] [-mm] ACPI: add ACPI device sysfs interface
  2007-03-20  9:21 [PATCH 0/8] [-mm] ACPI: add ACPI device sysfs interface Zhang Rui
@ 2007-03-20 15:31 ` Henrique de Moraes Holschuh
  2007-03-21  7:17   ` Zhang Rui
  0 siblings, 1 reply; 4+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-03-20 15:31 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, lenb

On Tue, 20 Mar 2007, Zhang Rui wrote:
> 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;
}

-- 
  "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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/8] [-mm] ACPI: add ACPI device sysfs interface
  2007-03-20 15:31 ` Henrique de Moraes Holschuh
@ 2007-03-21  7:17   ` Zhang Rui
  2007-03-21 19:11     ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2007-03-21  7:17 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: linux-acpi, lenb

On Tue, 2007-03-20 at 12:31 -0300, Henrique de Moraes Holschuh wrote:
> On Tue, 20 Mar 2007, Zhang Rui wrote:
> > 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;
> }
> 
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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/8] [-mm] ACPI: add ACPI device sysfs interface
  2007-03-21  7:17   ` Zhang Rui
@ 2007-03-21 19:11     ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 4+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-03-21 19:11 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, lenb

On Wed, 21 Mar 2007, Zhang Rui wrote:
> On Tue, 2007-03-20 at 12:31 -0300, Henrique de Moraes Holschuh wrote:
> > On Tue, 20 Mar 2007, Zhang Rui wrote:
> > > 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;
> > }
> > 
> 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 :-)

-- 
  "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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-03-21 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-20  9:21 [PATCH 0/8] [-mm] ACPI: add ACPI device sysfs interface Zhang Rui
2007-03-20 15:31 ` Henrique de Moraes Holschuh
2007-03-21  7:17   ` Zhang Rui
2007-03-21 19:11     ` Henrique de Moraes Holschuh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox