mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Carlo Caione <carlo.caione@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/5] BCM2835: add gpio driver
Date: Tue, 16 Oct 2012 23:09:58 +0200	[thread overview]
Message-ID: <20121016210958.GB27665@pengutronix.de> (raw)
In-Reply-To: <1350410685-46202-3-git-send-email-carlo.caione@gmail.com>

Hi Carlo,

I had an additional look before applying it, but there are still
some things that deserve a cleanup.

On Tue, Oct 16, 2012 at 08:04:42PM +0200, Carlo Caione wrote:
> +#include <common.h>
> +#include <errno.h>
> +#include <malloc.h>
> +#include <io.h>
> +#include <gpio.h>
> +#include <init.h>
> +#include <mach/platform.h>

Is this needed? I think not as this file only defines some base
addresses.

> +static int bcm2835_gpio_probe(struct device_d *dev)
> +{
> +	struct bcm2835_gpio_chip *bcmgpio;
> +	int ret;
> +
> +	bcmgpio = xzalloc(sizeof(*bcmgpio));
> +	bcmgpio->base = dev_request_mem_region(dev, 0);
> +	bcmgpio->chip.ops = &bcm2835_gpio_ops;
> +	bcmgpio->chip.base = -1;

Better to use 0 for base of the SoC internal gpios (or something like
dev->id * 32) to get a known base for the gpios. Board code will likely
depend on fixed numbers.

> +
> +static __maybe_unused struct of_device_id bcm2835_gpio_dt_ids[] = {
> +	{
> +			.compatible = "brcm,bcm2835-gpio",

Too many whitespaces here.

Sascha

> +static int bcm2835_gpio_add(void)
> +{
> +	platform_driver_register(&bcm2835_gpio_driver);
> +	return 0;

return platform_device_register() please. We had a time when barebox
just paniced when an initcall failed, hence we never returned
unsuccesful. Now we just print an error message, so when the register
for some reason fails you will see it.

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:[~2012-10-16 21:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16 18:04 [PATCH 0/5] BCM2835/Raspberry-Pi support Carlo Caione
2012-10-16 18:04 ` [PATCH 1/5] BCM2835: add clocksource driver Carlo Caione
2012-10-16 18:04 ` [PATCH 2/5] BCM2835: add gpio driver Carlo Caione
2012-10-16 21:09   ` Sascha Hauer [this message]
2012-10-16 18:04 ` [PATCH 3/5] ARM1176: add support Carlo Caione
2012-10-16 18:04 ` [PATCH 4/5] BCM2835: add support (arch) Carlo Caione
2012-10-16 21:24   ` Sascha Hauer
2012-10-17  6:51     ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-17  7:01       ` Sascha Hauer
2012-10-17  7:25         ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-17  8:31           ` Carlo Caione
2012-10-17 21:00             ` Sascha Hauer
2012-10-17 22:27     ` Carlo Caione
2012-10-18  7:02       ` Sascha Hauer
2012-10-16 18:04 ` [PATCH 5/5] Raspberry-Pi: add support (board) Carlo Caione
  -- strict thread matches above, loose matches on Subject: below --
2012-10-18 19:42 [PATCH 0/5] BCM2835/Raspberry-Pi support Carlo Caione
2012-10-18 19:42 ` [PATCH 2/5] BCM2835: add gpio driver Carlo Caione
2012-10-13 14:00 [PATCH 0/5] BCM2835/Raspberry-Pi support Carlo Caione
2012-10-13 14:00 ` [PATCH 2/5] BCM2835: add gpio driver Carlo Caione
2012-10-13 11:22 [PATCH 0/5] BCM2835/Raspberry-Pi Carlo Caione
2012-10-13 11:22 ` [PATCH 2/5] BCM2835: add gpio driver Carlo Caione
2012-10-11 21:52 [PATCH 0/5] BCM2835/RPi support Carlo Caione
2012-10-11 21:52 ` [PATCH 2/5] BCM2835: add gpio driver Carlo Caione
2012-10-12  9:30   ` Jean-Christophe PLAGNIOL-VILLARD

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=20121016210958.GB27665@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=carlo.caione@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