linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] [Patch-next] ACPI, APEI Fix the return value(==NULL) of acpi_pre_map always.
@ 2010-08-17  0:56 Jin Dongming
  2010-08-17  1:37 ` Huang Ying
  0 siblings, 1 reply; 5+ messages in thread
From: Jin Dongming @ 2010-08-17  0:56 UTC (permalink / raw)
  To: Huang Ying
  Cc: Randy Dunlap, Stephen Rothwell, Andi Kleen, Hidetoshi Seto, ACPI,
	LKLM

acpi_pre_map() is used for remapping the physical address of I/O, so
it should be return NULL or remapped virtual address. The problem
is whether I/O remapping is successful or not, the function returns
NULL always.

In acpi_pre_map(), after the physical address is remapped sucessfully,
it will check whether the physical address has been added into acpi_iomaps
list again. If the physical address has beed added into acpi_iomaps,
the virtual address will be saved in vaddr. Otherwise, NULL be saved in
vaddr.

So if the physical address has never been remapped, the return value of
acpi_pre_map will be NULL always.

This patch fixed it and I confirmed it on x86_64 next-tree.

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
 drivers/acpi/atomicio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
index 8f8bd73..1bc2614 100644
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -133,7 +133,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr,
 
 	spin_lock_irqsave(&acpi_iomaps_lock, flags);
 	vaddr = __acpi_try_ioremap(paddr, size);
-	if (vaddr) {
+	if (unlikely(vaddr)) {
 		spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
 		iounmap(map->vaddr);
 		kfree(map);
@@ -142,7 +142,7 @@ static void __iomem *acpi_pre_map(phys_addr_t paddr,
 	list_add_tail_rcu(&map->list, &acpi_iomaps);
 	spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
 
-	return vaddr + (paddr - pg_off);
+	return map->vaddr + (paddr - pg_off);
 err_unmap:
 	iounmap(vaddr);
 	return NULL;
-- 
1.7.1.1

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

end of thread, other threads:[~2010-08-17  4:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-17  0:56 [PATCH 3/4] [Patch-next] ACPI, APEI Fix the return value(==NULL) of acpi_pre_map always Jin Dongming
2010-08-17  1:37 ` Huang Ying
2010-08-17  2:43   ` Jin Dongming
2010-08-17  4:15     ` Huang Ying
2010-08-17  4:47       ` Jin Dongming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).