Fix _STA checking in acpi_bus_add
PATCH 1/1 Fix _STA checking in acpi_bus_add
In 2.6.1-rc1, acpi_bus_add() calls acpi_bus_get_status() to evaluate _STA, but botches checking the return value. The result is that _STA is ignored (if it was evaluated correctly), or we check garbage (if the evaluation failed). Here's a patch to fix it:
===== drivers/acpi/scan.c 1.19 vs edited =====
drivers/acpi/scan.c +4 -4
@@ -703,11 +703,11 @@switch (type) {case ACPI_BUS_TYPE_DEVICE : result =acpi_bus_get_status (device); -if (!result) -break ; -if (!device->status.present) +if (ACPI_FAILURE (result) || !device->status.present) { result = -ENOENT ; - goto end; + goto end; + } +break ;default :STRUCT_TO_INT (device->status) =0x0F ;break ;
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
A message that is not in the archive (sent off-list or not yet received): [email protected]
I haven't seen any response to this. Is there at least agreement that the current code is broken? Is there somewhere I should be checking for status besides the mailing list?
Quoted 15 lines · Bjorn Helgaas
In 2.6.1-rc1,
acpi_bus_add()callsacpi_bus_get_status()to evaluate_STA, but botches checking the return value. The result is that_STAis ignored (if it was evaluated correctly), or we check garbage (if the evaluation failed). Here's a patch to fix it:=====
drivers/acpi/scan.c1.19 vs edited =====drivers/acpi/scan.c +0
-2@@ -703,11 +703,11 @@switch (type) {case ACPI_BUS_TYPE_DEVICE : result =acpi_bus_get_status (device); -if (!result) -break ;
drivers/acpi/scan.c line 713
Quoted 10 lines
drivers/acpi/scan.c +4
-2-if (!device->status.present) +if (ACPI_FAILURE (result) || !device->status.present) { result = -ENOENT ; - goto end; + goto end; + } +break ;default :STRUCT_TO_INT (device->status) =0x0F ;break ;
-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html
Len Brown
AppliedApplied.
thanks Bjorn,
-Len
ps. did you find this because you've got a system where the actual get_status failed, or the _STA returned !present and that was ignored?
Quoted 15 lines · Bjorn Helgaas
In 2.6.1-rc1,
acpi_bus_add()callsacpi_bus_get_status()to evaluate_STA, but botches checking the return value. The result is that_STAis ignored (if it was evaluated correctly), or we check garbage (if the evaluation failed). Here's a patch to fix it:=====
drivers/acpi/scan.c1.19 vs edited =====drivers/acpi/scan.c +0
-2@@ -703,11 +703,11 @@switch (type) {case ACPI_BUS_TYPE_DEVICE : result =acpi_bus_get_status (device); -if (!result) -break ;
drivers/acpi/scan.c line 713
Quoted 10 lines
drivers/acpi/scan.c +4
-2-if (!device->status.present) +if (ACPI_FAILURE (result) || !device->status.present) { result = -ENOENT ; - goto end; + goto end; + } +break ;default :STRUCT_TO_INT (device->status) =0x0F ;break ;
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line · Len Brown
Applied.
Thanks!
Quoted 2 lines
ps. did you find this because you've got a system where the actual
get_statusfailed, or the_STAreturned !present and that was ignored?
Umm... let's see... the latter, I guess. I found this because ia64 linux was complaining about some invalid ranges in _CRS on the Intel Tiger box. It turned out that the ranges all had _LEN==0, and we should have been ignoring them anyway.
But somebody from HP-UX noticed that we were complaining about ranges on a bridge that should have been !present according to the _STA.
Now that you've applied this, we have to resolve the next issue I found while investigating this: the chipset config interface (CBN/CSFF) is reported as _STA==0x8, i.e., "functioning, but not present". We can't find anything in the spec on how to interpret this.
The problem here is that since CBN/CSFF is !present, we won't enumerate devices under them. Therefore, we will no longer find the AGP bridge on Big Sur.
Bjorn
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn