Re: [PATCH] of: Create function for counting number of phandles ina property

From: Andreas Larsson
Date: Tue Feb 12 2013 - 04:18:40 EST


On 2013-02-11 00:58, Grant Likely wrote:
This patch creates of_count_phandle_with_args(), a new function for
counting the number of phandle+argument tuples in a given property. This
is better than the existing method of parsing each phandle individually
until parsing fails which is a horribly slow way to do the count.

It also converts of_gpio_named_count() to use the new function instead
of using the above described horrible method.

This also requires the return value of of_gpio_count() &
of_gpio_named_count() from 'unsigned int' to 'int' so that it can return
an error code. All the users of that function are fixed up to correctly
handle a negative return value.

One more thing: In of_spi_register_master() in drivers/spi.c the error code is put in the unsigned variable nb, leading to a huge nb and master->num_chipselect with following problems when of_gpio_named_count returns an error code.

Cheers,
Andreas Larsson

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/