All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
@ 2012-11-02 11:03 ` Andreas Larsson
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Larsson @ 2012-11-02 11:03 UTC (permalink / raw)
  To: Grant Likely, davem; +Cc: Rob Herring, sparclinux, software, sam, linux-kernel

This bug-fix makes sure that of_address_to_resource is defined extern for sparc
so that the sparc-specific implementation of of_address_to_resource() is once
again used when including include/linux/of_address.h in a sparc context. A
number of drivers in mainline relies on this function working for sparc.

The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
static inlines are added for !CONFIG_OF_ADRESS, and CONFIG_OF_ADRESS is never
defined for sparc. This is good behavior for the other functions in
include/linux/of_address.h, as the extern functions defined in
drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
for of_address_to_resource is that there exists a sparc-specific implementation
in arch/sparc/arch/sparc/kernel/of_device_common.c

A similar solution is already in place for irq_of_parse_and_map() in
include/linux/of_irq.h.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---
 include/linux/of_address.h |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd..66adde9 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -4,11 +4,24 @@
 #include <linux/errno.h>
 #include <linux/of.h>
 
+/* of_address_to_resource() is used by all OF enabled platforms; but SPARC
+ * implements it differently. However, the prototype is the same for all,
+ * so declare it here for sparc as well as when CONFIG_OF_ADDRESS is set.
+ */
+#if defined(CONFIG_OF_ADDRESS) || defined(CONFIG_SPARC)
+extern int of_address_to_resource(struct device_node *dev, int index,
+				  struct resource *r);
+#else
+static inline int of_address_to_resource(struct device_node *dev, int index,
+					 struct resource *r)
+{
+	return -EINVAL;
+}
+#endif
+
 #ifdef CONFIG_OF_ADDRESS
 extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
 extern bool of_can_translate_address(struct device_node *dev);
-extern int of_address_to_resource(struct device_node *dev, int index,
-				  struct resource *r);
 extern struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
@@ -28,11 +41,6 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
-static inline int of_address_to_resource(struct device_node *dev, int index,
-					 struct resource *r)
-{
-	return -EINVAL;
-}
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
@ 2012-11-02 11:03 ` Andreas Larsson
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Larsson @ 2012-11-02 11:03 UTC (permalink / raw)
  To: Grant Likely, davem; +Cc: Rob Herring, sparclinux, software, sam, linux-kernel

This bug-fix makes sure that of_address_to_resource is defined extern for sparc
so that the sparc-specific implementation of of_address_to_resource() is once
again used when including include/linux/of_address.h in a sparc context. A
number of drivers in mainline relies on this function working for sparc.

The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
static inlines are added for !CONFIG_OF_ADRESS, and CONFIG_OF_ADRESS is never
defined for sparc. This is good behavior for the other functions in
include/linux/of_address.h, as the extern functions defined in
drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
for of_address_to_resource is that there exists a sparc-specific implementation
in arch/sparc/arch/sparc/kernel/of_device_common.c

A similar solution is already in place for irq_of_parse_and_map() in
include/linux/of_irq.h.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---
 include/linux/of_address.h |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd..66adde9 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -4,11 +4,24 @@
 #include <linux/errno.h>
 #include <linux/of.h>
 
+/* of_address_to_resource() is used by all OF enabled platforms; but SPARC
+ * implements it differently. However, the prototype is the same for all,
+ * so declare it here for sparc as well as when CONFIG_OF_ADDRESS is set.
+ */
+#if defined(CONFIG_OF_ADDRESS) || defined(CONFIG_SPARC)
+extern int of_address_to_resource(struct device_node *dev, int index,
+				  struct resource *r);
+#else
+static inline int of_address_to_resource(struct device_node *dev, int index,
+					 struct resource *r)
+{
+	return -EINVAL;
+}
+#endif
+
 #ifdef CONFIG_OF_ADDRESS
 extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
 extern bool of_can_translate_address(struct device_node *dev);
-extern int of_address_to_resource(struct device_node *dev, int index,
-				  struct resource *r);
 extern struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
