From: Vitaly Bordug <vbordug@ru•mvista.com>
To: Kumar Gala <galak@freescale•com>
Cc: linuxppc-embedded list <linuxppc-embedded@ozlabs•org>
Subject: [PATCH] identify_ppc_sys_by_name_and_id function implementation (braces fixed)
Date: Wed, 10 Aug 2005 21:46:35 +0400 [thread overview]
Message-ID: <42FA3D7B.8040200@ru.mvista.com> (raw)
In-Reply-To: <42FA3636.7010804@ru.mvista.com>
[-- Attachment #1: Type: text/plain, Size: 133 bytes --]
The same as above but with correct kernel bracing style.
Signed-off-by: Vitaly Bordug <vbordug@ru•mvista.com>
--
Sincerely,
Vitaly
[-- Attachment #2: ppc_sys_add.patch --]
[-- Type: text/x-patch, Size: 2174 bytes --]
diff --git a/arch/ppc/syslib/ppc_sys.c b/arch/ppc/syslib/ppc_sys.c
--- a/arch/ppc/syslib/ppc_sys.c
+++ b/arch/ppc/syslib/ppc_sys.c
@@ -6,6 +6,7 @@
* Maintainer: Kumar Gala <kumar.gala@freescale•com>
*
* Copyright 2005 Freescale Semiconductor Inc.
+ * Copyright 2005 MontaVista, Inc. by Vitaly Bordug <vbordug@ru•mvista.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -33,10 +34,45 @@ void __init identify_ppc_sys_by_id(u32 i
return;
}
-void __init identify_ppc_sys_by_name(char *name)
+static int __init count_sys_specs(void)
{
- /* TODO */
- return;
+ int i = 0;
+ while (strcmp(ppc_sys_specs[i].ppc_sys_name,""))
+ i++;
+ return i;
+}
+
+static int __init find_chip_by_name_and_id(char *name, u32 id)
+{
+ int ret = -1;
+ unsigned int i = 0;
+ unsigned int j = 0;
+ unsigned int dups = 0;
+
+ unsigned int matched[count_sys_specs()];
+
+ while (strcmp(ppc_sys_specs[i].ppc_sys_name,"")) {
+ if (!strcmp(ppc_sys_specs[i].ppc_sys_name, name))
+ matched[j++]=i;
+ i++;
+ }
+ if(j != 0) {
+ for(i = 0;i < j;i++) {
+ if ((ppc_sys_specs[matched[i]].mask & id) == ppc_sys_specs[matched[i]].value) {
+ ret = matched[i];
+ dups++;
+ }
+ }
+ ret = (dups == 1) ? ret : (-1*dups);
+ }
+ return ret;
+}
+
+void __init identify_ppc_sys_by_name_and_id(char* name, u32 id)
+{
+ int i = find_chip_by_name_and_id(name,id);
+ BUG_ON(i < 0);
+ cur_ppc_sys_spec = &ppc_sys_specs[i];
}
/* Update all memory resources by paddr, call before platform_device_register */
diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
--- a/include/asm-ppc/ppc_sys.h
+++ b/include/asm-ppc/ppc_sys.h
@@ -51,7 +51,7 @@ extern struct ppc_sys_spec *cur_ppc_sys_
/* determine which specific SOC we are */
extern void identify_ppc_sys_by_id(u32 id) __init;
-extern void identify_ppc_sys_by_name(char *name) __init;
+extern void identify_ppc_sys_by_name_and_id(char *name, u32 id) __init;
/* describes all devices that may exist in a given family of processors */
extern struct platform_device ppc_sys_platform_devices[];
next prev parent reply other threads:[~2005-08-10 17:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-10 17:15 [RFC][PATCH] identify_ppc_sys_by_name_and_id function implementation Vitaly Bordug
2005-08-10 17:46 ` Vitaly Bordug [this message]
2005-08-10 18:01 ` [PATCH] identify_ppc_sys_by_name_and_id function implementation final Vitaly Bordug
2005-08-10 19:16 ` Kumar Gala
2005-08-11 5:30 ` Marcelo Tosatti
2005-08-11 15:25 ` Vitaly Bordug
2005-08-11 22:45 ` Marcelo Tosatti
2005-08-12 15:37 ` Vitaly Bordug
2005-08-12 16:18 ` Kumar Gala
2005-08-12 16:30 ` Vitaly Bordug
2005-08-12 19:48 ` Kumar Gala
2005-08-16 13:36 ` Vitaly Bordug
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42FA3D7B.8040200@ru.mvista.com \
--to=vbordug@ru$(echo .)mvista.com \
--cc=galak@freescale$(echo .)com \
--cc=linuxppc-embedded@ozlabs$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox