]> www.infradead.org Git - nvme.git/commitdiff
nvmet-fc: inline nvmet_fc_free_hostport
authorDaniel Wagner <wagi@kernel.org>
Tue, 8 Apr 2025 15:29:07 +0000 (17:29 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 9 Apr 2025 11:03:56 +0000 (13:03 +0200)
No need for this tiny helper with only one user, let's inline it.

And since the hostport ref counter needs to stay in sync, it's not
optional anymore to give back the reference.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/fc.c

index 6487c46ebba8d12e573d19fe8c39d526492c506a..6d64dadcb356b78b522d0deaa433cc745bfcd8f6 100644 (file)
@@ -995,16 +995,6 @@ nvmet_fc_hostport_get(struct nvmet_fc_hostport *hostport)
        return kref_get_unless_zero(&hostport->ref);
 }
 
-static void
-nvmet_fc_free_hostport(struct nvmet_fc_hostport *hostport)
-{
-       /* if LLDD not implemented, leave as NULL */
-       if (!hostport || !hostport->hosthandle)
-               return;
-
-       nvmet_fc_hostport_put(hostport);
-}
-
 static struct nvmet_fc_hostport *
 nvmet_fc_match_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
 {
@@ -1184,7 +1174,7 @@ nvmet_fc_target_assoc_free(struct kref *ref)
        /* Send Disconnect now that all i/o has completed */
        nvmet_fc_xmt_disconnect_assoc(assoc);
 
-       nvmet_fc_free_hostport(assoc->hostport);
+       nvmet_fc_hostport_put(assoc->hostport);
        spin_lock_irqsave(&tgtport->lock, flags);
        oldls = assoc->rcv_disconn;
        spin_unlock_irqrestore(&tgtport->lock, flags);
@@ -1449,11 +1439,6 @@ nvmet_fc_free_tgtport(struct kref *ref)
        struct nvmet_fc_tgtport *tgtport =
                container_of(ref, struct nvmet_fc_tgtport, ref);
        struct device *dev = tgtport->dev;
-       unsigned long flags;
-
-       spin_lock_irqsave(&nvmet_fc_tgtlock, flags);
-       list_del(&tgtport->tgt_list);
-       spin_unlock_irqrestore(&nvmet_fc_tgtlock, flags);
 
        nvmet_fc_free_ls_iodlist(tgtport);
 
@@ -1614,6 +1599,11 @@ int
 nvmet_fc_unregister_targetport(struct nvmet_fc_target_port *target_port)
 {
        struct nvmet_fc_tgtport *tgtport = targetport_to_tgtport(target_port);
+       unsigned long flags;
+
+       spin_lock_irqsave(&nvmet_fc_tgtlock, flags);
+       list_del(&tgtport->tgt_list);
+       spin_unlock_irqrestore(&nvmet_fc_tgtlock, flags);
 
        nvmet_fc_portentry_unbind_tgt(tgtport);