Deleted Added
full compact
acpi_cmbat.c (152818) acpi_cmbat.c (157774)
1/*-
2 * Copyright (c) 2005 Nate Lawson
3 * Copyright (c) 2000 Munehiro Matsuda
4 * Copyright (c) 2000 Takanori Watanabe
5 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

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

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_cmbat.c 152818 2005-11-26 07:36:53Z njl $");
31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_cmbat.c 157774 2006-04-15 12:31:34Z iwasaki $");
32
33#include "opt_acpi.h"
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/bus.h>
38#include <sys/ioccom.h>
39

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

154 return (0);
155}
156
157static int
158acpi_cmbat_detach(device_t dev)
159{
160
161 acpi_battery_remove(dev);
32
33#include "opt_acpi.h"
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/bus.h>
38#include <sys/ioccom.h>
39

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

154 return (0);
155}
156
157static int
158acpi_cmbat_detach(device_t dev)
159{
160
161 acpi_battery_remove(dev);
162 AcpiRemoveNotifyHandler(handle, ACPI_ALL_NOTIFY, acpi_cmbat_notify_handler);
162 return (0);
163}
164
165static int
166acpi_cmbat_resume(device_t dev)
167{
168
169 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_cmbat_init_battery, dev);

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

430 "battery initialization start\n");
431
432 /*
433 * Try repeatedly to get valid data from the battery. Since the
434 * embedded controller isn't always ready just after boot, we may have
435 * to wait a while.
436 */
437 for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(10000)) {
163 return (0);
164}
165
166static int
167acpi_cmbat_resume(device_t dev)
168{
169
170 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_cmbat_init_battery, dev);

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

431 "battery initialization start\n");
432
433 /*
434 * Try repeatedly to get valid data from the battery. Since the
435 * embedded controller isn't always ready just after boot, we may have
436 * to wait a while.
437 */
438 for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(10000)) {
439 /* batteries on DOCK can be ejected w/ DOCK during retrying */
440 if (!device_is_attached(dev))
441 return;
442
438 if (!acpi_BatteryIsPresent(dev))
439 continue;
440
441 /*
442 * Only query the battery if this is the first try or the specific
443 * type of info is still invalid.
444 */
445 ACPI_SERIAL_BEGIN(cmbat);

--- 23 unchanged lines hidden ---
443 if (!acpi_BatteryIsPresent(dev))
444 continue;
445
446 /*
447 * Only query the battery if this is the first try or the specific
448 * type of info is still invalid.
449 */
450 ACPI_SERIAL_BEGIN(cmbat);

--- 23 unchanged lines hidden ---