public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: make acpi_bus_register_driver() return zero for success, not device count
@ 2005-07-27 22:28 Bjorn Helgaas
       [not found] ` <200507271628.25844.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2005-07-27 22:28 UTC (permalink / raw)
  To: Len Brown
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	sziwan-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f,
	julien.lerouge-GANU6spQydw,
	acpi4asus-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

pci_register_driver() used to return the number of devices claimed,
and we made acpi_bus_register_driver() consistent with that.  But
pci_register_driver() recently changed to return only success/failure
(because the interface is to register the *driver*, not claim devices,
and devices may be hot-plugged later).

So let's do the same with acpi_bus_register_driver().

Note that asus_acpi.c used to unregister itself if it didn't claim
any devices.  Now it will remain registered, like everything else
in drivers/acpi.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>

Index: work/drivers/acpi/scan.c
===================================================================
--- work.orig/drivers/acpi/scan.c	2005-07-27 10:17:43.000000000 -0600
+++ work/drivers/acpi/scan.c	2005-07-27 10:17:55.000000000 -0600
@@ -578,10 +578,9 @@
 	return_VALUE(result);
 }
 
-static int acpi_driver_attach(struct acpi_driver * drv)
+static void acpi_driver_attach(struct acpi_driver * drv)
 {
 	struct list_head * node, * next;
-	int count = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_driver_attach");
 
@@ -597,7 +596,6 @@
 			if (!acpi_bus_driver_init(dev, drv)) {
 				acpi_start_single_object(dev);
 				atomic_inc(&drv->references);
-				count++;
 				ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n",
 						  drv->name, dev->pnp.bus_id));
 			}
@@ -605,7 +603,6 @@
 		spin_lock(&acpi_device_lock);
 	}
 	spin_unlock(&acpi_device_lock);
-	return_VALUE(count);
 }
 
 static int acpi_driver_detach(struct acpi_driver * drv)
@@ -636,16 +633,13 @@
  * acpi_bus_register_driver 
  * ------------------------ 
  * Registers a driver with the ACPI bus.  Searches the namespace for all
- * devices that match the driver's criteria and binds.  Returns the
- * number of devices that were claimed by the driver, or a negative
- * error status for failure.
+ * devices that match the driver's criteria and binds.  Returns zero for
+ * success or a negative error status for failure.
  */
 int
 acpi_bus_register_driver (
 	struct acpi_driver	*driver)
 {
-	int count;
-
 	ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
 
 	if (acpi_disabled)
@@ -657,9 +651,9 @@
 	spin_lock(&acpi_device_lock);
 	list_add_tail(&driver->node, &acpi_bus_drivers);
 	spin_unlock(&acpi_device_lock);
-	count = acpi_driver_attach(driver);
+	acpi_driver_attach(driver);
 
-	return_VALUE(count);
+	return_VALUE(0);
 }
 EXPORT_SYMBOL(acpi_bus_register_driver);
 
Index: work/drivers/acpi/asus_acpi.c
===================================================================
--- work.orig/drivers/acpi/asus_acpi.c	2005-07-27 10:17:43.000000000 -0600
+++ work/drivers/acpi/asus_acpi.c	2005-07-27 10:17:55.000000000 -0600
@@ -1216,8 +1216,7 @@
 	asus_proc_dir->owner = THIS_MODULE;
 
 	result = acpi_bus_register_driver(&asus_hotk_driver);
-	if (result < 1) {
-		acpi_bus_unregister_driver(&asus_hotk_driver);
+	if (result < 0) {
 		remove_proc_entry(PROC_ASUS, acpi_root_dir);
 		return -ENODEV;
 	}


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-07-28 16:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-27 22:28 [PATCH] ACPI: make acpi_bus_register_driver() return zero for success, not device count Bjorn Helgaas
     [not found] ` <200507271628.25844.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-07-28 11:58   ` Karol Kozimor
     [not found]     ` <20050728115816.GA29744-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
2005-07-28 15:26       ` Bjorn Helgaas
     [not found]         ` <200507280926.41472.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-07-28 16:07           ` Bjorn Helgaas
     [not found]             ` <200507281007.53805.bjorn.helgaas-VXdhtT5mjnY@public.gmane.org>
2005-07-28 16:31               ` Karol Kozimor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox