* [PATCH] of/platform: Allow missing address for dev name lookup
@ 2011-11-18 15:09 Wojciech Baranowski
  2011-11-18 16:10 ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Wojciech Baranowski @ 2011-11-18 15:09 UTC (permalink / raw)
  To: devicetree-discuss, Grant Likely, Rob Herring; +Cc: linux-kernel
While looking up linux name for platform device, check the address only if it
has been supplied in lookup table.
Signed-off-by: Wojciech Baranowski <baranowski@chromium.org>
---
 drivers/of/platform.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index cbd5d70..94763c0 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -314,12 +314,14 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
 	if (!lookup)
 		return NULL;
 
-	for(; lookup->name != NULL; lookup++) {
+	for (; lookup->name != NULL; lookup++) {
 		if (!of_device_is_compatible(np, lookup->compatible))
 			continue;
-		if (of_address_to_resource(np, 0, &res))
+		if (lookup->phys_addr &&
+				of_address_to_resource(np, 0, &res))
 			continue;
-		if (res.start != lookup->phys_addr)
+		if (lookup->phys_addr &&
+				res.start != lookup->phys_addr)
 			continue;
 		pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
 		return lookup;
-- 
1.7.3.1
^ permalink raw reply related	[flat|nested] 4+ messages in thread- * Re: [PATCH] of/platform: Allow missing address for dev name lookup
  2011-11-18 15:09 [PATCH] of/platform: Allow missing address for dev name lookup Wojciech Baranowski
@ 2011-11-18 16:10 ` Rob Herring
  2011-11-18 16:45   ` Wojciech Baranowski
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2011-11-18 16:10 UTC (permalink / raw)
  To: Wojciech Baranowski; +Cc: devicetree-discuss, Grant Likely, linux-kernel
On 11/18/2011 09:09 AM, Wojciech Baranowski wrote:
> While looking up linux name for platform device, check the address only if it
> has been supplied in lookup table.
> 
And the reason you want to do this is?
Rob
> Signed-off-by: Wojciech Baranowski <baranowski@chromium.org>
> ---
>  drivers/of/platform.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index cbd5d70..94763c0 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -314,12 +314,14 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
>  	if (!lookup)
>  		return NULL;
>  
> -	for(; lookup->name != NULL; lookup++) {
> +	for (; lookup->name != NULL; lookup++) {
>  		if (!of_device_is_compatible(np, lookup->compatible))
>  			continue;
> -		if (of_address_to_resource(np, 0, &res))
> +		if (lookup->phys_addr &&
> +				of_address_to_resource(np, 0, &res))
>  			continue;
> -		if (res.start != lookup->phys_addr)
> +		if (lookup->phys_addr &&
> +				res.start != lookup->phys_addr)
>  			continue;
>  		pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
>  		return lookup;
^ permalink raw reply	[flat|nested] 4+ messages in thread
- * Re: [PATCH] of/platform: Allow missing address for dev name lookup
  2011-11-18 16:10 ` Rob Herring
@ 2011-11-18 16:45   ` Wojciech Baranowski
  2011-11-18 22:12     ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Wojciech Baranowski @ 2011-11-18 16:45 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree-discuss, Grant Likely, linux-kernel
On Fri, Nov 18, 2011 at 11:10 AM, Rob Herring <rob.herring@calxeda.com> wrote:
> On 11/18/2011 09:09 AM, Wojciech Baranowski wrote:
>> While looking up linux name for platform device, check the address only if it
>> has been supplied in lookup table.
>>
> And the reason you want to do this is?
Name lookup table is used to provide names for platform devices on the
board I'm working on. I'm adding /sound node without address for audio
subsystem and don't want to break that convention.
>> Signed-off-by: Wojciech Baranowski <baranowski@chromium.org>
>> ---
>>  drivers/of/platform.c |    8 +++++---
>>  1 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
>> index cbd5d70..94763c0 100644
>> --- a/drivers/of/platform.c
>> +++ b/drivers/of/platform.c
>> @@ -314,12 +314,14 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
>>       if (!lookup)
>>               return NULL;
>>
>> -     for(; lookup->name != NULL; lookup++) {
>> +     for (; lookup->name != NULL; lookup++) {
>>               if (!of_device_is_compatible(np, lookup->compatible))
>>                       continue;
>> -             if (of_address_to_resource(np, 0, &res))
>> +             if (lookup->phys_addr &&
>> +                             of_address_to_resource(np, 0, &res))
>>                       continue;
>> -             if (res.start != lookup->phys_addr)
>> +             if (lookup->phys_addr &&
>> +                             res.start != lookup->phys_addr)
>>                       continue;
>>               pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
>>               return lookup;
>
>
^ permalink raw reply	[flat|nested] 4+ messages in thread
- * Re: [PATCH] of/platform: Allow missing address for dev name lookup
  2011-11-18 16:45   ` Wojciech Baranowski
@ 2011-11-18 22:12     ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2011-11-18 22:12 UTC (permalink / raw)
  To: Wojciech Baranowski; +Cc: devicetree-discuss, Grant Likely, linux-kernel
On 11/18/2011 10:45 AM, Wojciech Baranowski wrote:
> On Fri, Nov 18, 2011 at 11:10 AM, Rob Herring <rob.herring@calxeda.com> wrote:
>> On 11/18/2011 09:09 AM, Wojciech Baranowski wrote:
>>> While looking up linux name for platform device, check the address only if it
>>> has been supplied in lookup table.
>>>
>> And the reason you want to do this is?
> 
> Name lookup table is used to provide names for platform devices on the
> board I'm working on. I'm adding /sound node without address for audio
> subsystem and don't want to break that convention.
auxdata is really meant to be a temporary solution to plug platform_data.
All platform devices do not necessarily go into the DT. The DT should
describe the h/w. For sound I would expect this to be all the h/w blocks
like i2s, dma, codec and then information on how they are connected. Can
you show what your sound binding looks like.
Rob
> 
>>> Signed-off-by: Wojciech Baranowski <baranowski@chromium.org>
>>> ---
>>>  drivers/of/platform.c |    8 +++++---
>>>  1 files changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
>>> index cbd5d70..94763c0 100644
>>> --- a/drivers/of/platform.c
>>> +++ b/drivers/of/platform.c
>>> @@ -314,12 +314,14 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l
>>>       if (!lookup)
>>>               return NULL;
>>>
>>> -     for(; lookup->name != NULL; lookup++) {
>>> +     for (; lookup->name != NULL; lookup++) {
>>>               if (!of_device_is_compatible(np, lookup->compatible))
>>>                       continue;
>>> -             if (of_address_to_resource(np, 0, &res))
>>> +             if (lookup->phys_addr &&
>>> +                             of_address_to_resource(np, 0, &res))
>>>                       continue;
>>> -             if (res.start != lookup->phys_addr)
>>> +             if (lookup->phys_addr &&
>>> +                             res.start != lookup->phys_addr)
>>>                       continue;
>>>               pr_debug("%s: devname=%s\n", np->full_name, lookup->name);
>>>               return lookup;
>>
>>
^ permalink raw reply	[flat|nested] 4+ messages in thread
 
 
end of thread, other threads:[~2011-11-18 22:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-18 15:09 [PATCH] of/platform: Allow missing address for dev name lookup Wojciech Baranowski
2011-11-18 16:10 ` Rob Herring
2011-11-18 16:45   ` Wojciech Baranowski
2011-11-18 22:12     ` Rob Herring
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).