RE: [patch 12/26] ACPI: simplify scan.c coding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



applied.

thanks,
-Len 

>-----Original Message-----
>From: akpm@xxxxxxxx [mailto:akpm@xxxxxxxx] 
>Sent: Tuesday, March 28, 2006 5:04 PM
>To: Brown, Len
>Cc: linux-acpi@xxxxxxxxxxxxxxx; akpm@xxxxxxxx; bjorn.helgaas@xxxxxx
>Subject: [patch 12/26] ACPI: simplify scan.c coding
>
>
>From: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
>
>No functional changes; just remove leftover, unused "buffer" 
>and simplify
>control flow (no need to remember error values and goto the 
>end, when we can
>simply return the value directly).
>
>Signed-off-by: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
>Cc: "Brown, Len" <len.brown@xxxxxxxxx>
>Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
>---
>
> drivers/acpi/scan.c |   36 +++++++++++++-----------------------
> 1 files changed, 13 insertions(+), 23 deletions(-)
>
>diff -puN drivers/acpi/scan.c~acpi-simplify-scanc-coding 
>drivers/acpi/scan.c
>--- devel/drivers/acpi/scan.c~acpi-simplify-scanc-coding	
>2006-03-28 14:03:04.000000000 -0800
>+++ devel-akpm/drivers/acpi/scan.c	2006-03-28 
>14:03:04.000000000 -0800
>@@ -235,12 +235,9 @@ static int acpi_bus_get_power_flags(stru
> 
> int acpi_match_ids(struct acpi_device *device, char *ids)
> {
>-	int error = 0;
>-	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
>-
> 	if (device->flags.hardware_id)
> 		if (strstr(ids, device->pnp.hardware_id))
>-			goto Done;
>+			return 0;
> 
> 	if (device->flags.compatible_ids) {
> 		struct acpi_compatible_id_list *cid_list = 
>device->pnp.cid_list;
>@@ -249,15 +246,10 @@ int acpi_match_ids(struct acpi_device *d
> 		/* compare multiple _CID entries against driver ids */
> 		for (i = 0; i < cid_list->count; i++) {
> 			if (strstr(ids, cid_list->id[i].value))
>-				goto Done;
>+				return 0;
> 		}
> 	}
>-	error = -ENOENT;
>-
>-      Done:
>-	if (buffer.pointer)
>-		acpi_os_free(buffer.pointer);
>-	return error;
>+	return -ENOENT;
> }
> 
> static acpi_status
>@@ -639,21 +631,19 @@ EXPORT_SYMBOL(acpi_bus_register_driver);
>  */
> int acpi_bus_unregister_driver(struct acpi_driver *driver)
> {
>-	int error = 0;
>-
> 	ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver");
> 
>-	if (driver) {
>-		acpi_driver_detach(driver);
>+	if (!driver)
>+		return_VALUE(-EINVAL);
> 
>-		if (!atomic_read(&driver->references)) {
>-			spin_lock(&acpi_device_lock);
>-			list_del_init(&driver->node);
>-			spin_unlock(&acpi_device_lock);
>-		}
>-	} else
>-		error = -EINVAL;
>-	return_VALUE(error);
>+	acpi_driver_detach(driver);
>+
>+	if (!atomic_read(&driver->references)) {
>+		spin_lock(&acpi_device_lock);
>+		list_del_init(&driver->node);
>+		spin_unlock(&acpi_device_lock);
>+	}
>+	return_VALUE(0);
> }
> 
> EXPORT_SYMBOL(acpi_bus_unregister_driver);
>_
>
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux