From patchwork Wed Jul 4 08:08:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 1154811 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 315B63FE4F for ; Wed, 4 Jul 2012 08:08:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933391Ab2GDIIW (ORCPT ); Wed, 4 Jul 2012 04:08:22 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:34397 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932567Ab2GDIIS (ORCPT ); Wed, 4 Jul 2012 04:08:18 -0400 Received: from m3.gw.fujitsu.co.jp (unknown [10.0.50.73]) by fgwmail6.fujitsu.co.jp (Postfix) with ESMTP id EFA0A3EE0BB for ; Wed, 4 Jul 2012 17:08:17 +0900 (JST) Received: from smail (m3 [127.0.0.1]) by outgoing.m3.gw.fujitsu.co.jp (Postfix) with ESMTP id D82C045DEA6 for ; Wed, 4 Jul 2012 17:08:17 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (s3.gw.fujitsu.co.jp [10.0.50.93]) by m3.gw.fujitsu.co.jp (Postfix) with ESMTP id B81AA45DEB9 for ; Wed, 4 Jul 2012 17:08:17 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id A82251DB803B for ; Wed, 4 Jul 2012 17:08:17 +0900 (JST) Received: from m003.s.css.fujitsu.com (m003.s.css.fujitsu.com [10.23.4.33]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 43AB31DB8047 for ; Wed, 4 Jul 2012 17:08:17 +0900 (JST) Received: from m003.css.fujitsu.com (m003 [127.0.0.1]) by m003.s.css.fujitsu.com (Postfix) with ESMTP id 8A0CE2E083F; Wed, 4 Jul 2012 17:08:16 +0900 (JST) Received: from DEUCALION (unknown [10.124.101.32]) by m003.s.css.fujitsu.com (Postfix) with SMTP id 327A82E081F; Wed, 4 Jul 2012 17:08:16 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Date: Wed, 4 Jul 2012 17:08:11 +0900 From: Taku Izumi To: Taku Izumi Cc: linux-pci@vger.kernel.org, Bjorn Helgaas , Kenji Kaneshige , Yinghai Lu , Jiang Liu Subject: [PATCH 3/7] ACPI, PCI: Use normal list for struct acpi_pci_driver Message-Id: <20120704170811.98ec88dc.izumi.taku@jp.fujitsu.com> In-Reply-To: <20120704170345.07cd0ad7.izumi.taku@jp.fujitsu.com> References: <20120704170345.07cd0ad7.izumi.taku@jp.fujitsu.com> X-Mailer: Sylpheed 3.1.1 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux/drivers/acpi/pci_root.c =================================================================== --- linux.orig/drivers/acpi/pci_root.c 2012-07-04 09:54:52.061486507 +0900 +++ linux/drivers/acpi/pci_root.c 2012-07-04 09:55:45.697815965 +0900 @@ -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: linux/include/linux/acpi.h =================================================================== --- linux.orig/include/linux/acpi.h 2012-07-04 09:54:52.061486507 +0900 +++ linux/include/linux/acpi.h 2012-07-04 09:55:45.697815965 +0900 @@ -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); };