diff options
| author | Marius Strobl <marius@FreeBSD.org> | 2013-01-27 22:59:59 +0000 |
|---|---|---|
| committer | Marius Strobl <marius@FreeBSD.org> | 2013-01-27 22:59:59 +0000 |
| commit | 72ec7abd20cc71bb907e0f12c987b81deac71455 (patch) | |
| tree | faad1f2ff41c727c7ee9301474d4765df8f7b937 /sys/dev/xen | |
| parent | 133ff376321c07476ce4dacb2d6abae642c2a175 (diff) | |
Notes
Diffstat (limited to 'sys/dev/xen')
| -rw-r--r-- | sys/dev/xen/control/control.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 63ece1ef05f4..18f42bbe653b 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -125,7 +125,6 @@ __FBSDID("$FreeBSD$"); #include <sys/smp.h> #endif - #include <geom/geom.h> #include <machine/_inttypes.h> @@ -145,8 +144,6 @@ __FBSDID("$FreeBSD$"); #include <xen/xenbus/xenbusvar.h> -#define NUM_ELEMENTS(x) (sizeof(x) / sizeof(*(x))) - /*--------------------------- Forward Declarations --------------------------*/ /** Function signature for shutdown event handlers. */ typedef void (xctrl_shutdown_handler_t)(void); @@ -165,7 +162,7 @@ struct xctrl_shutdown_reason { }; /** Lookup table for shutdown event name to handler. */ -static struct xctrl_shutdown_reason xctrl_shutdown_reasons[] = { +static const struct xctrl_shutdown_reason xctrl_shutdown_reasons[] = { { "poweroff", xctrl_poweroff }, { "reboot", xctrl_reboot }, { "suspend", xctrl_suspend }, @@ -198,7 +195,6 @@ extern void xencons_resume(void); static void xctrl_suspend() { - u_int cpuid; int i, j, k, fpp; unsigned long max_pfn, start_info_mfn; @@ -207,6 +203,8 @@ xctrl_suspend() #ifdef SMP struct thread *td; cpuset_t map; + u_int cpuid; + /* * Bind us to CPU 0 and stop any other VCPUs. */ @@ -231,7 +229,7 @@ xctrl_suspend() mtx_lock(&Giant); if (DEVICE_SUSPEND(root_bus) != 0) { mtx_unlock(&Giant); - printf("xen_suspend: device_suspend failed\n"); + printf("%s: device_suspend failed\n", __func__); #ifdef SMP if (!CPU_EMPTY(&map)) restart_cpus(map); @@ -343,9 +341,9 @@ xctrl_suspend() * drivers need this. */ mtx_lock(&Giant); - if (DEVICE_SUSPEND(root_bus)) { + if (DEVICE_SUSPEND(root_bus) != 0) { mtx_unlock(&Giant); - printf("xen_suspend: device_suspend failed\n"); + printf("%s: device_suspend failed\n", __func__); return; } mtx_unlock(&Giant); @@ -396,8 +394,8 @@ xctrl_halt() static void xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len) { - struct xctrl_shutdown_reason *reason; - struct xctrl_shutdown_reason *last_reason; + const struct xctrl_shutdown_reason *reason; + const struct xctrl_shutdown_reason *last_reason; char *result; int error; int result_len; @@ -408,7 +406,7 @@ xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len) return; reason = xctrl_shutdown_reasons; - last_reason = reason + NUM_ELEMENTS(xctrl_shutdown_reasons); + last_reason = reason + nitems(xctrl_shutdown_reasons); while (reason < last_reason) { if (!strcmp(result, reason->name)) { @@ -511,10 +509,10 @@ static device_method_t xctrl_methods[] = { DEVMETHOD(device_attach, xctrl_attach), DEVMETHOD(device_detach, xctrl_detach), - { 0, 0 } + DEVMETHOD_END }; DEFINE_CLASS_0(xctrl, xctrl_driver, xctrl_methods, sizeof(struct xctrl_softc)); devclass_t xctrl_devclass; -DRIVER_MODULE(xctrl, xenstore, xctrl_driver, xctrl_devclass, 0, 0); +DRIVER_MODULE(xctrl, xenstore, xctrl_driver, xctrl_devclass, NULL, NULL); |
