Re: [PATCH 2/2] mpc85xx_edac: change to use new definitions for PCI EDAC regspace

2010-07-24 Thread Dmitry Eremin-Solenikov
On 7/24/10, Grant Likely  wrote:
> On Fri, Jul 23, 2010 at 6:20 PM, Dmitry Eremin-Solenikov
>  wrote:
>> Hello,
>>
>> On 7/22/10, Grant Likely  wrote:
>>> On Thu, Jul 22, 2010 at 10:48 AM, Dmitry Eremin-Solenikov
>>>  wrote:
 Hello,

 On Thu, Jul 22, 2010 at 7:38 PM, Kumar Gala 
 wrote:
>
> On Jul 21, 2010, at 7:03 PM, Dmitry Eremin-Solenikov wrote:
>
>> Currently (as mpc8540-pci) devices are not created on of_platform bus,
>> mpc85xx_edac can't probe to them. Follow the change to dts trees to
>> bind
>> not to the main mpc8540-pci node but to special mpc85xx-pci-error
>> nodes,
>> present on soc bus.
>>
>> Signed-off-by: Dmitry Eremin-Solenikov 
>> ---
>> drivers/edac/mpc85xx_edac.c |   18 +-
>> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> Nak.
>
> We already have a node in the dts for the PCI controller.  Lets update
> the platform code to add the pci controller to the
> of_platform_bus_probe
> list.

 I've had that idea. However it's really look strange to me to call
 of_platform_bus_probe() on the bus node, for which we (IMO) explicitly
 won't like for
 child devices (PCI devices) to be added to of_platform bus. Would it
 be suitable to just call of_platform_device_create for it (Or do i
 miss someth>>
>>> Try the attached patch (lightly tested).  If it works for you then
>>> I'll post it for wider review.
>>
>> Yes, this patch worked for me. However it looks a bit like a hack for me.
>
> I'll probably refine it a bit before merging, but I don't think it is
> a hack.  It reflects the behaviour that makes sense when registering
> devices hanging off the root node.  If a device node is a child of the
> root, then we know it isn't hanging off an i2c or pci bus, or anything
> else.  It is essentially a system device.
>
> The troublesome bit is that the root node also has memory, cpus,
> chosen and aliases nodes which are not devices.  In the vast majority
> of cases, we want all the device nodes that are children of the root
> to be registered, but we don't want to register the special nodes.
> Checking for the presence of a compatible property is a pretty good
> test for determining whether or not a node actually represents a
> device, especially because all users of of_platform_bus_probe() seem
> to be FDT users where we've been very strict about enforcing that
> drivers must use the compatible property for matching to device nodes.


Now it's clear to me, thanks for the explanation.

BTW: On 2.6.35-rc6 I had to make 'compat' and 'match' variables const.

-- 
With best wishes
Dmitry
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH] of: Provide default of_node_to_nid() when CONFIG_NUMA is not set

2010-07-24 Thread Grant Likely
of_node_to_nid() is only relevant for NUMA.  Don't force architectures to
implement it if CONFIG_NUMA is not set.

Signed-off-by: Grant Likely 
---
 arch/microblaze/include/asm/topology.h |   10 --
 arch/powerpc/include/asm/topology.h|7 ---
 arch/sparc/include/asm/prom.h  |5 -
 include/linux/of.h |8 
 4 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/arch/microblaze/include/asm/topology.h 
b/arch/microblaze/include/asm/topology.h
index 96bcea5..5428f33 100644
--- a/arch/microblaze/include/asm/topology.h
+++ b/arch/microblaze/include/asm/topology.h
@@ -1,11 +1 @@
 #include 
-
-#ifndef _ASM_MICROBLAZE_TOPOLOGY_H
-#define _ASM_MICROBLAZE_TOPOLOGY_H
-
-struct device_node;
-static inline int of_node_to_nid(struct device_node *device)
-{
-   return 0;
-}
-#endif /* _ASM_MICROBLAZE_TOPOLOGY_H */
diff --git a/arch/powerpc/include/asm/topology.h 
b/arch/powerpc/include/asm/topology.h
index 32adf72..09dd38c 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -41,8 +41,6 @@ static inline int cpu_to_node(int cpu)
   cpu_all_mask :   \
   node_to_cpumask_map[node])
 
-int of_node_to_nid(struct device_node *device);
-
 struct pci_bus;
 #ifdef CONFIG_PCI
 extern int pcibus_to_node(struct pci_bus *bus);
@@ -94,11 +92,6 @@ extern void sysfs_remove_device_from_node(struct sys_device 
*dev, int nid);
 
 #else
 
-static inline int of_node_to_nid(struct device_node *device)
-{
-   return 0;
-}
-
 static inline void dump_numa_cpu_topology(void) {}
 
 static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid)
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c82a7da..b47d2a7 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -41,11 +41,6 @@ extern int of_getintprop_default(struct device_node *np,
 const char *name,
 int def);
 extern int of_find_in_proplist(const char *list, const char *match, int len);
