mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Raphaël Poggi" <poggi.raph@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v3 2/3] pinctrl: at91: add pinctrl driver
Date: Wed, 3 Sep 2014 08:56:49 +0200	[thread overview]
Message-ID: <20140903065649.GD5352@pengutronix.de> (raw)
In-Reply-To: <1409656080-19280-3-git-send-email-poggi.raph@gmail.com>

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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-09-03  6:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 11:07 [PATCH v3 0/3] Add atmel " Raphaël Poggi
2014-09-02 11:07 ` [PATCH v3 1/3] arm: mach-at91: move gpio.h to include folder Raphaël Poggi
2014-09-03  7:00   ` Sascha Hauer
2014-09-02 11:07 ` [PATCH v3 2/3] pinctrl: at91: add pinctrl driver Raphaël Poggi
2014-09-03  6:56   ` Sascha Hauer [this message]
2014-09-03 11:23     ` Raphaël Poggi
2014-09-03 13:52       ` Sascha Hauer
2014-09-03 15:10         ` Raphaël Poggi
2014-09-04  9:26           ` Sascha Hauer
2014-09-04  9:41             ` Raphaël Poggi
2014-09-02 11:08 ` [PATCH v3 3/3] at91sam9g45: add device tree gpio clocks Raphaël Poggi
2014-09-03  6:46   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140903065649.GD5352@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=poggi.raph@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox