From: Sylwester Nawrocki <snjw23@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] video: s3c-fb: Add device tree support
Date: Fri, 13 Jan 2012 21:03:00 +0000 [thread overview]
Message-ID: <4F109C04.5090600@gmail.com> (raw)
In-Reply-To: <1326139307-25112-1-git-send-email-thomas.abraham@linaro.org>
On 01/09/2012 09:01 PM, Thomas Abraham wrote:
>
> + for (idx = 0; idx< nr_gpios; idx++) {
> + gpio = of_get_gpio(dev->of_node, idx);
> + if (!gpio_is_valid(gpio)) {
> + dev_err(dev, "invalid gpio[%d]: %d\n", idx, gpio);
> + return -EINVAL;
> + }
> +
> + if (!request)
> + continue;
> +
> + ret = gpio_request(gpio, "fimd");
Is it how it normally is supposed to be done, i.e. configuring a gpio
_before_ it has been requested ? of_get_gpio() indirectly touches the
gpio controller and gpio_request() doesn't seem to serve its purpose
in this case, i.e. if there is situation like:
driver A driver B
of_get_gpio(nodeA, gpioA);
of_get_gpio(nodeB, gpioA);
gpio_request(gpioA);
gpio_request(gpioB);
driver B will end up with configuration of gpioA from nodeA, not from
nodeB.
As there are few drivers doing that I must be missing something,
not sure what..
I realize the GPIO number needs to be known in order for a GPIO to be
requested. Shouldn't of_get_gpio() be extended to allow locking gpio
controller's module and marking a GPIO as requested in advance ?
> + if (ret) {
> + dev_err(dev, "gpio [%d] request failed\n", gpio);
> + goto gpio_free;
> + }
> + sfb->gpios[idx] = gpio;
> + }
> + return 0;
> +
> +gpio_free:
> + while (--idx>= 0)
> + gpio_free(sfb->gpios[idx]);
> + return ret;
> +}
> +
> +static void s3c_fb_dt_free_gpios(struct s3c_fb *sfb)
> +{
> + unsigned int idx, nr_gpio;
> +
> + nr_gpio = sfb->pdata->win[0]->max_bpp + 4;
> + for (idx = 0; idx< nr_gpio; idx++)
> + gpio_free(sfb->gpios[idx]);
> +}
next prev parent reply other threads:[~2012-01-13 21:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-09 19:59 [PATCH] video: s3c-fb: Add device tree support Thomas Abraham
2012-01-10 4:52 ` Mark Brown
2012-01-11 11:16 ` Thomas Abraham
2012-01-11 17:40 ` Mark Brown
2012-01-11 9:16 ` Jingoo Han
2012-01-11 11:23 ` Thomas Abraham
2012-01-13 21:03 ` Sylwester Nawrocki [this message]
2012-01-13 21:30 ` Sylwester Nawrocki
2012-01-17 5:26 ` Thomas Abraham
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=4F109C04.5090600@gmail.com \
--to=snjw23@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).