diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2007-04-21 10:08:35 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-04-21 23:30:34 -0400 |
commit | 926411779287ad4f7013c9d80aa44fd131b70cd9 (patch) | |
tree | af58ff9542651deb712b3756af559dbb97fee86f /drivers/misc | |
parent | 0dcef77c5b889338811d35e786b42046259fe433 (diff) |
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: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 32 | ||||
-rw-r--r-- | drivers/misc/thinkpad_acpi.h | 13 |
2 files changed, 23 insertions, 22 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index cddf81bb2d97..a5efd06523dd 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -339,7 +339,7 @@ static int __init setup_notify(struct ibm_struct *ibm) | |||
339 | } | 339 | } |
340 | return -ENODEV; | 340 | return -ENODEV; |
341 | } | 341 | } |
342 | ibm->notify_installed = 1; | 342 | ibm->flags.notify_installed = 1; |
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
@@ -372,7 +372,7 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) | |||
372 | kfree(ibm->driver); | 372 | kfree(ibm->driver); |
373 | ibm->driver = NULL; | 373 | ibm->driver = NULL; |
374 | } else if (!ret) | 374 | } else if (!ret) |
375 | ibm->driver_registered = 1; | 375 | ibm->flags.driver_registered = 1; |
376 | 376 | ||
377 | return ret; | 377 | return ret; |
378 | } | 378 | } |
@@ -815,7 +815,7 @@ static struct ibm_struct wan_driver_data = { | |||
815 | .name = "wan", | 815 | .name = "wan", |
816 | .read = wan_read, | 816 | .read = wan_read, |
817 | .write = wan_write, | 817 | .write = wan_write, |
818 | .experimental = 1, | 818 | .flags.experimental = 1, |
819 | }; | 819 | }; |
820 | 820 | ||
821 | /************************************************************************* | 821 | /************************************************************************* |
@@ -1851,7 +1851,7 @@ static struct ibm_struct ecdump_driver_data = { | |||
1851 | .name = "ecdump", | 1851 | .name = "ecdump", |
1852 | .read = ecdump_read, | 1852 | .read = ecdump_read, |
1853 | .write = ecdump_write, | 1853 | .write = ecdump_write, |
1854 | .experimental = 1, | 1854 | .flags.experimental = 1, |
1855 | }; | 1855 | }; |
1856 | 1856 | ||
1857 | /************************************************************************* | 1857 | /************************************************************************* |
@@ -2684,7 +2684,7 @@ static struct ibm_struct fan_driver_data = { | |||
2684 | .read = fan_read, | 2684 | .read = fan_read, |
2685 | .write = fan_write, | 2685 | .write = fan_write, |
2686 | .exit = fan_exit, | 2686 | .exit = fan_exit, |
2687 | .experimental = 1, | 2687 | .flags.experimental = 1, |
2688 | }; | 2688 | }; |
2689 | 2689 | ||
2690 | /**************************************************************************** | 2690 | /**************************************************************************** |
@@ -2725,7 +2725,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm) | |||
2725 | 2725 | ||
2726 | INIT_LIST_HEAD(&ibm->all_drivers); | 2726 | INIT_LIST_HEAD(&ibm->all_drivers); |
2727 | 2727 | ||
2728 | if (ibm->experimental && !experimental) | 2728 | if (ibm->flags.experimental && !experimental) |
2729 | return 0; | 2729 | return 0; |
2730 | 2730 | ||
2731 | dbg_printk(TPACPI_DBG_INIT, | 2731 | dbg_printk(TPACPI_DBG_INIT, |
@@ -2738,7 +2738,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm) | |||
2738 | if (ret) | 2738 | if (ret) |
2739 | return ret; | 2739 | return ret; |
2740 | 2740 | ||
2741 | ibm->init_called = 1; | 2741 | ibm->flags.init_called = 1; |
2742 | } | 2742 | } |
2743 | 2743 | ||
2744 | if (ibm->hid) { | 2744 | if (ibm->hid) { |
@@ -2777,7 +2777,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm) | |||
2777 | entry->read_proc = &dispatch_read; | 2777 | entry->read_proc = &dispatch_read; |
2778 | if (ibm->write) | 2778 | if (ibm->write) |
2779 | entry->write_proc = &dispatch_write; | 2779 | entry->write_proc = &dispatch_write; |
2780 | ibm->proc_created = 1; | 2780 | ibm->flags.proc_created = 1; |
2781 | } | 2781 | } |
2782 | 2782 | ||
2783 | list_add_tail(&ibm->all_drivers, &tpacpi_all_drivers); | 2783 | list_add_tail(&ibm->all_drivers, &tpacpi_all_drivers); |
@@ -2799,33 +2799,33 @@ static void ibm_exit(struct ibm_struct *ibm) | |||
2799 | 2799 | ||
2800 | list_del_init(&ibm->all_drivers); | 2800 | list_del_init(&ibm->all_drivers); |
2801 | 2801 | ||
2802 | if (ibm->notify_installed) { | 2802 | if (ibm->flags.notify_installed) { |
2803 | dbg_printk(TPACPI_DBG_EXIT, | 2803 | dbg_printk(TPACPI_DBG_EXIT, |
2804 | "%s: acpi_remove_notify_handler\n", ibm->name); | 2804 | "%s: acpi_remove_notify_handler\n", ibm->name); |
2805 | acpi_remove_notify_handler(*ibm->handle, ibm->type, | 2805 | acpi_remove_notify_handler(*ibm->handle, ibm->type, |
2806 | dispatch_notify); | 2806 | dispatch_notify); |
2807 | ibm->notify_installed = 0; | 2807 | ibm->flags.notify_installed = 0; |
2808 | } | 2808 | } |
2809 | 2809 | ||
2810 | if (ibm->proc_created) { | 2810 | if (ibm->flags.proc_created) { |
2811 | dbg_printk(TPACPI_DBG_EXIT, | 2811 | dbg_printk(TPACPI_DBG_EXIT, |
2812 | "%s: remove_proc_entry\n", ibm->name); | 2812 | "%s: remove_proc_entry\n", ibm->name); |
2813 | remove_proc_entry(ibm->name, proc_dir); | 2813 | remove_proc_entry(ibm->name, proc_dir); |
2814 | ibm->proc_created = 0; | 2814 | ibm->flags.proc_created = 0; |
2815 | } | 2815 | } |
2816 | 2816 | ||
2817 | if (ibm->driver_registered) { | 2817 | if (ibm->flags.driver_registered) { |
2818 | dbg_printk(TPACPI_DBG_EXIT, | 2818 | dbg_printk(TPACPI_DBG_EXIT, |
2819 | "%s: acpi_bus_unregister_driver\n", ibm->name); | 2819 | "%s: acpi_bus_unregister_driver\n", ibm->name); |
2820 | acpi_bus_unregister_driver(ibm->driver); | 2820 | acpi_bus_unregister_driver(ibm->driver); |
2821 | kfree(ibm->driver); | 2821 | kfree(ibm->driver); |
2822 | ibm->driver = NULL; | 2822 | ibm->driver = NULL; |
2823 | ibm->driver_registered = 0; | 2823 | ibm->flags.driver_registered = 0; |
2824 | } | 2824 | } |
2825 | 2825 | ||
2826 | if (ibm->init_called && ibm->exit) { | 2826 | if (ibm->flags.init_called && ibm->exit) { |
2827 | ibm->exit(); | 2827 | ibm->exit(); |
2828 | ibm->init_called = 0; | 2828 | ibm->flags.init_called = 0; |
2829 | } | 2829 | } |
2830 | 2830 | ||
2831 | dbg_printk(TPACPI_DBG_INIT, "finished removing %s\n", ibm->name); | 2831 | dbg_printk(TPACPI_DBG_INIT, "finished removing %s\n", ibm->name); |
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index 20203981cb7a..8b72061d8f0e 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
@@ -157,12 +157,13 @@ struct ibm_struct { | |||
157 | 157 | ||
158 | struct list_head all_drivers; | 158 | struct list_head all_drivers; |
159 | 159 | ||
160 | int driver_registered; | 160 | struct { |
161 | int proc_created; | 161 | u8 driver_registered:1; |
162 | int init_called; | 162 | u8 proc_created:1; |
163 | int notify_installed; | 163 | u8 init_called:1; |
164 | 164 | u8 notify_installed:1; | |
165 | int experimental; | 165 | u8 experimental:1; |
166 | } flags; | ||
166 | }; | 167 | }; |
167 | 168 | ||
168 | struct ibm_init_struct { | 169 | struct ibm_init_struct { |