aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sbs.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-04-12 12:27:28 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-05-01 17:29:46 -0400
commita8ca16ea7b0abb0a7e49492d1123b715f0ec62e8 (patch)
treefe201353c71385cab2f3cc0d7235c76121f51789 /drivers/acpi/sbs.c
parent8d8b97ba499cb69fccb5fd9f2b439e3265fc3f27 (diff)
proc: Supply a function to remove a proc entry by PDE
Supply a function (proc_remove()) to remove a proc entry (and any subtree rooted there) by proc_dir_entry pointer rather than by name and (optionally) root dir entry pointer. This allows us to eliminate all remaining pde->name accesses outside of procfs. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Grant Likely <grant.likely@linaro.or> cc: linux-acpi@vger.kernel.org cc: openipmi-developer@lists.sourceforge.net cc: devicetree-discuss@lists.ozlabs.org cc: linux-pci@vger.kernel.org cc: netdev@vger.kernel.org cc: netfilter-devel@vger.kernel.org cc: alsa-devel@alsa-project.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/acpi/sbs.c')
-rw-r--r--drivers/acpi/sbs.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index a296e08d76b6..b6241eeb1132 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -521,19 +521,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
521 return 0; 521 return 0;
522} 522}
523 523
524static void
525acpi_sbs_remove_fs(struct proc_dir_entry **dir,
526 struct proc_dir_entry *parent_dir)
527{
528 if (*dir) {
529 remove_proc_entry(ACPI_SBS_FILE_INFO, *dir);
530 remove_proc_entry(ACPI_SBS_FILE_STATE, *dir);
531 remove_proc_entry(ACPI_SBS_FILE_ALARM, *dir);
532 remove_proc_entry((*dir)->name, parent_dir);
533 *dir = NULL;
534 }
535}
536
537/* Smart Battery Interface */ 524/* Smart Battery Interface */
538static struct proc_dir_entry *acpi_battery_dir = NULL; 525static struct proc_dir_entry *acpi_battery_dir = NULL;
539 526
@@ -836,8 +823,8 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
836 power_supply_unregister(&battery->bat); 823 power_supply_unregister(&battery->bat);
837 } 824 }
838#ifdef CONFIG_ACPI_PROCFS_POWER 825#ifdef CONFIG_ACPI_PROCFS_POWER
839 if (battery->proc_entry) 826 proc_remove(battery->proc_entry);
840 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); 827 battery->proc_entry = NULL;
841#endif 828#endif
842} 829}
843 830
@@ -873,8 +860,8 @@ static void acpi_charger_remove(struct acpi_sbs *sbs)
873 if (sbs->charger.dev) 860 if (sbs->charger.dev)
874 power_supply_unregister(&sbs->charger); 861 power_supply_unregister(&sbs->charger);
875#ifdef CONFIG_ACPI_PROCFS_POWER 862#ifdef CONFIG_ACPI_PROCFS_POWER
876 if (sbs->charger_entry) 863 proc_remove(sbs->charger_entry);
877 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); 864 sbs->charger_entry = NULL;
878#endif 865#endif
879} 866}
880 867