Deleted Added
full compact
acpi_battery.c (79282) acpi_battery.c (82372)
1/*-
2 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/acpica/acpi_battery.c 79282 2001-07-05 07:14:30Z msmith $
26 * $FreeBSD: head/sys/dev/acpica/acpi_battery.c 82372 2001-08-26 22:50:15Z msmith $
27 */
28
29#include "opt_acpi.h" /* XXX trim includes */
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/proc.h>
33#include <sys/lock.h>
34#include <sys/malloc.h>

--- 9 unchanged lines hidden (view full) ---

44
45#include <machine/resource.h>
46
47#include "acpi.h"
48
49#include <dev/acpica/acpivar.h>
50#include <dev/acpica/acpiio.h>
51
27 */
28
29#include "opt_acpi.h" /* XXX trim includes */
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/proc.h>
33#include <sys/lock.h>
34#include <sys/malloc.h>

--- 9 unchanged lines hidden (view full) ---

44
45#include <machine/resource.h>
46
47#include "acpi.h"
48
49#include <dev/acpica/acpivar.h>
50#include <dev/acpica/acpiio.h>
51
52/* XXX should use our own malloc class */
53MALLOC_DECLARE(M_ACPIDEV);
52MALLOC_DEFINE(M_ACPIBATT, "acpibatt", "ACPI generic battery data");
54
55/*
56 * ACPI Battery Abstruction Layer.
57 */
58
59struct acpi_batteries {
60 TAILQ_ENTRY(acpi_batteries) link;
61 struct acpi_battdesc battdesc;

--- 164 unchanged lines hidden (view full) ---

226
227int
228acpi_battery_register(int type, int phys_unit)
229{
230 int error;
231 struct acpi_batteries *bp;
232
233 error = 0;
53
54/*
55 * ACPI Battery Abstruction Layer.
56 */
57
58struct acpi_batteries {
59 TAILQ_ENTRY(acpi_batteries) link;
60 struct acpi_battdesc battdesc;

--- 164 unchanged lines hidden (view full) ---

225
226int
227acpi_battery_register(int type, int phys_unit)
228{
229 int error;
230 struct acpi_batteries *bp;
231
232 error = 0;
234 if ((bp = malloc(sizeof(*bp), M_ACPIDEV, M_NOWAIT)) == NULL) {
233 if ((bp = malloc(sizeof(*bp), M_ACPIBATT, M_NOWAIT)) == NULL) {
235 return(ENOMEM);
236 }
237
238 bp->battdesc.type = type;
239 bp->battdesc.phys_unit = phys_unit;
240 if (acpi_batteries_initted == 0) {
241 if ((error = acpi_battery_init()) != 0) {
234 return(ENOMEM);
235 }
236
237 bp->battdesc.type = type;
238 bp->battdesc.phys_unit = phys_unit;
239 if (acpi_batteries_initted == 0) {
240 if ((error = acpi_battery_init()) != 0) {
242 free(bp, M_ACPIDEV);
241 free(bp, M_ACPIBATT);
243 return(error);
244 }
245 }
246
247 TAILQ_INSERT_TAIL(&acpi_batteries, bp, link);
248 acpi_batteries_units++;
249
250 return(0);
251}
242 return(error);
243 }
244 }
245
246 TAILQ_INSERT_TAIL(&acpi_batteries, bp, link);
247 acpi_batteries_units++;
248
249 return(0);
250}