[Linux1394-cvslog] rev 829 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-03-08 07:11:40
|
Author: bencollins Date: 2003-03-08 02:10:59 -0500 (Sat, 08 Mar 2003) New Revision: 829 Modified: trunk/nodemgr.c Log: Hell, let's get real slick and make irm_id and busmgr_id a symlink to the device which is irm or busmgr. Re-arrange a bit for upcoming changes for probe/register of drivers. Modified: trunk/nodemgr.c ============================================================================== --- trunk/nodemgr.c (original) +++ trunk/nodemgr.c 2003-03-08 02:11:00.000000000 -0500 @@ -101,11 +101,6 @@ char daemon_name[15]; }; -struct bus_type ieee1394_bus_type = { - .name = "ieee1394", - .hotplug = NULL, - .add = NULL, -}; #define fw_ne_attr(field, type, format_string) \ static ssize_t fw_ne_show_##field (struct device *dev, char *buf)\ @@ -213,22 +208,6 @@ static DEVICE_ATTR(tlabels_mask,S_IRUGO,fw_ne_show_tlabels_mask,NULL); -static ssize_t fw_host_show_irm(struct device *dev, char *buf) -{ - struct hpsb_host *host = container_of(dev, struct hpsb_host, device); - return sprintf(buf, NODE_BUS_FMT "\n", NODE_BUS_ARGS(host->irm_id)); -} -static DEVICE_ATTR(irm_id,S_IRUGO,fw_host_show_irm,NULL); - - -static ssize_t fw_host_show_busmgr(struct device *dev, char *buf) -{ - struct hpsb_host *host = container_of(dev, struct hpsb_host, device); - return sprintf(buf, NODE_BUS_FMT "\n", NODE_BUS_ARGS(host->busmgr_id)); -} -static DEVICE_ATTR(busmgr_id,S_IRUGO,fw_host_show_busmgr,NULL); - - static void nodemgr_create_ne_dev_files(struct node_entry *ne) { struct device *dev = &ne->device; @@ -246,6 +225,7 @@ static void nodemgr_create_host_dev_files(struct hpsb_host *host) { struct device *dev = &host->device; + struct node_entry *ne; device_create_file(dev, &dev_attr_host_node_count); device_create_file(dev, &dev_attr_host_selfid_count); @@ -255,8 +235,11 @@ device_create_file(dev, &dev_attr_host_is_cycmst); device_create_file(dev, &dev_attr_host_is_irm); device_create_file(dev, &dev_attr_host_is_busmgr); - device_create_file(dev, &dev_attr_irm_id); - device_create_file(dev, &dev_attr_busmgr_id); + + if ((ne = hpsb_nodeid_get_entry(host->irm_id))) + sysfs_create_link(&dev->kobj, &ne->device.kobj, "irm_id"); + if ((ne = hpsb_nodeid_get_entry(host->busmgr_id))) + sysfs_create_link(&dev->kobj, &ne->device.kobj, "busmgr_id"); } static void nodemgr_create_ud_dev_files(struct unit_directory *ud) @@ -285,6 +268,17 @@ } } + +static int nodemgr_bus_match(struct device * dev, struct device_driver * drv) +{ + return 0; +} + +struct bus_type ieee1394_bus_type = { + .name = "ieee1394", + .match = nodemgr_bus_match, +}; + static void nodemgr_process_config_rom(struct node_entry *ne, quadlet_t busoptions); @@ -1385,6 +1379,7 @@ static int nodemgr_host_thread(void *__hi) { struct host_info *hi = (struct host_info *)__hi; + int host_dev_files = 0; /* No userlevel access needed */ daemonize(hi->daemon_name); @@ -1405,6 +1400,12 @@ nodemgr_do_irm_duties(hi->host); up(&nodemgr_serialize); + + /* First time around, let's also create the host dev files */ + if (!host_dev_files) { + nodemgr_create_host_dev_files(hi->host); + host_dev_files = 1; + } } #ifdef CONFIG_IEEE1394_VERBOSEDEBUG HPSB_DEBUG ("NodeMgr: Exiting thread for %s", hi->host->driver->name); @@ -1530,7 +1531,6 @@ sprintf(hi->daemon_name, "knodemgrd/%d", hi->id); device_register(&host->device); - nodemgr_create_host_dev_files(host); hi->pid = kernel_thread(nodemgr_host_thread, hi, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); |