* ACPI device model
  */
 
-static void ibm_handle_init(char *name,
+static void drv_acpi_handle_init(char *name,
                           acpi_handle *handle, acpi_handle parent,
                           char **paths, int num_paths, char **path)
 {
        *handle = NULL;
 }
 
-static void dispatch_notify(acpi_handle handle, u32 event, void *data)
+static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data)
 {
        struct ibm_struct *ibm = data;
 
-       if (!ibm || !ibm->notify)
+       if (!ibm || !ibm->acpi || !ibm->acpi->notify)
                return;
 
-       ibm->notify(ibm, event);
+       ibm->acpi->notify(ibm, event);
 }
 
-static int __init setup_notify(struct ibm_struct *ibm)
+static int __init setup_acpi_notify(struct ibm_struct *ibm)
 {
        acpi_status status;
        int ret;
 
-       if (!*ibm->handle)
+       BUG_ON(!ibm->acpi);
+
+       if (!*ibm->acpi->handle)
                return 0;
 
        dbg_printk(TPACPI_DBG_INIT,
                "setting up ACPI notify for %s\n", ibm->name);
 
-       ret = acpi_bus_get_device(*ibm->handle, &ibm->device);
+       ret = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device);
        if (ret < 0) {
                printk(IBM_ERR "%s device not present\n", ibm->name);
                return -ENODEV;
        }
 
-       acpi_driver_data(ibm->device) = ibm;
-       sprintf(acpi_device_class(ibm->device), "%s/%s",
+       acpi_driver_data(ibm->acpi->device) = ibm;
+       sprintf(acpi_device_class(ibm->acpi->device), "%s/%s",
                IBM_ACPI_EVENT_PREFIX,
                ibm->name);
 
-       status = acpi_install_notify_handler(*ibm->handle, ibm->type,
-                                            dispatch_notify, ibm);
+       status = acpi_install_notify_handler(*ibm->acpi->handle,
+                       ibm->acpi->type, dispatch_acpi_notify, ibm);
        if (ACPI_FAILURE(status)) {
                if (status == AE_ALREADY_EXISTS) {
                        printk(IBM_NOTICE "another device driver is already handling %s events\n",
                }
                return -ENODEV;
        }
-       ibm->flags.notify_installed = 1;
+       ibm->flags.acpi_notify_installed = 1;
        return 0;
 }
 
-static int __init ibm_device_add(struct acpi_device *device)
+static int __init tpacpi_device_add(struct acpi_device *device)
 {
        return 0;
 }
        dbg_printk(TPACPI_DBG_INIT,
                "registering %s as an ACPI driver\n", ibm->name);
 
-       ibm->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
-       if (!ibm->driver) {
+       BUG_ON(!ibm->acpi);
+
+       ibm->acpi->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
+       if (!ibm->acpi->driver) {
                printk(IBM_ERR "kzalloc(ibm->driver) failed\n");
                return -ENOMEM;
        }
 
-       sprintf(ibm->driver->name, "%s_%s", IBM_NAME, ibm->name);
-       ibm->driver->ids = ibm->hid;
-       ibm->driver->ops.add = &ibm_device_add;
+       sprintf(ibm->acpi->driver->name, "%s_%s", IBM_NAME, ibm->name);
+       ibm->acpi->driver->ids = ibm->acpi->hid;
+       ibm->acpi->driver->ops.add = &tpacpi_device_add;
 
-       ret = acpi_bus_register_driver(ibm->driver);
+       ret = acpi_bus_register_driver(ibm->acpi->driver);
        if (ret < 0) {
                printk(IBM_ERR "acpi_bus_register_driver(%s) failed: %d\n",
-                      ibm->hid, ret);
-               kfree(ibm->driver);
-               ibm->driver = NULL;
+                      ibm->acpi->hid, ret);
+               kfree(ibm->acpi->driver);
+               ibm->acpi->driver = NULL;
        } else if (!ret)
-               ibm->flags.driver_registered = 1;
+               ibm->flags.acpi_driver_registered = 1;
 
        return ret;
 }
  ****************************************************************************
  ****************************************************************************/
 
-static int dispatch_read(char *page, char **start, off_t off, int count,
-                        int *eof, void *data)
+static int dispatch_procfs_read(char *page, char **start, off_t off,
+                       int count, int *eof, void *data)
 {
        struct ibm_struct *ibm = data;
        int len;
        return len;
 }
 
