From: Akinobu Mita <akinobu.mita@gmail.com>
To: Christoph Hellwig <hch@infradead.org>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
Len Brown <len.brown@intel.com>
Subject: [PATCH -mm] acpi: use list.h API for sub_driver list
Date: Sun, 29 Oct 2006 22:40:03 +0900 [thread overview]
Message-ID: <20061029134003.GC10295@localhost> (raw)
In-Reply-To: <20061028190254.GA7070@infradead.org>
On Sat, Oct 28, 2006 at 08:02:54PM +0100, Christoph Hellwig wrote:
> Any chance to just switch the driver to use the list.h APIs instead
> of opencoding lists?
Subject: [PATCH -mm] acpi: use list.h API for sub_driver list
Use the list.h APIs instead of opencoding lists.
Cc: Len Brown <len.brown@intel.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Index: work-fault-inject/drivers/acpi/pci_root.c
===================================================================
--- work-fault-inject.orig/drivers/acpi/pci_root.c
+++ work-fault-inject/drivers/acpi/pci_root.c
@@ -65,17 +65,14 @@ struct acpi_pci_root {
static LIST_HEAD(acpi_pci_roots);
-static struct acpi_pci_driver *sub_driver;
+static LIST_HEAD(sub_driver);
int acpi_pci_register_driver(struct acpi_pci_driver *driver)
{
int n = 0;
struct list_head *entry;
- struct acpi_pci_driver **pptr = &sub_driver;
- while (*pptr)
- pptr = &(*pptr)->next;
- *pptr = driver;
+ list_add_tail(&driver->list, &sub_driver);
if (!driver->add)
return 0;
@@ -96,14 +93,7 @@ void acpi_pci_unregister_driver(struct a
{
struct list_head *entry;
- 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->list);
if (!driver->remove)
return;
Index: work-fault-inject/include/linux/acpi.h
===================================================================
--- work-fault-inject.orig/include/linux/acpi.h
+++ work-fault-inject/include/linux/acpi.h
@@ -480,7 +480,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 list;
int (*add)(acpi_handle handle);
void (*remove)(acpi_handle handle);
};
next prev parent reply other threads:[~2006-10-29 13:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-28 18:53 [PATCH] acpi: fix single linked list manipulation Akinobu Mita
2006-10-28 19:02 ` Christoph Hellwig
2006-10-29 13:40 ` Akinobu Mita [this message]
2006-10-29 13:42 ` [PATCH -mm] acpi: use list.h API for sub_driver list Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061029134003.GC10295@localhost \
--to=akinobu.mita@gmail.com \
--cc=hch@infradead.org \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox