Commit 3264fe10 authored by Len Brown's avatar Len Brown Committed by Len Brown

[ACPI] Remove default PNPACPI driver binding to legacy ACPI devices.

This conflicted with PNP-aware and ACPI-aware drivers,
and required that its exclude-list carry vendor-specific
driver names, which we can't possibly maintain.
Signed-off-by: default avatarDavid Shaohua Li <shaohua.li@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 52352fbb
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
static int num = 0; static int num = 0;
static char excluded_id_list[] = static char __initdata excluded_id_list[] =
"PNP0C0A," /* Battery */ "PNP0C0A," /* Battery */
"PNP0C0C,PNP0C0E,PNP0C0D," /* Button */ "PNP0C0C,PNP0C0E,PNP0C0D," /* Button */
"PNP0C09," /* EC */ "PNP0C09," /* EC */
...@@ -58,7 +58,7 @@ void *pnpacpi_kmalloc(size_t size, int f) ...@@ -58,7 +58,7 @@ void *pnpacpi_kmalloc(size_t size, int f)
#define TEST_ALPHA(c) \ #define TEST_ALPHA(c) \
if (!('@' <= (c) || (c) <= 'Z')) \ if (!('@' <= (c) || (c) <= 'Z')) \
return 0 return 0
static int ispnpidacpi(char *id) static int __init ispnpidacpi(char *id)
{ {
TEST_ALPHA(id[0]); TEST_ALPHA(id[0]);
TEST_ALPHA(id[1]); TEST_ALPHA(id[1]);
...@@ -72,7 +72,7 @@ static int ispnpidacpi(char *id) ...@@ -72,7 +72,7 @@ static int ispnpidacpi(char *id)
return 1; return 1;
} }
static void pnpidacpi_to_pnpid(char *id, char *str) static void __init pnpidacpi_to_pnpid(char *id, char *str)
{ {
str[0] = id[0]; str[0] = id[0];
str[1] = id[1]; str[1] = id[1];
...@@ -131,13 +131,17 @@ struct pnp_protocol pnpacpi_protocol = { ...@@ -131,13 +131,17 @@ struct pnp_protocol pnpacpi_protocol = {
.disable = pnpacpi_disable_resources, .disable = pnpacpi_disable_resources,
}; };
static int acpi_pnp_add(struct acpi_device *device) static int __init pnpacpi_add_device(struct acpi_device *device)
{ {
acpi_handle temp = NULL; acpi_handle temp = NULL;
acpi_status status; acpi_status status;
struct pnp_id *dev_id; struct pnp_id *dev_id;
struct pnp_dev *dev; struct pnp_dev *dev;
if (!ispnpidacpi(acpi_device_hid(device)) ||
is_exclusive_device(device))
return 0;
pnp_dbg("ACPI device : hid %s", acpi_device_hid(device)); pnp_dbg("ACPI device : hid %s", acpi_device_hid(device));
dev = pnpacpi_kmalloc(sizeof(struct pnp_dev), GFP_KERNEL); dev = pnpacpi_kmalloc(sizeof(struct pnp_dev), GFP_KERNEL);
if (!dev) { if (!dev) {
...@@ -217,7 +221,6 @@ static int acpi_pnp_add(struct acpi_device *device) ...@@ -217,7 +221,6 @@ static int acpi_pnp_add(struct acpi_device *device)
pnp_add_device(dev); pnp_add_device(dev);
num ++; num ++;
acpi_driver_data(device) = dev;
return AE_OK; return AE_OK;
err1: err1:
kfree(dev_id); kfree(dev_id);
...@@ -226,34 +229,16 @@ static int acpi_pnp_add(struct acpi_device *device) ...@@ -226,34 +229,16 @@ static int acpi_pnp_add(struct acpi_device *device)
return -EINVAL; return -EINVAL;
} }
static int acpi_pnp_remove (struct acpi_device *device, int type) static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
u32 lvl, void *context, void **rv)
{ {
struct pnp_dev *dev = acpi_driver_data(device); struct acpi_device *device;
if (!dev)
return AE_ERROR;
pnp_remove_device(dev); if (!acpi_bus_get_device(handle, &device))
pnpacpi_add_device(device);
return AE_OK; return AE_OK;
} }
static int acpi_pnp_match(struct acpi_device *device,
struct acpi_driver *driver)
{
return (!ispnpidacpi(acpi_device_hid(device)) ||
is_exclusive_device(device));
}
/* default acpi PNP device driver, support hotplug */
static struct acpi_driver acpi_pnp_driver = {
.name = "ACPI PNP Driver",
.class = "acpi_pnp",
.ops = {
.add = acpi_pnp_add,
.remove = acpi_pnp_remove,
.match = acpi_pnp_match,
},
};
int __init pnpacpi_init(void) int __init pnpacpi_init(void)
{ {
if (acpi_disabled) { if (acpi_disabled) {
...@@ -262,8 +247,9 @@ int __init pnpacpi_init(void) ...@@ -262,8 +247,9 @@ int __init pnpacpi_init(void)
} }
pnp_info("PnP ACPI init"); pnp_info("PnP ACPI init");
pnp_register_protocol(&pnpacpi_protocol); pnp_register_protocol(&pnpacpi_protocol);
if (acpi_bus_register_driver(&acpi_pnp_driver) < 0) acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
return -ENODEV; ACPI_UINT32_MAX, pnpacpi_add_device_handler,
NULL, NULL);
pnp_info("PnP ACPI: found %d devices", num); pnp_info("PnP ACPI: found %d devices", num);
return 0; return 0;
} }
......
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