diff options
Diffstat (limited to 'drivers/scsi/fcoe/fcoe.c')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 5126685ab982..278958157e24 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -384,7 +384,6 @@ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev, | |||
384 | } | 384 | } |
385 | 385 | ||
386 | dev_hold(netdev); | 386 | dev_hold(netdev); |
387 | kref_init(&fcoe->kref); | ||
388 | 387 | ||
389 | /* | 388 | /* |
390 | * Initialize FIP. | 389 | * Initialize FIP. |
@@ -412,42 +411,6 @@ out: | |||
412 | } | 411 | } |
413 | 412 | ||
414 | /** | 413 | /** |
415 | * fcoe_interface_release() - fcoe_port kref release function | ||
416 | * @kref: Embedded reference count in an fcoe_interface struct | ||
417 | */ | ||
418 | static void fcoe_interface_release(struct kref *kref) | ||
419 | { | ||
420 | struct fcoe_interface *fcoe; | ||
421 | struct net_device *netdev; | ||
422 | |||
423 | fcoe = container_of(kref, struct fcoe_interface, kref); | ||
424 | netdev = fcoe->netdev; | ||
425 | /* tear-down the FCoE controller */ | ||
426 | fcoe_ctlr_destroy(&fcoe->ctlr); | ||
427 | kfree(fcoe); | ||
428 | dev_put(netdev); | ||
429 | module_put(THIS_MODULE); | ||
430 | } | ||
431 | |||
432 | /** | ||
433 | * fcoe_interface_get() - Get a reference to a FCoE interface | ||
434 | * @fcoe: The FCoE interface to be held | ||
435 | */ | ||
436 | static inline void fcoe_interface_get(struct fcoe_interface *fcoe) | ||
437 | { | ||
438 | kref_get(&fcoe->kref); | ||
439 | } | ||
440 | |||
441 | /** | ||
442 | * fcoe_interface_put() - Put a reference to a FCoE interface | ||
443 | * @fcoe: The FCoE interface to be released | ||
444 | */ | ||
445 | static inline void fcoe_interface_put(struct fcoe_interface *fcoe) | ||
446 | { | ||
447 | kref_put(&fcoe->kref, fcoe_interface_release); | ||
448 | } | ||
449 | |||
450 | /** | ||
451 | * fcoe_interface_cleanup() - Clean up a FCoE interface | 414 | * fcoe_interface_cleanup() - Clean up a FCoE interface |
452 | * @fcoe: The FCoE interface to be cleaned up | 415 | * @fcoe: The FCoE interface to be cleaned up |
453 | * | 416 | * |
@@ -494,7 +457,11 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) | |||
494 | rtnl_unlock(); | 457 | rtnl_unlock(); |
495 | 458 | ||
496 | /* Release the self-reference taken during fcoe_interface_create() */ | 459 | /* Release the self-reference taken during fcoe_interface_create() */ |
497 | fcoe_interface_put(fcoe); | 460 | /* tear-down the FCoE controller */ |
461 | fcoe_ctlr_destroy(fip); | ||
462 | kfree(fcoe); | ||
463 | dev_put(netdev); | ||
464 | module_put(THIS_MODULE); | ||
498 | } | 465 | } |
499 | 466 | ||
500 | /** | 467 | /** |
@@ -976,9 +943,6 @@ static void fcoe_if_destroy(struct fc_lport *lport) | |||
976 | dev_uc_del(netdev, port->data_src_addr); | 943 | dev_uc_del(netdev, port->data_src_addr); |
977 | rtnl_unlock(); | 944 | rtnl_unlock(); |
978 | 945 | ||
979 | /* Release reference held in fcoe_if_create() */ | ||
980 | fcoe_interface_put(fcoe); | ||
981 | |||
982 | /* Free queued packets for the per-CPU receive threads */ | 946 | /* Free queued packets for the per-CPU receive threads */ |
983 | fcoe_percpu_clean(lport); | 947 | fcoe_percpu_clean(lport); |
984 | 948 | ||
@@ -1168,7 +1132,6 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe, | |||
1168 | goto out_lp_destroy; | 1132 | goto out_lp_destroy; |
1169 | } | 1133 | } |
1170 | 1134 | ||
1171 | fcoe_interface_get(fcoe); | ||
1172 | return lport; | 1135 | return lport; |
1173 | 1136 | ||
1174 | out_lp_destroy: | 1137 | out_lp_destroy: |
@@ -2113,7 +2076,6 @@ static void fcoe_destroy_work(struct work_struct *work) | |||
2113 | 2076 | ||
2114 | fcoe = port->priv; | 2077 | fcoe = port->priv; |
2115 | fcoe_if_destroy(port->lport); | 2078 | fcoe_if_destroy(port->lport); |
2116 | |||
2117 | fcoe_interface_cleanup(fcoe); | 2079 | fcoe_interface_cleanup(fcoe); |
2118 | 2080 | ||
2119 | mutex_unlock(&fcoe_config_mutex); | 2081 | mutex_unlock(&fcoe_config_mutex); |