Patchwork [1/16] ACPI: Separate adding ACPI device objects from probing ACPI drivers

login
register
mail settings
Submitter Rafael J. Wysocki
Date Jan. 11, 2013, 8:58 p.m.
Message ID <6935441.WoipOdx2kz@vostro.rjw.lan>
Download mbox | patch
Permalink /patch/211418/
State Not Applicable
Headers show

Comments

Rafael J. Wysocki - Jan. 11, 2013, 8:58 p.m.
On Friday, January 11, 2013 10:37:59 PM Mika Westerberg wrote:
> On Fri, Jan 11, 2013 at 09:31:43PM +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Subject: ACPI / scan: Fix check of device_attach() return value.
> > 
> > Since device_attach() returns 1 on success and 0 on failure,
> > the check against its return value in acpi_bus_device_attach()
> > should be reveresed.  Make it so.
> 
> Not sure if it matters but it returns 0 if no device was bound to a driver
> and -ENODEV in case of error. If we only want to terminate in case of
> error, following might be better.
> 
> 	} else if (device_attach(&device->dev) < 0) {

Yes, this check will be better.

Which means that the patch is actually yours, so I've just added the changelog. :-)

Thanks,
Rafael


---
From: Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: ACPI / scan: Fix check of device_attach() return value.

Since device_attach() returns 1 on success (a driver has been bound
to the device), the check against its return value in
acpi_bus_device_attach() should modified to take that into accout.
Make it so.

[rjw: Subject and changelog.]
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/acpi/scan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
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
Mika Westerberg - Jan. 11, 2013, 8:59 p.m.
On Fri, Jan 11, 2013 at 09:58:50PM +0100, Rafael J. Wysocki wrote:
> On Friday, January 11, 2013 10:37:59 PM Mika Westerberg wrote:
> > On Fri, Jan 11, 2013 at 09:31:43PM +0100, Rafael J. Wysocki wrote:
> > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > Subject: ACPI / scan: Fix check of device_attach() return value.
> > > 
> > > Since device_attach() returns 1 on success and 0 on failure,
> > > the check against its return value in acpi_bus_device_attach()
> > > should be reveresed.  Make it so.
> > 
> > Not sure if it matters but it returns 0 if no device was bound to a driver
> > and -ENODEV in case of error. If we only want to terminate in case of
> > error, following might be better.
> > 
> > 	} else if (device_attach(&device->dev) < 0) {
> 
> Yes, this check will be better.
> 
> Which means that the patch is actually yours, so I've just added the changelog. :-)
> 

Thanks! (and I've tested this, it works ;-))
--
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

Patch

Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -1598,7 +1598,7 @@  static acpi_status acpi_bus_device_attac
 	if (!acpi_match_device_ids(device, acpi_platform_device_ids)) {
 		/* This is a known good platform device. */
 		acpi_create_platform_device(device);
-	} else if (device_attach(&device->dev)) {
+	} else if (device_attach(&device->dev) < 0) {
 		status = AE_CTRL_DEPTH;
 	}
 	return status;