diff options
Diffstat (limited to 'drivers/connector/connector.c')
-rw-r--r-- | drivers/connector/connector.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 35897079a78d..b49bacfd8de8 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c | |||
@@ -121,6 +121,7 @@ nlmsg_failure: | |||
121 | kfree_skb(skb); | 121 | kfree_skb(skb); |
122 | return -EINVAL; | 122 | return -EINVAL; |
123 | } | 123 | } |
124 | EXPORT_SYMBOL_GPL(cn_netlink_send); | ||
124 | 125 | ||
125 | /* | 126 | /* |
126 | * Callback helper - queues work and setup destructor for given data. | 127 | * Callback helper - queues work and setup destructor for given data. |
@@ -308,6 +309,9 @@ int cn_add_callback(struct cb_id *id, char *name, void (*callback)(void *)) | |||
308 | int err; | 309 | int err; |
309 | struct cn_dev *dev = &cdev; | 310 | struct cn_dev *dev = &cdev; |
310 | 311 | ||
312 | if (!cn_already_initialized) | ||
313 | return -EAGAIN; | ||
314 | |||
311 | err = cn_queue_add_callback(dev->cbdev, name, id, callback); | 315 | err = cn_queue_add_callback(dev->cbdev, name, id, callback); |
312 | if (err) | 316 | if (err) |
313 | return err; | 317 | return err; |
@@ -316,6 +320,7 @@ int cn_add_callback(struct cb_id *id, char *name, void (*callback)(void *)) | |||
316 | 320 | ||
317 | return 0; | 321 | return 0; |
318 | } | 322 | } |
323 | EXPORT_SYMBOL_GPL(cn_add_callback); | ||
319 | 324 | ||
320 | /* | 325 | /* |
321 | * Callback remove routing - removes callback | 326 | * Callback remove routing - removes callback |
@@ -332,6 +337,7 @@ void cn_del_callback(struct cb_id *id) | |||
332 | cn_queue_del_callback(dev->cbdev, id); | 337 | cn_queue_del_callback(dev->cbdev, id); |
333 | cn_notify(id, 1); | 338 | cn_notify(id, 1); |
334 | } | 339 | } |
340 | EXPORT_SYMBOL_GPL(cn_del_callback); | ||
335 | 341 | ||
336 | /* | 342 | /* |
337 | * Checks two connector's control messages to be the same. | 343 | * Checks two connector's control messages to be the same. |
@@ -435,7 +441,7 @@ static void cn_callback(void *data) | |||
435 | mutex_unlock(¬ify_lock); | 441 | mutex_unlock(¬ify_lock); |
436 | } | 442 | } |
437 | 443 | ||
438 | static int __init cn_init(void) | 444 | static int __devinit cn_init(void) |
439 | { | 445 | { |
440 | struct cn_dev *dev = &cdev; | 446 | struct cn_dev *dev = &cdev; |
441 | int err; | 447 | int err; |
@@ -456,21 +462,22 @@ static int __init cn_init(void) | |||
456 | sock_release(dev->nls->sk_socket); | 462 | sock_release(dev->nls->sk_socket); |
457 | return -EINVAL; | 463 | return -EINVAL; |
458 | } | 464 | } |
465 | |||
466 | cn_already_initialized = 1; | ||
459 | 467 | ||
460 | err = cn_add_callback(&dev->id, "connector", &cn_callback); | 468 | err = cn_add_callback(&dev->id, "connector", &cn_callback); |
461 | if (err) { | 469 | if (err) { |
470 | cn_already_initialized = 0; | ||
462 | cn_queue_free_dev(dev->cbdev); | 471 | cn_queue_free_dev(dev->cbdev); |
463 | if (dev->nls->sk_socket) | 472 | if (dev->nls->sk_socket) |
464 | sock_release(dev->nls->sk_socket); | 473 | sock_release(dev->nls->sk_socket); |
465 | return -EINVAL; | 474 | return -EINVAL; |
466 | } | 475 | } |
467 | 476 | ||
468 | cn_already_initialized = 1; | ||
469 | |||
470 | return 0; | 477 | return 0; |
471 | } | 478 | } |
472 | 479 | ||
473 | static void __exit cn_fini(void) | 480 | static void __devexit cn_fini(void) |
474 | { | 481 | { |
475 | struct cn_dev *dev = &cdev; | 482 | struct cn_dev *dev = &cdev; |
476 | 483 | ||
@@ -482,9 +489,5 @@ static void __exit cn_fini(void) | |||
482 | sock_release(dev->nls->sk_socket); | 489 | sock_release(dev->nls->sk_socket); |
483 | } | 490 | } |
484 | 491 | ||
485 | module_init(cn_init); | 492 | subsys_initcall(cn_init); |
486 | module_exit(cn_fini); | 493 | module_exit(cn_fini); |
487 | |||
488 | EXPORT_SYMBOL_GPL(cn_add_callback); | ||
489 | EXPORT_SYMBOL_GPL(cn_del_callback); | ||
490 | EXPORT_SYMBOL_GPL(cn_netlink_send); | ||