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.
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html