summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/utilities/hv_util.c
diff options
context:
space:
mode:
authorsephe <sephe@FreeBSD.org>2016-10-11 07:30:59 +0000
committersephe <sephe@FreeBSD.org>2016-10-11 07:30:59 +0000
commite454e6f1254efd4b2d767a04a4e076f85863c58c (patch)
tree7062d628c193dc4f758f1b55865b14a9e36a53b0 /sys/dev/hyperv/utilities/hv_util.c
parent5aca196a1235050ca5edda3bcef3ce631a06097b (diff)
downloadFreeBSD-src-e454e6f1254efd4b2d767a04a4e076f85863c58c.zip
FreeBSD-src-e454e6f1254efd4b2d767a04a4e076f85863c58c.tar.gz
MFC 302698-302704,302706
302698 hyperv/vmbus: Add vmbus method for GUID base device probing. Reduce the exposure of hv_device. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7024 302699 hyperv/vmbus: All ivars are read-only; nuke unnecessary write_ivar Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7025 302700 hyperv/vmbus: Add channel ivar accessor. This makes life easier during the transition period to nuke the hv_device. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7026 302701 hyperv/stor: Avoid the hv_device and nuke the broken get_stor_device This paves way to nuke the hv_device, which is actually an unncessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7027 302702 hyperv/util: Avoid the hv_device This paves way to nuke the hv_device, which is actually an unncessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7028 302703 hyperv/vmbus: Deprecate the usage of hv_device. This paves way to nuke the hv_device, which is actually an unncessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7032 302704 hyperv/hn: Avoid the hv_device This paves way to nuke the hv_device, which is actually an unncessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7033 302706 hyperv: Get rid of hv_device, which is unnecessary indirection. Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7034
Diffstat (limited to 'sys/dev/hyperv/utilities/hv_util.c')
-rw-r--r--sys/dev/hyperv/utilities/hv_util.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/sys/dev/hyperv/utilities/hv_util.c b/sys/dev/hyperv/utilities/hv_util.c
index 3119e3f..f7cbd3c 100644
--- a/sys/dev/hyperv/utilities/hv_util.c
+++ b/sys/dev/hyperv/utilities/hv_util.c
@@ -74,13 +74,11 @@ hv_negotiate_version(
int
hv_util_attach(device_t dev)
{
- struct hv_device* hv_dev;
struct hv_util_sc* softc;
int ret;
- hv_dev = vmbus_get_devctx(dev);
softc = device_get_softc(dev);
- softc->hv_dev = hv_dev;
+ softc->channel = vmbus_get_channel(dev);
softc->receive_buffer =
malloc(4 * PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO);
@@ -91,9 +89,9 @@ hv_util_attach(device_t dev)
* Turn off batched reading for all util drivers before we open the
* channel.
*/
- hv_set_channel_read_state(hv_dev->channel, FALSE);
+ hv_set_channel_read_state(softc->channel, FALSE);
- ret = hv_vmbus_channel_open(hv_dev->channel, 4 * PAGE_SIZE,
+ ret = hv_vmbus_channel_open(softc->channel, 4 * PAGE_SIZE,
4 * PAGE_SIZE, NULL, 0,
softc->callback, softc);
@@ -110,14 +108,10 @@ error0:
int
hv_util_detach(device_t dev)
{
- struct hv_device* hv_dev;
- struct hv_util_sc* softc;
-
- hv_dev = vmbus_get_devctx(dev);
+ struct hv_util_sc *sc = device_get_softc(dev);
- hv_vmbus_channel_close(hv_dev->channel);
- softc = device_get_softc(dev);
+ hv_vmbus_channel_close(sc->channel);
+ free(sc->receive_buffer, M_DEVBUF);
- free(softc->receive_buffer, M_DEVBUF);
return (0);
}
OpenPOWER on IntegriCloud