From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Toshi Kani <toshi.kani@hp.com>
Subject: [PATCH] ACPI: Do not fail acpi_bind_one() if device is already bound correctly
Date: Fri, 02 Aug 2013 00:33:42 +0200 [thread overview]
Message-ID: <1888947.F5IBMfDKlY@vostro.rjw.lan> (raw)
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Modify acpi_bind_one() so that it doesn't fail if the device
represented by its first argument has already been bound to the
given ACPI handle (second argument), because that is not a good
enough reason for returning an error code.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/glue.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
Index: linux-pm/drivers/acpi/glue.c
===================================================================
--- linux-pm.orig/drivers/acpi/glue.c
+++ linux-pm/drivers/acpi/glue.c
@@ -143,7 +143,10 @@ int acpi_bind_one(struct device *dev, ac
list_for_each_entry(pn, &acpi_dev->physical_node_list, node)
if (pn->dev == dev) {
dev_warn(dev, "Already associated with ACPI node\n");
- goto err_free;
+ if (ACPI_HANDLE(dev) == handle)
+ retval = 0;
+
+ goto out_free;
}
/* allocate physical node id according to physical_node_id_bitmap */
@@ -152,7 +155,7 @@ int acpi_bind_one(struct device *dev, ac
ACPI_MAX_PHYSICAL_NODE);
if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) {
retval = -ENOSPC;
- goto err_free;
+ goto out_free;
}
set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap);
@@ -185,10 +188,14 @@ int acpi_bind_one(struct device *dev, ac
put_device(dev);
return retval;
- err_free:
+ out_free:
mutex_unlock(&acpi_dev->physical_node_lock);
kfree(physical_node);
- goto err;
+ if (retval)
+ goto err;
+
+ put_device(dev);
+ return 0;
}
EXPORT_SYMBOL_GPL(acpi_bind_one);
next reply other threads:[~2013-08-01 22:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 22:33 Rafael J. Wysocki [this message]
2013-08-02 2:48 ` [PATCH] ACPI: Do not fail acpi_bind_one() if device is already bound correctly Lan Tianyu
2013-08-02 13:43 ` Rafael J. Wysocki
2013-08-02 15:16 ` Lan Tianyu
2013-08-02 22:38 ` Toshi Kani
2013-08-03 0:47 ` Rafael J. Wysocki
2013-08-04 0:32 ` Toshi Kani
2013-08-04 14:03 ` Rafael J. Wysocki
2013-08-05 22:20 ` Toshi Kani
2013-08-05 22:47 ` Rafael J. Wysocki
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=1888947.F5IBMfDKlY@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=bhelgaas@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=toshi.kani@hp.com \
/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