Lines Matching refs:sub_driver
48 int (*init)(struct generic_sub_driver *sub_driver);
49 void (*notify)(struct generic_sub_driver *sub_driver, u32 event);
150 struct generic_sub_driver *sub_driver = data; in dispatch_acpi_notify() local
152 if (!sub_driver || !sub_driver->notify) in dispatch_acpi_notify()
154 sub_driver->notify(sub_driver, event); in dispatch_acpi_notify()
157 static int __init setup_acpi_notify(struct generic_sub_driver *sub_driver) in setup_acpi_notify() argument
161 if (!*sub_driver->handle) in setup_acpi_notify()
164 sub_driver->device = acpi_fetch_acpi_dev(*sub_driver->handle); in setup_acpi_notify()
165 if (!sub_driver->device) { in setup_acpi_notify()
166 pr_err("acpi_fetch_acpi_dev(%s) failed\n", sub_driver->name); in setup_acpi_notify()
170 sub_driver->device->driver_data = sub_driver; in setup_acpi_notify()
171 sprintf(acpi_device_class(sub_driver->device), "%s/%s", in setup_acpi_notify()
172 ACPI_LAPTOP_ACPI_EVENT_PREFIX, sub_driver->name); in setup_acpi_notify()
174 status = acpi_install_notify_handler(*sub_driver->handle, in setup_acpi_notify()
175 sub_driver->type, dispatch_acpi_notify, sub_driver); in setup_acpi_notify()
179 "handling %s events\n", sub_driver->name); in setup_acpi_notify()
182 sub_driver->name, acpi_format_exception(status)); in setup_acpi_notify()
186 sub_driver->acpi_notify_installed = 1; in setup_acpi_notify()
437 static int __init event_init(struct generic_sub_driver *sub_driver) in event_init() argument
470 static void event_notify(struct generic_sub_driver *sub_driver, u32 event) in event_notify() argument
493 static void generic_subdriver_exit(struct generic_sub_driver *sub_driver);
495 static int __init generic_subdriver_init(struct generic_sub_driver *sub_driver) in generic_subdriver_init() argument
499 if (!sub_driver || !sub_driver->driver) in generic_subdriver_init()
502 ret = platform_driver_register(sub_driver->driver); in generic_subdriver_init()
506 if (sub_driver->init) { in generic_subdriver_init()
507 ret = sub_driver->init(sub_driver); in generic_subdriver_init()
512 if (sub_driver->notify) { in generic_subdriver_init()
513 ret = setup_acpi_notify(sub_driver); in generic_subdriver_init()
525 generic_subdriver_exit(sub_driver); in generic_subdriver_init()
529 static void generic_subdriver_exit(struct generic_sub_driver *sub_driver) in generic_subdriver_exit() argument
532 if (sub_driver->acpi_notify_installed) { in generic_subdriver_exit()
533 acpi_remove_notify_handler(*sub_driver->handle, in generic_subdriver_exit()
534 sub_driver->type, dispatch_acpi_notify); in generic_subdriver_exit()
535 sub_driver->acpi_notify_installed = 0; in generic_subdriver_exit()
537 platform_driver_unregister(sub_driver->driver); in generic_subdriver_exit()