From patchwork Sat Dec 26 01:18:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Corbacho X-Patchwork-Id: 69776 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBQ1Icjw006239 for ; Sat, 26 Dec 2009 01:18:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755019AbZLZBSf (ORCPT ); Fri, 25 Dec 2009 20:18:35 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756521AbZLZBSf (ORCPT ); Fri, 25 Dec 2009 20:18:35 -0500 Received: from mail-ew0-f219.google.com ([209.85.219.219]:64250 "EHLO mail-ew0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755019AbZLZBSd (ORCPT ); Fri, 25 Dec 2009 20:18:33 -0500 Received: by ewy19 with SMTP id 19so446525ewy.21 for ; Fri, 25 Dec 2009 17:18:31 -0800 (PST) Received: by 10.213.24.3 with SMTP id t3mr10433950ebb.40.1261790310905; Fri, 25 Dec 2009 17:18:30 -0800 (PST) Received: from pegasus.localnet (bb-87-81-255-5.ukonline.co.uk [87.81.255.5]) by mx.google.com with ESMTPS id 24sm19870324eyx.30.2009.12.25.17.18.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 25 Dec 2009 17:18:30 -0800 (PST) From: Carlos Corbacho To: Larry Finger Subject: Re: Regression in module wmi since 2.6.32 (bisected to commit 1caab3c) Date: Sat, 26 Dec 2009 01:18:26 +0000 User-Agent: KMail/1.12.4 (Linux/2.6.31.5; KDE/4.3.4; x86_64; ; ) Cc: Matthew Garrett , LKML , Linus Torvalds , Linux ACPI References: <4B352513.90302@lwfinger.net> <200912252158.31127.carlos@strangeworlds.co.uk> <4B353818.1020308@lwfinger.net> In-Reply-To: <4B353818.1020308@lwfinger.net> MIME-Version: 1.0 Message-Id: <200912260118.26391.carlos@strangeworlds.co.uk> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 9f93d6c..483827f 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -716,6 +716,22 @@ static int wmi_class_init(void) return ret; } +static bool guid_already_parsed(const char *guid_string) { + struct guid_block *gblock; + struct wmi_block *wblock; + struct list_head *p; + + list_for_each(p, &wmi_blocks.list) { + wblock = list_entry(p, struct wmi_block, list); + gblock = &wblock->gblock; + + if (strncmp(gblock->guid, guid_string, 16) != 0) { + return true; + } + } + return false; +} + /* * Parse the _WDG method for the GUID data blocks */ @@ -747,6 +763,16 @@ static __init acpi_status parse_wdg(acpi_handle handle) memcpy(gblock, obj->buffer.pointer, obj->buffer.length); for (i = 0; i < total; i++) { + /* + Some WMI devices, like those for nVidia hooks, have a + duplicate GUID. It's not clear what we should do in this + case yet, so for now, we'll just ignore the duplicate. + Anyone who wants to add support for that device can come + up with a better workaround for the mess then. + */ + if (guid_already_parsed(gblock[i].guid) == true) { + continue; + } wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); if (!wblock) return AE_NO_MEMORY;