From patchwork Wed Jan 15 14:42:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 3492121 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 22EAF9F32F for ; Wed, 15 Jan 2014 14:43:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 37F8D2015E for ; Wed, 15 Jan 2014 14:43:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E4702012B for ; Wed, 15 Jan 2014 14:43:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751774AbaAOOml (ORCPT ); Wed, 15 Jan 2014 09:42:41 -0500 Received: from mga09.intel.com ([134.134.136.24]:15839 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbaAOOml (ORCPT ); Wed, 15 Jan 2014 09:42:41 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 15 Jan 2014 06:38:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,663,1384329600"; d="scan'208";a="459229753" Received: from unknown (HELO tlan1-mobl2.ccr.corp.intel.com) ([10.255.21.148]) by fmsmga001.fm.intel.com with ESMTP; 15 Jan 2014 06:42:32 -0800 Message-ID: <52D69E57.5020208@intel.com> Date: Wed, 15 Jan 2014 22:42:31 +0800 From: Lan Tianyu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130612 Thunderbird/17.0.6 MIME-Version: 1.0 To: "Rafael J. Wysocki" , Matthew Garrett CC: Dmitry Torokhov , lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, fcr@adinet.com.uy, l@dorileo.org, "Zheng, Lv" , robert.moore@intel.com Subject: Re: [PATCH V2] ACPI/Battery: Add a _BIX quirk for NEC LZ750/LS References: <1389019837-13619-1-git-send-email-tianyu.lan@intel.com> <5255063.SeYbBZqxVQ@vostro.rjw.lan> <20140114212406.GA25438@srcf.ucam.org> <4100200.O09E65sAKi@vostro.rjw.lan> In-Reply-To: <4100200.O09E65sAKi@vostro.rjw.lan> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 01/15/2014 06:17 AM, Rafael J. Wysocki wrote: > On Tuesday, January 14, 2014 09:24:06 PM Matthew Garrett wrote: >> On Tue, Jan 14, 2014 at 10:37:02PM +0100, Rafael J. Wysocki wrote: >>> On Tuesday, January 14, 2014 04:06:01 PM Matthew Garrett wrote: >>>> On Mon, Jan 06, 2014 at 11:25:53PM +0100, Rafael J. Wysocki wrote: >>>> >>>>> Queued up as a fix for 3.13 (I fixed up the indentation). >>>> >>>> Ah, sorry, I missed this chunk of the thread. If the system provides >>>> valid _BIF data then we should possibly just fall back to that rather >>>> than adding another quirk table. >>> >>> The problem is to know that _BIX is broken. If we could figure that out >>> upfront, we woulnd't need the quirk table in any case. >> >> It's obvious that it is in this case - the package is the wrong size. > > Then Tianyu should be able to come up with a better fix relatively easily. :-) > Hi Rafael&Matthew: I think we can evaluate _BIX before setting ACPI_BATTERY_XINFO_PRESENT flag. CA routine(acpi_ns_check_package) will check the package size and return error code when there is wrong size package. Something like this. diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index fbf1ace..e98fa83 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c @@ -770,7 +770,7 @@ static int acpi_battery_add(struct acpi_device *device) device->driver_data = battery; mutex_init(&battery->lock); mutex_init(&battery->sysfs_lock); - if (acpi_has_method(battery->device->handle, "_BIX")) + if (acpi_evaluate_object(device->handle, "_BIX", NULL, &buffer);) set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags); result = acpi_battery_update(battery); if (result)