Skip to content

Commit 800b932

Browse files
shemmingergregkh
authored andcommitted
vmbus: pass channel to hv_process_channel_removal
Rather than passing relid and then looking up the channel. Pass the channel directly, since caller already knows it. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 581ae6b commit 800b932

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

drivers/hv/channel.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,7 @@ void vmbus_close(struct vmbus_channel *channel)
690690
wait_for_completion(&cur_channel->rescind_event);
691691
mutex_lock(&vmbus_connection.channel_mutex);
692692
vmbus_close_internal(cur_channel);
693-
hv_process_channel_removal(
694-
cur_channel->offermsg.child_relid);
693+
hv_process_channel_removal(cur_channel);
695694
} else {
696695
mutex_lock(&vmbus_connection.channel_mutex);
697696
vmbus_close_internal(cur_channel);

drivers/hv/channel_mgmt.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -385,21 +385,14 @@ static void vmbus_release_relid(u32 relid)
385385
trace_vmbus_release_relid(&msg, ret);
386386
}
387387

388-
void hv_process_channel_removal(u32 relid)
388+
void hv_process_channel_removal(struct vmbus_channel *channel)
389389
{
390+
struct vmbus_channel *primary_channel;
390391
unsigned long flags;
391-
struct vmbus_channel *primary_channel, *channel;
392392

393393
BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex));
394-
395-
/*
396-
* Make sure channel is valid as we may have raced.
397-
*/
398-
channel = relid2channel(relid);
399-
if (!channel)
400-
return;
401-
402394
BUG_ON(!channel->rescind);
395+
403396
if (channel->target_cpu != get_cpu()) {
404397
put_cpu();
405398
smp_call_function_single(channel->target_cpu,
@@ -429,7 +422,7 @@ void hv_process_channel_removal(u32 relid)
429422
cpumask_clear_cpu(channel->target_cpu,
430423
&primary_channel->alloced_cpus_in_node);
431424

432-
vmbus_release_relid(relid);
425+
vmbus_release_relid(channel->offermsg.child_relid);
433426

434427
free_channel(channel);
435428
}
@@ -943,7 +936,7 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
943936
* The channel is currently not open;
944937
* it is safe for us to cleanup the channel.
945938
*/
946-
hv_process_channel_removal(rescind->child_relid);
939+
hv_process_channel_removal(channel);
947940
} else {
948941
complete(&channel->rescind_event);
949942
}

drivers/hv/vmbus_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,10 +864,9 @@ static void vmbus_device_release(struct device *device)
864864
struct vmbus_channel *channel = hv_dev->channel;
865865

866866
mutex_lock(&vmbus_connection.channel_mutex);
867-
hv_process_channel_removal(channel->offermsg.child_relid);
867+
hv_process_channel_removal(channel);
868868
mutex_unlock(&vmbus_connection.channel_mutex);
869869
kfree(hv_dev);
870-
871870
}
872871

873872
/* The one and only one */

include/linux/hyperv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ extern bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp, u8 *buf,
14431443
const int *srv_version, int srv_vercnt,
14441444
int *nego_fw_version, int *nego_srv_version);
14451445

1446-
void hv_process_channel_removal(u32 relid);
1446+
void hv_process_channel_removal(struct vmbus_channel *channel);
14471447

14481448
void vmbus_setevent(struct vmbus_channel *channel);
14491449
/*

0 commit comments

Comments
 (0)