public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Li Shaohua <shaohua.li@intel.com>
Cc: Matthieu Castet <castet.matthieu@free.fr>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Rene Herman <rene.herman@keyaccess.nl>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: [patch 47/53] PNPACPI: move _CRS/_PRS warnings closer to the action
Date: Fri, 18 Apr 2008 14:50:42 -0600	[thread overview]
Message-ID: <20080418205056.769763376@ldl.fc.hp.com> (raw)
In-Reply-To: 20080418204955.342963315@ldl.fc.hp.com

[-- Attachment #1: pnpacpi-cleanup-CRS-PRS-warnings --]
[-- Type: text/plain, Size: 4796 bytes --]

Move warnings about _CRS and _PRS problems to the place where we
actually make the ACPI calls.  Then we don't have to pass around
acpi_status values any more than necessary.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Index: work8/drivers/pnp/pnpacpi/pnpacpi.h
===================================================================
--- work8.orig/drivers/pnp/pnpacpi/pnpacpi.h	2008-04-17 15:58:17.000000000 -0600
+++ work8/drivers/pnp/pnpacpi/pnpacpi.h	2008-04-17 15:58:22.000000000 -0600
@@ -5,8 +5,8 @@
 #include <linux/acpi.h>
 #include <linux/pnp.h>
 
-acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *);
-acpi_status pnpacpi_parse_resource_option_data(struct pnp_dev *);
+int pnpacpi_parse_allocated_resource(struct pnp_dev *);
+int pnpacpi_parse_resource_option_data(struct pnp_dev *);
 int pnpacpi_encode_resources(struct pnp_dev *, struct acpi_buffer *);
 int pnpacpi_build_resource_template(struct pnp_dev *, struct acpi_buffer *);
 #endif
Index: work8/drivers/pnp/pnpacpi/core.c
===================================================================
--- work8.orig/drivers/pnp/pnpacpi/core.c	2008-04-17 16:00:00.000000000 -0600
+++ work8/drivers/pnp/pnpacpi/core.c	2008-04-17 16:04:22.000000000 -0600
@@ -75,10 +75,7 @@
 
 static int pnpacpi_get_resources(struct pnp_dev *dev)
 {
-	acpi_status status;
-
-	status = pnpacpi_parse_allocated_resource(dev);
-	return ACPI_FAILURE(status) ? -ENODEV : 0;
+	return pnpacpi_parse_allocated_resource(dev);
 }
 
 static int pnpacpi_set_resources(struct pnp_dev *dev)
@@ -180,22 +177,11 @@
 	else
 		strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name));
 
-	if (dev->active) {
-		/* parse allocated resource */
-		status = pnpacpi_parse_allocated_resource(dev);
-		if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
-			pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s",
-				acpi_device_hid(device));
-		}
-	}
+	if (dev->active)
+		pnpacpi_parse_allocated_resource(dev);
 
-	if (dev->capabilities & PNP_CONFIGURABLE) {
-		status = pnpacpi_parse_resource_option_data(dev);
-		if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
-			pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s",
-				acpi_device_hid(device));
-		}
-	}
+	if (dev->capabilities & PNP_CONFIGURABLE)
+		pnpacpi_parse_resource_option_data(dev);
 
 	if (device->flags.compatible_ids) {
 		struct acpi_compatible_id_list *cid_list = device->pnp.cid_list;
Index: work8/drivers/pnp/pnpacpi/rsparser.c
===================================================================
--- work8.orig/drivers/pnp/pnpacpi/rsparser.c	2008-04-17 15:58:29.000000000 -0600
+++ work8/drivers/pnp/pnpacpi/rsparser.c	2008-04-17 16:17:08.000000000 -0600
@@ -339,14 +339,21 @@
 	return AE_OK;
 }
 
-acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *dev)
+int pnpacpi_parse_allocated_resource(struct pnp_dev *dev)
 {
 	acpi_handle handle = dev->data;
+	acpi_status status;
 
 	pnp_init_resources(dev);
 
-	return acpi_walk_resources(handle, METHOD_NAME__CRS,
-				   pnpacpi_allocated_resource, dev);
+	status = acpi_walk_resources(handle, METHOD_NAME__CRS,
+				     pnpacpi_allocated_resource, dev);
+	if (ACPI_FAILURE(status)) {
+		if (status != AE_NOT_FOUND)
+			dev_err(&dev->dev, "can't evaluate _CRS: %d", status);
+		return -EPERM;
+	}
+	return 0;
 }
 
 static __init void pnpacpi_parse_dma_option(struct pnp_option *option,
@@ -656,7 +663,7 @@
 	return AE_OK;
 }
 
