Thread (21 messages) 21 messages, 4 authors, 2010-09-10

Re: [PATCH v2] powerpc/mpc8xxx_gpio.c: extend the driver to support mpc512x gpios

From: Anton Vorontsov <hidden>
Date: 2010-08-08 07:40:41

On Sat, Aug 07, 2010 at 06:40:22PM -0600, Grant Likely wrote:
[...]
quoted
static int __init mpc8xxx_add_gpiochips(void)
{
+	const struct of_device_id *id;
	struct device_node *np;

-	for_each_compatible_node(np, NULL, "fsl,mpc8349-gpio")
-		mpc8xxx_add_controller(np);
-
-	for_each_compatible_node(np, NULL, "fsl,mpc8572-gpio")
-		mpc8xxx_add_controller(np);
-
-	for_each_compatible_node(np, NULL, "fsl,mpc8610-gpio")
+	for_each_matching_node(np, mpc8xxx_gpio_ids) {
+		id = of_match_node(mpc8xxx_gpio_ids, np);
+		if (id)
+			np->data = id->data;
		mpc8xxx_add_controller(np);
+	}
[...]
Actually, there is absolutely no reason to keep mpc8xxx_add_gpiochip()
as a separate function with the simplification of
mpc8xxx_add_gpiochips().  I'd simplify the whole thing by merging the
two functions together.
You mean mpc8xxx_add_controller()? Putting 65-line function
on a second indentation level, inside the for loop... sounds
like a bad idea.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help