From patchwork Tue Apr 14 03:02:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Rui" X-Patchwork-Id: 18010 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3E324pj015442 for ; Tue, 14 Apr 2009 03:02:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751964AbZDNDB6 (ORCPT ); Mon, 13 Apr 2009 23:01:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751697AbZDNDB6 (ORCPT ); Mon, 13 Apr 2009 23:01:58 -0400 Received: from mga11.intel.com ([192.55.52.93]:12046 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751463AbZDNDB6 (ORCPT ); Mon, 13 Apr 2009 23:01:58 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 13 Apr 2009 19:57:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.40,182,1239001200"; d="scan'208";a="681292934" Received: from rzhang-dt.sh.intel.com (HELO [10.239.36.94]) ([10.239.36.94]) by fmsmga001.fm.intel.com with ESMTP; 13 Apr 2009 20:05:37 -0700 Subject: [PATCH -test] ACPI video: fix an error when the brightness levels on AC and on Battery are same From: Zhang Rui To: Len Brown Cc: linux-acpi Date: Tue, 14 Apr 2009 11:02:18 +0800 Message-Id: <1239678138.7661.255.camel@rzhang-dt> Mime-Version: 1.0 X-Mailer: Evolution 2.22.1 (2.22.1-2.fc9) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org when the brightness level on AC and brightness level on Battery are same, the level_ac_battery is 1 in the current code, which is wrong. http://marc.info/?l=linux-acpi&m=123963513206858&w=2 Signed-off-by: Zhang Rui --- drivers/acpi/video.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/acpi/video.c =================================================================== --- linux-2.6.orig/drivers/acpi/video.c +++ linux-2.6/drivers/acpi/video.c @@ -768,10 +768,12 @@ acpi_video_init_brightness(struct acpi_v * In this case, the first two elements in _BCL packages * are also supported brightness levels that OS should take care of. */ - for (i = 2; i < count; i++) - if (br->levels[i] == br->levels[0] || - br->levels[i] == br->levels[1]) + for (i = 2; i < count; i++) { + if (br->levels[i] == br->levels[0]) level_ac_battery++; + if (br->levels[i] == br->levels[1]) + level_ac_battery++; + } if (level_ac_battery < 2) { level_ac_battery = 2 - level_ac_battery;