ieee1394: Consolidate driver registering
authorBen Collins <ben.collins@ubuntu.com>
Thu, 23 Nov 2006 18:59:48 +0000 (13:59 -0500)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Thu, 7 Dec 2006 22:11:55 +0000 (23:11 +0100)
This patch consolidates some bookkeeping for driver registering. It
closely models what pci_register_driver() does. The main addition is
that the owner of the driver is set, so we get a proper symlink
for /sys/bus/ieee1394/driver/*/module.

Also moves setting of name and bus type into nodemgr. Because of this,
we can remove the EXPORT_SYMBOL for ieee1394_bus_type, since it's now
only used in ieee1394.ko.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/ieee1394/dv1394.c
drivers/ieee1394/eth1394.c
drivers/ieee1394/ieee1394_core.c
drivers/ieee1394/nodemgr.c
drivers/ieee1394/nodemgr.h
drivers/ieee1394/raw1394.c
drivers/ieee1394/sbp2.c
drivers/ieee1394/video1394.c

index 3bd78efd1852b0a417d172747cb4aa9018fedad6..1084da4d88a9d68799954ecac8e0a70eedf9b9d2 100644 (file)
@@ -2180,12 +2180,8 @@ static struct ieee1394_device_id dv1394_id_table[] = {
 MODULE_DEVICE_TABLE(ieee1394, dv1394_id_table);
 
 static struct hpsb_protocol_driver dv1394_driver = {
-       .name           = "DV/1394 Driver",
+       .name           = "dv1394",
        .id_table       = dv1394_id_table,
-       .driver         = {
-               .name   = "dv1394",
-               .bus    = &ieee1394_bus_type,
-       },
 };
 
 
index 27d6c642415dd16af7d94bc81150c2137c1652ac..97e5c3dd044d05aacae220ab5b67d02c5fe2bce6 100644 (file)
@@ -474,12 +474,10 @@ static struct ieee1394_device_id eth1394_id_table[] = {
 MODULE_DEVICE_TABLE(ieee1394, eth1394_id_table);
 
 static struct hpsb_protocol_driver eth1394_proto_driver = {
-       .name           = "IPv4 over 1394 Driver",
+       .name           = ETH1394_DRIVER_NAME,
        .id_table       = eth1394_id_table,
        .update         = eth1394_update,
        .driver         = {
-               .name           = ETH1394_DRIVER_NAME,
-               .bus            = &ieee1394_bus_type,
                .probe          = eth1394_probe,
                .remove         = eth1394_remove,
        },
index 5fccf9f7a1d2e2a72eabffa78404156824156950..7778ab3e8ea4cf1a138f1e1f64c1c3ca50882bf3 100644 (file)
@@ -1237,9 +1237,8 @@ EXPORT_SYMBOL(highlevel_remove_host);
 /** nodemgr.c **/
 EXPORT_SYMBOL(hpsb_node_fill_packet);
 EXPORT_SYMBOL(hpsb_node_write);
-EXPORT_SYMBOL(hpsb_register_protocol);
+EXPORT_SYMBOL(__hpsb_register_protocol);
 EXPORT_SYMBOL(hpsb_unregister_protocol);
-EXPORT_SYMBOL(ieee1394_bus_type);
 #ifdef CONFIG_IEEE1394_EXPORT_FULL_API
 EXPORT_SYMBOL(nodemgr_for_each_host);
 #endif
index d2a543972c8d21adbb86d2caec67975612eac544..2953aebf4ef1ea49e3bc52fbacbf35718a2c5591 100644 (file)
@@ -1282,12 +1282,19 @@ static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp,
 #endif /* CONFIG_HOTPLUG */
 
 
-int hpsb_register_protocol(struct hpsb_protocol_driver *driver)
+int __hpsb_register_protocol(struct hpsb_protocol_driver *drv,
+                            struct module *owner)
 {
+       int error;
+
+       drv->driver.bus = &ieee1394_bus_type;
+       drv->driver.owner = owner;
+       drv->driver.name = drv->name;
+
        /* This will cause a probe for devices */
-       int error = driver_register(&driver->driver);
+       error = driver_register(&drv->driver);
        if (!error)
-               nodemgr_create_drv_files(driver);
+               nodemgr_create_drv_files(drv);
        return error;
 }
 
index 0e1e7d930783e7320a78a7f993fc10f756cadc6f..e25cbadb8be0144e4a1bea0326c23b96bcfce16f 100644 (file)
@@ -144,7 +144,12 @@ struct hpsb_protocol_driver {
        struct device_driver driver;
 };
 
-int hpsb_register_protocol(struct hpsb_protocol_driver *driver);
+int __hpsb_register_protocol(struct hpsb_protocol_driver *, struct module *);
+static inline int hpsb_register_protocol(struct hpsb_protocol_driver *driver)
+{
+       return __hpsb_register_protocol(driver, THIS_MODULE);
+}
+
 void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver);
 
 static inline int hpsb_node_entry_valid(struct node_entry *ne)
index 4889383d309115744a40da352a3262e41c84f7a4..ad2108f27a04783643b84b4b9beb663e3e6f5cdd 100644 (file)
@@ -2987,12 +2987,8 @@ static struct ieee1394_device_id raw1394_id_table[] = {
 MODULE_DEVICE_TABLE(ieee1394, raw1394_id_table);
 
 static struct hpsb_protocol_driver raw1394_driver = {
-       .name = "raw1394 Driver",
+       .name = "raw1394",
        .id_table = raw1394_id_table,
-       .driver = {
-                  .name = "raw1394",
-                  .bus = &ieee1394_bus_type,
-                  },
 };
 
 /******************************************************************************/
index ab7059858bbd8442e7cb5863141c043c0ccd6fd4..ffcd9e41454c572569f3b34aa9f45735764668ee 100644 (file)
@@ -259,12 +259,10 @@ static int sbp2_remove(struct device *);
 static int sbp2_update(struct unit_directory *);
 
 static struct hpsb_protocol_driver sbp2_driver = {
-       .name           = "SBP2 Driver",
+       .name           = SBP2_DEVICE_NAME,
        .id_table       = sbp2_id_table,
        .update         = sbp2_update,
        .driver         = {
-               .name           = SBP2_DEVICE_NAME,
-               .bus            = &ieee1394_bus_type,
                .probe          = sbp2_probe,
                .remove         = sbp2_remove,
        },
index 77f58bc831353a048f8c08b1e6193696047a2c5f..598b19fc5989da426d87510031cd6e4bb105d5d4 100644 (file)
@@ -1308,12 +1308,8 @@ static struct ieee1394_device_id video1394_id_table[] = {
 MODULE_DEVICE_TABLE(ieee1394, video1394_id_table);
 
 static struct hpsb_protocol_driver video1394_driver = {
-       .name           = "1394 Digital Camera Driver",
+       .name           = VIDEO1394_DRIVER_NAME,
        .id_table       = video1394_id_table,
-       .driver         = {
-               .name   = VIDEO1394_DRIVER_NAME,
-               .bus    = &ieee1394_bus_type,
-       },
 };