@@ -28,11 +41,6 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
-static inline int of_address_to_resource(struct device_node *dev, int index,
-					 struct resource *r)
-{
-	return -EINVAL;
-}
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc agai
  2012-11-02 11:03 ` Andreas Larsson
@ 2012-11-02 17:53   ` Sam Ravnborg
  -1 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2012-11-02 17:53 UTC (permalink / raw)
  To: Andreas Larsson
  Cc: Grant Likely, davem, Rob Herring, sparclinux, software,
	linux-kernel

Hi Andreas.
On Fri, Nov 02, 2012 at 12:03:56PM +0100, Andreas Larsson wrote:
> This bug-fix makes sure that of_address_to_resource is defined extern for sparc
> so that the sparc-specific implementation of of_address_to_resource() is once
> again used when including include/linux/of_address.h in a sparc context. A
> number of drivers in mainline relies on this function working for sparc.

How about following (untested) approach.
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c287651..8194801 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -63,5 +63,8 @@ extern char *of_console_options;
 extern void irq_trans_init(struct device_node *dp);
 extern char *build_path_component(struct device_node *dp);
 
+/* SPARC has a local implementation */
+#define of_address_to_resource of_address_to_resource
+
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd..e20e3af 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
+#ifndef of_address_to_resource
 static inline int of_address_to_resource(struct device_node *dev, int index,
 					 struct resource *r)
 {
 	return -EINVAL;
 }
+#endif
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,

We use prom.h to teach the general of layer what SPARC provides.
In prom.h we define the symbol of_address_to_resource which tell
of_address.h that we have a local definition of this function, and
the static version is skipped.

This looks more elegant as we do not have to hardcode SPARC in of_address.h
and this is easy to re-use the sme pattern in other places.

