[Linux1394-cvslog] rev 823 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-03-07 19:12:37
|
Author: bencollins Date: 2003-03-07 14:11:50 -0500 (Fri, 07 Mar 2003) New Revision: 823 Modified: trunk/nodemgr.c trunk/nodemgr.h Log: Add devices for unit directories aswell. Next step will be to move all the info we normally export in /proc/bus/ieee1394/devices into attributes of the ne and ud devices. Modified: trunk/nodemgr.c ============================================================================== --- trunk/nodemgr.c (original) +++ trunk/nodemgr.c 2003-03-07 14:11:51.000000000 -0500 @@ -395,8 +395,6 @@ list_add_tail(&ne->list, &node_list); - nodemgr_process_config_rom (ne, busoptions); - ne->device.parent = &host->device; sprintf(ne->device.bus_id, "%u-" NODE_BUS_FMT, hi->id, NODE_BUS_ARGS(nodeid)); sprintf(ne->device.name, "IEEE-1394 device %s", ne->device.bus_id); @@ -404,6 +402,8 @@ device_register(&ne->device); + nodemgr_process_config_rom (ne, busoptions); + HPSB_DEBUG("%s added: ID:BUS[%s] GUID[%016Lx] [%s] (%s)", (host->node_id == nodeid) ? "Host" : "Node", ne->device.bus_id, (unsigned long long)guid, @@ -520,10 +520,12 @@ return NULL; } } + total_size += count * sizeof (quadlet_t); ud = kmalloc (total_size, GFP_KERNEL); + if (ud != NULL) { - memset (ud, 0, sizeof *ud); + memset (ud, 0, total_size); ud->flags = flags; ud->count = count; ud->vendor_name_size = vendor_name_size; @@ -532,6 +534,7 @@ use the one in the root directory. */ ud->vendor_name = ne->vendor_name; } + return ud; } @@ -541,7 +544,7 @@ */ static void nodemgr_process_unit_directory(struct node_entry *ne, - octlet_t address) + octlet_t address, unsigned int id) { struct unit_directory *ud; quadlet_t quad; @@ -553,6 +556,7 @@ ud->ne = ne; ud->address = address; + ud->id = id; if (nodemgr_read_quadlet(ne->host, ne->nodeid, ne->generation, address, &quad)) @@ -642,6 +646,13 @@ list_add_tail(&ud->node_list, &ne->unit_directories); list_add_tail(&ud->driver_list, &unit_directory_list); + ud->device.parent = &ne->device; + sprintf(ud->device.bus_id, "%s-%u", ne->device.bus_id, ud->id); + sprintf(ud->device.name, "IEEE-1394 unit directory %s", ud->device.bus_id); + ud->device.bus = &ieee1394_bus_type; + + device_register(&ud->device); + return; unit_directory_error: @@ -682,6 +693,7 @@ octlet_t address; quadlet_t quad; int length; + unsigned int ud_id = 0; address = CSR_REGISTER_BASE + CSR_CONFIG_ROM; @@ -734,7 +746,7 @@ break; case CONFIG_ROM_UNIT_DIRECTORY: - nodemgr_process_unit_directory(ne, address + value * 4); + nodemgr_process_unit_directory(ne, address + value * 4, ud_id++); break; case CONFIG_ROM_DESCRIPTOR_LEAF: @@ -836,6 +848,7 @@ static void nodemgr_release_unit_directory(struct unit_directory *ud) { + device_unregister(&ud->device); ud->driver = NULL; list_del(&ud->driver_list); list_add_tail(&ud->driver_list, &unit_directory_list); Modified: trunk/nodemgr.h ============================================================================== --- trunk/nodemgr.h (original) +++ trunk/nodemgr.h 2003-03-07 14:11:51.000000000 -0500 @@ -117,6 +117,8 @@ /* For linking directories belonging to a node */ struct list_head node_list; + unsigned int id; + int count; /* Number of quadlets */ struct device device; |