aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/nodemgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/nodemgr.c')
-rw-r--r--drivers/ieee1394/nodemgr.c63
1 files changed, 16 insertions, 47 deletions
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 61307ca296ae..ba9faeff4793 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -41,22 +41,6 @@ struct nodemgr_csr_info {
41}; 41};
42 42
43 43
44static char *nodemgr_find_oui_name(int oui)
45{
46#ifdef CONFIG_IEEE1394_OUI_DB
47 extern struct oui_list_struct {
48 int oui;
49 char *name;
50 } oui_list[];
51 int i;
52
53 for (i = 0; oui_list[i].name; i++)
54 if (oui_list[i].oui == oui)
55 return oui_list[i].name;
56#endif
57 return NULL;
58}
59
60/* 44/*
61 * Correct the speed map entry. This is necessary 45 * Correct the speed map entry. This is necessary
62 * - for nodes with link speed < phy speed, 46 * - for nodes with link speed < phy speed,
@@ -274,7 +258,6 @@ static struct device_driver nodemgr_mid_layer_driver = {
274struct device nodemgr_dev_template_host = { 258struct device nodemgr_dev_template_host = {
275 .bus = &ieee1394_bus_type, 259 .bus = &ieee1394_bus_type,
276 .release = nodemgr_release_host, 260 .release = nodemgr_release_host,
277 .driver = &nodemgr_mid_layer_driver,
278}; 261};
279 262
280 263
@@ -473,11 +456,9 @@ fw_attr(ne, struct node_entry, nodeid, unsigned int, "0x%04x\n")
473 456
474fw_attr(ne, struct node_entry, vendor_id, unsigned int, "0x%06x\n") 457fw_attr(ne, struct node_entry, vendor_id, unsigned int, "0x%06x\n")
475fw_attr_td(ne, struct node_entry, vendor_name_kv) 458fw_attr_td(ne, struct node_entry, vendor_name_kv)
476fw_attr(ne, struct node_entry, vendor_oui, const char *, "%s\n")
477 459
478fw_attr(ne, struct node_entry, guid, unsigned long long, "0x%016Lx\n") 460fw_attr(ne, struct node_entry, guid, unsigned long long, "0x%016Lx\n")
479fw_attr(ne, struct node_entry, guid_vendor_id, unsigned int, "0x%06x\n") 461fw_attr(ne, struct node_entry, guid_vendor_id, unsigned int, "0x%06x\n")
480fw_attr(ne, struct node_entry, guid_vendor_oui, const char *, "%s\n")
481fw_attr(ne, struct node_entry, in_limbo, int, "%d\n"); 462fw_attr(ne, struct node_entry, in_limbo, int, "%d\n");
482 463
483static struct device_attribute *const fw_ne_attrs[] = { 464static struct device_attribute *const fw_ne_attrs[] = {
@@ -503,7 +484,6 @@ fw_attr(ud, struct unit_directory, model_id, unsigned int, "0x%06x\n")
503fw_attr(ud, struct unit_directory, specifier_id, unsigned int, "0x%06x\n") 484fw_attr(ud, struct unit_directory, specifier_id, unsigned int, "0x%06x\n")
504fw_attr(ud, struct unit_directory, version, unsigned int, "0x%06x\n") 485fw_attr(ud, struct unit_directory, version, unsigned int, "0x%06x\n")
505fw_attr_td(ud, struct unit_directory, vendor_name_kv) 486fw_attr_td(ud, struct unit_directory, vendor_name_kv)
506fw_attr(ud, struct unit_directory, vendor_oui, const char *, "%s\n")
507fw_attr_td(ud, struct unit_directory, model_name_kv) 487fw_attr_td(ud, struct unit_directory, model_name_kv)
508 488
509static struct device_attribute *const fw_ud_attrs[] = { 489static struct device_attribute *const fw_ud_attrs[] = {
@@ -865,7 +845,6 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr
865 845
866 ne->guid = guid; 846 ne->guid = guid;
867 ne->guid_vendor_id = (guid >> 40) & 0xffffff; 847 ne->guid_vendor_id = (guid >> 40) & 0xffffff;
868 ne->guid_vendor_oui = nodemgr_find_oui_name(ne->guid_vendor_id);
869 ne->csr = csr; 848 ne->csr = csr;
870 849
871 memcpy(&ne->device, &nodemgr_dev_template_ne, 850 memcpy(&ne->device, &nodemgr_dev_template_ne,
@@ -885,9 +864,6 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr
885 goto fail_classdevreg; 864 goto fail_classdevreg;
886 get_device(&ne->device); 865 get_device(&ne->device);
887 866
888 if (ne->guid_vendor_oui &&
889 device_create_file(&ne->device, &dev_attr_ne_guid_vendor_oui))
890 goto fail_addoiu;
891 nodemgr_create_ne_dev_files(ne); 867 nodemgr_create_ne_dev_files(ne);
892 868
893 nodemgr_update_bus_options(ne); 869 nodemgr_update_bus_options(ne);
@@ -898,8 +874,6 @@ static struct node_entry *nodemgr_create_node(octlet_t guid, struct csr1212_csr
898 874
899 return ne; 875 return ne;
900 876
901fail_addoiu:
902 put_device(&ne->device);
903fail_classdevreg: 877fail_classdevreg:
904 device_unregister(&ne->device); 878 device_unregister(&ne->device);
905fail_devreg: 879fail_devreg:
@@ -975,15 +949,10 @@ static void nodemgr_register_device(struct node_entry *ne,
975 goto fail_classdevreg; 949 goto fail_classdevreg;
976 get_device(&ud->device); 950 get_device(&ud->device);
977 951
978 if (ud->vendor_oui &&
979 device_create_file(&ud->device, &dev_attr_ud_vendor_oui))
980 goto fail_addoui;
981 nodemgr_create_ud_dev_files(ud); 952 nodemgr_create_ud_dev_files(ud);
982 953
983 return; 954 return;
984 955
985fail_addoui:
986 put_device(&ud->device);
987fail_classdevreg: 956fail_classdevreg:
988 device_unregister(&ud->device); 957 device_unregister(&ud->device);
989fail_devreg: 958fail_devreg:
@@ -1020,9 +989,6 @@ static struct unit_directory *nodemgr_process_unit_directory
1020 if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) { 989 if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
1021 ud->vendor_id = kv->value.immediate; 990 ud->vendor_id = kv->value.immediate;
1022 ud->flags |= UNIT_DIRECTORY_VENDOR_ID; 991 ud->flags |= UNIT_DIRECTORY_VENDOR_ID;
1023
1024 if (ud->vendor_id)
1025 ud->vendor_oui = nodemgr_find_oui_name(ud->vendor_id);
1026 } 992 }
1027 break; 993 break;
1028 994
@@ -1153,9 +1119,6 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent
1153 switch (kv->key.id) { 1119 switch (kv->key.id) {
1154 case CSR1212_KV_ID_VENDOR: 1120 case CSR1212_KV_ID_VENDOR:
1155 ne->vendor_id = kv->value.immediate; 1121 ne->vendor_id = kv->value.immediate;
1156
1157 if (ne->vendor_id)
1158 ne->vendor_oui = nodemgr_find_oui_name(ne->vendor_id);
1159 break; 1122 break;
1160 1123
1161 case CSR1212_KV_ID_NODE_CAPABILITIES: 1124 case CSR1212_KV_ID_NODE_CAPABILITIES:
@@ -1183,9 +1146,6 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent
1183 last_key_id = kv->key.id; 1146 last_key_id = kv->key.id;
1184 } 1147 }
1185 1148
1186 if (ne->vendor_oui &&
1187 device_create_file(&ne->device, &dev_attr_ne_vendor_oui))
1188 goto fail;
1189 if (ne->vendor_name_kv && 1149 if (ne->vendor_name_kv &&
1190 device_create_file(&ne->device, &dev_attr_ne_vendor_name_kv)) 1150 device_create_file(&ne->device, &dev_attr_ne_vendor_name_kv))
1191 goto fail; 1151 goto fail;
@@ -1889,22 +1849,31 @@ int init_ieee1394_nodemgr(void)
1889 1849
1890 error = class_register(&nodemgr_ne_class); 1850 error = class_register(&nodemgr_ne_class);
1891 if (error) 1851 if (error)
1892 return error; 1852 goto fail_ne;
1893
1894 error = class_register(&nodemgr_ud_class); 1853 error = class_register(&nodemgr_ud_class);
1895 if (error) { 1854 if (error)
1896 class_unregister(&nodemgr_ne_class); 1855 goto fail_ud;
1897 return error;
1898 }
1899 error = driver_register(&nodemgr_mid_layer_driver); 1856 error = driver_register(&nodemgr_mid_layer_driver);
1857 if (error)
1858 goto fail_ml;
1859 /* This driver is not used if nodemgr is off (disable_nodemgr=1). */
1860 nodemgr_dev_template_host.driver = &nodemgr_mid_layer_driver;
1861
1900 hpsb_register_highlevel(&nodemgr_highlevel); 1862 hpsb_register_highlevel(&nodemgr_highlevel);
1901 return 0; 1863 return 0;
1864
1865fail_ml:
1866 class_unregister(&nodemgr_ud_class);
1867fail_ud:
1868 class_unregister(&nodemgr_ne_class);
1869fail_ne:
1870 return error;
1902} 1871}
1903 1872
1904void cleanup_ieee1394_nodemgr(void) 1873void cleanup_ieee1394_nodemgr(void)
1905{ 1874{
1906 hpsb_unregister_highlevel(&nodemgr_highlevel); 1875 hpsb_unregister_highlevel(&nodemgr_highlevel);
1907 1876 driver_unregister(&nodemgr_mid_layer_driver);
1908 class_unregister(&nodemgr_ud_class); 1877 class_unregister(&nodemgr_ud_class);
1909 class_unregister(&nodemgr_ne_class); 1878 class_unregister(&nodemgr_ne_class);
1910} 1879}