Pull acpi_bus_register_driver into release branch
Conflicts: drivers/acpi/asus_acpi.c drivers/acpi/scan.c
This commit is contained in:
commit
69cd291c6b
|
@ -1119,6 +1119,8 @@ static int asus_hotk_check(void)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int asus_hotk_found;
|
||||||
|
|
||||||
static int asus_hotk_add(struct acpi_device *device)
|
static int asus_hotk_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
@ -1180,6 +1182,8 @@ static int asus_hotk_add(struct acpi_device *device)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asus_hotk_found = 1;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (result) {
|
if (result) {
|
||||||
kfree(hotk);
|
kfree(hotk);
|
||||||
|
@ -1226,7 +1230,19 @@ static int __init asus_acpi_init(void)
|
||||||
asus_proc_dir->owner = THIS_MODULE;
|
asus_proc_dir->owner = THIS_MODULE;
|
||||||
|
|
||||||
result = acpi_bus_register_driver(&asus_hotk_driver);
|
result = acpi_bus_register_driver(&asus_hotk_driver);
|
||||||
if (result < 1) {
|
if (result < 0) {
|
||||||
|
remove_proc_entry(PROC_ASUS, acpi_root_dir);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a bit of a kludge. We only want this module loaded
|
||||||
|
* for ASUS systems, but there's currently no way to probe the
|
||||||
|
* ACPI namespace for ASUS HIDs. So we just return failure if
|
||||||
|
* we didn't find one, which will cause the module to be
|
||||||
|
* unloaded.
|
||||||
|
*/
|
||||||
|
if (!asus_hotk_found) {
|
||||||
acpi_bus_unregister_driver(&asus_hotk_driver);
|
acpi_bus_unregister_driver(&asus_hotk_driver);
|
||||||
remove_proc_entry(PROC_ASUS, acpi_root_dir);
|
remove_proc_entry(PROC_ASUS, acpi_root_dir);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
|
@ -142,7 +142,7 @@ static void acpi_device_register(struct acpi_device *device,
|
||||||
create_sysfs_device_files(device);
|
create_sysfs_device_files(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_device_unregister(struct acpi_device *device, int type)
|
static void acpi_device_unregister(struct acpi_device *device, int type)
|
||||||
{
|
{
|
||||||
spin_lock(&acpi_device_lock);
|
spin_lock(&acpi_device_lock);
|
||||||
if (device->parent) {
|
if (device->parent) {
|
||||||
|
@ -158,7 +158,6 @@ static int acpi_device_unregister(struct acpi_device *device, int type)
|
||||||
acpi_detach_data(device->handle, acpi_bus_data_handler);
|
acpi_detach_data(device->handle, acpi_bus_data_handler);
|
||||||
remove_sysfs_device_files(device);
|
remove_sysfs_device_files(device);
|
||||||
kobject_unregister(&device->kobj);
|
kobject_unregister(&device->kobj);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
|
void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
|
||||||
|
@ -537,10 +536,9 @@ static int acpi_start_single_object(struct acpi_device *device)
|
||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_driver_attach(struct acpi_driver *drv)
|
static void acpi_driver_attach(struct acpi_driver *drv)
|
||||||
{
|
{
|
||||||
struct list_head *node, *next;
|
struct list_head *node, *next;
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_driver_attach");
|
ACPI_FUNCTION_TRACE("acpi_driver_attach");
|
||||||
|
|
||||||
|
@ -557,7 +555,6 @@ static int acpi_driver_attach(struct acpi_driver *drv)
|
||||||
if (!acpi_bus_driver_init(dev, drv)) {
|
if (!acpi_bus_driver_init(dev, drv)) {
|
||||||
acpi_start_single_object(dev);
|
acpi_start_single_object(dev);
|
||||||
atomic_inc(&drv->references);
|
atomic_inc(&drv->references);
|
||||||
count++;
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Found driver [%s] for device [%s]\n",
|
"Found driver [%s] for device [%s]\n",
|
||||||
drv->name, dev->pnp.bus_id));
|
drv->name, dev->pnp.bus_id));
|
||||||
|
@ -566,10 +563,9 @@ static int acpi_driver_attach(struct acpi_driver *drv)
|
||||||
spin_lock(&acpi_device_lock);
|
spin_lock(&acpi_device_lock);
|
||||||
}
|
}
|
||||||
spin_unlock(&acpi_device_lock);
|
spin_unlock(&acpi_device_lock);
|
||||||
return_VALUE(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_driver_detach(struct acpi_driver *drv)
|
static void acpi_driver_detach(struct acpi_driver *drv)
|
||||||
{
|
{
|
||||||
struct list_head *node, *next;
|
struct list_head *node, *next;
|
||||||
|
|
||||||
|
@ -591,7 +587,6 @@ static int acpi_driver_detach(struct acpi_driver *drv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spin_unlock(&acpi_device_lock);
|
spin_unlock(&acpi_device_lock);
|
||||||
return_VALUE(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -599,28 +594,22 @@ static int acpi_driver_detach(struct acpi_driver *drv)
|
||||||
* @driver: driver being registered
|
* @driver: driver being registered
|
||||||
*
|
*
|
||||||
* Registers a driver with the ACPI bus. Searches the namespace for all
|
* Registers a driver with the ACPI bus. Searches the namespace for all
|
||||||
* devices that match the driver's criteria and binds. Returns the
|
* devices that match the driver's criteria and binds. Returns zero for
|
||||||
* number of devices that were claimed by the driver, or a negative
|
* success or a negative error status for failure.
|
||||||
* error status for failure.
|
|
||||||
*/
|
*/
|
||||||
int acpi_bus_register_driver(struct acpi_driver *driver)
|
int acpi_bus_register_driver(struct acpi_driver *driver)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
|
ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
|
||||||
|
|
||||||
if (acpi_disabled)
|
if (acpi_disabled)
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
|
|
||||||
if (!driver)
|
|
||||||
return_VALUE(-EINVAL);
|
|
||||||
|
|
||||||
spin_lock(&acpi_device_lock);
|
spin_lock(&acpi_device_lock);
|
||||||
list_add_tail(&driver->node, &acpi_bus_drivers);
|
list_add_tail(&driver->node, &acpi_bus_drivers);
|
||||||
spin_unlock(&acpi_device_lock);
|
spin_unlock(&acpi_device_lock);
|
||||||
count = acpi_driver_attach(driver);
|
acpi_driver_attach(driver);
|
||||||
|
|
||||||
return_VALUE(count);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_bus_register_driver);
|
EXPORT_SYMBOL(acpi_bus_register_driver);
|
||||||
|
@ -632,13 +621,8 @@ EXPORT_SYMBOL(acpi_bus_register_driver);
|
||||||
* Unregisters a driver with the ACPI bus. Searches the namespace for all
|
* Unregisters a driver with the ACPI bus. Searches the namespace for all
|
||||||
* devices that match the driver's criteria and unbinds.
|
* devices that match the driver's criteria and unbinds.
|
||||||
*/
|
*/
|
||||||
int acpi_bus_unregister_driver(struct acpi_driver *driver)
|
void acpi_bus_unregister_driver(struct acpi_driver *driver)
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver");
|
|
||||||
|
|
||||||
if (!driver)
|
|
||||||
return_VALUE(-EINVAL);
|
|
||||||
|
|
||||||
acpi_driver_detach(driver);
|
acpi_driver_detach(driver);
|
||||||
|
|
||||||
if (!atomic_read(&driver->references)) {
|
if (!atomic_read(&driver->references)) {
|
||||||
|
@ -646,7 +630,7 @@ int acpi_bus_unregister_driver(struct acpi_driver *driver)
|
||||||
list_del_init(&driver->node);
|
list_del_init(&driver->node);
|
||||||
spin_unlock(&acpi_device_lock);
|
spin_unlock(&acpi_device_lock);
|
||||||
}
|
}
|
||||||
return_VALUE(0);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_bus_unregister_driver);
|
EXPORT_SYMBOL(acpi_bus_unregister_driver);
|
||||||
|
|
|
@ -512,7 +512,7 @@ static struct sonypi_device {
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
static struct acpi_device *sonypi_acpi_device;
|
static struct acpi_device *sonypi_acpi_device;
|
||||||
static int acpi_enabled;
|
static int acpi_driver_registered;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int sonypi_ec_write(u8 addr, u8 value)
|
static int sonypi_ec_write(u8 addr, u8 value)
|
||||||
|
@ -869,7 +869,7 @@ found:
|
||||||
sonypi_report_input_event(event);
|
sonypi_report_input_event(event);
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
if (acpi_enabled)
|
if (sonypi_acpi_device)
|
||||||
acpi_bus_generate_event(sonypi_acpi_device, 1, event);
|
acpi_bus_generate_event(sonypi_acpi_device, 1, event);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1551,8 +1551,8 @@ static int __init sonypi_init(void)
|
||||||
goto err_free_device;
|
goto err_free_device;
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0)
|
if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0)
|
||||||
acpi_enabled = 1;
|
acpi_driver_registered = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1567,7 +1567,7 @@ static int __init sonypi_init(void)
|
||||||
static void __exit sonypi_exit(void)
|
static void __exit sonypi_exit(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
if (acpi_enabled)
|
if (acpi_driver_registered)
|
||||||
acpi_bus_unregister_driver(&sonypi_acpi_driver);
|
acpi_bus_unregister_driver(&sonypi_acpi_driver);
|
||||||
#endif
|
#endif
|
||||||
platform_device_unregister(sonypi_platform_device);
|
platform_device_unregister(sonypi_platform_device);
|
||||||
|
|
|
@ -327,7 +327,7 @@ int acpi_bus_set_power(acpi_handle handle, int state);
|
||||||
int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data);
|
int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data);
|
||||||
int acpi_bus_receive_event(struct acpi_bus_event *event);
|
int acpi_bus_receive_event(struct acpi_bus_event *event);
|
||||||
int acpi_bus_register_driver(struct acpi_driver *driver);
|
int acpi_bus_register_driver(struct acpi_driver *driver);
|
||||||
int acpi_bus_unregister_driver(struct acpi_driver *driver);
|
void acpi_bus_unregister_driver(struct acpi_driver *driver);
|
||||||
int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
|
int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent,
|
||||||
acpi_handle handle, int type);
|
acpi_handle handle, int type);
|
||||||
int acpi_bus_trim(struct acpi_device *start, int rmdevice);
|
int acpi_bus_trim(struct acpi_device *start, int rmdevice);
|
||||||
|
|
Loading…
Reference in a new issue