diff mbox

[07/10] powerpc/mpic: Don't open-code dcr_resource_start

Message ID 1322593117-29938-8-git-send-email-Kyle.D.Moffett@boeing.com (mailing list archive)
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Kyle Moffett Nov. 29, 2011, 6:58 p.m. UTC
Don't open-code the OpenFirmware "dcr-reg" property lookup trying to map
DCR resources.  This makes the code a bit easier to read.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
---
 arch/powerpc/sysdev/mpic.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

Comments

Michael Ellerman Dec. 1, 2011, 6:58 a.m. UTC | #1
On Tue, 2011-11-29 at 13:58 -0500, Kyle Moffett wrote:
> Don't open-code the OpenFirmware "dcr-reg" property lookup trying to map
> DCR resources.  This makes the code a bit easier to read.
> 
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
> ---
>  arch/powerpc/sysdev/mpic.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
> index e0216ff..6916ba5 100644
> --- a/arch/powerpc/sysdev/mpic.c
> +++ b/arch/powerpc/sysdev/mpic.c
> @@ -319,11 +319,8 @@ static void _mpic_map_dcr(struct mpic *mpic, struct device_node *node,
>  			  struct mpic_reg_bank *rb,
>  			  unsigned int offset, unsigned int size)
>  {
> -	const u32 *dbasep;
> -
> -	dbasep = of_get_property(node, "dcr-reg", NULL);
> -
> -	rb->dhost = dcr_map(node, *dbasep + offset, size);
> +	phys_addr_t phys_addr = dcr_resource_start(node);

Gives me:

  arch/powerpc/sysdev/mpic.c:321: error: too few arguments to function 'dcr_resource_start'

Because you're missing index:

  unsigned int dcr_resource_start(const struct device_node *np, unsigned int index)

cheers
diff mbox

Patch

diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index e0216ff..6916ba5 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -319,11 +319,8 @@  static void _mpic_map_dcr(struct mpic *mpic, struct device_node *node,
 			  struct mpic_reg_bank *rb,
 			  unsigned int offset, unsigned int size)
 {
-	const u32 *dbasep;
-
-	dbasep = of_get_property(node, "dcr-reg", NULL);
-
-	rb->dhost = dcr_map(node, *dbasep + offset, size);
+	phys_addr_t phys_addr = dcr_resource_start(node);
+	rb->dhost = dcr_map(mpic->node, phys_addr + offset, size);
 	BUG_ON(!DCR_MAP_OK(rb->dhost));
 }