brcm47xx: BCMA - Consolidate/reduce code in bcma_device_name
Eliminate unneeded procedure by incorporating code into bcma_device_name Signed-off-by: Nathan Hintz <nlhintz@hotmail.com> SVN-Revision: 31120
This commit is contained in:
parent
a31a9b8650
commit
2f6e19e203
1 changed files with 10 additions and 25 deletions
|
@ -48,7 +48,7 @@
|
||||||
{ BCMA_CORE_MAC_GBIT, "GBit MAC" },
|
{ BCMA_CORE_MAC_GBIT, "GBit MAC" },
|
||||||
{ BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" },
|
{ BCMA_CORE_DDR12_MEM_CTL, "DDR1/DDR2 Memory Controller" },
|
||||||
{ BCMA_CORE_PCIE_RC, "PCIe Root Complex" },
|
{ BCMA_CORE_PCIE_RC, "PCIe Root Complex" },
|
||||||
@@ -79,16 +80,57 @@ struct bcma_device_id_name bcma_device_n
|
@@ -79,16 +80,41 @@ struct bcma_device_id_name bcma_device_n
|
||||||
{ BCMA_CORE_SHIM, "SHIM" },
|
{ BCMA_CORE_SHIM, "SHIM" },
|
||||||
{ BCMA_CORE_DEFAULT, "Default" },
|
{ BCMA_CORE_DEFAULT, "Default" },
|
||||||
};
|
};
|
||||||
|
@ -60,30 +60,17 @@
|
||||||
+ { BCMA_CORE_MIPS_74K, "MIPS 74K" },
|
+ { BCMA_CORE_MIPS_74K, "MIPS 74K" },
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+static const char *bcma_scan_device_names(const struct bcma_device_id *id,
|
+static const char *bcma_device_name(const struct bcma_device_id *id)
|
||||||
+ const struct bcma_device_id_name *device_names,
|
|
||||||
+ int array_size)
|
|
||||||
{
|
{
|
||||||
int i;
|
- int i;
|
||||||
|
+ const struct bcma_device_id_name *names;
|
||||||
|
+ int size, i;
|
||||||
|
|
||||||
- if (id->manuf == BCMA_MANUF_BCM) {
|
- if (id->manuf == BCMA_MANUF_BCM) {
|
||||||
- for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
|
- for (i = 0; i < ARRAY_SIZE(bcma_device_names); i++) {
|
||||||
- if (bcma_device_names[i].id == id->id)
|
- if (bcma_device_names[i].id == id->id)
|
||||||
- return bcma_device_names[i].name;
|
- return bcma_device_names[i].name;
|
||||||
- }
|
- }
|
||||||
+ for (i = 0; i < array_size; i++) {
|
|
||||||
+ if (device_names[i].id == id->id)
|
|
||||||
+ return device_names[i].name;
|
|
||||||
}
|
|
||||||
+ return NULL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static const char *bcma_device_name(const struct bcma_device_id *id)
|
|
||||||
+{
|
|
||||||
+ const char *name;
|
|
||||||
+ const struct bcma_device_id_name *names;
|
|
||||||
+ int size;
|
|
||||||
+
|
|
||||||
+ /* search manufacturer specific names */
|
+ /* search manufacturer specific names */
|
||||||
+ switch (id->manuf) {
|
+ switch (id->manuf) {
|
||||||
+ case BCMA_MANUF_ARM:
|
+ case BCMA_MANUF_ARM:
|
||||||
|
@ -99,14 +86,12 @@
|
||||||
+ size = ARRAY_SIZE(bcma_mips_device_names);
|
+ size = ARRAY_SIZE(bcma_mips_device_names);
|
||||||
+ break;
|
+ break;
|
||||||
+ default:
|
+ default:
|
||||||
+ names = NULL;
|
+ return "UNKNOWN";
|
||||||
+ break;
|
}
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
+ if (names) {
|
+ for (i = 0; i < size; i++) {
|
||||||
+ name = bcma_scan_device_names(id, names, size);
|
+ if (names[i].id == id->id)
|
||||||
+ if (name)
|
+ return names[i].name;
|
||||||
+ return name;
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
|
|
Loading…
Reference in a new issue