-acpi_status __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev)
+int __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev)
 {
 	acpi_handle handle = dev->data;
 	acpi_status status;
@@ -664,13 +671,19 @@
 
 	parse_data.option = pnp_register_independent_option(dev);
 	if (!parse_data.option)
-		return AE_ERROR;
+		return -ENOMEM;
+
 	parse_data.option_independent = parse_data.option;
 	parse_data.dev = dev;
 	status = acpi_walk_resources(handle, METHOD_NAME__PRS,
 				     pnpacpi_option_resource, &parse_data);
 
-	return status;
+	if (ACPI_FAILURE(status)) {
+		if (status != AE_NOT_FOUND)
+			dev_err(&dev->dev, "can't evaluate _PRS: %d", status);
+		return -EPERM;
+	}
+	return 0;
 }
 
 static int pnpacpi_supported_resource(struct acpi_resource *res)
@@ -729,7 +742,7 @@
 	status = acpi_walk_resources(handle, METHOD_NAME__CRS,
 				     pnpacpi_count_resources, &res_cnt);
 	if (ACPI_FAILURE(status)) {
-		dev_err(&dev->dev, "can't evaluate _CRS\n");
+		dev_err(&dev->dev, "can't evaluate _CRS: %d\n", status);
 		return -EINVAL;
 	}
 	if (!res_cnt)
@@ -744,7 +757,7 @@
 				     pnpacpi_type_resources, &resource);
 	if (ACPI_FAILURE(status)) {
 		kfree(buffer->pointer);
-		dev_err(&dev->dev, "can't evaluate _CRS\n");
+		dev_err(&dev->dev, "can't evaluate _CRS: %d\n", status);
 		return -EINVAL;
 	}
 	/* resource will pointer the end resource now */

