public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Zhang Rui <rui.zhang@intel.com>
Cc: linux-acpi@vger.kernel.org, lenb@kernel.org
Subject: Re: [PATCH 0/8] [-mm] ACPI: add ACPI device sysfs interface
Date: Wed, 21 Mar 2007 16:11:44 -0300	[thread overview]
Message-ID: <20070321191144.GA21721@khazad-dum.debian.net> (raw)
In-Reply-To: <1174461421.8833.103.camel@localhost.localdomain>

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

      reply	other threads:[~2007-03-21 19:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070321191144.GA21721@khazad-dum.debian.net \
    --to=hmh@hmh.eng.br \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox