From 6ad9bc9a7779734ead6ac09fa9f5ef748368d800 Mon Sep 17 00:00:00 2001 From: njl Date: Wed, 14 Apr 2004 03:45:20 +0000 Subject: Style cleanups, M_ZERO instead of bzero. --- sys/dev/acpica/Osd/OsdSchedule.c | 42 +++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/sys/dev/acpica/Osd/OsdSchedule.c b/sys/dev/acpica/Osd/OsdSchedule.c index 4ba1dee..0c8c1a7 100644 --- a/sys/dev/acpica/Osd/OsdSchedule.c +++ b/sys/dev/acpica/Osd/OsdSchedule.c @@ -31,8 +31,6 @@ * 6.3 : Scheduling services */ -#include "acpi.h" - #include "opt_acpi.h" #include #include @@ -45,8 +43,7 @@ #include #include -#include - +#include "acpi.h" #include #define _COMPONENT ACPI_OS_SERVICES @@ -151,11 +148,13 @@ acpi_task_thread_init(void) } return (err); } -#endif -#endif +#endif /* ACPI_USE_THREADS */ +#endif /* __FreeBSD_version >= 500000 */ +/* This function is called in interrupt context. */ ACPI_STATUS -AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void *Context) +AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, + void *Context) { struct acpi_task *at; int pri; @@ -163,12 +162,11 @@ AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void * ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); if (Function == NULL) - return_ACPI_STATUS(AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_BAD_PARAMETER); - at = malloc(sizeof(*at), M_ACPITASK, M_NOWAIT); /* Interrupt Context */ + at = malloc(sizeof(*at), M_ACPITASK, M_NOWAIT | M_ZERO); if (at == NULL) - return_ACPI_STATUS(AE_NO_MEMORY); - bzero(at, sizeof(*at)); + return_ACPI_STATUS (AE_NO_MEMORY); at->at_function = Function; at->at_context = Context; @@ -187,16 +185,17 @@ AcpiOsQueueForExecution(UINT32 Priority, OSD_EXECUTION_CALLBACK Function, void * break; default: free(at, M_ACPITASK); - return_ACPI_STATUS(AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_BAD_PARAMETER); } TASK_INIT(&at->at_task, pri, AcpiOsExecuteQueue, at); -#if __FreeBSD_version < 500000 - taskqueue_enqueue(taskqueue_swi, (struct task *)at); -#else +#if __FreeBSD_version >= 500000 taskqueue_enqueue(taskqueue_acpi, (struct task *)at); +#else + taskqueue_enqueue(taskqueue_swi, (struct task *)at); #endif - return_ACPI_STATUS(AE_OK); + + return_ACPI_STATUS (AE_OK); } static void @@ -238,10 +237,6 @@ AcpiOsExecuteQueue(void *arg, int pending) return_VOID; } -/* - * We don't have any sleep granularity better than hz, so - * make do with that. - */ void AcpiOsSleep(UINT32 Seconds, UINT32 Milliseconds) { @@ -277,7 +272,8 @@ UINT32 AcpiOsGetThreadId(void) { struct proc *p; - /* XXX do not add FUNCTION_TRACE here, results in recursive call */ + + /* XXX do not add ACPI_FUNCTION_TRACE here, results in recursive call. */ p = curproc; #if __FreeBSD_version < 500000 @@ -285,5 +281,7 @@ AcpiOsGetThreadId(void) p = &proc0; #endif KASSERT(p != NULL, ("%s: curproc is NULL!", __func__)); - return(p->p_pid + 1); /* can't return 0 */ + + /* Returning 0 is not allowed. */ + return (p->p_pid + 1); } -- cgit v1.1