.. | .. |
---|
8 | 8 | * Copyright (C) 2002 Hiroshi Aono (h-aono@ap.jp.nec.com) |
---|
9 | 9 | * Copyright (C) 2002,2003 Takayoshi Kochi (t-kochi@bq.jp.nec.com) |
---|
10 | 10 | * Copyright (C) 2002,2003 NEC Corporation |
---|
11 | | - * Copyright (C) 2003-2005 Matthew Wilcox (matthew.wilcox@hp.com) |
---|
| 11 | + * Copyright (C) 2003-2005 Matthew Wilcox (willy@infradead.org) |
---|
12 | 12 | * Copyright (C) 2003-2005 Hewlett Packard |
---|
13 | 13 | * |
---|
14 | 14 | * All rights reserved. |
---|
.. | .. |
---|
40 | 40 | static struct acpiphp_attention_info *attention_info; |
---|
41 | 41 | |
---|
42 | 42 | #define DRIVER_VERSION "0.5" |
---|
43 | | -#define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@us.ibm.com>, Takayoshi Kochi <t-kochi@bq.jp.nec.com>, Matthew Wilcox <willy@hp.com>" |
---|
| 43 | +#define DRIVER_AUTHOR "Greg Kroah-Hartman <gregkh@us.ibm.com>, Takayoshi Kochi <t-kochi@bq.jp.nec.com>, Matthew Wilcox <willy@infradead.org>" |
---|
44 | 44 | #define DRIVER_DESC "ACPI Hot Plug PCI Controller Driver" |
---|
45 | 45 | |
---|
46 | 46 | MODULE_AUTHOR(DRIVER_AUTHOR); |
---|
.. | .. |
---|
57 | 57 | static int get_latch_status(struct hotplug_slot *slot, u8 *value); |
---|
58 | 58 | static int get_adapter_status(struct hotplug_slot *slot, u8 *value); |
---|
59 | 59 | |
---|
60 | | -static struct hotplug_slot_ops acpi_hotplug_slot_ops = { |
---|
| 60 | +static const struct hotplug_slot_ops acpi_hotplug_slot_ops = { |
---|
61 | 61 | .enable_slot = enable_slot, |
---|
62 | 62 | .disable_slot = disable_slot, |
---|
63 | 63 | .set_attention_status = set_attention_status, |
---|
.. | .. |
---|
118 | 118 | */ |
---|
119 | 119 | static int enable_slot(struct hotplug_slot *hotplug_slot) |
---|
120 | 120 | { |
---|
121 | | - struct slot *slot = hotplug_slot->private; |
---|
| 121 | + struct slot *slot = to_slot(hotplug_slot); |
---|
122 | 122 | |
---|
123 | 123 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
---|
124 | 124 | |
---|
.. | .. |
---|
135 | 135 | */ |
---|
136 | 136 | static int disable_slot(struct hotplug_slot *hotplug_slot) |
---|
137 | 137 | { |
---|
138 | | - struct slot *slot = hotplug_slot->private; |
---|
| 138 | + struct slot *slot = to_slot(hotplug_slot); |
---|
139 | 139 | |
---|
140 | 140 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
---|
141 | 141 | |
---|
.. | .. |
---|
179 | 179 | */ |
---|
180 | 180 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) |
---|
181 | 181 | { |
---|
182 | | - struct slot *slot = hotplug_slot->private; |
---|
| 182 | + struct slot *slot = to_slot(hotplug_slot); |
---|
183 | 183 | |
---|
184 | 184 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
---|
185 | 185 | |
---|
.. | .. |
---|
225 | 225 | */ |
---|
226 | 226 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) |
---|
227 | 227 | { |
---|
228 | | - struct slot *slot = hotplug_slot->private; |
---|
| 228 | + struct slot *slot = to_slot(hotplug_slot); |
---|
229 | 229 | |
---|
230 | 230 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
---|
231 | 231 | |
---|
.. | .. |
---|
245 | 245 | */ |
---|
246 | 246 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
---|
247 | 247 | { |
---|
248 | | - struct slot *slot = hotplug_slot->private; |
---|
| 248 | + struct slot *slot = to_slot(hotplug_slot); |
---|
249 | 249 | |
---|
250 | 250 | pr_debug("%s - physical_slot = %s\n", __func__, slot_name(slot)); |
---|
251 | 251 | |
---|
.. | .. |
---|
266 | 266 | if (!slot) |
---|
267 | 267 | goto error; |
---|
268 | 268 | |
---|
269 | | - slot->hotplug_slot = kzalloc(sizeof(*slot->hotplug_slot), GFP_KERNEL); |
---|
270 | | - if (!slot->hotplug_slot) |
---|
271 | | - goto error_slot; |
---|
272 | | - |
---|
273 | | - slot->hotplug_slot->info = &slot->info; |
---|
274 | | - |
---|
275 | | - slot->hotplug_slot->private = slot; |
---|
276 | | - slot->hotplug_slot->ops = &acpi_hotplug_slot_ops; |
---|
| 269 | + slot->hotplug_slot.ops = &acpi_hotplug_slot_ops; |
---|
277 | 270 | |
---|
278 | 271 | slot->acpi_slot = acpiphp_slot; |
---|
279 | | - slot->hotplug_slot->info->power_status = acpiphp_get_power_status(slot->acpi_slot); |
---|
280 | | - slot->hotplug_slot->info->attention_status = 0; |
---|
281 | | - slot->hotplug_slot->info->latch_status = acpiphp_get_latch_status(slot->acpi_slot); |
---|
282 | | - slot->hotplug_slot->info->adapter_status = acpiphp_get_adapter_status(slot->acpi_slot); |
---|
283 | 272 | |
---|
284 | 273 | acpiphp_slot->slot = slot; |
---|
285 | 274 | slot->sun = sun; |
---|
286 | 275 | snprintf(name, SLOT_NAME_SIZE, "%u", sun); |
---|
287 | 276 | |
---|
288 | | - retval = pci_hp_register(slot->hotplug_slot, acpiphp_slot->bus, |
---|
| 277 | + retval = pci_hp_register(&slot->hotplug_slot, acpiphp_slot->bus, |
---|
289 | 278 | acpiphp_slot->device, name); |
---|
290 | 279 | if (retval == -EBUSY) |
---|
291 | | - goto error_hpslot; |
---|
| 280 | + goto error_slot; |
---|
292 | 281 | if (retval) { |
---|
293 | 282 | pr_err("pci_hp_register failed with error %d\n", retval); |
---|
294 | | - goto error_hpslot; |
---|
| 283 | + goto error_slot; |
---|
295 | 284 | } |
---|
296 | 285 | |
---|
297 | 286 | pr_info("Slot [%s] registered\n", slot_name(slot)); |
---|
298 | 287 | |
---|
299 | 288 | return 0; |
---|
300 | | -error_hpslot: |
---|
301 | | - kfree(slot->hotplug_slot); |
---|
302 | 289 | error_slot: |
---|
303 | 290 | kfree(slot); |
---|
304 | 291 | error: |
---|
.. | .. |
---|
312 | 299 | |
---|
313 | 300 | pr_info("Slot [%s] unregistered\n", slot_name(slot)); |
---|
314 | 301 | |
---|
315 | | - pci_hp_deregister(slot->hotplug_slot); |
---|
316 | | - kfree(slot->hotplug_slot); |
---|
| 302 | + pci_hp_deregister(&slot->hotplug_slot); |
---|
317 | 303 | kfree(slot); |
---|
318 | 304 | } |
---|
319 | 305 | |
---|