[PATCH v3 2/3] pinctrl: at91: add pinctrl driver

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 2 23:56:49 PDT 2014


On Tue, Sep 02, 2014 at 01:07:59PM +0200, Raphaël Poggi wrote:
> +static int at91_gpio_probe(struct device_d *dev)
> +{
> +	struct at91_gpio_chip *at91_gpio;
> +	struct clk *clk;
> +	int ret;
> +	int alias_idx = of_alias_get_id(dev->device_node, "gpio");
> +
> +	BUG_ON(dev->id > MAX_GPIO_BANKS);
> +
> +	at91_gpio = &gpio_chip[alias_idx];
> +
> +	clk = clk_get(dev, NULL);
> +	if (IS_ERR(clk)) {
> +		ret = PTR_ERR(clk);
> +		dev_err(dev, "clock not found: %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = clk_enable(clk);
> +	if (ret < 0) {
> +		dev_err(dev, "clock failed to enable: %d\n", ret);
> +		clk_put(clk);
> +		return ret;
> +	}
> +
> +	gpio_banks = max(gpio_banks, alias_idx + 1);
> +	at91_gpio->regbase = dev_request_mem_region(dev, 0);

Please check the return value.

This driver duplicates the existing Atmel GPIO driver. Shouldn't the
existing driver be dropped? If yes, you should also make sure that this
driver is compiled unconditionally on Atmel SoCs and add a

	if (!IS_ENABLED(CONFIG_PINCTRL))
		return 0;

to at91_pinctrl_init() to reduce the overhead when pinctrl is disabled.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list