Lines Matching defs:sub_driver

56 	int (*init)(struct generic_sub_driver *sub_driver);
57 void (*notify)(struct generic_sub_driver *sub_driver, u32 event);
158 struct generic_sub_driver *sub_driver = data;
160 if (!sub_driver || !sub_driver->notify)
162 sub_driver->notify(sub_driver, event);
165 static int __init setup_acpi_notify(struct generic_sub_driver *sub_driver)
170 if (!*sub_driver->handle)
173 rc = acpi_bus_get_device(*sub_driver->handle, &sub_driver->device);
175 pr_err("acpi_bus_get_device(%s) failed: %d\n", sub_driver->name, rc);
179 sub_driver->device->driver_data = sub_driver;
180 sprintf(acpi_device_class(sub_driver->device), "%s/%s",
181 ACPI_LAPTOP_ACPI_EVENT_PREFIX, sub_driver->name);
183 status = acpi_install_notify_handler(*sub_driver->handle,
184 sub_driver->type, dispatch_acpi_notify, sub_driver);
188 "handling %s events\n", sub_driver->name);
191 sub_driver->name, acpi_format_exception(status));
195 sub_driver->acpi_notify_installed = 1;
445 static int __init event_init(struct generic_sub_driver *sub_driver)
478 static void event_notify(struct generic_sub_driver *sub_driver, u32 event)
500 static void generic_subdriver_exit(struct generic_sub_driver *sub_driver);
502 static int __init generic_subdriver_init(struct generic_sub_driver *sub_driver)
506 if (!sub_driver || !sub_driver->driver)
509 ret = platform_driver_register(sub_driver->driver);
513 if (sub_driver->init) {
514 ret = sub_driver->init(sub_driver);
519 if (sub_driver->notify) {
520 ret = setup_acpi_notify(sub_driver);
532 generic_subdriver_exit(sub_driver);
536 static void generic_subdriver_exit(struct generic_sub_driver *sub_driver)
539 if (sub_driver->acpi_notify_installed) {
540 acpi_remove_notify_handler(*sub_driver->handle,
541 sub_driver->type, dispatch_acpi_notify);
542 sub_driver->acpi_notify_installed = 0;
544 platform_driver_unregister(sub_driver->driver);