Lines Matching defs:context
50 static void hotplug_event(u32 type, struct acpiphp_context *context);
54 * acpiphp_init_context - Create hotplug context and grab a reference to it.
55 * @adev: ACPI device object to create the context for.
61 struct acpiphp_context *context;
63 context = kzalloc(sizeof(*context), GFP_KERNEL);
64 if (!context)
67 context->refcount = 1;
68 context->hp.notify = acpiphp_hotplug_notify;
69 context->hp.fixup = acpiphp_post_dock_fixup;
70 acpi_set_hp_context(adev, &context->hp);
71 return context;
75 * acpiphp_get_context - Get hotplug context and grab a reference to it.
76 * @adev: ACPI device object to get the context for.
82 struct acpiphp_context *context;
87 context = to_acpiphp_context(adev->hp);
88 context->refcount++;
89 return context;
93 * acpiphp_put_context - Drop a reference to ACPI hotplug context.
94 * @context: ACPI hotplug context to drop a reference to.
96 * The context object is removed if there are no more references to it.
100 static void acpiphp_put_context(struct acpiphp_context *context)
102 if (--context->refcount)
105 WARN_ON(context->bridge);
106 context->hp.self->hp = NULL;
107 kfree(context);
122 struct acpiphp_context *context;
126 context = acpiphp_get_context(adev);
127 if (!context)
130 if (context->func.parent->is_going_away) {
131 acpiphp_put_context(context);
132 context = NULL;
136 get_bridge(context->func.parent);
137 acpiphp_put_context(context);
141 return context;
144 static void acpiphp_let_context_go(struct acpiphp_context *context)
146 put_bridge(context->func.parent);
151 struct acpiphp_context *context;
167 context = bridge->context;
168 /* Root bridges will not have hotplug context. */
169 if (context) {
171 put_bridge(context->func.parent);
172 context->bridge = NULL;
173 acpiphp_put_context(context);
191 struct acpiphp_context *context = acpiphp_grab_context(adev);
195 if (!context)
198 bus = context->func.slot->bus;
216 acpiphp_let_context_go(context);
220 * acpiphp_add_context - Add ACPIPHP context to an ACPI device object.
221 * @handle: ACPI handle of the object to add a context to.
230 struct acpiphp_context *context;
255 context = acpiphp_init_context(adev);
256 if (!context) {
258 acpi_handle_err(handle, "No hotplug context\n");
261 newfunc = &context->func;
284 acpiphp_put_context(context);
774 static void hotplug_event(u32 type, struct acpiphp_context *context)
776 acpi_handle handle = context->hp.self->handle;
777 struct acpiphp_func *func = &context->func;
782 bridge = context->bridge;
830 struct acpiphp_context *context;
832 context = acpiphp_grab_context(adev);
833 if (!context)
836 hotplug_event(type, context);
837 acpiphp_let_context_go(context);
890 struct acpiphp_context *context;
894 * under its parent, so the context should be there, unless the
898 context = acpiphp_get_context(adev);
899 if (!context)
902 bridge->context = context;
903 context->bridge = bridge;
905 get_bridge(context->func.parent);