diff options
author | Ben Collins <ben.collins@ubuntu.com> | 2006-11-23 13:59:48 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-12-07 17:11:55 -0500 |
commit | ed30c26ee809b060f437fd9f1b3453e1d0375e32 (patch) | |
tree | 00daeacae861f1a544ed346d5ce4f26700f8f6ba /drivers/ieee1394 | |
parent | 9b7d9c096dd4e4baacc21b2588662bbb56f36c4e (diff) |
ieee1394: Consolidate driver registering
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>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/dv1394.c | 6 | ||||
-rw-r--r-- | drivers/ieee1394/eth1394.c | 4 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_core.c | 3 | ||||
-rw-r--r-- | drivers/ieee1394/nodemgr.c | 13 | ||||
-rw-r--r-- | drivers/ieee1394/nodemgr.h | 7 | ||||
-rw-r--r-- | drivers/ieee1394/raw1394.c | 6 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.c | 4 | ||||
-rw-r--r-- | drivers/ieee1394/video1394.c | 6 |
8 files changed, 22 insertions, 27 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 3bd78efd1852..1084da4d88a9 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -2180,12 +2180,8 @@ static struct ieee1394_device_id dv1394_id_table[] = { | |||
2180 | MODULE_DEVICE_TABLE(ieee1394, dv1394_id_table); | 2180 | MODULE_DEVICE_TABLE(ieee1394, dv1394_id_table); |
2181 | 2181 | ||
2182 | static struct hpsb_protocol_driver dv1394_driver = { | 2182 | static struct hpsb_protocol_driver dv1394_driver = { |
2183 | .name = "DV/1394 Driver", | 2183 | .name = "dv1394", |
2184 | .id_table = dv1394_id_table, | 2184 | .id_table = dv1394_id_table, |
2185 | .driver = { | ||
2186 | .name = "dv1394", | ||
2187 | .bus = &ieee1394_bus_type, | ||
2188 | }, | ||
2189 | }; | 2185 | }; |
2190 | 2186 | ||
2191 | 2187 | ||
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 27d6c642415d..97e5c3dd044d 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -474,12 +474,10 @@ static struct ieee1394_device_id eth1394_id_table[] = { | |||
474 | MODULE_DEVICE_TABLE(ieee1394, eth1394_id_table); | 474 | MODULE_DEVICE_TABLE(ieee1394, eth1394_id_table); |
475 | 475 | ||
476 | static struct hpsb_protocol_driver eth1394_proto_driver = { | 476 | static struct hpsb_protocol_driver eth1394_proto_driver = { |
477 | .name = "IPv4 over 1394 Driver", | 477 | .name = ETH1394_DRIVER_NAME, |
478 | .id_table = eth1394_id_table, | 478 | .id_table = eth1394_id_table, |
479 | .update = eth1394_update, | 479 | .update = eth1394_update, |
480 | .driver = { | 480 | .driver = { |
481 | .name = ETH1394_DRIVER_NAME, | ||
482 | .bus = &ieee1394_bus_type, | ||
483 | .probe = eth1394_probe, | 481 | .probe = eth1394_probe, |
484 | .remove = eth1394_remove, | 482 | .remove = eth1394_remove, |
485 | }, | 483 | }, |
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index 5fccf9f7a1d2..7778ab3e8ea4 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c | |||
@@ -1237,9 +1237,8 @@ EXPORT_SYMBOL(highlevel_remove_host); | |||
1237 | /** nodemgr.c **/ | 1237 | /** nodemgr.c **/ |
1238 | EXPORT_SYMBOL(hpsb_node_fill_packet); | 1238 | EXPORT_SYMBOL(hpsb_node_fill_packet); |
1239 | EXPORT_SYMBOL(hpsb_node_write); | 1239 | EXPORT_SYMBOL(hpsb_node_write); |
1240 | EXPORT_SYMBOL(hpsb_register_protocol); | 1240 | EXPORT_SYMBOL(__hpsb_register_protocol); |
1241 | EXPORT_SYMBOL(hpsb_unregister_protocol); | 1241 | EXPORT_SYMBOL(hpsb_unregister_protocol); |
1242 | EXPORT_SYMBOL(ieee1394_bus_type); | ||
1243 | #ifdef CONFIG_IEEE1394_EXPORT_FULL_API | 1242 | #ifdef CONFIG_IEEE1394_EXPORT_FULL_API |
1244 | EXPORT_SYMBOL(nodemgr_for_each_host); | 1243 | EXPORT_SYMBOL(nodemgr_for_each_host); |
1245 | #endif | 1244 | #endif |
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index d2a543972c8d..2953aebf4ef1 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c | |||
@@ -1282,12 +1282,19 @@ static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, | |||
1282 | #endif /* CONFIG_HOTPLUG */ | 1282 | #endif /* CONFIG_HOTPLUG */ |
1283 | 1283 | ||
1284 | 1284 | ||
1285 | int hpsb_register_protocol(struct hpsb_protocol_driver *driver) | 1285 | int __hpsb_register_protocol(struct hpsb_protocol_driver *drv, |
1286 | struct module *owner) | ||
1286 | { | 1287 | { |
1288 | int error; | ||
1289 | |||
1290 | drv->driver.bus = &ieee1394_bus_type; | ||
1291 | drv->driver.owner = owner; | ||
1292 | drv->driver.name = drv->name; | ||
1293 | |||
1287 | /* This will cause a probe for devices */ | 1294 | /* This will cause a probe for devices */ |
1288 | int error = driver_register(&driver->driver); | 1295 | error = driver_register(&drv->driver); |
1289 | if (!error) | 1296 | if (!error) |
1290 | nodemgr_create_drv_files(driver); | 1297 | nodemgr_create_drv_files(drv); |
1291 | return error; | 1298 | return error; |
1292 | } | 1299 | } |
1293 | 1300 | ||
diff --git a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h index 0e1e7d930783..e25cbadb8be0 100644 --- a/drivers/ieee1394/nodemgr.h +++ b/drivers/ieee1394/nodemgr.h | |||
@@ -144,7 +144,12 @@ struct hpsb_protocol_driver { | |||
144 | struct device_driver driver; | 144 | struct device_driver driver; |
145 | }; | 145 | }; |
146 | 146 | ||
147 | int hpsb_register_protocol(struct hpsb_protocol_driver *driver); | 147 | int __hpsb_register_protocol(struct hpsb_protocol_driver *, struct module *); |
148 | static inline int hpsb_register_protocol(struct hpsb_protocol_driver *driver) | ||
149 | { | ||
150 | return __hpsb_register_protocol(driver, THIS_MODULE); | ||
151 | } | ||
152 | |||
148 | void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver); | 153 | void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver); |
149 | 154 | ||
150 | static inline int hpsb_node_entry_valid(struct node_entry *ne) | 155 | static inline int hpsb_node_entry_valid(struct node_entry *ne) |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 4889383d3091..ad2108f27a04 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -2987,12 +2987,8 @@ static struct ieee1394_device_id raw1394_id_table[] = { | |||
2987 | MODULE_DEVICE_TABLE(ieee1394, raw1394_id_table); | 2987 | MODULE_DEVICE_TABLE(ieee1394, raw1394_id_table); |
2988 | 2988 | ||
2989 | static struct hpsb_protocol_driver raw1394_driver = { | 2989 | static struct hpsb_protocol_driver raw1394_driver = { |
2990 | .name = "raw1394 Driver", | 2990 | .name = "raw1394", |
2991 | .id_table = raw1394_id_table, | 2991 | .id_table = raw1394_id_table, |
2992 | .driver = { | ||
2993 | .name = "raw1394", | ||
2994 | .bus = &ieee1394_bus_type, | ||
2995 | }, | ||
2996 | }; | 2992 | }; |
2997 | 2993 | ||
2998 | /******************************************************************************/ | 2994 | /******************************************************************************/ |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index ab7059858bbd..ffcd9e41454c 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -259,12 +259,10 @@ static int sbp2_remove(struct device *); | |||
259 | static int sbp2_update(struct unit_directory *); | 259 | static int sbp2_update(struct unit_directory *); |
260 | 260 | ||
261 | static struct hpsb_protocol_driver sbp2_driver = { | 261 | static struct hpsb_protocol_driver sbp2_driver = { |
262 | .name = "SBP2 Driver", | 262 | .name = SBP2_DEVICE_NAME, |
263 | .id_table = sbp2_id_table, | 263 | .id_table = sbp2_id_table, |
264 | .update = sbp2_update, | 264 | .update = sbp2_update, |
265 | .driver = { | 265 | .driver = { |
266 | .name = SBP2_DEVICE_NAME, | ||
267 | .bus = &ieee1394_bus_type, | ||
268 | .probe = sbp2_probe, | 266 | .probe = sbp2_probe, |
269 | .remove = sbp2_remove, | 267 | .remove = sbp2_remove, |
270 | }, | 268 | }, |
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index 77f58bc83135..598b19fc5989 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c | |||
@@ -1308,12 +1308,8 @@ static struct ieee1394_device_id video1394_id_table[] = { | |||
1308 | MODULE_DEVICE_TABLE(ieee1394, video1394_id_table); | 1308 | MODULE_DEVICE_TABLE(ieee1394, video1394_id_table); |
1309 | 1309 | ||
1310 | static struct hpsb_protocol_driver video1394_driver = { | 1310 | static struct hpsb_protocol_driver video1394_driver = { |
1311 | .name = "1394 Digital Camera Driver", | 1311 | .name = VIDEO1394_DRIVER_NAME, |
1312 | .id_table = video1394_id_table, | 1312 | .id_table = video1394_id_table, |
1313 | .driver = { | ||
1314 | .name = VIDEO1394_DRIVER_NAME, | ||
1315 | .bus = &ieee1394_bus_type, | ||
1316 | }, | ||
1317 | }; | 1313 | }; |
1318 | 1314 | ||
1319 | 1315 | ||