| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * battery.c - ACPI Battery Driver (Revision: 2.0) |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * Copyright (C) 2004-2007 Vladimir Lebedev <vladimir.p.lebedev@intel.com> |
|---|
| 6 | 7 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
|---|
| 7 | 8 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 13 | | - * the Free Software Foundation; either version 2 of the License, or (at |
|---|
| 14 | | - * your option) any later version. |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 17 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 19 | | - * General Public License for more details. |
|---|
| 20 | | - * |
|---|
| 21 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 22 | 9 | */ |
|---|
| 23 | 10 | |
|---|
| 24 | 11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 36 | 23 | #include <linux/types.h> |
|---|
| 37 | 24 | |
|---|
| 38 | 25 | #include <asm/unaligned.h> |
|---|
| 39 | | - |
|---|
| 40 | | -#ifdef CONFIG_ACPI_PROCFS_POWER |
|---|
| 41 | | -#include <linux/proc_fs.h> |
|---|
| 42 | | -#include <linux/seq_file.h> |
|---|
| 43 | | -#include <linux/uaccess.h> |
|---|
| 44 | | -#endif |
|---|
| 45 | 26 | |
|---|
| 46 | 27 | #include <linux/acpi.h> |
|---|
| 47 | 28 | #include <linux/power_supply.h> |
|---|
| .. | .. |
|---|
| 83 | 64 | module_param(cache_time, uint, 0644); |
|---|
| 84 | 65 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
|---|
| 85 | 66 | |
|---|
| 86 | | -#ifdef CONFIG_ACPI_PROCFS_POWER |
|---|
| 87 | | -extern struct proc_dir_entry *acpi_lock_battery_dir(void); |
|---|
| 88 | | -extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); |
|---|
| 89 | | -#endif |
|---|
| 90 | | - |
|---|
| 91 | 67 | static const struct acpi_device_id battery_device_ids[] = { |
|---|
| 92 | 68 | {"PNP0C0A", 0}, |
|---|
| 69 | + |
|---|
| 70 | + /* Microsoft Surface Go 3 */ |
|---|
| 71 | + {"MSHW0146", 0}, |
|---|
| 72 | + |
|---|
| 93 | 73 | {"", 0}, |
|---|
| 94 | 74 | }; |
|---|
| 95 | 75 | |
|---|
| .. | .. |
|---|
| 1014 | 994 | */ |
|---|
| 1015 | 995 | if ((battery->state & ACPI_BATTERY_STATE_CRITICAL) || |
|---|
| 1016 | 996 | (test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags) && |
|---|
| 1017 | | - (battery->capacity_now <= battery->alarm))) |
|---|
| 997 | + (battery->capacity_now <= battery->alarm))) |
|---|
| 1018 | 998 | acpi_pm_wakeup_event(&battery->device->dev); |
|---|
| 1019 | 999 | |
|---|
| 1020 | 1000 | return result; |
|---|
| .. | .. |
|---|
| 1038 | 1018 | sysfs_remove_battery(battery); |
|---|
| 1039 | 1019 | sysfs_add_battery(battery); |
|---|
| 1040 | 1020 | } |
|---|
| 1041 | | - |
|---|
| 1042 | | -/* -------------------------------------------------------------------------- |
|---|
| 1043 | | - FS Interface (/proc) |
|---|
| 1044 | | - -------------------------------------------------------------------------- */ |
|---|
| 1045 | | - |
|---|
| 1046 | | -#ifdef CONFIG_ACPI_PROCFS_POWER |
|---|
| 1047 | | -static struct proc_dir_entry *acpi_battery_dir; |
|---|
| 1048 | | - |
|---|
| 1049 | | -static const char *acpi_battery_units(const struct acpi_battery *battery) |
|---|
| 1050 | | -{ |
|---|
| 1051 | | - return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ? |
|---|
| 1052 | | - "mA" : "mW"; |
|---|
| 1053 | | -} |
|---|
| 1054 | | - |
|---|
| 1055 | | -static int acpi_battery_info_proc_show(struct seq_file *seq, void *offset) |
|---|
| 1056 | | -{ |
|---|
| 1057 | | - struct acpi_battery *battery = seq->private; |
|---|
| 1058 | | - int result = acpi_battery_update(battery, false); |
|---|
| 1059 | | - |
|---|
| 1060 | | - if (result) |
|---|
| 1061 | | - goto end; |
|---|
| 1062 | | - |
|---|
| 1063 | | - seq_printf(seq, "present: %s\n", |
|---|
| 1064 | | - acpi_battery_present(battery) ? "yes" : "no"); |
|---|
| 1065 | | - if (!acpi_battery_present(battery)) |
|---|
| 1066 | | - goto end; |
|---|
| 1067 | | - if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN) |
|---|
| 1068 | | - seq_printf(seq, "design capacity: unknown\n"); |
|---|
| 1069 | | - else |
|---|
| 1070 | | - seq_printf(seq, "design capacity: %d %sh\n", |
|---|
| 1071 | | - battery->design_capacity, |
|---|
| 1072 | | - acpi_battery_units(battery)); |
|---|
| 1073 | | - |
|---|
| 1074 | | - if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN) |
|---|
| 1075 | | - seq_printf(seq, "last full capacity: unknown\n"); |
|---|
| 1076 | | - else |
|---|
| 1077 | | - seq_printf(seq, "last full capacity: %d %sh\n", |
|---|
| 1078 | | - battery->full_charge_capacity, |
|---|
| 1079 | | - acpi_battery_units(battery)); |
|---|
| 1080 | | - |
|---|
| 1081 | | - seq_printf(seq, "battery technology: %srechargeable\n", |
|---|
| 1082 | | - battery->technology ? "" : "non-"); |
|---|
| 1083 | | - |
|---|
| 1084 | | - if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN) |
|---|
| 1085 | | - seq_printf(seq, "design voltage: unknown\n"); |
|---|
| 1086 | | - else |
|---|
| 1087 | | - seq_printf(seq, "design voltage: %d mV\n", |
|---|
| 1088 | | - battery->design_voltage); |
|---|
| 1089 | | - seq_printf(seq, "design capacity warning: %d %sh\n", |
|---|
| 1090 | | - battery->design_capacity_warning, |
|---|
| 1091 | | - acpi_battery_units(battery)); |
|---|
| 1092 | | - seq_printf(seq, "design capacity low: %d %sh\n", |
|---|
| 1093 | | - battery->design_capacity_low, |
|---|
| 1094 | | - acpi_battery_units(battery)); |
|---|
| 1095 | | - seq_printf(seq, "cycle count: %i\n", battery->cycle_count); |
|---|
| 1096 | | - seq_printf(seq, "capacity granularity 1: %d %sh\n", |
|---|
| 1097 | | - battery->capacity_granularity_1, |
|---|
| 1098 | | - acpi_battery_units(battery)); |
|---|
| 1099 | | - seq_printf(seq, "capacity granularity 2: %d %sh\n", |
|---|
| 1100 | | - battery->capacity_granularity_2, |
|---|
| 1101 | | - acpi_battery_units(battery)); |
|---|
| 1102 | | - seq_printf(seq, "model number: %s\n", battery->model_number); |
|---|
| 1103 | | - seq_printf(seq, "serial number: %s\n", battery->serial_number); |
|---|
| 1104 | | - seq_printf(seq, "battery type: %s\n", battery->type); |
|---|
| 1105 | | - seq_printf(seq, "OEM info: %s\n", battery->oem_info); |
|---|
| 1106 | | - end: |
|---|
| 1107 | | - if (result) |
|---|
| 1108 | | - seq_printf(seq, "ERROR: Unable to read battery info\n"); |
|---|
| 1109 | | - return result; |
|---|
| 1110 | | -} |
|---|
| 1111 | | - |
|---|
| 1112 | | -static int acpi_battery_state_proc_show(struct seq_file *seq, void *offset) |
|---|
| 1113 | | -{ |
|---|
| 1114 | | - struct acpi_battery *battery = seq->private; |
|---|
| 1115 | | - int result = acpi_battery_update(battery, false); |
|---|
| 1116 | | - |
|---|
| 1117 | | - if (result) |
|---|
| 1118 | | - goto end; |
|---|
| 1119 | | - |
|---|
| 1120 | | - seq_printf(seq, "present: %s\n", |
|---|
| 1121 | | - acpi_battery_present(battery) ? "yes" : "no"); |
|---|
| 1122 | | - if (!acpi_battery_present(battery)) |
|---|
| 1123 | | - goto end; |
|---|
| 1124 | | - |
|---|
| 1125 | | - seq_printf(seq, "capacity state: %s\n", |
|---|
| 1126 | | - (battery->state & 0x04) ? "critical" : "ok"); |
|---|
| 1127 | | - if ((battery->state & 0x01) && (battery->state & 0x02)) |
|---|
| 1128 | | - seq_printf(seq, |
|---|
| 1129 | | - "charging state: charging/discharging\n"); |
|---|
| 1130 | | - else if (battery->state & 0x01) |
|---|
| 1131 | | - seq_printf(seq, "charging state: discharging\n"); |
|---|
| 1132 | | - else if (battery->state & 0x02) |
|---|
| 1133 | | - seq_printf(seq, "charging state: charging\n"); |
|---|
| 1134 | | - else |
|---|
| 1135 | | - seq_printf(seq, "charging state: charged\n"); |
|---|
| 1136 | | - |
|---|
| 1137 | | - if (battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN) |
|---|
| 1138 | | - seq_printf(seq, "present rate: unknown\n"); |
|---|
| 1139 | | - else |
|---|
| 1140 | | - seq_printf(seq, "present rate: %d %s\n", |
|---|
| 1141 | | - battery->rate_now, acpi_battery_units(battery)); |
|---|
| 1142 | | - |
|---|
| 1143 | | - if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN) |
|---|
| 1144 | | - seq_printf(seq, "remaining capacity: unknown\n"); |
|---|
| 1145 | | - else |
|---|
| 1146 | | - seq_printf(seq, "remaining capacity: %d %sh\n", |
|---|
| 1147 | | - battery->capacity_now, acpi_battery_units(battery)); |
|---|
| 1148 | | - if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN) |
|---|
| 1149 | | - seq_printf(seq, "present voltage: unknown\n"); |
|---|
| 1150 | | - else |
|---|
| 1151 | | - seq_printf(seq, "present voltage: %d mV\n", |
|---|
| 1152 | | - battery->voltage_now); |
|---|
| 1153 | | - end: |
|---|
| 1154 | | - if (result) |
|---|
| 1155 | | - seq_printf(seq, "ERROR: Unable to read battery state\n"); |
|---|
| 1156 | | - |
|---|
| 1157 | | - return result; |
|---|
| 1158 | | -} |
|---|
| 1159 | | - |
|---|
| 1160 | | -static int acpi_battery_alarm_proc_show(struct seq_file *seq, void *offset) |
|---|
| 1161 | | -{ |
|---|
| 1162 | | - struct acpi_battery *battery = seq->private; |
|---|
| 1163 | | - int result = acpi_battery_update(battery, false); |
|---|
| 1164 | | - |
|---|
| 1165 | | - if (result) |
|---|
| 1166 | | - goto end; |
|---|
| 1167 | | - |
|---|
| 1168 | | - if (!acpi_battery_present(battery)) { |
|---|
| 1169 | | - seq_printf(seq, "present: no\n"); |
|---|
| 1170 | | - goto end; |
|---|
| 1171 | | - } |
|---|
| 1172 | | - seq_printf(seq, "alarm: "); |
|---|
| 1173 | | - if (battery->alarm) { |
|---|
| 1174 | | - seq_printf(seq, "%u %sh\n", battery->alarm, |
|---|
| 1175 | | - acpi_battery_units(battery)); |
|---|
| 1176 | | - } else { |
|---|
| 1177 | | - seq_printf(seq, "unsupported\n"); |
|---|
| 1178 | | - } |
|---|
| 1179 | | - end: |
|---|
| 1180 | | - if (result) |
|---|
| 1181 | | - seq_printf(seq, "ERROR: Unable to read battery alarm\n"); |
|---|
| 1182 | | - return result; |
|---|
| 1183 | | -} |
|---|
| 1184 | | - |
|---|
| 1185 | | -static ssize_t acpi_battery_write_alarm(struct file *file, |
|---|
| 1186 | | - const char __user * buffer, |
|---|
| 1187 | | - size_t count, loff_t * ppos) |
|---|
| 1188 | | -{ |
|---|
| 1189 | | - int result = 0; |
|---|
| 1190 | | - char alarm_string[12] = { '\0' }; |
|---|
| 1191 | | - struct seq_file *m = file->private_data; |
|---|
| 1192 | | - struct acpi_battery *battery = m->private; |
|---|
| 1193 | | - |
|---|
| 1194 | | - if (!battery || (count > sizeof(alarm_string) - 1)) |
|---|
| 1195 | | - return -EINVAL; |
|---|
| 1196 | | - if (!acpi_battery_present(battery)) { |
|---|
| 1197 | | - result = -ENODEV; |
|---|
| 1198 | | - goto end; |
|---|
| 1199 | | - } |
|---|
| 1200 | | - if (copy_from_user(alarm_string, buffer, count)) { |
|---|
| 1201 | | - result = -EFAULT; |
|---|
| 1202 | | - goto end; |
|---|
| 1203 | | - } |
|---|
| 1204 | | - alarm_string[count] = '\0'; |
|---|
| 1205 | | - if (kstrtoint(alarm_string, 0, &battery->alarm)) { |
|---|
| 1206 | | - result = -EINVAL; |
|---|
| 1207 | | - goto end; |
|---|
| 1208 | | - } |
|---|
| 1209 | | - result = acpi_battery_set_alarm(battery); |
|---|
| 1210 | | - end: |
|---|
| 1211 | | - if (result) |
|---|
| 1212 | | - return result; |
|---|
| 1213 | | - return count; |
|---|
| 1214 | | -} |
|---|
| 1215 | | - |
|---|
| 1216 | | -static int acpi_battery_alarm_proc_open(struct inode *inode, struct file *file) |
|---|
| 1217 | | -{ |
|---|
| 1218 | | - return single_open(file, acpi_battery_alarm_proc_show, PDE_DATA(inode)); |
|---|
| 1219 | | -} |
|---|
| 1220 | | - |
|---|
| 1221 | | -static const struct file_operations acpi_battery_alarm_fops = { |
|---|
| 1222 | | - .owner = THIS_MODULE, |
|---|
| 1223 | | - .open = acpi_battery_alarm_proc_open, |
|---|
| 1224 | | - .read = seq_read, |
|---|
| 1225 | | - .write = acpi_battery_write_alarm, |
|---|
| 1226 | | - .llseek = seq_lseek, |
|---|
| 1227 | | - .release = single_release, |
|---|
| 1228 | | -}; |
|---|
| 1229 | | - |
|---|
| 1230 | | -static int acpi_battery_add_fs(struct acpi_device *device) |
|---|
| 1231 | | -{ |
|---|
| 1232 | | - pr_warning(PREFIX "Deprecated procfs I/F for battery is loaded, please retry with CONFIG_ACPI_PROCFS_POWER cleared\n"); |
|---|
| 1233 | | - if (!acpi_device_dir(device)) { |
|---|
| 1234 | | - acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
|---|
| 1235 | | - acpi_battery_dir); |
|---|
| 1236 | | - if (!acpi_device_dir(device)) |
|---|
| 1237 | | - return -ENODEV; |
|---|
| 1238 | | - } |
|---|
| 1239 | | - |
|---|
| 1240 | | - if (!proc_create_single_data("info", S_IRUGO, acpi_device_dir(device), |
|---|
| 1241 | | - acpi_battery_info_proc_show, acpi_driver_data(device))) |
|---|
| 1242 | | - return -ENODEV; |
|---|
| 1243 | | - if (!proc_create_single_data("state", S_IRUGO, acpi_device_dir(device), |
|---|
| 1244 | | - acpi_battery_state_proc_show, acpi_driver_data(device))) |
|---|
| 1245 | | - return -ENODEV; |
|---|
| 1246 | | - if (!proc_create_data("alarm", S_IFREG | S_IRUGO | S_IWUSR, |
|---|
| 1247 | | - acpi_device_dir(device), &acpi_battery_alarm_fops, |
|---|
| 1248 | | - acpi_driver_data(device))) |
|---|
| 1249 | | - return -ENODEV; |
|---|
| 1250 | | - return 0; |
|---|
| 1251 | | -} |
|---|
| 1252 | | - |
|---|
| 1253 | | -static void acpi_battery_remove_fs(struct acpi_device *device) |
|---|
| 1254 | | -{ |
|---|
| 1255 | | - if (!acpi_device_dir(device)) |
|---|
| 1256 | | - return; |
|---|
| 1257 | | - remove_proc_subtree(acpi_device_bid(device), acpi_battery_dir); |
|---|
| 1258 | | - acpi_device_dir(device) = NULL; |
|---|
| 1259 | | -} |
|---|
| 1260 | | - |
|---|
| 1261 | | -#endif |
|---|
| 1262 | 1021 | |
|---|
| 1263 | 1022 | /* -------------------------------------------------------------------------- |
|---|
| 1264 | 1023 | Driver Interface |
|---|
| .. | .. |
|---|
| 1388 | 1147 | }, |
|---|
| 1389 | 1148 | }, |
|---|
| 1390 | 1149 | { |
|---|
| 1391 | | - /* ECS EF20EA */ |
|---|
| 1150 | + /* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */ |
|---|
| 1392 | 1151 | .callback = battery_do_not_check_pmic_quirk, |
|---|
| 1393 | 1152 | .matches = { |
|---|
| 1394 | 1153 | DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"), |
|---|
| 1395 | 1154 | }, |
|---|
| 1396 | 1155 | }, |
|---|
| 1397 | 1156 | { |
|---|
| 1398 | | - /* Lenovo Ideapad Miix 320 */ |
|---|
| 1157 | + /* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */ |
|---|
| 1399 | 1158 | .callback = battery_do_not_check_pmic_quirk, |
|---|
| 1400 | 1159 | .matches = { |
|---|
| 1401 | | - DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|---|
| 1402 | | - DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"), |
|---|
| 1403 | | - DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), |
|---|
| 1160 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|---|
| 1161 | + DMI_MATCH(DMI_PRODUCT_NAME, "80XF"), |
|---|
| 1162 | + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"), |
|---|
| 1404 | 1163 | }, |
|---|
| 1405 | 1164 | }, |
|---|
| 1406 | 1165 | { |
|---|
| .. | .. |
|---|
| 1414 | 1173 | .matches = { |
|---|
| 1415 | 1174 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|---|
| 1416 | 1175 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"), |
|---|
| 1176 | + }, |
|---|
| 1177 | + }, |
|---|
| 1178 | + { |
|---|
| 1179 | + /* Microsoft Surface Go 3 */ |
|---|
| 1180 | + .callback = battery_notification_delay_quirk, |
|---|
| 1181 | + .matches = { |
|---|
| 1182 | + DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), |
|---|
| 1183 | + DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"), |
|---|
| 1417 | 1184 | }, |
|---|
| 1418 | 1185 | }, |
|---|
| 1419 | 1186 | {}, |
|---|
| .. | .. |
|---|
| 1468 | 1235 | if (result) |
|---|
| 1469 | 1236 | goto fail; |
|---|
| 1470 | 1237 | |
|---|
| 1471 | | -#ifdef CONFIG_ACPI_PROCFS_POWER |
|---|
| 1472 | | - result = acpi_battery_add_fs(device); |
|---|
| 1473 | | - if (result) { |
|---|
| 1474 | | - acpi_battery_remove_fs(device); |
|---|
| 1475 | | - goto fail; |
|---|
| 1476 | | - } |
|---|
| 1477 | | -#endif |
|---|
| 1478 | | - |
|---|
| 1479 | 1238 | pr_info(PREFIX "%s Slot [%s] (battery %s)\n", |
|---|
| 1480 | 1239 | ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), |
|---|
| 1481 | 1240 | device->status.battery_present ? "present" : "absent"); |
|---|
| .. | .. |
|---|
| 1504 | 1263 | device_init_wakeup(&device->dev, 0); |
|---|
| 1505 | 1264 | battery = acpi_driver_data(device); |
|---|
| 1506 | 1265 | unregister_pm_notifier(&battery->pm_nb); |
|---|
| 1507 | | -#ifdef CONFIG_ACPI_PROCFS_POWER |
|---|
| 1508 | | - acpi_battery_remove_fs(device); |
|---|
| 1509 | | -#endif |
|---|
| 1510 | 1266 | sysfs_remove_battery(battery); |
|---|
| 1511 | 1267 | mutex_destroy(&battery->lock); |
|---|
| 1512 | 1268 | mutex_destroy(&battery->sysfs_lock); |
|---|
| .. | .. |
|---|
| 1567 | 1323 | } |
|---|
| 1568 | 1324 | } |
|---|
| 1569 | 1325 | |
|---|
| 1570 | | -#ifdef CONFIG_ACPI_PROCFS_POWER |
|---|
| 1571 | | - acpi_battery_dir = acpi_lock_battery_dir(); |
|---|
| 1572 | | - if (!acpi_battery_dir) |
|---|
| 1573 | | - return; |
|---|
| 1574 | | -#endif |
|---|
| 1575 | 1326 | result = acpi_bus_register_driver(&acpi_battery_driver); |
|---|
| 1576 | | -#ifdef CONFIG_ACPI_PROCFS_POWER |
|---|
| 1577 | | - if (result < 0) |
|---|
| 1578 | | - acpi_unlock_battery_dir(acpi_battery_dir); |
|---|
| 1579 | | -#endif |
|---|
| 1580 | 1327 | battery_driver_registered = (result == 0); |
|---|
| 1581 | 1328 | } |
|---|
| 1582 | 1329 | |
|---|
| .. | .. |
|---|
| 1596 | 1343 | acpi_bus_unregister_driver(&acpi_battery_driver); |
|---|
| 1597 | 1344 | battery_hook_exit(); |
|---|
| 1598 | 1345 | } |
|---|
| 1599 | | -#ifdef CONFIG_ACPI_PROCFS_POWER |
|---|
| 1600 | | - if (acpi_battery_dir) |
|---|
| 1601 | | - acpi_unlock_battery_dir(acpi_battery_dir); |
|---|
| 1602 | | -#endif |
|---|
| 1603 | 1346 | } |
|---|
| 1604 | 1347 | |
|---|
| 1605 | 1348 | module_init(acpi_battery_init); |
|---|