[RESEND] [PATCH 1/2 v2] [OF] Add of_device_is_available function

Paul Mackerras paulus at samba.org
Mon Mar 24 22:39:18 EST 2008


Josh Boyer writes:

> This adds a function called of_device_is_available that checks the state
> of the status property of a device.  If the property is absent or set to
> either "okay" or "ok", it returns 1.  Otherwise it returns 0.

Well actually...

> +	if (statlen > 0) {
> +		if (!strncmp(status, "okay", 4) || !strncmp(status, "ok", 2))
> +			return 1;

The second test will succeed for anything that starts with "ok", so
the first test is redundant.  I suspect you want strcmp instead of
strncmp in both tests.

Paul.



More information about the Linuxppc-dev mailing list