From patchwork Thu Sep 2 02:31:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jin Dongming X-Patchwork-Id: 148031 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o822VEM0010740 for ; Thu, 2 Sep 2010 02:31:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753651Ab0IBCbN (ORCPT ); Wed, 1 Sep 2010 22:31:13 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:41450 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752646Ab0IBCbM (ORCPT ); Wed, 1 Sep 2010 22:31:12 -0400 Received: from m2.gw.fujitsu.co.jp ([10.0.50.72]) by fgwmail5.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o822VAeN023495 (envelope-from jin.dongming@np.css.fujitsu.com); Thu, 2 Sep 2010 11:31:10 +0900 Received: from smail (m2 [127.0.0.1]) by outgoing.m2.gw.fujitsu.co.jp (Postfix) with ESMTP id 318BF45DE55; Thu, 2 Sep 2010 11:31:10 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (s2.gw.fujitsu.co.jp [10.0.50.92]) by m2.gw.fujitsu.co.jp (Postfix) with ESMTP id EEC4345DE6C; Thu, 2 Sep 2010 11:31:09 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 9BE9EE08005; Thu, 2 Sep 2010 11:31:09 +0900 (JST) Received: from m000.s.css.fujitsu.com (m000.s.css.fujitsu.com [10.23.4.38]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id E9CB9E38005; Thu, 2 Sep 2010 11:31:07 +0900 (JST) Received: from m000.css.fujitsu.com (m000 [127.0.0.1]) by m000.s.css.fujitsu.com (Postfix) with ESMTP id CF42950EBDF; Thu, 2 Sep 2010 11:31:07 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.102.46]) by m000.s.css.fujitsu.com (Postfix) with ESMTP id 9947550EBDD; Thu, 2 Sep 2010 11:31:07 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.5.1 Message-ID: <4C7F0C94.8090802@np.css.fujitsu.com> Date: Thu, 02 Sep 2010 11:31:48 +0900 From: Jin Dongming User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: APEI-lenb CC: Huang Ying , Andi Kleen , ACPI , LKLM , Stephen Rothwell , Randy Dunlap , Hidetoshi Seto Subject: [PATCH 2/2][Patch-next -v2] ACPI, APEI, HEST Fix the unsuitable usage of platform_data. Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Sep 2010 02:31:14 +0000 (UTC) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 385a605..0d505e5 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -302,7 +302,7 @@ static int __devinit ghes_probe(struct platform_device *ghes_dev) struct ghes *ghes = NULL; int rc = -EINVAL; - generic = ghes_dev->dev.platform_data; + generic = *(struct acpi_hest_generic **)ghes_dev->dev.platform_data; if (!generic->enabled) return -ENODEV; diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c index 343168d..1a3508a 100644 --- a/drivers/acpi/apei/hest.c +++ b/drivers/acpi/apei/hest.c @@ -137,20 +137,23 @@ static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) { - struct acpi_hest_generic *generic; struct platform_device *ghes_dev; struct ghes_arr *ghes_arr = data; int rc; if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR) return 0; - generic = (struct acpi_hest_generic *)hest_hdr; - if (!generic->enabled) + + if (!((struct acpi_hest_generic *)hest_hdr)->enabled) return 0; ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id); if (!ghes_dev) return -ENOMEM; - ghes_dev->dev.platform_data = generic; + + rc = platform_device_add_data(ghes_dev, &hest_hdr, sizeof(void *)); + if (rc) + goto err; + rc = platform_device_add(ghes_dev); if (rc) goto err;