Skip to content

Commit 8851756

Browse files
igawChristoph Hellwig
authored andcommitted
nvmet-fc: inline nvmet_fc_free_hostport
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>
1 parent aeaa091 commit 8851756

File tree

1 file changed

+6
-16
lines changed
  • drivers/nvme/target

1 file changed

+6
-16
lines changed

drivers/nvme/target/fc.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -995,16 +995,6 @@ nvmet_fc_hostport_get(struct nvmet_fc_hostport *hostport)
995995
return kref_get_unless_zero(&hostport->ref);
996996
}
997997

998-
static void
999-
nvmet_fc_free_hostport(struct nvmet_fc_hostport *hostport)
1000-
{
1001-
/* if LLDD not implemented, leave as NULL */
1002-
if (!hostport || !hostport->hosthandle)
1003-
return;
1004-
1005-
nvmet_fc_hostport_put(hostport);
1006-
}
1007-
1008998
static struct nvmet_fc_hostport *
1009999
nvmet_fc_match_hostport(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
10101000
{
@@ -1184,7 +1174,7 @@ nvmet_fc_target_assoc_free(struct kref *ref)
11841174
/* Send Disconnect now that all i/o has completed */
11851175
nvmet_fc_xmt_disconnect_assoc(assoc);
11861176

1187-
nvmet_fc_free_hostport(assoc->hostport);
1177+
nvmet_fc_hostport_put(assoc->hostport);
11881178
spin_lock_irqsave(&tgtport->lock, flags);
11891179
oldls = assoc->rcv_disconn;
11901180
spin_unlock_irqrestore(&tgtport->lock, flags);
@@ -1449,11 +1439,6 @@ nvmet_fc_free_tgtport(struct kref *ref)
14491439
struct nvmet_fc_tgtport *tgtport =
14501440
container_of(ref, struct nvmet_fc_tgtport, ref);
14511441
struct device *dev = tgtport->dev;
1452-
unsigned long flags;
1453-
1454-
spin_lock_irqsave(&nvmet_fc_tgtlock, flags);
1455-
list_del(&tgtport->tgt_list);
1456-
spin_unlock_irqrestore(&nvmet_fc_tgtlock, flags);
14571442

14581443
nvmet_fc_free_ls_iodlist(tgtport);
14591444

@@ -1614,6 +1599,11 @@ int
16141599
nvmet_fc_unregister_targetport(struct nvmet_fc_target_port *target_port)
16151600
{
16161601
struct nvmet_fc_tgtport *tgtport = targetport_to_tgtport(target_port);
1602+
unsigned long flags;
1603+
1604+
spin_lock_irqsave(&nvmet_fc_tgtlock, flags);
1605+
list_del(&tgtport->tgt_list);
1606+
spin_unlock_irqrestore(&nvmet_fc_tgtlock, flags);
16171607

16181608
nvmet_fc_portentry_unbind_tgt(tgtport);
16191609

0 commit comments

Comments
 (0)