hyperv/vmbus: Move new channel scan notification to device register

And nuke now unnecessary function indirection.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7103
This commit is contained in:
Sepherosa Ziehau 2016-07-14 06:40:42 +00:00
parent 245903228c
commit dab4260c90
2 changed files with 11 additions and 22 deletions

View File

@ -40,14 +40,12 @@
typedef void (*vmbus_chanmsg_proc_t)
(struct vmbus_softc *, const struct vmbus_message *);
static void vmbus_channel_on_offer_internal(struct vmbus_softc *,
const struct vmbus_chanmsg_choffer *);
static void vmbus_chan_detach_task(void *, int);
static void vmbus_channel_on_offer(struct vmbus_softc *,
const struct vmbus_message *);
static void vmbus_channel_on_offers_delivered(struct vmbus_softc *,
const struct vmbus_message *);
static void vmbus_chan_msgproc_choffer(struct vmbus_softc *,
const struct vmbus_message *);
static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *,
const struct vmbus_message *);
@ -62,7 +60,7 @@ static void vmbus_chan_msgproc_chrescind(struct vmbus_softc *,
static const vmbus_chanmsg_proc_t
vmbus_chanmsg_process[VMBUS_CHANMSG_TYPE_MAX] = {
VMBUS_CHANMSG_PROC(CHOFFER, vmbus_channel_on_offer),
VMBUS_CHANMSG_PROC(CHOFFER, vmbus_chan_msgproc_choffer),
VMBUS_CHANMSG_PROC(CHRESCIND, vmbus_chan_msgproc_chrescind),
VMBUS_CHANMSG_PROC(CHOFFER_DONE,vmbus_channel_on_offers_delivered),
@ -259,28 +257,16 @@ vmbus_channel_select_defcpu(struct hv_vmbus_channel *chan)
vmbus_channel_cpu_set(chan, 0);
}
/**
* @brief Handler for channel offers from Hyper-V/Azure
*
* Handler for channel offers from vmbus in parent partition.
*/
static void
vmbus_channel_on_offer(struct vmbus_softc *sc, const struct vmbus_message *msg)
{
/* New channel is offered by vmbus */
vmbus_scan_newchan(sc);
vmbus_channel_on_offer_internal(sc,
(const struct vmbus_chanmsg_choffer *)msg->msg_data);
}
static void
vmbus_channel_on_offer_internal(struct vmbus_softc *sc,
const struct vmbus_chanmsg_choffer *offer)
vmbus_chan_msgproc_choffer(struct vmbus_softc *sc,
const struct vmbus_message *msg)
{
const struct vmbus_chanmsg_choffer *offer;
hv_vmbus_channel* new_channel;
int error;
offer = (const struct vmbus_chanmsg_choffer *)msg->msg_data;
/*
* Allocate the channel object and save this offer
*/

View File

@ -994,6 +994,9 @@ hv_vmbus_child_device_register(struct hv_vmbus_channel *chan)
device_t parent = sc->vmbus_dev;
int error = 0;
/* New channel has been offered */
vmbus_scan_newchan(sc);
chan->ch_dev = device_add_child(parent, NULL, -1);
if (chan->ch_dev == NULL) {
device_printf(parent, "device_add_child for chan%u failed\n",