Also pci_address_to_pio already uses the same approach in the same file.
pci_address_to_pio is defined if it was not defined before - I see no
reason to do so which is why I omitted it in the above.

	Sam

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
@ 2012-11-02 17:53   ` Sam Ravnborg
  0 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2012-11-02 17:53 UTC (permalink / raw)
  To: Andreas Larsson
  Cc: Grant Likely, davem, Rob Herring, sparclinux, software,
	linux-kernel

Hi Andreas.
On Fri, Nov 02, 2012 at 12:03:56PM +0100, Andreas Larsson wrote:
> This bug-fix makes sure that of_address_to_resource is defined extern for sparc
> so that the sparc-specific implementation of of_address_to_resource() is once
> again used when including include/linux/of_address.h in a sparc context. A
> number of drivers in mainline relies on this function working for sparc.

How about following (untested) approach.
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c287651..8194801 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -63,5 +63,8 @@ extern char *of_console_options;
 extern void irq_trans_init(struct device_node *dp);
 extern char *build_path_component(struct device_node *dp);
 
+/* SPARC has a local implementation */
+#define of_address_to_resource of_address_to_resource
+
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd..e20e3af 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
+#ifndef of_address_to_resource
 static inline int of_address_to_resource(struct device_node *dev, int index,
 					 struct resource *r)
 {
 	return -EINVAL;
 }
+#endif
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,

We use prom.h to teach the general of layer what SPARC provides.
In prom.h we define the symbol of_address_to_resource which tell
of_address.h that we have a local definition of this function, and
the static version is skipped.

This looks more elegant as we do not have to hardcode SPARC in of_address.h
and this is easy to re-use the sme pattern in other places.

Also pci_address_to_pio already uses the same approach in the same file.
pci_address_to_pio is defined if it was not defined before - I see no
reason to do so which is why I omitted it in the above.

	Sam

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc agai
  2012-11-02 17:53   ` [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again Sam Ravnborg
@ 2012-11-05 10:21     ` Andreas Larsson
  -1 siblings, 0 replies; 14+ messages in thread
From: Andreas Larsson @ 2012-11-05 10:21 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Grant Likely, davem, Rob Herring, sparclinux, software,
	linux-kernel

On 2012-11-02 18:53, Sam Ravnborg wrote:
> Hi Andreas.
> On Fri, Nov 02, 2012 at 12:03:56PM +0100, Andreas Larsson wrote:
>> This bug-fix makes sure that of_address_to_resource is defined extern for sparc
>> so that the sparc-specific implementation of of_address_to_resource() is once
>> again used when including include/linux/of_address.h in a sparc context. A
>> number of drivers in mainline relies on this function working for sparc.
>
> How about following (untested) approach.
> diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
> index c287651..8194801 100644
> --- a/arch/sparc/include/asm/prom.h
> +++ b/arch/sparc/include/asm/prom.h
> @@ -63,5 +63,8 @@ extern char *of_console_options;
>   extern void irq_trans_init(struct device_node *dp);
>   extern char *build_path_component(struct device_node *dp);
>
> +/* SPARC has a local implementation */
> +#define of_address_to_resource of_address_to_resource
> +
>   #endif /* __KERNEL__ */
>   #endif /* _SPARC_PROM_H */
> diff --git a/include/linux/of_address.h b/include/linux/of_address.h
> index a1984dd..e20e3af 100644
> --- a/include/linux/of_address.h
> +++ b/include/linux/of_address.h
> @@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
>   #endif
>
>   #else /* CONFIG_OF_ADDRESS */
> +#ifndef of_address_to_resource
>   static inline int of_address_to_resource(struct device_node *dev, int index,
>   					 struct resource *r)
>   {
>   	return -EINVAL;
>   }
> +#endif
>   static inline struct device_node *of_find_matching_node_by_address(
>   					struct device_node *from,
>   					const struct of_device_id *matches,
>
> We use prom.h to teach the general of layer what SPARC provides.
> In prom.h we define the symbol of_address_to_resource which tell
> of_address.h that we have a local definition of this function, and
> the static version is skipped.
>
> This looks more elegant as we do not have to hardcode SPARC in of_address.h
> and this is easy to re-use the sme pattern in other places.

I agree that this is a much nicer approach! I'll send a v2 based on this.

Thanks for the feedback!

Cheers,
Andreas


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
@ 2012-11-05 10:21     ` Andreas Larsson
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Larsson @ 2012-11-05 10:21 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Grant Likely, davem, Rob Herring, sparclinux, software,
	linux-kernel

On 2012-11-02 18:53, Sam Ravnborg wrote:
> Hi Andreas.
> On Fri, Nov 02, 2012 at 12:03:56PM +0100, Andreas Larsson wrote:
>> This bug-fix makes sure that of_address_to_resource is defined extern for sparc
>> so that the sparc-specific implementation of of_address_to_resource() is once
>> again used when including include/linux/of_address.h in a sparc context. A
>> number of drivers in mainline relies on this function working for sparc.
>
> How about following (untested) approach.
> diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
> index c287651..8194801 100644
> --- a/arch/sparc/include/asm/prom.h
> +++ b/arch/sparc/include/asm/prom.h
> @@ -63,5 +63,8 @@ extern char *of_console_options;
>   extern void irq_trans_init(struct device_node *dp);
>   extern char *build_path_component(struct device_node *dp);
>
> +/* SPARC has a local implementation */
> +#define of_address_to_resource of_address_to_resource
> +
>   #endif /* __KERNEL__ */
>   #endif /* _SPARC_PROM_H */
> diff --git a/include/linux/of_address.h b/include/linux/of_address.h
> index a1984dd..e20e3af 100644
> --- a/include/linux/of_address.h
> +++ b/include/linux/of_address.h
> @@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
>   #endif
>
>   #else /* CONFIG_OF_ADDRESS */
> +#ifndef of_address_to_resource
>   static inline int of_address_to_resource(struct device_node *dev, int index,
>   					 struct resource *r)
>   {
>   	return -EINVAL;
>   }
> +#endif
>   static inline struct device_node *of_find_matching_node_by_address(
>   					struct device_node *from,
>   					const struct of_device_id *matches,
>
> We use prom.h to teach the general of layer what SPARC provides.
> In prom.h we define the symbol of_address_to_resource which tell
> of_address.h that we have a local definition of this function, and
> the static version is skipped.
>
> This looks more elegant as we do not have to hardcode SPARC in of_address.h
> and this is easy to re-use the sme pattern in other places.

I agree that this is a much nicer approach! I'll send a v2 based on this.

Thanks for the feedback!

Cheers,
Andreas


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
  2012-11-05 10:21     ` [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again Andreas Larsson
@ 2012-11-05 10:53       ` Andreas Larsson
  -1 siblings, 0 replies; 14+ messages in thread
From: Andreas Larsson @ 2012-11-05 10:53 UTC (permalink / raw)
  To: davem, sam; +Cc: sparclinux, software, Grant Likely, Rob Herring, linux-kernel

This bug-fix makes sure that of_address_to_resource is defined extern for sparc
so that the sparc-specific implementation of of_address_to_resource() is once
again used when including include/linux/of_address.h in a sparc context. A
number of drivers in mainline relies on this function working for sparc.

The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
static inlines are added for !CONFIG_OF_ADRESS, and CONFIG_OF_ADRESS is never
defined for sparc. This is good behavior for the other functions in
include/linux/of_address.h, as the extern functions defined in
drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
for of_address_to_resource is that there exists a sparc-specific implementation
in arch/sparc/arch/sparc/kernel/of_device_common.c

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---
 arch/sparc/include/asm/prom.h |    5 +++++
 include/linux/of_address.h    |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c287651..f930031 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -63,5 +63,10 @@ extern char *of_console_options;
 extern void irq_trans_init(struct device_node *dp);
 extern char *build_path_component(struct device_node *dp);
 
+/* SPARC has a local implementation */
+extern int of_address_to_resource(struct device_node *dev, int index,
+				  struct resource *r);
+#define of_address_to_resource of_address_to_resource
+
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd..e20e3af 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
+#ifndef of_address_to_resource
 static inline int of_address_to_resource(struct device_node *dev, int index,
 					 struct resource *r)
 {
 	return -EINVAL;
 }
+#endif
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
@ 2012-11-05 10:53       ` Andreas Larsson
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Larsson @ 2012-11-05 10:53 UTC (permalink / raw)
  To: davem, sam; +Cc: sparclinux, software, Grant Likely, Rob Herring, linux-kernel

This bug-fix makes sure that of_address_to_resource is defined extern for sparc
so that the sparc-specific implementation of of_address_to_resource() is once
again used when including include/linux/of_address.h in a sparc context. A
number of drivers in mainline relies on this function working for sparc.

The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
static inlines are added for !CONFIG_OF_ADRESS, and CONFIG_OF_ADRESS is never
defined for sparc. This is good behavior for the other functions in
include/linux/of_address.h, as the extern functions defined in
drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
for of_address_to_resource is that there exists a sparc-specific implementation
in arch/sparc/arch/sparc/kernel/of_device_common.c

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
---
 arch/sparc/include/asm/prom.h |    5 +++++
 include/linux/of_address.h    |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c287651..f930031 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -63,5 +63,10 @@ extern char *of_console_options;
 extern void irq_trans_init(struct device_node *dp);
 extern char *build_path_component(struct device_node *dp);
 
+/* SPARC has a local implementation */
+extern int of_address_to_resource(struct device_node *dev, int index,
+				  struct resource *r);
+#define of_address_to_resource of_address_to_resource
+
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd..e20e3af 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
+#ifndef of_address_to_resource
 static inline int of_address_to_resource(struct device_node *dev, int index,
 					 struct resource *r)
 {
 	return -EINVAL;
 }
+#endif
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc a
  2012-11-05 10:53       ` Andreas Larsson
@ 2012-11-05 16:12         ` Rob Herring
  -1 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2012-11-05 16:12 UTC (permalink / raw)
  To: Andreas Larsson
  Cc: davem, sam, sparclinux, software, Grant Likely, linux-kernel

On 11/05/2012 04:53 AM, Andreas Larsson wrote:
> This bug-fix makes sure that of_address_to_resource is defined extern for sparc
> so that the sparc-specific implementation of of_address_to_resource() is once
> again used when including include/linux/of_address.h in a sparc context. A
> number of drivers in mainline relies on this function working for sparc.
> 
> The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
> add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
> static inlines are added for !CONFIG_OF_ADRESS, and CONFIG_OF_ADRESS is never

s/ADRESS/ADDRESS/

> defined for sparc. This is good behavior for the other functions in
> include/linux/of_address.h, as the extern functions defined in
> drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
> for of_address_to_resource is that there exists a sparc-specific implementation
> in arch/sparc/arch/sparc/kernel/of_device_common.c
> 
> Signed-off-by: Andreas Larsson <andreas@gaisler.com>

Otherwise,

Acked-by: Rob Herring <rob.herring@calxeda.com>

> ---
>  arch/sparc/include/asm/prom.h |    5 +++++
>  include/linux/of_address.h    |    2 ++
>  2 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
> index c287651..f930031 100644
> --- a/arch/sparc/include/asm/prom.h
> +++ b/arch/sparc/include/asm/prom.h
> @@ -63,5 +63,10 @@ extern char *of_console_options;
>  extern void irq_trans_init(struct device_node *dp);
>  extern char *build_path_component(struct device_node *dp);
>  
> +/* SPARC has a local implementation */
> +extern int of_address_to_resource(struct device_node *dev, int index,
> +				  struct resource *r);
> +#define of_address_to_resource of_address_to_resource
> +
>  #endif /* __KERNEL__ */
>  #endif /* _SPARC_PROM_H */
> diff --git a/include/linux/of_address.h b/include/linux/of_address.h
> index a1984dd..e20e3af 100644
> --- a/include/linux/of_address.h
> +++ b/include/linux/of_address.h
> @@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
>  #endif
>  
>  #else /* CONFIG_OF_ADDRESS */
> +#ifndef of_address_to_resource
>  static inline int of_address_to_resource(struct device_node *dev, int index,
>  					 struct resource *r)
>  {
>  	return -EINVAL;
>  }
> +#endif
>  static inline struct device_node *of_find_matching_node_by_address(
>  					struct device_node *from,
>  					const struct of_device_id *matches,
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
@ 2012-11-05 16:12         ` Rob Herring
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2012-11-05 16:12 UTC (permalink / raw)
  To: Andreas Larsson
  Cc: davem, sam, sparclinux, software, Grant Likely, linux-kernel

On 11/05/2012 04:53 AM, Andreas Larsson wrote:
> This bug-fix makes sure that of_address_to_resource is defined extern for sparc
> so that the sparc-specific implementation of of_address_to_resource() is once
> again used when including include/linux/of_address.h in a sparc context. A
> number of drivers in mainline relies on this function working for sparc.
> 
> The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
> add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
> static inlines are added for !CONFIG_OF_ADRESS, and CONFIG_OF_ADRESS is never

s/ADRESS/ADDRESS/

> defined for sparc. This is good behavior for the other functions in
> include/linux/of_address.h, as the extern functions defined in
> drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
> for of_address_to_resource is that there exists a sparc-specific implementation
> in arch/sparc/arch/sparc/kernel/of_device_common.c
> 
> Signed-off-by: Andreas Larsson <andreas@gaisler.com>

Otherwise,

Acked-by: Rob Herring <rob.herring@calxeda.com>

> ---
>  arch/sparc/include/asm/prom.h |    5 +++++
>  include/linux/of_address.h    |    2 ++
>  2 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
> index c287651..f930031 100644
> --- a/arch/sparc/include/asm/prom.h
> +++ b/arch/sparc/include/asm/prom.h
> @@ -63,5 +63,10 @@ extern char *of_console_options;
>  extern void irq_trans_init(struct device_node *dp);
>  extern char *build_path_component(struct device_node *dp);
>  
> +/* SPARC has a local implementation */
> +extern int of_address_to_resource(struct device_node *dev, int index,
> +				  struct resource *r);
> +#define of_address_to_resource of_address_to_resource
> +
>  #endif /* __KERNEL__ */
>  #endif /* _SPARC_PROM_H */
> diff --git a/include/linux/of_address.h b/include/linux/of_address.h
> index a1984dd..e20e3af 100644
> --- a/include/linux/of_address.h
> +++ b/include/linux/of_address.h
> @@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
>  #endif
>  
>  #else /* CONFIG_OF_ADDRESS */
> +#ifndef of_address_to_resource
>  static inline int of_address_to_resource(struct device_node *dev, int index,
>  					 struct resource *r)
>  {
>  	return -EINVAL;
>  }
> +#endif
>  static inline struct device_node *of_find_matching_node_by_address(
>  					struct device_node *from,
>  					const struct of_device_id *matches,
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
  2012-11-05 16:12         ` [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again Rob Herring
@ 2012-11-06 10:12           ` Andreas Larsson
  -1 siblings, 0 replies; 14+ messages in thread
From: Andreas Larsson @ 2012-11-06 10:12 UTC (permalink / raw)
  To: davem, Rob Herring; +Cc: sparclinux, software, sam, Grant Likely, linux-kernel

This bug-fix makes sure that of_address_to_resource is defined extern for sparc
so that the sparc-specific implementation of of_address_to_resource() is once
again used when including include/linux/of_address.h in a sparc context. A
number of drivers in mainline relies on this function working for sparc.

The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
static inlines are added for !CONFIG_OF_ADDRESS, and CONFIG_OF_ADDRESS is never
defined for sparc. This is good behavior for the other functions in
include/linux/of_address.h, as the extern functions defined in
drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
for of_address_to_resource there exists a sparc-specific implementation in
arch/sparc/arch/sparc/kernel/of_device_common.c

Solution suggested by: Sam Ravnborg <sam@ravnborg.org>

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/sparc/include/asm/prom.h |    5 +++++
 include/linux/of_address.h    |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c287651..f930031 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -63,5 +63,10 @@ extern char *of_console_options;
 extern void irq_trans_init(struct device_node *dp);
 extern char *build_path_component(struct device_node *dp);
 
+/* SPARC has a local implementation */
+extern int of_address_to_resource(struct device_node *dev, int index,
+				  struct resource *r);
+#define of_address_to_resource of_address_to_resource
+
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd..e20e3af 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
+#ifndef of_address_to_resource
 static inline int of_address_to_resource(struct device_node *dev, int index,
 					 struct resource *r)
 {
 	return -EINVAL;
 }
+#endif
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v3] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
@ 2012-11-06 10:12           ` Andreas Larsson
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Larsson @ 2012-11-06 10:12 UTC (permalink / raw)
  To: davem, Rob Herring; +Cc: sparclinux, software, sam, Grant Likely, linux-kernel

This bug-fix makes sure that of_address_to_resource is defined extern for sparc
so that the sparc-specific implementation of of_address_to_resource() is once
again used when including include/linux/of_address.h in a sparc context. A
number of drivers in mainline relies on this function working for sparc.

The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
static inlines are added for !CONFIG_OF_ADDRESS, and CONFIG_OF_ADDRESS is never
defined for sparc. This is good behavior for the other functions in
include/linux/of_address.h, as the extern functions defined in
drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
for of_address_to_resource there exists a sparc-specific implementation in
arch/sparc/arch/sparc/kernel/of_device_common.c

Solution suggested by: Sam Ravnborg <sam@ravnborg.org>

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/sparc/include/asm/prom.h |    5 +++++
 include/linux/of_address.h    |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index c287651..f930031 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -63,5 +63,10 @@ extern char *of_console_options;
 extern void irq_trans_init(struct device_node *dp);
 extern char *build_path_component(struct device_node *dp);
 
+/* SPARC has a local implementation */
+extern int of_address_to_resource(struct device_node *dev, int index,
+				  struct resource *r);
+#define of_address_to_resource of_address_to_resource
+
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index a1984dd..e20e3af 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
 #endif
 
 #else /* CONFIG_OF_ADDRESS */
+#ifndef of_address_to_resource
 static inline int of_address_to_resource(struct device_node *dev, int index,
 					 struct resource *r)
 {
 	return -EINVAL;
 }
+#endif
 static inline struct device_node *of_find_matching_node_by_address(
 					struct device_node *from,
 					const struct of_device_id *matches,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc a
  2012-11-05 10:53       ` Andreas Larsson
@ 2012-11-10  3:49         ` David Miller
  -1 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2012-11-10  3:49 UTC (permalink / raw)
  To: andreas; +Cc: sam, sparclinux, software, grant.likely, rob.herring,
	linux-kernel

From: Andreas Larsson <andreas@gaisler.com>
Date: Mon,  5 Nov 2012 11:53:18 +0100

> This bug-fix makes sure that of_address_to_resource is defined extern for sparc
> so that the sparc-specific implementation of of_address_to_resource() is once
> again used when including include/linux/of_address.h in a sparc context. A
> number of drivers in mainline relies on this function working for sparc.
> 
> The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
> add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
> static inlines are added for !CONFIG_OF_ADRESS, and CONFIG_OF_ADRESS is never
> defined for sparc. This is good behavior for the other functions in
> include/linux/of_address.h, as the extern functions defined in
> drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
> for of_address_to_resource is that there exists a sparc-specific implementation
> in arch/sparc/arch/sparc/kernel/of_device_common.c
> 
> Signed-off-by: Andreas Larsson <andreas@gaisler.com>

Applied.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again
@ 2012-11-10  3:49         ` David Miller
  0 siblings, 0 replies; 14+ messages in thread
From: David Miller @ 2012-11-10  3:49 UTC (permalink / raw)
  To: andreas; +Cc: sam, sparclinux, software, grant.likely, rob.herring,
	linux-kernel

From: Andreas Larsson <andreas@gaisler.com>
Date: Mon,  5 Nov 2012 11:53:18 +0100

> This bug-fix makes sure that of_address_to_resource is defined extern for sparc
> so that the sparc-specific implementation of of_address_to_resource() is once
> again used when including include/linux/of_address.h in a sparc context. A
> number of drivers in mainline relies on this function working for sparc.
> 
> The bug was introduced in a850a7554442f08d3e910c6eeb4ee216868dda1e, "of/address:
> add empty static inlines for !CONFIG_OF". Contrary to that commit title, the
> static inlines are added for !CONFIG_OF_ADRESS, and CONFIG_OF_ADRESS is never
> defined for sparc. This is good behavior for the other functions in
> include/linux/of_address.h, as the extern functions defined in
> drivers/of/address.c only gets linked when OF_ADDRESS is configured. However,
> for of_address_to_resource is that there exists a sparc-specific implementation
> in arch/sparc/arch/sparc/kernel/of_device_common.c
> 
> Signed-off-by: Andreas Larsson <andreas@gaisler.com>

Applied.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-11-10  3:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-02 11:03 [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again Andreas Larsson
2012-11-02 11:03 ` Andreas Larsson
2012-11-02 17:53 ` [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc agai Sam Ravnborg
2012-11-02 17:53   ` [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again Sam Ravnborg
2012-11-05 10:21   ` [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc agai Andreas Larsson
2012-11-05 10:21     ` [PATCH] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again Andreas Larsson
2012-11-05 10:53     ` [PATCH v2] " Andreas Larsson
2012-11-05 10:53       ` Andreas Larsson
2012-11-05 16:12       ` [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc a Rob Herring
2012-11-05 16:12         ` [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again Rob Herring
2012-11-06 10:12         ` [PATCH v3] " Andreas Larsson
2012-11-06 10:12           ` Andreas Larsson
2012-11-10  3:49       ` [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc a David Miller
2012-11-10  3:49         ` [PATCH v2] of/address: sparc: Declare of_address_to_resource() as an extern function for sparc again David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.