[PATCH/RFC] CPM1: implement GPIO API

Scott Wood scottwood at freescale.com
Fri Dec 14 03:55:30 EST 2007


On Wed, Dec 12, 2007 at 05:42:06PM +0100, Jochen Friedrich wrote:
> +int cpm_init_par_io(void)
> +{
> +	int ret;
> +	struct device_node *np;
> +	const u32 *num_ports;
> +	int i;
> +
> +	np = of_find_node_by_name(NULL, "par_io");
> +	if (!np) {
> +		ret = -ENOENT;
> +		goto err0;
> +	}

Shouldn't this lookup be by compatible (something like fsl,cpm1-gpio would
be good)?

> +int gpio_request(unsigned int gpio, const char *label)
> +{
> +	if (!cpm1_port_locks)
> +		return -ENODEV;
> +
> +	if (gpio / 32 > cpm1_num_ports)
> +		return -EINVAL;

Shouldn't this be ">="?

> +	return 0;

No already-requested check?

> +}
> +EXPORT_SYMBOL_GPL(gpio_request);

This is an API, not internals; can we stick with plain EXPORT_SYMBOL()?

-Scott



More information about the Linuxppc-dev mailing list