Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: sbs: probe smart battery vis SMBus controller

http://bugzilla.kernel.org/show_bug.cgi?id=8559

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>

authored by

Alexey Starikovskiy and committed by
Len Brown
addad454 75154f40

+7 -26
+7 -26
drivers/acpi/sbs.c
··· 127 127 static struct acpi_driver acpi_sbs_driver = { 128 128 .name = "sbs", 129 129 .class = ACPI_SBS_CLASS, 130 - .ids = ACPI_SBS_HID, 130 + .ids = "ACPI0001,ACPI0005", 131 131 .ops = { 132 132 .add = acpi_sbs_add, 133 133 .remove = acpi_sbs_remove, ··· 176 176 }; 177 177 178 178 struct acpi_sbs { 179 - acpi_handle handle; 180 179 int base; 181 180 struct acpi_device *device; 182 - struct acpi_ec_smbus *smbus; 183 181 struct mutex mutex; 184 182 int sbsm_present; 185 183 int sbsm_batteries_supported; ··· 509 511 "acpi_sbs_read_word() failed")); 510 512 goto end; 511 513 } 512 - 514 + sbs->sbsm_present = 1; 513 515 sbs->sbsm_batteries_supported = battery_system_info & 0x000f; 514 516 515 517 end: ··· 1628 1630 { 1629 1631 struct acpi_sbs *sbs = NULL; 1630 1632 int result = 0, remove_result = 0; 1631 - unsigned long sbs_obj; 1632 1633 int id; 1633 1634 acpi_status status = AE_OK; 1634 1635 unsigned long val; 1635 1636 1636 1637 status = 1637 - acpi_evaluate_integer(device->parent->handle, "_EC", NULL, &val); 1638 + acpi_evaluate_integer(device->handle, "_EC", NULL, &val); 1638 1639 if (ACPI_FAILURE(status)) { 1639 1640 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Error obtaining _EC")); 1640 1641 return -EIO; ··· 1650 1653 1651 1654 sbs_mutex_lock(sbs); 1652 1655 1653 - sbs->base = (val & 0xff00ull) >> 8; 1656 + sbs->base = 0xff & (val >> 8); 1654 1657 sbs->device = device; 1655 1658 1656 1659 strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); ··· 1662 1665 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "acpi_ac_add() failed")); 1663 1666 goto end; 1664 1667 } 1665 - status = acpi_evaluate_integer(device->handle, "_SBS", NULL, &sbs_obj); 1666 - if (status) { 1667 - ACPI_EXCEPTION((AE_INFO, status, 1668 - "acpi_evaluate_integer() failed")); 1669 - result = -EIO; 1670 - goto end; 1671 - } 1672 - if (sbs_obj > 0) { 1673 - result = acpi_sbsm_get_info(sbs); 1674 - if (result) { 1675 - ACPI_EXCEPTION((AE_INFO, AE_ERROR, 1676 - "acpi_sbsm_get_info() failed")); 1677 - goto end; 1678 - } 1679 - sbs->sbsm_present = 1; 1680 - } 1681 1668 1682 - if (sbs->sbsm_present == 0) { 1669 + acpi_sbsm_get_info(sbs); 1670 + 1671 + if (!sbs->sbsm_present) { 1683 1672 result = acpi_battery_add(sbs, 0); 1684 1673 if (result) { 1685 1674 ACPI_EXCEPTION((AE_INFO, AE_ERROR, ··· 1684 1701 } 1685 1702 } 1686 1703 } 1687 - 1688 - sbs->handle = device->handle; 1689 1704 1690 1705 init_timer(&sbs->update_timer); 1691 1706 result = acpi_check_update_proc(sbs);