From: Sascha Hauer <s.hauer@pengutronix.de>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 7/9] OF: remove device and resource pointer from struct device_node
Date: Sat, 29 Jun 2013 18:09:57 +0200 [thread overview]
Message-ID: <20130629160957.GR516@pengutronix.de> (raw)
In-Reply-To: <51CF0560.2050902@gmail.com>
On Sat, Jun 29, 2013 at 06:03:44PM +0200, Sebastian Hesselbarth wrote:
> On 06/29/2013 04:31 PM, Sascha Hauer wrote:
> >On Sat, Jun 29, 2013 at 04:28:57PM +0200, Sascha Hauer wrote:
> >>On Tue, Jun 25, 2013 at 11:20:45AM +0200, Sebastian Hesselbarth wrote:
> >>>diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c
> >>>index 41e91ec..7f6d99c 100644
> >>>--- a/drivers/of/gpio.c
> >>>+++ b/drivers/of/gpio.c
> >>>@@ -10,6 +10,10 @@ int of_get_named_gpio(struct device_node *np,
> >>> {
> >>> int ret;
> >>> struct of_phandle_args out_args;
> >>>+ struct device_d *dev = of_find_device_by_node(np);
> >>>+
> >>>+ if (!dev)
> >>>+ return -EINVAL;
> >>>
> >>> ret = of_parse_phandle_with_args(np, propname, "#gpio-cells",
> >>> index,&out_args);
> >>>@@ -18,7 +22,7 @@ int of_get_named_gpio(struct device_node *np,
> >>> return -EINVAL;
> >>> }
> >>>
> >>>- ret = gpio_get_num(out_args.np->device, out_args.args[0]);
> >>>+ ret = gpio_get_num(dev, out_args.args[0]);
> >>
> >>This doesn't work. What gpio_get_num needs is the device pointer from
> >>the gpio device, not from the device from the node we pass to this
> >>function. You would have to use of_find_device_by_node(out_args.np) here
> >>I guess.
> >
> >Apart from this of_find_device_by_node() only works on platform_devices,
> >so this will break calling of_get_named_gpio on i2c gpio expanders.
>
> Ok, to work on this I would have to have something to test with. MVEBU
> DT is still at a very early stage. So for now, I guess removing the
> device pointer is a bit early?
Probably, yes. I think the solution would be to adjust gpio_get_num() so
that it takes a device_node as argument instead of a device.
> I will also have to have a close look
> into i2c core what makes those devices special here.
I may be wrong here. In the kernel of_find_device_by_node() works only
for platform_devices, but since you do for_each_device(), it should work
for i2c devices in barebox aswell.
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
next prev parent reply other threads:[~2013-06-29 16:10 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 9:20 [PATCH 0/9] OF: address and device related sync and cleanup Sebastian Hesselbarth
2013-06-25 9:20 ` [PATCH 1/9] OF: import address related functions from Linux OF API Sebastian Hesselbarth
2013-06-25 9:20 ` [PATCH 2/9] OF: convert of_translate_address to new API Sebastian Hesselbarth
2013-06-25 9:20 ` [PATCH 3/9] OF: base: move OF_ROOT_NODE_ defines to local OF code Sebastian Hesselbarth
2013-06-25 9:20 ` [PATCH 4/9] OF: import bus/device related functions from Linux OF API Sebastian Hesselbarth
2013-06-25 12:55 ` Sebastian Hesselbarth
2013-06-26 6:11 ` Sascha Hauer
2013-06-26 8:23 ` Sebastian Hesselbarth
2013-06-26 8:43 ` [PATCH v2 " Sebastian Hesselbarth
2013-06-25 9:20 ` [PATCH 5/9] OF: base: use of_platform_populate for probing Sebastian Hesselbarth
2013-06-29 14:22 ` Sascha Hauer
2013-06-25 9:20 ` [PATCH 6/9] OF: base: remove dead device related functions Sebastian Hesselbarth
2013-06-25 9:20 ` [PATCH 7/9] OF: remove device and resource pointer from struct device_node Sebastian Hesselbarth
2013-06-29 14:28 ` Sascha Hauer
2013-06-29 14:31 ` Sascha Hauer
2013-06-29 16:03 ` Sebastian Hesselbarth
2013-06-29 16:09 ` Sascha Hauer [this message]
2013-06-25 9:20 ` [PATCH 8/9] OF: base: convert of_add_memory to OF API Sebastian Hesselbarth
2013-06-25 19:48 ` Sascha Hauer
2013-06-25 19:57 ` Sebastian Hesselbarth
2013-06-25 21:38 ` Sebastian Hesselbarth
2013-06-26 8:43 ` [PATCH v2 " Sebastian Hesselbarth
2013-06-25 9:20 ` [PATCH 9/9] OF: base: rename of_free to of_delete_node Sebastian Hesselbarth
2013-06-27 6:51 ` [PATCH 0/9] OF: address and device related sync and cleanup Sascha Hauer
2013-06-27 7:50 ` Sebastian Hesselbarth
2013-06-27 8:58 ` Sascha Hauer
2013-06-27 9:00 ` Sebastian Hesselbarth
2013-06-27 18:19 ` Sascha Hauer
2013-06-27 18:27 ` Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 00/10] " Sebastian Hesselbarth
2013-07-05 6:45 ` Sascha Hauer
2013-07-02 18:14 ` [PATCH v3 01/10] OF: import address related functions from Linux OF API Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 02/10] OF: convert of_translate_address to new API Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 03/10] OF: base: move OF_ROOT_NODE_ defines to local OF code Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 04/10] OF: import bus/device related functions from Linux OF API Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 05/10] OF: gpio: convert DT based gpio handling to new " Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 06/10] OF: base: use of_platform_populate for probing Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 07/10] OF: base: remove dead device related functions Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 08/10] OF: remove device and resource pointer from struct device_node Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 09/10] OF: base: convert of_add_memory to OF API Sebastian Hesselbarth
2013-07-02 18:14 ` [PATCH v3 10/10] OF: base: rename of_free to of_delete_node Sebastian Hesselbarth
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=20130629160957.GR516@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=sebastian.hesselbarth@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