[PATCH 7/9] OF: remove device and resource pointer from struct device_node
Sebastian Hesselbarth
sebastian.hesselbarth at gmail.com
Sat Jun 29 12:03:44 EDT 2013
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? I will also have to have a close look
into i2c core what makes those devices special here.
Sebastian
More information about the barebox
mailing list