[PATCH] powerpc: don't create two devices for each cpm_uart device tree node

Nikita V. Youshchenko yoush at debian.org
Wed Feb 20 10:32:33 EST 2008


    powerpc: don't create two devices for each cpm_uart device tree node
    
    Code in arch/powerpc/sysdev/fsl_soc.c used to create two 'struct device'
    objects for each cpm_uart device tree node - one "fsl-cpm-scc:uart"
    in cpm_uart_of_init() and one "fsl-cpm-smc:uart" in cpm_smc_uart_of_init().
    
    This patch adds additional test to those routines, such that cpm_uart_of_init()
    only registers devices with model "SCC", and cpm_smc_uart_of_init() only
    registers devices with model "SMC".
    
    Signed-off-by: Nikita Youshchenko <yoush at debian.org>

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index f1b8412..536f8c9 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -890,6 +890,10 @@ static int __init cpm_uart_of_init(void)
 		const int *id;
 		const char *model;
 
+		model = of_get_property(np, "model", NULL);
+		if (!model || strcmp(model, "SCC") != 0)
+			continue;
+
 		memset(r, 0, sizeof(r));
 		memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
 
@@ -917,7 +921,6 @@ static int __init cpm_uart_of_init(void)
 		id = of_get_property(np, "device-id", NULL);
 		cpm_uart_data.fs_no = *id;
 
-		model = of_get_property(np, "model", NULL);
 		strcpy(cpm_uart_data.fs_type, model);
 
 		cpm_uart_data.uart_clk = ppc_proc_freq;
@@ -1175,6 +1178,10 @@ static int __init cpm_smc_uart_of_init(void)
 		const int *id;
 		const char *model;
 
+		model = of_get_property(np, "model", NULL);
+		if (!model || strcmp(model, "SMC") != 0)
+			continue;
+
 		memset(r, 0, sizeof(r));
 		memset(&cpm_uart_data, 0, sizeof(cpm_uart_data));
 
@@ -1200,7 +1207,6 @@ static int __init cpm_smc_uart_of_init(void)
 			goto err;
 		}
 
-		model = of_get_property(np, "model", NULL);
 		strcpy(cpm_uart_data.fs_type, model);
 
 		id = of_get_property(np, "device-id", NULL);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20080220/021c9f45/attachment.pgp>


More information about the Linuxppc-dev mailing list