-static int dispatch_write(struct file *file, const char __user * userbuf,
-                         unsigned long count, void *data)
+static int dispatch_procfs_write(struct file *file,
+                       const char __user * userbuf,
+                       unsigned long count, void *data)
 {
        struct ibm_struct *ibm = data;
        char *kernbuf;
 {
        vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n");
 
-       IBM_HANDLE_INIT(hkey);
+       IBM_ACPIHANDLE_INIT(hkey);
 
        /* hotkey not supported on 570 */
        tp_features.hotkey = hkey_handle != NULL;
        int hkey;
 
        if (acpi_evalf(hkey_handle, &hkey, "MHKP", "d"))
-               acpi_bus_generate_event(ibm->device, event, hkey);
+               acpi_bus_generate_event(ibm->acpi->device, event, hkey);
        else {
                printk(IBM_ERR "unknown hotkey event %d\n", event);
-               acpi_bus_generate_event(ibm->device, event, 0);
+               acpi_bus_generate_event(ibm->acpi->device, event, 0);
        }
 }
 
        return 0;
 }
 
+static struct tp_acpi_drv_struct ibm_hotkey_acpidriver = {
+       .hid = IBM_HKEY_HID,
+       .notify = hotkey_notify,
+       .handle = &hkey_handle,
+       .type = ACPI_DEVICE_NOTIFY,
+};
+
 static struct ibm_struct hotkey_driver_data = {
        .name = "hotkey",
-       .hid = IBM_HKEY_HID,
        .read = hotkey_read,
        .write = hotkey_write,
        .exit = hotkey_exit,
-       .notify = hotkey_notify,
-       .handle = &hkey_handle,
-       .type = ACPI_DEVICE_NOTIFY,
+       .acpi = &ibm_hotkey_acpidriver,
 };
 
 /*************************************************************************
 {
        vdbg_printk(TPACPI_DBG_INIT, "initializing bluetooth subdriver\n");
 
-       IBM_HANDLE_INIT(hkey);
+       IBM_ACPIHANDLE_INIT(hkey);
 
        /* bluetooth not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
           G4x, R30, R31, R40e, R50e, T20-22, X20-21 */
 {
        vdbg_printk(TPACPI_DBG_INIT, "initializing wan subdriver\n");
 
-       IBM_HANDLE_INIT(hkey);
+       IBM_ACPIHANDLE_INIT(hkey);
 
        tp_features.wan = hkey_handle &&
                          acpi_evalf(hkey_handle, NULL, "GWAN", "qv");
 
        vdbg_printk(TPACPI_DBG_INIT, "initializing video subdriver\n");
 
-       IBM_HANDLE_INIT(vid);
-       IBM_HANDLE_INIT(vid2);
+       IBM_ACPIHANDLE_INIT(vid);
+       IBM_ACPIHANDLE_INIT(vid2);
 
        if (vid2_handle && acpi_evalf(NULL, &ivga, "\\IVGA", "d") && ivga)
                /* G41, assume IVGA doesn't change */
 {
        vdbg_printk(TPACPI_DBG_INIT, "initializing light subdriver\n");
 
-       IBM_HANDLE_INIT(ledb);
-       IBM_HANDLE_INIT(lght);
-       IBM_HANDLE_INIT(cmos);
+       IBM_ACPIHANDLE_INIT(ledb);
+       IBM_ACPIHANDLE_INIT(lght);
+       IBM_ACPIHANDLE_INIT(cmos);
 
        /* light not supported on 570, 600e/x, 770e, 770x, G4x, R30, R31 */
        tp_features.light = (cmos_handle || lght_handle) && !ledb_handle;
 {
        vdbg_printk(TPACPI_DBG_INIT, "initializing dock subdriver\n");
 
-       IBM_HANDLE_INIT(dock);
-       IBM_HANDLE_INIT(pci);
+       IBM_ACPIHANDLE_INIT(dock);
+       IBM_ACPIHANDLE_INIT(pci);
 
        vdbg_printk(TPACPI_DBG_INIT, "dock is %s\n",
                str_supported(dock_handle != NULL));
 static void dock_notify(struct ibm_struct *ibm, u32 event)
 {
        int docked = dock_docked();
-       int pci = ibm->hid && strstr(ibm->hid, IBM_PCI_HID);
+       int pci = ibm->acpi->hid && strstr(ibm->acpi->hid, IBM_PCI_HID);
 
        if (event == 1 && !pci) /* 570 */
-               acpi_bus_generate_event(ibm->device, event, 1); /* button */
+               acpi_bus_generate_event(ibm->acpi->device, event, 1);   /* button */
        else if (event == 1 && pci)     /* 570 */
-               acpi_bus_generate_event(ibm->device, event, 3); /* dock */
+               acpi_bus_generate_event(ibm->acpi->device, event, 3);   /* dock */
        else if (event == 3 && docked)
-               acpi_bus_generate_event(ibm->device, event, 1); /* button */
+               acpi_bus_generate_event(ibm->acpi->device, event, 1);   /* button */
        else if (event == 3 && !docked)
-               acpi_bus_generate_event(ibm->device, event, 2); /* undock */
+               acpi_bus_generate_event(ibm->acpi->device, event, 2);   /* undock */
        else if (event == 0 && docked)
-               acpi_bus_generate_event(ibm->device, event, 3); /* dock */
+               acpi_bus_generate_event(ibm->acpi->device, event, 3);   /* dock */
        else {
                printk(IBM_ERR "unknown dock event %d, status %d\n",
                       event, _sta(dock_handle));
-               acpi_bus_generate_event(ibm->device, event, 0); /* unknown */
+               acpi_bus_generate_event(ibm->acpi->device, event, 0);   /* unknown */
        }
 }
 
        return 0;
 }
 
-static struct ibm_struct dock_driver_data[2] = {
+static struct tp_acpi_drv_struct ibm_dock_acpidriver[2] = {
        {
-        .name = "dock",
-        .read = dock_read,
-        .write = dock_write,
         .notify = dock_notify,
         .handle = &dock_handle,
         .type = ACPI_SYSTEM_NOTIFY,
        },
        {
-        .name = "dock",
         .hid = IBM_PCI_HID,
         .notify = dock_notify,
         .handle = &pci_handle,
        },
 };
 
+static struct ibm_struct dock_driver_data[2] = {
+       {
+        .name = "dock",
+        .read = dock_read,
+        .write = dock_write,
+        .acpi = &ibm_dock_acpidriver[0],
+       },
+       {
+        .name = "dock",
+        .acpi = &ibm_dock_acpidriver[1],
+       },
+};
+
 #endif /* CONFIG_THINKPAD_ACPI_DOCK */
 
 /*************************************************************************
 {
        vdbg_printk(TPACPI_DBG_INIT, "initializing bay subdriver\n");
 
-       IBM_HANDLE_INIT(bay);
+       IBM_ACPIHANDLE_INIT(bay);
        if (bay_handle)
-               IBM_HANDLE_INIT(bay_ej);
-       IBM_HANDLE_INIT(bay2);
+               IBM_ACPIHANDLE_INIT(bay_ej);
+       IBM_ACPIHANDLE_INIT(bay2);
        if (bay2_handle)
-               IBM_HANDLE_INIT(bay2_ej);
+               IBM_ACPIHANDLE_INIT(bay2_ej);
 
        tp_features.bay_status = bay_handle &&
                acpi_evalf(bay_handle, NULL, "_STA", "qv");
 
 static void bay_notify(struct ibm_struct *ibm, u32 event)
 {
-       acpi_bus_generate_event(ibm->device, event, 0);
+       acpi_bus_generate_event(ibm->acpi->device, event, 0);
 }
 
 #define bay_occupied(b) (_sta(b##_handle) & 1)
        return 0;
 }
 
+static struct tp_acpi_drv_struct ibm_bay_acpidriver = {
+       .notify = bay_notify,
+       .handle = &bay_handle,
+       .type = ACPI_SYSTEM_NOTIFY,
+};
+
 static struct ibm_struct bay_driver_data = {
        .name = "bay",
        .read = bay_read,
        .write = bay_write,
-       .notify = bay_notify,
-       .handle = &bay_handle,
-       .type = ACPI_SYSTEM_NOTIFY,
+       .acpi = &ibm_bay_acpidriver,
 };
 
 #endif /* CONFIG_THINKPAD_ACPI_BAY */
        vdbg_printk(TPACPI_DBG_INIT,
                "initializing cmos commands subdriver\n");
 
-       IBM_HANDLE_INIT(cmos);
+       IBM_ACPIHANDLE_INIT(cmos);
 
        vdbg_printk(TPACPI_DBG_INIT, "cmos commands are %s\n",
                str_supported(cmos_handle != NULL));
 {
        vdbg_printk(TPACPI_DBG_INIT, "initializing LED subdriver\n");
 
-       IBM_HANDLE_INIT(led);
+       IBM_ACPIHANDLE_INIT(led);
 
        if (!led_handle)
                /* led not supported on R30, R31 */
 {
        vdbg_printk(TPACPI_DBG_INIT, "initializing beep subdriver\n");
 
-       IBM_HANDLE_INIT(beep);
+       IBM_ACPIHANDLE_INIT(beep);
 
        vdbg_printk(TPACPI_DBG_INIT, "beep is %s\n",
                str_supported(beep_handle != NULL));
        fan_watchdog_maxinterval = 0;
        tp_features.fan_ctrl_status_undef = 0;
 
-       IBM_HANDLE_INIT(fans);
-       IBM_HANDLE_INIT(gfan);
-       IBM_HANDLE_INIT(sfan);
+       IBM_ACPIHANDLE_INIT(fans);
+       IBM_ACPIHANDLE_INIT(gfan);
+       IBM_ACPIHANDLE_INIT(sfan);
 
        if (gfan_handle) {
                /* 570, 600e/x, 770e, 770x */
                ibm->flags.init_called = 1;
        }
 
-       if (ibm->hid) {
-               ret = register_tpacpi_subdriver(ibm);
-               if (ret)
-                       goto err_out;
-       }
+       if (ibm->acpi) {
+               if (ibm->acpi->hid) {
+                       ret = register_tpacpi_subdriver(ibm);
+                       if (ret)
+                               goto err_out;
+               }
 
-       if (ibm->notify) {
-               ret = setup_notify(ibm);
-               if (ret == -ENODEV) {
-                       printk(IBM_NOTICE "disabling subdriver %s\n",
-                               ibm->name);
-                       ret = 0;
-                       goto err_out;
+               if (ibm->acpi->notify) {
+                       ret = setup_acpi_notify(ibm);
+                       if (ret == -ENODEV) {
+                               printk(IBM_NOTICE "disabling subdriver %s\n",
+                                       ibm->name);
+                               ret = 0;
+                               goto err_out;
+                       }
+                       if (ret < 0)
+                               goto err_out;
                }
-               if (ret < 0)
-                       goto err_out;
        }
 
        dbg_printk(TPACPI_DBG_INIT,
                }
                entry->owner = THIS_MODULE;
                entry->data = ibm;
-               entry->read_proc = &dispatch_read;
+               entry->read_proc = &dispatch_procfs_read;
                if (ibm->write)
-                       entry->write_proc = &dispatch_write;
+                       entry->write_proc = &dispatch_procfs_write;
                ibm->flags.proc_created = 1;
        }
 
 
        list_del_init(&ibm->all_drivers);
 
-       if (ibm->flags.notify_installed) {
+       if (ibm->flags.acpi_notify_installed) {
                dbg_printk(TPACPI_DBG_EXIT,
                        "%s: acpi_remove_notify_handler\n", ibm->name);
-               acpi_remove_notify_handler(*ibm->handle, ibm->type,
-                                          dispatch_notify);
-               ibm->flags.notify_installed = 0;
+               BUG_ON(!ibm->acpi);
+               acpi_remove_notify_handler(*ibm->acpi->handle,
+                                          ibm->acpi->type,
+                                          dispatch_acpi_notify);
+               ibm->flags.acpi_notify_installed = 0;
+               ibm->flags.acpi_notify_installed = 0;
        }
 
        if (ibm->flags.proc_created) {
                ibm->flags.proc_created = 0;
        }
 
-       if (ibm->flags.driver_registered) {
+       if (ibm->flags.acpi_driver_registered) {
                dbg_printk(TPACPI_DBG_EXIT,
                        "%s: acpi_bus_unregister_driver\n", ibm->name);
-               acpi_bus_unregister_driver(ibm->driver);
-               kfree(ibm->driver);
-               ibm->driver = NULL;
-               ibm->flags.driver_registered = 0;
+               BUG_ON(!ibm->acpi);
+               acpi_bus_unregister_driver(ibm->acpi->driver);
+               kfree(ibm->acpi->driver);
+               ibm->acpi->driver = NULL;
+               ibm->flags.acpi_driver_registered = 0;
        }
 
        if (ibm->flags.init_called && ibm->exit) {
        is_thinkpad = dmi_name_in_vendors("ThinkPad");
 
        /* ec is required because many other handles are relative to it */
-       IBM_HANDLE_INIT(ec);
+       IBM_ACPIHANDLE_INIT(ec);
        if (!ec_handle) {
                if (is_thinkpad)
                        printk(IBM_ERR
                return ret;
 
        ibm_thinkpad_ec_found = check_dmi_for_ec();
-       IBM_HANDLE_INIT(ecrd);
-       IBM_HANDLE_INIT(ecwr);
+       IBM_ACPIHANDLE_INIT(ecrd);
+       IBM_ACPIHANDLE_INIT(ecwr);
 
-       proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
+       proc_dir = proc_mkdir(IBM_PROC_DIR, acpi_root_dir);
        if (!proc_dir) {
-               printk(IBM_ERR "unable to create proc dir %s", IBM_DIR);
+               printk(IBM_ERR "unable to create proc dir " IBM_PROC_DIR);
                thinkpad_acpi_module_exit();
                return -ENODEV;
        }
        dbg_printk(TPACPI_DBG_INIT, "finished subdriver exit path...\n");
 
        if (proc_dir)
-               remove_proc_entry(IBM_DIR, acpi_root_dir);
+               remove_proc_entry(IBM_PROC_DIR, acpi_root_dir);
 
-       if (ibm_thinkpad_ec_found)
-               kfree(ibm_thinkpad_ec_found);
+       kfree(ibm_thinkpad_ec_found);
 }
 
 module_init(thinkpad_acpi_module_init);