-#ifdef CONFIG_NUMA
-extern int of_node_to_nid(struct device_node *dp);
-#else
-#define of_node_to_nid(dp) (-1)
-#endif
 
 extern void prom_build_devicetree(void);
 extern void of_populate_present_mask(void);
diff --git a/include/linux/of.h b/include/linux/of.h
index b0756f3..ec25482 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -205,6 +205,14 @@ extern int of_parse_phandles_with_args(struct device_node 
*np,
 
 extern int of_machine_is_compatible(const char *compat);
 
+#if defined(CONFIG_NUMA)
+extern int of_node_to_nid(struct device_node *device);
+#elif defined(CONFIG_SPARC)
+static inline int of_node_to_nid(struct device_node *device) { return -1; }
+#else
+static inline int of_node_to_nid(struct device_node *device) { return 0; }
+#endif
+
 extern int prom_add_property(struct device_node* np, struct property* prop);
 extern int prom_remove_property(struct device_node *np, struct property *prop);
 extern int prom_update_property(struct device_node *np,

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH][v2] fix of_flat_dt_is_compa tible to match the full compatible string

2010-07-24 Thread Grant Likely


"Stuart Yoder"  wrote:

>From: Stuart Yoder 
>
>With the previous string comparison, a device tree
>compatible of "foo-bar" would match as compatible
>with a driver looking for "foo".
>
>Signed-off-by: Stuart Yoder 

Hi Stewart. 

Patch looks good.  I'll test it this afternoon.

However, please remember to cc: me and devicetree-discuss if you want patches 
picked up remotely quickly (I know, I'm slow anyway, but I'm even slower when I 
don't see something.  I only came across this one by chance.)

g.

>---
> drivers/of/fdt.c |2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>index dee4fb5..28c0c2b 100644
>--- a/drivers/of/fdt.c
>+++ b/drivers/of/fdt.c
>@@ -169,7 +169,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, 
>const char *compat)
>   if (cp == NULL)
>   return 0;
>   while (cplen > 0) {
>-  if (strncasecmp(cp, compat, strlen(compat)) == 0)
>+  if (!strcasecmp(cp, compat))
>   return 1;
>   l = strlen(cp) + 1;
>   cp += l;
>-- 
>1.6.2.5
>
>
>___
>Linuxppc-dev mailing list
>Linuxppc-dev@lists.ozlabs.org
>https://lists.ozlabs.org/listinfo/linuxppc-dev

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] fix of_flat_dt_is_compatible to match the full compatible string

2010-07-24 Thread Grant Likely
On Thu, Jul 22, 2010 at 8:45 PM, Benjamin Herrenschmidt
 wrote:
> On Thu, 2010-07-22 at 18:28 -0500, Stuart Yoder wrote:
>> From: Stuart Yoder 
>>
>> With the previous string comparison, a device tree
>> compatible of "foo-bar" would match as compatible
>> with a driver looking for "foo".
>>
>> Signed-off-by: Stuart Yoder 
>
> Beware you are doing two changes in one here and only documenting one...
>
> You also removed the case insenstivity.
>
> Now, those things are supposed to be case sensitive afaik, but we have
> enough legacy HW with more/less crap DTs and I'd be careful with
> changing that without a good reason (ie, it breaks not to do it ?).
>
> No objection with fixing the partial match tho.

On that note, for completeness, this code should be using the
of_compat_cmp() to match up with other code.  If SPARC ever uses this
code, which davem said he might tp support kexec, then this macro will
be important.  I'll change it when I pick up the patch.

g.

>
> Cheers,
> Ben.
>
>> ---
>>  drivers/of/fdt.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>> index dee4fb5..f5239c0 100644
>> --- a/drivers/of/fdt.c
>> +++ b/drivers/of/fdt.c
>> @@ -169,7 +169,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, 
>> const char *compat)
>>       if (cp == NULL)
>>               return 0;
>>       while (cplen > 0) {
>> -             if (strncasecmp(cp, compat, strlen(compat)) == 0)
>> +             if (!strcmp(cp, compat))
>>                       return 1;
>>               l = strlen(cp) + 1;
>>               cp += l;
>
>
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH] of: Provide default of_node_to_nid() when CONFIG_NUMA is not set

2010-07-24 Thread Stephen Rothwell
Hi Grant,

On Sat, 24 Jul 2010 09:43:31 -0600 Grant Likely  
wrote:
>
> of_node_to_nid() is only relevant for NUMA.  Don't force architectures to
> implement it if CONFIG_NUMA is not set.

Why not just do:

#ifndef of_node_to_nid
static inline int of_node_to_nid(struct device_node *device) { return 0; }
#define of_node_to_nid  of_node_to_nid
#endif

in include/linux/of.h

and then add:

#define of_node_to_nid  of_node_to_nid

Where it is declared/defined for each arch ...
(it would be nice if all the archs were consistent in where it was
declared).
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


pgpod7ArZqvri.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev