Commit 96e89afe authored by Henrique de Moraes Holschuh's avatar Henrique de Moraes Holschuh Committed by Len Brown

ACPI: ibm-acpi: allow module to load when acpi notifiers can't be set (v2)

This patch allows for ibm-acpi to coexist (with diminished functionality) with
other drivers like ACPI_BAY.  ibm-acpi will simply disable the functions it is
not able to register ACPI notifiers for.
Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Chris Wedgwood <cw@f00f.org>
Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 5b18167d
...@@ -2507,7 +2507,7 @@ static int __init setup_notify(struct ibm_struct *ibm) ...@@ -2507,7 +2507,7 @@ static int __init setup_notify(struct ibm_struct *ibm)
ret = acpi_bus_get_device(*ibm->handle, &ibm->device); ret = acpi_bus_get_device(*ibm->handle, &ibm->device);
if (ret < 0) { if (ret < 0) {
printk(IBM_ERR "%s device not present\n", ibm->name); printk(IBM_ERR "%s device not present\n", ibm->name);
return 0; return -ENODEV;
} }
acpi_driver_data(ibm->device) = ibm; acpi_driver_data(ibm->device) = ibm;
...@@ -2516,8 +2516,13 @@ static int __init setup_notify(struct ibm_struct *ibm) ...@@ -2516,8 +2516,13 @@ static int __init setup_notify(struct ibm_struct *ibm)
status = acpi_install_notify_handler(*ibm->handle, ibm->type, status = acpi_install_notify_handler(*ibm->handle, ibm->type,
dispatch_notify, ibm); dispatch_notify, ibm);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n", if (status == AE_ALREADY_EXISTS) {
ibm->name, status); printk(IBM_NOTICE "another device driver is already handling %s events\n",
ibm->name);
} else {
printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n",
ibm->name, status);
}
return -ENODEV; return -ENODEV;
} }
ibm->notify_installed = 1; ibm->notify_installed = 1;
...@@ -2553,6 +2558,8 @@ static int __init register_driver(struct ibm_struct *ibm) ...@@ -2553,6 +2558,8 @@ static int __init register_driver(struct ibm_struct *ibm)
return ret; return ret;
} }
static void ibm_exit(struct ibm_struct *ibm);
static int __init ibm_init(struct ibm_struct *ibm) static int __init ibm_init(struct ibm_struct *ibm)
{ {
int ret; int ret;
...@@ -2594,6 +2601,12 @@ static int __init ibm_init(struct ibm_struct *ibm) ...@@ -2594,6 +2601,12 @@ static int __init ibm_init(struct ibm_struct *ibm)
if (ibm->notify) { if (ibm->notify) {
ret = setup_notify(ibm); ret = setup_notify(ibm);
if (ret == -ENODEV) {
printk(IBM_NOTICE "disabling subdriver %s\n",
ibm->name);
ibm_exit(ibm);
return 0;
}
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment