Deleted Added
full compact
acpi_battery.c (172490) acpi_battery.c (173782)
1/*-
2 * Copyright (c) 2005 Nate Lawson
3 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2005 Nate Lawson
3 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_battery.c 172490 2007-10-09 07:51:46Z njl $");
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_battery.c 173782 2007-11-20 18:35:36Z jkim $");
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/malloc.h>
35#include <sys/bus.h>
36#include <sys/ioccom.h>
37#include <sys/sysctl.h>

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

162 if (batt_dev == NULL)
163 continue;
164
165 /* If examining a specific battery and this is it, record its index. */
166 if (dev != NULL && dev == batt_dev)
167 dev_idx = i;
168
169 /*
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/malloc.h>
35#include <sys/bus.h>
36#include <sys/ioccom.h>
37#include <sys/sysctl.h>

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

162 if (batt_dev == NULL)
163 continue;
164
165 /* If examining a specific battery and this is it, record its index. */
166 if (dev != NULL && dev == batt_dev)
167 dev_idx = i;
168
169 /*
170 * Be sure we can get various info from the battery. Note that we
171 * can't check acpi_BatteryIsPresent() because smart batteries only
170 * Be sure we can get various info from the battery. Note that
171 * acpi_BatteryIsPresent() is not enough because smart batteries only
172 * return that the device is present.
173 */
172 * return that the device is present.
173 */
174 if (ACPI_BATT_GET_STATUS(batt_dev, &bst[i]) != 0 ||
174 if (!acpi_BatteryIsPresent(batt_dev) ||
175 ACPI_BATT_GET_STATUS(batt_dev, &bst[i]) != 0 ||
175 ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
176 continue;
177
178 /* If a battery is not installed, we sometimes get strange values. */
179 if (!acpi_battery_bst_valid(&bst[i]) ||
180 !acpi_battery_bif_valid(bif))
181 continue;
182

--- 320 unchanged lines hidden ---
176 ACPI_BATT_GET_INFO(batt_dev, bif) != 0)
177 continue;
178
179 /* If a battery is not installed, we sometimes get strange values. */
180 if (!acpi_battery_bst_valid(&bst[i]) ||
181 !acpi_battery_bif_valid(bif))
182 continue;
183

--- 320 unchanged lines hidden ---