diff options
-rw-r--r-- | drivers/acpi/pci_slot.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c index dd376f7ad090..d5b4ef898879 100644 --- a/drivers/acpi/pci_slot.c +++ b/drivers/acpi/pci_slot.c | |||
@@ -76,9 +76,9 @@ static struct acpi_pci_driver acpi_pci_slot_driver = { | |||
76 | }; | 76 | }; |
77 | 77 | ||
78 | static int | 78 | static int |
79 | check_slot(acpi_handle handle, int *device, unsigned long *sun) | 79 | check_slot(acpi_handle handle, unsigned long *sun) |
80 | { | 80 | { |
81 | int retval = 0; | 81 | int device = -1; |
82 | unsigned long adr, sta; | 82 | unsigned long adr, sta; |
83 | acpi_status status; | 83 | acpi_status status; |
84 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 84 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -89,32 +89,27 @@ check_slot(acpi_handle handle, int *device, unsigned long *sun) | |||
89 | if (check_sta_before_sun) { | 89 | if (check_sta_before_sun) { |
90 | /* If SxFy doesn't have _STA, we just assume it's there */ | 90 | /* If SxFy doesn't have _STA, we just assume it's there */ |
91 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); | 91 | status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); |
92 | if (ACPI_SUCCESS(status) && !(sta & ACPI_STA_DEVICE_PRESENT)) { | 92 | if (ACPI_SUCCESS(status) && !(sta & ACPI_STA_DEVICE_PRESENT)) |
93 | retval = -1; | ||
94 | goto out; | 93 | goto out; |
95 | } | ||
96 | } | 94 | } |
97 | 95 | ||
98 | status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); | 96 | status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); |
99 | if (ACPI_FAILURE(status)) { | 97 | if (ACPI_FAILURE(status)) { |
100 | dbg("_ADR returned %d on %s\n", status, (char *)buffer.pointer); | 98 | dbg("_ADR returned %d on %s\n", status, (char *)buffer.pointer); |
101 | retval = -1; | ||
102 | goto out; | 99 | goto out; |
103 | } | 100 | } |
104 | 101 | ||
105 | *device = (adr >> 16) & 0xffff; | ||
106 | |||
107 | /* No _SUN == not a slot == bail */ | 102 | /* No _SUN == not a slot == bail */ |
108 | status = acpi_evaluate_integer(handle, "_SUN", NULL, sun); | 103 | status = acpi_evaluate_integer(handle, "_SUN", NULL, sun); |
109 | if (ACPI_FAILURE(status)) { | 104 | if (ACPI_FAILURE(status)) { |
110 | dbg("_SUN returned %d on %s\n", status, (char *)buffer.pointer); | 105 | dbg("_SUN returned %d on %s\n", status, (char *)buffer.pointer); |
111 | retval = -1; | ||
112 | goto out; | 106 | goto out; |
113 | } | 107 | } |
114 | 108 | ||
109 | device = (adr >> 16) & 0xffff; | ||
115 | out: | 110 | out: |
116 | kfree(buffer.pointer); | 111 | kfree(buffer.pointer); |
117 | return retval; | 112 | return device; |
118 | } | 113 | } |
119 | 114 | ||
120 | struct callback_args { | 115 | struct callback_args { |
@@ -144,7 +139,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
144 | struct callback_args *parent_context = context; | 139 | struct callback_args *parent_context = context; |
145 | struct pci_bus *pci_bus = parent_context->pci_bus; | 140 | struct pci_bus *pci_bus = parent_context->pci_bus; |
146 | 141 | ||
147 | if (check_slot(handle, &device, &sun)) | 142 | device = check_slot(handle, &sun); |
143 | if (device < 0) | ||
148 | return AE_OK; | 144 | return AE_OK; |
149 | 145 | ||
150 | slot = kmalloc(sizeof(*slot), GFP_KERNEL); | 146 | slot = kmalloc(sizeof(*slot), GFP_KERNEL); |