提交 d94a7f16 编写于 作者: H Henrique de Moraes Holschuh 提交者: Len Brown

ACPI: thinkpad-acpi: improve dock subdriver initialization

The dock sub-driver has split-personality (two subdrivers), and it was
doing some unoptimal things on init because of that.  Fix it so that the
second half of it will only init when necessary, and only if the first half
initialized sucessfully in the first place.
Signed-off-by: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 5ae930e6
...@@ -1519,6 +1519,33 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */ ...@@ -1519,6 +1519,33 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */
/* don't list other alternatives as we install a notify handler on the 570 */ /* don't list other alternatives as we install a notify handler on the 570 */
IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */
static struct tp_acpi_drv_struct ibm_dock_acpidriver[2] = {
{
.notify = dock_notify,
.handle = &dock_handle,
.type = ACPI_SYSTEM_NOTIFY,
},
{
.hid = IBM_PCI_HID,
.notify = dock_notify,
.handle = &pci_handle,
.type = ACPI_SYSTEM_NOTIFY,
},
};
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],
},
};
#define dock_docked() (_sta(dock_handle) & 1) #define dock_docked() (_sta(dock_handle) & 1)
static int __init dock_init(struct ibm_init_struct *iibm) static int __init dock_init(struct ibm_init_struct *iibm)
...@@ -1526,7 +1553,6 @@ static int __init dock_init(struct ibm_init_struct *iibm) ...@@ -1526,7 +1553,6 @@ static int __init dock_init(struct ibm_init_struct *iibm)
vdbg_printk(TPACPI_DBG_INIT, "initializing dock subdriver\n"); vdbg_printk(TPACPI_DBG_INIT, "initializing dock subdriver\n");
IBM_ACPIHANDLE_INIT(dock); IBM_ACPIHANDLE_INIT(dock);
IBM_ACPIHANDLE_INIT(pci);
vdbg_printk(TPACPI_DBG_INIT, "dock is %s\n", vdbg_printk(TPACPI_DBG_INIT, "dock is %s\n",
str_supported(dock_handle != NULL)); str_supported(dock_handle != NULL));
...@@ -1534,6 +1560,28 @@ static int __init dock_init(struct ibm_init_struct *iibm) ...@@ -1534,6 +1560,28 @@ static int __init dock_init(struct ibm_init_struct *iibm)
return (dock_handle)? 0 : 1; return (dock_handle)? 0 : 1;
} }
static int __init dock_init2(struct ibm_init_struct *iibm)
{
int dock2_needed;
vdbg_printk(TPACPI_DBG_INIT, "initializing dock subdriver part 2\n");
if (dock_driver_data[0].flags.acpi_driver_registered &&
dock_driver_data[0].flags.acpi_notify_installed) {
IBM_ACPIHANDLE_INIT(pci);
dock2_needed = (pci_handle != NULL);
vdbg_printk(TPACPI_DBG_INIT,
"dock PCI handler for the TP 570 is %s\n",
str_supported(dock2_needed));
} else {
vdbg_printk(TPACPI_DBG_INIT,
"dock subdriver part 2 not required\n");
dock2_needed = 0;
}
return (dock2_needed)? 0 : 1;
}
static void dock_notify(struct ibm_struct *ibm, u32 event) static void dock_notify(struct ibm_struct *ibm, u32 event)
{ {
int docked = dock_docked(); int docked = dock_docked();
...@@ -1595,33 +1643,6 @@ static int dock_write(char *buf) ...@@ -1595,33 +1643,6 @@ static int dock_write(char *buf)
return 0; return 0;
} }
static struct tp_acpi_drv_struct ibm_dock_acpidriver[2] = {
{
.notify = dock_notify,
.handle = &dock_handle,
.type = ACPI_SYSTEM_NOTIFY,
},
{
.hid = IBM_PCI_HID,
.notify = dock_notify,
.handle = &pci_handle,
.type = ACPI_SYSTEM_NOTIFY,
},
};
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 */ #endif /* CONFIG_THINKPAD_ACPI_DOCK */
/************************************************************************* /*************************************************************************
...@@ -3850,6 +3871,7 @@ static struct ibm_init_struct ibms_init[] __initdata = { ...@@ -3850,6 +3871,7 @@ static struct ibm_init_struct ibms_init[] __initdata = {
.data = &dock_driver_data[0], .data = &dock_driver_data[0],
}, },
{ {
.init = dock_init2,
.data = &dock_driver_data[1], .data = &dock_driver_data[1],
}, },
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册