All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ACPI: More acpi_bind_one() cleanups
@ 2013-08-07 23:54 Rafael J. Wysocki
  2013-08-07 23:55 ` [PATCH 1/2] ACPI: Drop unnecessary label from acpi_bind_one() Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-08-07 23:54 UTC (permalink / raw)
  To: ACPI Devel Maling List; +Cc: LKML, Toshi Kani, Yasuaki Ishimatsu

Hi All,

Two more cleanups for acpi_bind_one() on top of linux-pm.git/linux-next
follow:

[1/2] Drop unnecessary label from acpi_bind_one().
[2/2] Print diagnostic messages if device links cannot be created.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* [PATCH 1/2] ACPI: Drop unnecessary label from acpi_bind_one()
  2013-08-07 23:54 [PATCH 0/2] ACPI: More acpi_bind_one() cleanups Rafael J. Wysocki
@ 2013-08-07 23:55 ` Rafael J. Wysocki
  2013-08-07 23:55 ` [PATCH 2/2] ACPI: Print diagnostic messages if device links cannot be created Rafael J. Wysocki
  2013-08-08 19:33 ` [PATCH 0/2] ACPI: More acpi_bind_one() cleanups Toshi Kani
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-08-07 23:55 UTC (permalink / raw)
  To: ACPI Devel Maling List; +Cc: LKML, Toshi Kani, Yasuaki Ishimatsu

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The out_free label in acpi_bind_one() is only jumped to from one
place, so in fact it is not necessary, because the code below it
can be moved to that place directly.  Move that code and drop the
label.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/glue.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Index: linux-pm/drivers/acpi/glue.c
===================================================================
--- linux-pm.orig/drivers/acpi/glue.c
+++ linux-pm/drivers/acpi/glue.c
@@ -225,11 +225,15 @@ int acpi_bind_one(struct device *dev, ac
 	list_for_each_entry(pn, &acpi_dev->physical_node_list, node) {
 		/* Sanity check. */
 		if (pn->dev == dev) {
+			mutex_unlock(&acpi_dev->physical_node_lock);
+
 			dev_warn(dev, "Already associated with ACPI node\n");
-			if (ACPI_HANDLE(dev) == handle)
-				retval = 0;
+			kfree(physical_node);
+			if (ACPI_HANDLE(dev) != handle)
+				goto err;
 
-			goto out_free;
+			put_device(dev);
+			return 0;
 		}
 		if (pn->node_id == node_id) {
 			physnode_list = &pn->node;
@@ -262,15 +266,6 @@ int acpi_bind_one(struct device *dev, ac
 	ACPI_HANDLE_SET(dev, NULL);
 	put_device(dev);
 	return retval;
-
- out_free:
-	mutex_unlock(&acpi_dev->physical_node_lock);
-	kfree(physical_node);
-	if (retval)
-		goto err;
-
-	put_device(dev);
-	return 0;
 }
 EXPORT_SYMBOL_GPL(acpi_bind_one);
 

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

* [PATCH 2/2] ACPI: Print diagnostic messages if device links cannot be created
  2013-08-07 23:54 [PATCH 0/2] ACPI: More acpi_bind_one() cleanups Rafael J. Wysocki
  2013-08-07 23:55 ` [PATCH 1/2] ACPI: Drop unnecessary label from acpi_bind_one() Rafael J. Wysocki
@ 2013-08-07 23:55 ` Rafael J. Wysocki
  2013-08-08 19:33 ` [PATCH 0/2] ACPI: More acpi_bind_one() cleanups Toshi Kani
  2 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-08-07 23:55 UTC (permalink / raw)
  To: ACPI Devel Maling List; +Cc: LKML, Toshi Kani, Yasuaki Ishimatsu

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Although the device links created by acpi_bind_one() are not
essential from the kernel functionality point of view, user space
may be confused when they are missing, so print diagnostic messages
to the kernel log if they can't be created.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/glue.c |    7 +++++++
 1 file changed, 7 insertions(+)

Index: linux-pm/drivers/acpi/glue.c
===================================================================
--- linux-pm.orig/drivers/acpi/glue.c
+++ linux-pm/drivers/acpi/glue.c
@@ -252,8 +252,15 @@ int acpi_bind_one(struct device *dev, ac
 	acpi_physnode_link_name(physical_node_name, node_id);
 	retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
 				   physical_node_name);
+	if (retval)
+		dev_err(&acpi_dev->dev, "Failed to create link %s (%d)\n",
+			physical_node_name, retval);
+
 	retval = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj,
 				   "firmware_node");
+	if (retval)
+		dev_err(dev, "Failed to create link firmware_node (%d)\n",
+			retval);
 
 	mutex_unlock(&acpi_dev->physical_node_lock);
 


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

* Re: [PATCH 0/2] ACPI: More acpi_bind_one() cleanups
  2013-08-07 23:54 [PATCH 0/2] ACPI: More acpi_bind_one() cleanups Rafael J. Wysocki
  2013-08-07 23:55 ` [PATCH 1/2] ACPI: Drop unnecessary label from acpi_bind_one() Rafael J. Wysocki
  2013-08-07 23:55 ` [PATCH 2/2] ACPI: Print diagnostic messages if device links cannot be created Rafael J. Wysocki
@ 2013-08-08 19:33 ` Toshi Kani
  2 siblings, 0 replies; 4+ messages in thread
From: Toshi Kani @ 2013-08-08 19:33 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: ACPI Devel Maling List, LKML, Yasuaki Ishimatsu

On Thu, 2013-08-08 at 01:54 +0200, Rafael J. Wysocki wrote:
> Hi All,
> 
> Two more cleanups for acpi_bind_one() on top of linux-pm.git/linux-next
> follow:
> 
> [1/2] Drop unnecessary label from acpi_bind_one().
> [2/2] Print diagnostic messages if device links cannot be created.

Looks good.

Acked-by: Toshi Kani <toshi.kani@hp.com>

Thanks,
-Toshi


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

end of thread, other threads:[~2013-08-08 19:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07 23:54 [PATCH 0/2] ACPI: More acpi_bind_one() cleanups Rafael J. Wysocki
2013-08-07 23:55 ` [PATCH 1/2] ACPI: Drop unnecessary label from acpi_bind_one() Rafael J. Wysocki
2013-08-07 23:55 ` [PATCH 2/2] ACPI: Print diagnostic messages if device links cannot be created Rafael J. Wysocki
2013-08-08 19:33 ` [PATCH 0/2] ACPI: More acpi_bind_one() cleanups Toshi Kani

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.