-- 

  parent reply	other threads:[~2008-04-18 21:12 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18 20:49 [patch 00/53] PNP cleanup and convert to dynamic resources, v3 Bjorn Helgaas
2008-04-18 20:49 ` [patch 01/53] ISAPNP: move config register addresses out of isapnp.h Bjorn Helgaas
2008-04-18 20:49 ` [patch 02/53] PNPACPI: continue after _CRS and _PRS errors Bjorn Helgaas
2008-04-18 20:49 ` [patch 03/53] PNP: make pnp_add_id() internal to PNP core Bjorn Helgaas
2008-04-18 20:49 ` [patch 04/53] PNP: change pnp_add_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-18 20:50 ` [patch 05/53] PNP: add pnp_eisa_id_to_string() Bjorn Helgaas
2008-04-18 20:50 ` [patch 06/53] PNP: add pnp_alloc_dev() Bjorn Helgaas
2008-04-18 20:50 ` [patch 07/53] PNP: make pnp_add_card_id() internal to PNP core Bjorn Helgaas
2008-04-18 20:50 ` [patch 08/53] PNP: change pnp_add_card_id() to allocate its own pnp_id structures Bjorn Helgaas
2008-04-18 20:50 ` [patch 09/53] ISAPNP: pull pnp_add_card_id() out of isapnp_parse_card_id() Bjorn Helgaas
2008-04-18 20:50 ` [patch 10/53] PNP: add pnp_alloc_card() Bjorn Helgaas
2008-04-18 20:50 ` [patch 11/53] PNPACPI: pnpacpi_encode_ext_irq() wrongly set "irq" instead of "extended_irq" Bjorn Helgaas
2008-04-18 20:50 ` [patch 12/53] PNPACPI: use temporaries to reduce repetition Bjorn Helgaas
2008-04-18 20:50 ` [patch 13/53] PNPACPI: hoist dma_flags() out of pnpacpi_parse_allocated_dmaresource() Bjorn Helgaas
2008-04-18 20:50 ` [patch 14/53] PNPACPI: extend irq_flags() to set IORESOURCE_IRQ_SHAREABLE when appropriate Bjorn Helgaas
2008-04-18 20:50 ` [patch 15/53] PNPACPI: pass pnp_dev instead of acpi_handle Bjorn Helgaas
2008-04-18 20:50 ` [patch 16/53] PNP: remove pnp_resource_table from internal get/set interfaces Bjorn Helgaas
2008-04-18 20:50 ` [patch 17/53] PNP: remove more pnp_resource_table arguments Bjorn Helgaas
2008-04-18 20:50 ` [patch 18/53] PNP: add pnp_init_resources(struct pnp_dev *) interface Bjorn Helgaas
2008-04-18 20:50 ` [patch 19/53] PNP: remove pnp_resource_table from internal pnp_clean_resource_table interface Bjorn Helgaas
2008-04-18 20:50 ` [patch 20/53] PNP: remove unused interfaces using pnp_resource_table Bjorn Helgaas
2008-04-18 20:50 ` [patch 21/53] PNP: use dev_printk when possible Bjorn Helgaas
2008-04-18 20:50 ` [patch 22/53] PNP: factor pnp_init_resource_table() and pnp_clean_resource_table() Bjorn Helgaas
2008-04-18 22:29   ` Rene Herman
2008-04-19  3:57     ` Bjorn Helgaas
2008-04-19  4:43       ` Rene Herman
2008-04-19  4:46         ` Rene Herman
2008-04-21 18:41         ` Rene Herman
2008-04-21 23:10           ` Bjorn Helgaas
2008-04-22 21:01             ` Rene Herman
2008-04-23 23:08               ` Bjorn Helgaas
2008-04-24  1:26                 ` Rene Herman
2008-04-24  1:39                   ` Rene Herman
2008-04-24 22:45               ` Bjorn Helgaas
2008-04-18 20:50 ` [patch 23/53] PNP: add pnp_get_resource() interface Bjorn Helgaas
2008-04-18 20:50 ` [patch 24/53] PNP: remove pnp_mem_flags() as an lvalue Bjorn Helgaas
2008-04-18 20:50 ` [patch 25/53] PNP: convert resource accessors to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
2008-04-18 20:50 ` [patch 26/53] PNP: use conventional "i" for loop indices Bjorn Helgaas
2008-04-18 20:50 ` [patch 27/53] PNP: convert resource checks to use pnp_get_resource(), not pnp_resource_table Bjorn Helgaas
2008-04-18 20:50 ` [patch 28/53] PNP: convert resource assign functions " Bjorn Helgaas
2008-04-18 20:50 ` [patch 29/53] PNP: convert sysfs interface " Bjorn Helgaas
2008-04-18 20:50 ` [patch 30/53] PNP: convert resource initializers " Bjorn Helgaas
2008-04-18 20:50 ` [patch 31/53] PNP: convert encoders " Bjorn Helgaas
2008-04-18 20:50 ` [patch 32/53] PNP: remove PNP_MAX_* uses Bjorn Helgaas
2008-04-18 20:50 ` [patch 33/53] rtc: dont reference pnp_resource_table directly Bjorn Helgaas
2008-04-18 20:50 ` [patch 34/53] PNP: make pnp_resource_table private to PNP core Bjorn Helgaas
2008-04-18 20:50 ` [patch 35/53] PNP: remove pnp_resource_table references from resource decoders Bjorn Helgaas
2008-04-18 20:50 ` [patch 36/53] PNP: add struct pnp_resource Bjorn Helgaas
2008-04-18 20:50 ` [patch 37/53] PNP: add pnp_resource index for ISAPNP Bjorn Helgaas
2008-04-18 20:50 ` [patch 38/53] PNP: add pnp_new_resource() to find a new unset pnp_resource Bjorn Helgaas
2008-04-18 20:50 ` [patch 39/53] PNP: make generic pnp_add_irq_resource() Bjorn Helgaas
2008-04-18 20:50 ` [patch 40/53] PNP: make generic pnp_add_dma_resource() Bjorn Helgaas
2008-04-18 20:50 ` [patch 41/53] PNP: make generic pnp_add_io_resource() Bjorn Helgaas
2008-04-18 20:50 ` [patch 42/53] PNP: make generic pnp_add_mem_resource() Bjorn Helgaas
2008-04-18 20:50 ` [patch 43/53] ISAPNP: fold isapnp_read_resources() back into isapnp_get_resources() Bjorn Helgaas
2008-04-18 20:50 ` [patch 44/53] PNP: add pnp_resource_type() internal interface Bjorn Helgaas
2008-04-18 20:50 ` [patch 45/53] PNP: replace pnp_resource_table with dynamically allocated resources Bjorn Helgaas
2008-04-18 20:50 ` [patch 46/53] PNP: remove ratelimit on add resource failures Bjorn Helgaas
2008-04-18 20:50 ` Bjorn Helgaas [this message]
2008-04-18 20:50 ` [patch 48/53] PNPACPI: remove some pnp_dbg calls Bjorn Helgaas
2008-04-18 20:50 ` [patch 49/53] PNP: make interfaces private to the PNP core Bjorn Helgaas
2008-04-18 20:50 ` [patch 50/53] ISAPNP: remove unused pnp_dev->regs field Bjorn Helgaas
2008-04-18 20:50 ` [patch 51/53] PNPBIOS: remove include/linux/pnpbios.h Bjorn Helgaas
2008-04-18 20:50 ` [patch 52/53] PNP: fill in generic pnp_dev fields earlier Bjorn Helgaas
2008-04-18 20:50 ` [patch 53/53] PNP: dont sort by type in /sys/.../resources Bjorn Helgaas

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=20080418205056.769763376@ldl.fc.hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    /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