diff options
author | Roland Dreier <roland@purestorage.com> | 2012-05-02 18:42:33 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-05-08 14:17:49 -0400 |
commit | 349556692df946b9cd5b84f2b0fa09b98732e986 (patch) | |
tree | 3c887f8b85e864b103aff9a56c75c8f756185470 /drivers/infiniband/hw/ocrdma/ocrdma_main.c | |
parent | d19081e044356ae6464e939aef04514c5e227b5a (diff) |
RDMA/ocrdma: Fix build with IPV6=n
When IPV6 is not enabled:
ERROR: "register_inet6addr_notifier" [drivers/infiniband/hw/ocrdma/ocrdma.ko] undefined!
ERROR: "unregister_inet6addr_notifier" [drivers/infiniband/hw/ocrdma/ocrdma.ko] undefined!
Fix this by wrapping the inet6 calls in #ifdef IPV6. Also make the
ocrdma module depend on (IPV6 || IPV6=n) to forbid the case of modular
ipv6 but built-in ocrdma (which can't work, because ocrdma calls ipv6
functions).
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/ocrdma/ocrdma_main.c')
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_main.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 0bc1efb02ff5..a20d16eaae71 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c | |||
@@ -51,12 +51,6 @@ static DEFINE_SPINLOCK(ocrdma_devlist_lock); | |||
51 | static DEFINE_IDR(ocrdma_dev_id); | 51 | static DEFINE_IDR(ocrdma_dev_id); |
52 | 52 | ||
53 | static union ib_gid ocrdma_zero_sgid; | 53 | static union ib_gid ocrdma_zero_sgid; |
54 | static int ocrdma_inet6addr_event(struct notifier_block *, | ||
55 | unsigned long, void *); | ||
56 | |||
57 | static struct notifier_block ocrdma_inet6addr_notifier = { | ||
58 | .notifier_call = ocrdma_inet6addr_event | ||
59 | }; | ||
60 | 54 | ||
61 | static int ocrdma_get_instance(void) | 55 | static int ocrdma_get_instance(void) |
62 | { | 56 | { |
@@ -204,6 +198,8 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) | |||
204 | return 0; | 198 | return 0; |
205 | } | 199 | } |
206 | 200 | ||
201 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
202 | |||
207 | static int ocrdma_inet6addr_event(struct notifier_block *notifier, | 203 | static int ocrdma_inet6addr_event(struct notifier_block *notifier, |
208 | unsigned long event, void *ptr) | 204 | unsigned long event, void *ptr) |
209 | { | 205 | { |
@@ -259,6 +255,12 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier, | |||
259 | return NOTIFY_OK; | 255 | return NOTIFY_OK; |
260 | } | 256 | } |
261 | 257 | ||
258 | static struct notifier_block ocrdma_inet6addr_notifier = { | ||
259 | .notifier_call = ocrdma_inet6addr_event | ||
260 | }; | ||
261 | |||
262 | #endif /* IPV6 */ | ||
263 | |||
262 | static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device, | 264 | static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device, |
263 | u8 port_num) | 265 | u8 port_num) |
264 | { | 266 | { |
@@ -541,23 +543,34 @@ static struct ocrdma_driver ocrdma_drv = { | |||
541 | .state_change_handler = ocrdma_event_handler, | 543 | .state_change_handler = ocrdma_event_handler, |
542 | }; | 544 | }; |
543 | 545 | ||
546 | static void ocrdma_unregister_inet6addr_notifier(void) | ||
547 | { | ||
548 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
549 | unregister_inet6addr_notifier(&ocrdma_inet6addr_notifier); | ||
550 | #endif | ||
551 | } | ||
552 | |||
544 | static int __init ocrdma_init_module(void) | 553 | static int __init ocrdma_init_module(void) |
545 | { | 554 | { |
546 | int status; | 555 | int status; |
547 | 556 | ||
557 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
548 | status = register_inet6addr_notifier(&ocrdma_inet6addr_notifier); | 558 | status = register_inet6addr_notifier(&ocrdma_inet6addr_notifier); |
549 | if (status) | 559 | if (status) |
550 | return status; | 560 | return status; |
561 | #endif | ||
562 | |||
551 | status = be_roce_register_driver(&ocrdma_drv); | 563 | status = be_roce_register_driver(&ocrdma_drv); |
552 | if (status) | 564 | if (status) |
553 | unregister_inet6addr_notifier(&ocrdma_inet6addr_notifier); | 565 | ocrdma_unregister_inet6addr_notifier(); |
566 | |||
554 | return status; | 567 | return status; |
555 | } | 568 | } |
556 | 569 | ||
557 | static void __exit ocrdma_exit_module(void) | 570 | static void __exit ocrdma_exit_module(void) |
558 | { | 571 | { |
559 | be_roce_unregister_driver(&ocrdma_drv); | 572 | be_roce_unregister_driver(&ocrdma_drv); |
560 | unregister_inet6addr_notifier(&ocrdma_inet6addr_notifier); | 573 | ocrdma_unregister_inet6addr_notifier(); |
561 | } | 574 | } |
562 | 575 | ||
563 | module_init(ocrdma_init_module); | 576 | module_init(ocrdma_init_module); |