[Midnightbsd-cvs] src [8674] trunk/sys/dev/xen/control/control.c: fix not smp build, replace incorrect function names in printf(9)
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Sep 25 16:41:08 EDT 2016
Revision: 8674
http://svnweb.midnightbsd.org/src/?rev=8674
Author: laffer1
Date: 2016-09-25 16:41:08 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
fix not smp build, replace incorrect function names in printf(9)
Modified Paths:
--------------
trunk/sys/dev/xen/control/control.c
Modified: trunk/sys/dev/xen/control/control.c
===================================================================
--- trunk/sys/dev/xen/control/control.c 2016-09-25 20:40:22 UTC (rev 8673)
+++ trunk/sys/dev/xen/control/control.c 2016-09-25 20:41:08 UTC (rev 8674)
@@ -125,7 +125,6 @@
#include <sys/smp.h>
#endif
-
#include <geom/geom.h>
#include <machine/_inttypes.h>
@@ -145,8 +144,6 @@
#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 @@
};
/** 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 @@
static void
xctrl_suspend()
{
- u_int cpuid;
int i, j, k, fpp;
unsigned long max_pfn, start_info_mfn;
@@ -207,6 +203,8 @@
#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 @@
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 @@
* 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 @@
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 @@
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 @@
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);
More information about the Midnightbsd-cvs
mailing list