Date: Mon, 23 May 2016 07:23:19 +0000 (UTC) From: Sepherosa Ziehau <sephe@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300486 - head/sys/dev/hyperv/vmbus Message-ID: <201605230723.u4N7NJUA025873@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sephe Date: Mon May 23 07:23:19 2016 New Revision: 300486 URL: https://svnweb.freebsd.org/changeset/base/300486 Log: hyperv/vmbus: Get rid of vmbus_devp While I'm here, nuke useless print in vmbus_attach(). MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6447 Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:21:16 2016 (r300485) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Mon May 23 07:23:19 2016 (r300486) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); struct vmbus_softc *vmbus_sc; -static device_t vmbus_devp; static int vmbus_inited; static hv_setup_args setup_args; /* only CPU 0 supported at this time */ @@ -324,7 +323,7 @@ hv_vmbus_child_device_register(struct hv printf("VMBUS: Class ID: %s\n", name); } - child = device_add_child(vmbus_devp, NULL, -1); + child = device_add_child(vmbus_get_device(), NULL, -1); child_dev->device = child; device_set_ivars(child, child_dev); @@ -340,7 +339,7 @@ hv_vmbus_child_device_unregister(struct * device_add_child() */ mtx_lock(&Giant); - ret = device_delete_child(vmbus_devp, child_dev->device); + ret = device_delete_child(vmbus_get_device(), child_dev->device); mtx_unlock(&Giant); return(ret); } @@ -471,8 +470,8 @@ vmbus_bus_init(void) hv_vmbus_request_channel_offers(); vmbus_scan(); - bus_generic_attach(vmbus_devp); - device_printf(vmbus_devp, "device scan, probe and attach done\n"); + bus_generic_attach(sc->vmbus_dev); + device_printf(sc->vmbus_dev, "device scan, probe and attach done\n"); return (ret); @@ -508,11 +507,8 @@ vmbus_event_proc_dummy(struct vmbus_soft static int vmbus_attach(device_t dev) { - if(bootverbose) - device_printf(dev, "VMBUS: attach dev: %p\n", dev); - - vmbus_devp = dev; vmbus_sc = device_get_softc(dev); + vmbus_sc->vmbus_dev = dev; /* * Event processing logic will be configured: Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Mon May 23 07:21:16 2016 (r300485) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Mon May 23 07:23:19 2016 (r300486) @@ -38,6 +38,7 @@ struct vmbus_pcpu_data { struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); struct vmbus_pcpu_data vmbus_pcpu[MAXCPU]; + device_t vmbus_dev; }; extern struct vmbus_softc *vmbus_sc; @@ -48,6 +49,12 @@ vmbus_get_softc(void) return vmbus_sc; } +static __inline device_t +vmbus_get_device(void) +{ + return vmbus_sc->vmbus_dev; +} + #define VMBUS_SC_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field #define VMBUS_SC_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field #define VMBUS_PCPU_GET(field, cpu) \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605230723.u4N7NJUA025873>