public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] dm: rpi: Convert GPIO driver to driver model
Date: Tue, 30 Sep 2014 19:40:12 -0600	[thread overview]
Message-ID: <542B5B7C.8040004@wwwdotorg.org> (raw)
In-Reply-To: <1411428659-6823-2-git-send-email-sjg@chromium.org>

On 09/22/2014 05:30 PM, Simon Glass wrote:
> Convert the BCM2835 GPIO driver to use driver model, and switch over
> Raspberry Pi to use this, since it is the only board.

> diff --git a/drivers/gpio/bcm2835_gpio.c b/drivers/gpio/bcm2835_gpio.c

> +static inline bool gpio_is_requested(struct bcm2835_gpios *gpios, int offset)
>  {
> +	return *gpios->label[offset] != '\0';
>  }
>  
> +static int check_requested(struct udevice *dev, unsigned offset,
> +			   const char *func)
>  {
> +	struct bcm2835_gpios *gpios = dev_get_priv(dev);
> +	struct gpio_dev_priv *uc_priv = dev->uclass_priv;
> +
> +	if (!gpio_is_requested(gpios, offset)) {
> +		printf("omap_gpio: %s: error: gpio %s%d not requested\n",
> +		       func, uc_priv->bank_name, offset);
> +		return -EPERM;
> +	}
> +
> +	return 0;
>  }

It seems like the core GPIO layer should be doing the high-level
management of GPIO requesting, so each driver doesn't have to duplicate
the code?

  reply	other threads:[~2014-10-01  1:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-22 23:30 [U-Boot] [PATCH 0/4] dm: rpi: Move Raspberry Pi to use driver model Simon Glass
2014-09-22 23:30 ` [U-Boot] [PATCH 1/4] dm: rpi: Convert GPIO driver to " Simon Glass
2014-10-01  1:40   ` Stephen Warren [this message]
2014-10-01  2:15     ` Simon Glass
2014-10-23  3:07   ` Simon Glass
2014-09-22 23:30 ` [U-Boot] [PATCH 2/4] dm: serial: Tidy up the pl01x driver Simon Glass
2014-10-23  3:07   ` Simon Glass
2015-04-21 11:56   ` Linus Walleij
2015-04-21 12:00     ` Linus Walleij
2014-09-22 23:30 ` [U-Boot] [PATCH 3/4] dm: serial: Support driver model in " Simon Glass
2014-10-23  3:07   ` Simon Glass
2014-09-22 23:30 ` [U-Boot] [PATCH 4/4] dm: rpi: Move serial to driver model Simon Glass
2014-10-01  1:41 ` [U-Boot] [PATCH 0/4] dm: rpi: Move Raspberry Pi to use " Stephen Warren
2014-10-01  2:17   ` Simon Glass
2014-10-18  2:51   ` Stephen Warren
2014-10-20  3:14     ` Simon Glass
2014-10-21  2:23       ` Stephen Warren
2014-10-22  2:04         ` Simon Glass
2014-10-23  3:21           ` Simon Glass
2014-10-26  3:22           ` Stephen Warren
2014-10-26  3:43           ` Stephen Warren
2014-10-26  3:47             ` Simon Glass
2014-10-26  5:08               ` Stephen Warren
2014-10-26  5:10                 ` Simon Glass
2014-11-24 18:38                   ` Simon Glass

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=542B5B7C.8040004@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /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