From patchwork Mon Sep 3 08:03:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 1398801 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7BEF03FC71 for ; Mon, 3 Sep 2012 08:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754797Ab2ICIDf (ORCPT ); Mon, 3 Sep 2012 04:03:35 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:44718 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752208Ab2ICIDd (ORCPT ); Mon, 3 Sep 2012 04:03:33 -0400 Received: from m4.gw.fujitsu.co.jp (unknown [10.0.50.74]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id 6B21A3EE0BC; Mon, 3 Sep 2012 17:03:32 +0900 (JST) Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 4631345DE53; Mon, 3 Sep 2012 17:03:32 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (s4.gw.fujitsu.co.jp [10.0.50.94]) by m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 2FB8245DE4E; Mon, 3 Sep 2012 17:03:32 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 1DFEA1DB8044; Mon, 3 Sep 2012 17:03:32 +0900 (JST) Received: from m0000.s.css.fujitsu.com (m0000.s.css.fujitsu.com [10.23.4.183]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id C5DD41DB802F; Mon, 3 Sep 2012 17:03:31 +0900 (JST) Received: from m0000.css.fujitsu.com (m0000 [127.0.0.1]) by m0000.s.css.fujitsu.com (Postfix) with ESMTP id AADB2101650; Mon, 3 Sep 2012 17:03:31 +0900 (JST) Received: from DEUCALION (unknown [10.124.101.32]) by m0000.s.css.fujitsu.com (Postfix) with SMTP id 88FF7101602; Mon, 3 Sep 2012 17:03:31 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Date: Mon, 3 Sep 2012 17:03:56 +0900 From: Taku Izumi To: Taku Izumi Cc: linux-pci@vger.kernel.org, bhelgaas@google.com, linux-acpi@vger.kernel.org, kaneshige.kenji@jp.fujitsu.com, yinghai@kernel.org, jiang.liu@huawei.com Subject: [PATCH v2 1/6] ACPI, PCI: Use normal list for struct acpi_pci_driver Message-Id: <20120903170356.bbfd8c53.izumi.taku@jp.fujitsu.com> In-Reply-To: <20120903165831.29aed72c.izumi.taku@jp.fujitsu.com> References: <20120903165831.29aed72c.izumi.taku@jp.fujitsu.com> X-Mailer: Sylpheed 3.1.1 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Jiang Liu ACPI, PCI: Use normal list for struct acpi_pci_driver Use normal list for struct acpi_pci_driver to simplify code. Signed-off-by: Jiang Liu Signed-off-by: Yinghai Lu Signed-off-by: Taku Izumi --- drivers/acpi/pci_root.c | 16 +++------------- include/linux/acpi.h | 2 +- 2 files changed, 4 insertions(+), 14 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: Bjorn-next-0903/drivers/acpi/pci_root.c =================================================================== --- Bjorn-next-0903.orig/drivers/acpi/pci_root.c +++ Bjorn-next-0903/drivers/acpi/pci_root.c @@ -72,8 +72,8 @@ static struct acpi_driver acpi_pci_root_ }; static LIST_HEAD(acpi_pci_roots); +static LIST_HEAD(acpi_pci_drivers); -static struct acpi_pci_driver *sub_driver; static DEFINE_MUTEX(osc_lock); int acpi_pci_register_driver(struct acpi_pci_driver *driver) @@ -81,10 +81,7 @@ int acpi_pci_register_driver(struct acpi int n = 0; struct acpi_pci_root *root; - struct acpi_pci_driver **pptr = &sub_driver; - while (*pptr) - pptr = &(*pptr)->next; - *pptr = driver; + list_add_tail(&driver->node, &acpi_pci_drivers); if (!driver->add) return 0; @@ -103,14 +100,7 @@ void acpi_pci_unregister_driver(struct a { struct acpi_pci_root *root; - struct acpi_pci_driver **pptr = &sub_driver; - while (*pptr) { - if (*pptr == driver) - break; - pptr = &(*pptr)->next; - } - BUG_ON(!*pptr); - *pptr = (*pptr)->next; + list_del(&driver->node); if (!driver->remove) return; Index: Bjorn-next-0903/include/linux/acpi.h =================================================================== --- Bjorn-next-0903.orig/include/linux/acpi.h +++ Bjorn-next-0903/include/linux/acpi.h @@ -138,7 +138,7 @@ void acpi_penalize_isa_irq(int irq, int void acpi_pci_irq_disable (struct pci_dev *dev); struct acpi_pci_driver { - struct acpi_pci_driver *next; + struct list_head node; int (*add)(acpi_handle handle); void (*remove)(acpi_handle handle); };