diff options
Diffstat (limited to 'drivers/acpi/events/evxfregn.c')
-rw-r--r-- | drivers/acpi/events/evxfregn.c | 114 |
1 files changed, 55 insertions, 59 deletions
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index d058587b3427..6f28ea2db5ba 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c | |||
@@ -49,8 +49,7 @@ | |||
49 | #include <acpi/acevents.h> | 49 | #include <acpi/acevents.h> |
50 | 50 | ||
51 | #define _COMPONENT ACPI_EVENTS | 51 | #define _COMPONENT ACPI_EVENTS |
52 | ACPI_MODULE_NAME ("evxfregn") | 52 | ACPI_MODULE_NAME("evxfregn") |
53 | |||
54 | 53 | ||
55 | /******************************************************************************* | 54 | /******************************************************************************* |
56 | * | 55 | * |
@@ -67,36 +66,31 @@ | |||
67 | * DESCRIPTION: Install a handler for all op_regions of a given space_id. | 66 | * DESCRIPTION: Install a handler for all op_regions of a given space_id. |
68 | * | 67 | * |
69 | ******************************************************************************/ | 68 | ******************************************************************************/ |
70 | |||
71 | acpi_status | 69 | acpi_status |
72 | acpi_install_address_space_handler ( | 70 | acpi_install_address_space_handler(acpi_handle device, |
73 | acpi_handle device, | 71 | acpi_adr_space_type space_id, |
74 | acpi_adr_space_type space_id, | 72 | acpi_adr_space_handler handler, |
75 | acpi_adr_space_handler handler, | 73 | acpi_adr_space_setup setup, void *context) |
76 | acpi_adr_space_setup setup, | ||
77 | void *context) | ||
78 | { | 74 | { |
79 | struct acpi_namespace_node *node; | 75 | struct acpi_namespace_node *node; |
80 | acpi_status status; | 76 | acpi_status status; |
81 | |||
82 | |||
83 | ACPI_FUNCTION_TRACE ("acpi_install_address_space_handler"); | ||
84 | 77 | ||
78 | ACPI_FUNCTION_TRACE("acpi_install_address_space_handler"); | ||
85 | 79 | ||
86 | /* Parameter validation */ | 80 | /* Parameter validation */ |
87 | 81 | ||
88 | if (!device) { | 82 | if (!device) { |
89 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 83 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
90 | } | 84 | } |
91 | 85 | ||
92 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 86 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
93 | if (ACPI_FAILURE (status)) { | 87 | if (ACPI_FAILURE(status)) { |
94 | return_ACPI_STATUS (status); | 88 | return_ACPI_STATUS(status); |
95 | } | 89 | } |
96 | 90 | ||
97 | /* Convert and validate the device handle */ | 91 | /* Convert and validate the device handle */ |
98 | 92 | ||
99 | node = acpi_ns_map_handle_to_node (device); | 93 | node = acpi_ns_map_handle_to_node(device); |
100 | if (!node) { | 94 | if (!node) { |
101 | status = AE_BAD_PARAMETER; | 95 | status = AE_BAD_PARAMETER; |
102 | goto unlock_and_exit; | 96 | goto unlock_and_exit; |
@@ -104,21 +98,23 @@ acpi_install_address_space_handler ( | |||
104 | 98 | ||
105 | /* Install the handler for all Regions for this Space ID */ | 99 | /* Install the handler for all Regions for this Space ID */ |
106 | 100 | ||
107 | status = acpi_ev_install_space_handler (node, space_id, handler, setup, context); | 101 | status = |
108 | if (ACPI_FAILURE (status)) { | 102 | acpi_ev_install_space_handler(node, space_id, handler, setup, |
103 | context); | ||
104 | if (ACPI_FAILURE(status)) { | ||
109 | goto unlock_and_exit; | 105 | goto unlock_and_exit; |
110 | } | 106 | } |
111 | 107 | ||
112 | /* Run all _REG methods for this address space */ | 108 | /* Run all _REG methods for this address space */ |
113 | 109 | ||
114 | status = acpi_ev_execute_reg_methods (node, space_id); | 110 | status = acpi_ev_execute_reg_methods(node, space_id); |
115 | 111 | ||
116 | unlock_and_exit: | 112 | unlock_and_exit: |
117 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 113 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
118 | return_ACPI_STATUS (status); | 114 | return_ACPI_STATUS(status); |
119 | } | 115 | } |
120 | EXPORT_SYMBOL(acpi_install_address_space_handler); | ||
121 | 116 | ||
117 | EXPORT_SYMBOL(acpi_install_address_space_handler); | ||
122 | 118 | ||
123 | /******************************************************************************* | 119 | /******************************************************************************* |
124 | * | 120 | * |
@@ -135,36 +131,33 @@ EXPORT_SYMBOL(acpi_install_address_space_handler); | |||
135 | ******************************************************************************/ | 131 | ******************************************************************************/ |
136 | 132 | ||
137 | acpi_status | 133 | acpi_status |
138 | acpi_remove_address_space_handler ( | 134 | acpi_remove_address_space_handler(acpi_handle device, |
139 | acpi_handle device, | 135 | acpi_adr_space_type space_id, |
140 | acpi_adr_space_type space_id, | 136 | acpi_adr_space_handler handler) |
141 | acpi_adr_space_handler handler) | ||
142 | { | 137 | { |
143 | union acpi_operand_object *obj_desc; | 138 | union acpi_operand_object *obj_desc; |
144 | union acpi_operand_object *handler_obj; | 139 | union acpi_operand_object *handler_obj; |
145 | union acpi_operand_object *region_obj; | 140 | union acpi_operand_object *region_obj; |
146 | union acpi_operand_object **last_obj_ptr; | 141 | union acpi_operand_object **last_obj_ptr; |
147 | struct acpi_namespace_node *node; | 142 | struct acpi_namespace_node *node; |
148 | acpi_status status; | 143 | acpi_status status; |
149 | |||
150 | |||
151 | ACPI_FUNCTION_TRACE ("acpi_remove_address_space_handler"); | ||
152 | 144 | ||
145 | ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler"); | ||
153 | 146 | ||
154 | /* Parameter validation */ | 147 | /* Parameter validation */ |
155 | 148 | ||
156 | if (!device) { | 149 | if (!device) { |
157 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 150 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
158 | } | 151 | } |
159 | 152 | ||
160 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 153 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
161 | if (ACPI_FAILURE (status)) { | 154 | if (ACPI_FAILURE(status)) { |
162 | return_ACPI_STATUS (status); | 155 | return_ACPI_STATUS(status); |
163 | } | 156 | } |
164 | 157 | ||
165 | /* Convert and validate the device handle */ | 158 | /* Convert and validate the device handle */ |
166 | 159 | ||
167 | node = acpi_ns_map_handle_to_node (device); | 160 | node = acpi_ns_map_handle_to_node(device); |
168 | if (!node) { | 161 | if (!node) { |
169 | status = AE_BAD_PARAMETER; | 162 | status = AE_BAD_PARAMETER; |
170 | goto unlock_and_exit; | 163 | goto unlock_and_exit; |
@@ -172,7 +165,7 @@ acpi_remove_address_space_handler ( | |||
172 | 165 | ||
173 | /* Make sure the internal object exists */ | 166 | /* Make sure the internal object exists */ |
174 | 167 | ||
175 | obj_desc = acpi_ns_get_attached_object (node); | 168 | obj_desc = acpi_ns_get_attached_object(node); |
176 | if (!obj_desc) { | 169 | if (!obj_desc) { |
177 | status = AE_NOT_EXIST; | 170 | status = AE_NOT_EXIST; |
178 | goto unlock_and_exit; | 171 | goto unlock_and_exit; |
@@ -188,10 +181,11 @@ acpi_remove_address_space_handler ( | |||
188 | if (handler_obj->address_space.space_id == space_id) { | 181 | if (handler_obj->address_space.space_id == space_id) { |
189 | /* Matched space_id, first dereference this in the Regions */ | 182 | /* Matched space_id, first dereference this in the Regions */ |
190 | 183 | ||
191 | ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, | 184 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
192 | "Removing address handler %p(%p) for region %s on Device %p(%p)\n", | 185 | "Removing address handler %p(%p) for region %s on Device %p(%p)\n", |
193 | handler_obj, handler, acpi_ut_get_region_name (space_id), | 186 | handler_obj, handler, |
194 | node, obj_desc)); | 187 | acpi_ut_get_region_name(space_id), |
188 | node, obj_desc)); | ||
195 | 189 | ||
196 | region_obj = handler_obj->address_space.region_list; | 190 | region_obj = handler_obj->address_space.region_list; |
197 | 191 | ||
@@ -205,13 +199,14 @@ acpi_remove_address_space_handler ( | |||
205 | * The region is just inaccessible as indicated to | 199 | * The region is just inaccessible as indicated to |
206 | * the _REG method | 200 | * the _REG method |
207 | */ | 201 | */ |
208 | acpi_ev_detach_region (region_obj, TRUE); | 202 | acpi_ev_detach_region(region_obj, TRUE); |
209 | 203 | ||
210 | /* | 204 | /* |
211 | * Walk the list: Just grab the head because the | 205 | * Walk the list: Just grab the head because the |
212 | * detach_region removed the previous head. | 206 | * detach_region removed the previous head. |
213 | */ | 207 | */ |
214 | region_obj = handler_obj->address_space.region_list; | 208 | region_obj = |
209 | handler_obj->address_space.region_list; | ||
215 | 210 | ||
216 | } | 211 | } |
217 | 212 | ||
@@ -221,7 +216,7 @@ acpi_remove_address_space_handler ( | |||
221 | 216 | ||
222 | /* Now we can delete the handler object */ | 217 | /* Now we can delete the handler object */ |
223 | 218 | ||
224 | acpi_ut_remove_reference (handler_obj); | 219 | acpi_ut_remove_reference(handler_obj); |
225 | goto unlock_and_exit; | 220 | goto unlock_and_exit; |
226 | } | 221 | } |
227 | 222 | ||
@@ -233,15 +228,16 @@ acpi_remove_address_space_handler ( | |||
233 | 228 | ||
234 | /* The handler does not exist */ | 229 | /* The handler does not exist */ |
235 | 230 | ||
236 | ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, | 231 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
237 | "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", | 232 | "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", |
238 | handler, acpi_ut_get_region_name (space_id), space_id, node, obj_desc)); | 233 | handler, acpi_ut_get_region_name(space_id), space_id, |
234 | node, obj_desc)); | ||
239 | 235 | ||
240 | status = AE_NOT_EXIST; | 236 | status = AE_NOT_EXIST; |
241 | 237 | ||
242 | unlock_and_exit: | 238 | unlock_and_exit: |
243 | (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 239 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
244 | return_ACPI_STATUS (status); | 240 | return_ACPI_STATUS(status); |
245 | } | 241 | } |
246 | EXPORT_SYMBOL(acpi_remove_address_space_handler); | ||
247 | 242 | ||
243 | EXPORT_SYMBOL(acpi_remove_address_space_handler); | ||