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

ACPI: thinkpad-acpi: use bitfields to hold subdriver flags

Save some memory by using bitfields to hold boolean flags for the
subdrivers.
Signed-off-by: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 0dcef77c
...@@ -339,7 +339,7 @@ static int __init setup_notify(struct ibm_struct *ibm) ...@@ -339,7 +339,7 @@ static int __init setup_notify(struct ibm_struct *ibm)
} }
return -ENODEV; return -ENODEV;
} }
ibm->notify_installed = 1; ibm->flags.notify_installed = 1;
return 0; return 0;
} }
...@@ -372,7 +372,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) ...@@ -372,7 +372,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm)
kfree(ibm->driver); kfree(ibm->driver);
ibm->driver = NULL; ibm->driver = NULL;
} else if (!ret) } else if (!ret)
ibm->driver_registered = 1; ibm->flags.driver_registered = 1;
return ret; return ret;
} }
...@@ -815,7 +815,7 @@ static struct ibm_struct wan_driver_data = { ...@@ -815,7 +815,7 @@ static struct ibm_struct wan_driver_data = {
.name = "wan", .name = "wan",
.read = wan_read, .read = wan_read,
.write = wan_write, .write = wan_write,
.experimental = 1, .flags.experimental = 1,
}; };
/************************************************************************* /*************************************************************************
...@@ -1851,7 +1851,7 @@ static struct ibm_struct ecdump_driver_data = { ...@@ -1851,7 +1851,7 @@ static struct ibm_struct ecdump_driver_data = {
.name = "ecdump", .name = "ecdump",
.read = ecdump_read, .read = ecdump_read,
.write = ecdump_write, .write = ecdump_write,
.experimental = 1, .flags.experimental = 1,
}; };
/************************************************************************* /*************************************************************************
...@@ -2684,7 +2684,7 @@ static struct ibm_struct fan_driver_data = { ...@@ -2684,7 +2684,7 @@ static struct ibm_struct fan_driver_data = {
.read = fan_read, .read = fan_read,
.write = fan_write, .write = fan_write,
.exit = fan_exit, .exit = fan_exit,
.experimental = 1, .flags.experimental = 1,
}; };
/**************************************************************************** /****************************************************************************
...@@ -2725,7 +2725,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm) ...@@ -2725,7 +2725,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
INIT_LIST_HEAD(&ibm->all_drivers); INIT_LIST_HEAD(&ibm->all_drivers);
if (ibm->experimental && !experimental) if (ibm->flags.experimental && !experimental)
return 0; return 0;
dbg_printk(TPACPI_DBG_INIT, dbg_printk(TPACPI_DBG_INIT,
...@@ -2738,7 +2738,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm) ...@@ -2738,7 +2738,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
if (ret) if (ret)
return ret; return ret;
ibm->init_called = 1; ibm->flags.init_called = 1;
} }
if (ibm->hid) { if (ibm->hid) {
...@@ -2777,7 +2777,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm) ...@@ -2777,7 +2777,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
entry->read_proc = &dispatch_read; entry->read_proc = &dispatch_read;
if (ibm->write) if (ibm->write)
entry->write_proc = &dispatch_write; entry->write_proc = &dispatch_write;
ibm->proc_created = 1; ibm->flags.proc_created = 1;
} }
list_add_tail(&ibm->all_drivers, &tpacpi_all_drivers); list_add_tail(&ibm->all_drivers, &tpacpi_all_drivers);
...@@ -2799,33 +2799,33 @@ static void ibm_exit(struct ibm_struct *ibm) ...@@ -2799,33 +2799,33 @@ static void ibm_exit(struct ibm_struct *ibm)
list_del_init(&ibm->all_drivers); list_del_init(&ibm->all_drivers);
if (ibm->notify_installed) { if (ibm->flags.notify_installed) {
dbg_printk(TPACPI_DBG_EXIT, dbg_printk(TPACPI_DBG_EXIT,
"%s: acpi_remove_notify_handler\n", ibm->name); "%s: acpi_remove_notify_handler\n", ibm->name);
acpi_remove_notify_handler(*ibm->handle, ibm->type, acpi_remove_notify_handler(*ibm->handle, ibm->type,
dispatch_notify); dispatch_notify);
ibm->notify_installed = 0; ibm->flags.notify_installed = 0;
} }
if (ibm->proc_created) { if (ibm->flags.proc_created) {
dbg_printk(TPACPI_DBG_EXIT, dbg_printk(TPACPI_DBG_EXIT,
"%s: remove_proc_entry\n", ibm->name); "%s: remove_proc_entry\n", ibm->name);
remove_proc_entry(ibm->name, proc_dir); remove_proc_entry(ibm->name, proc_dir);
ibm->proc_created = 0; ibm->flags.proc_created = 0;
} }
if (ibm->driver_registered) { if (ibm->flags.driver_registered) {
dbg_printk(TPACPI_DBG_EXIT, dbg_printk(TPACPI_DBG_EXIT,
"%s: acpi_bus_unregister_driver\n", ibm->name); "%s: acpi_bus_unregister_driver\n", ibm->name);
acpi_bus_unregister_driver(ibm->driver); acpi_bus_unregister_driver(ibm->driver);
kfree(ibm->driver); kfree(ibm->driver);
ibm->driver = NULL; ibm->driver = NULL;
ibm->driver_registered = 0; ibm->flags.driver_registered = 0;
} }
if (ibm->init_called && ibm->exit) { if (ibm->flags.init_called && ibm->exit) {
ibm->exit(); ibm->exit();
ibm->init_called = 0; ibm->flags.init_called = 0;
} }
dbg_printk(TPACPI_DBG_INIT, "finished removing %s\n", ibm->name); dbg_printk(TPACPI_DBG_INIT, "finished removing %s\n", ibm->name);
......
...@@ -157,12 +157,13 @@ struct ibm_struct { ...@@ -157,12 +157,13 @@ struct ibm_struct {
struct list_head all_drivers; struct list_head all_drivers;
int driver_registered; struct {
int proc_created; u8 driver_registered:1;
int init_called; u8 proc_created:1;
int notify_installed; u8 init_called:1;
u8 notify_installed:1;
int experimental; u8 experimental:1;
} flags;
}; };
struct ibm_init_struct { struct ibm_init_struct {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册