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.
231 struct acpiphp_context *context;
256 context = acpiphp_init_context(adev);
257 if (!context) {
259 acpi_handle_err(handle, "No hotplug context\n");
262 newfunc = &context->func;
285 acpiphp_put_context(context);
783 static void hotplug_event(u32 type, struct acpiphp_context *context)
785 acpi_handle handle = context->hp.self->handle;
786 struct acpiphp_func *func = &context->func;
791 bridge = context->bridge;
839 struct acpiphp_context *context;
841 context = acpiphp_grab_context(adev);
842 if (!context)
845 hotplug_event(type, context);
846 acpiphp_let_context_go(context);
899 struct acpiphp_context *context;
903 * under its parent, so the context should be there, unless the
907 context = acpiphp_get_context(adev);
908 if (!context)
911 bridge->context = context;
912 context->bridge = bridge;
914 get_bridge(context->func.parent);