Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8ca16ea authored by David Howells's avatar David Howells Committed by Al Viro
Browse files

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: default avatarDavid Howells <dhowells@redhat.com>
Acked-by: default avatarGrant 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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 8d8b97ba
Loading
Loading
Loading
Loading
+4 −17
Original line number Diff line number Diff line
@@ -521,19 +521,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
	return 0;
}

static void
acpi_sbs_remove_fs(struct proc_dir_entry **dir,
			   struct proc_dir_entry *parent_dir)
{
	if (*dir) {
		remove_proc_entry(ACPI_SBS_FILE_INFO, *dir);
		remove_proc_entry(ACPI_SBS_FILE_STATE, *dir);
		remove_proc_entry(ACPI_SBS_FILE_ALARM, *dir);
		remove_proc_entry((*dir)->name, parent_dir);
		*dir = NULL;
	}
}

/* Smart Battery Interface */
static struct proc_dir_entry *acpi_battery_dir = NULL;

@@ -836,8 +823,8 @@ static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
		power_supply_unregister(&battery->bat);
	}
#ifdef CONFIG_ACPI_PROCFS_POWER
	if (battery->proc_entry)
		acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
	proc_remove(battery->proc_entry);
	battery->proc_entry = NULL;
#endif
}

@@ -873,8 +860,8 @@ static void acpi_charger_remove(struct acpi_sbs *sbs)
	if (sbs->charger.dev)
		power_supply_unregister(&sbs->charger);
#ifdef CONFIG_ACPI_PROCFS_POWER
	if (sbs->charger_entry)
		acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
	proc_remove(sbs->charger_entry);
	sbs->charger_entry = NULL;
#endif
}

+1 −1
Original line number Diff line number Diff line
@@ -4541,7 +4541,7 @@ static void __exit cleanup_ipmi(void)
	del_timer_sync(&ipmi_timer);

#ifdef CONFIG_PROC_FS
	remove_proc_entry(proc_ipmi_root->name, NULL);
	proc_remove(proc_ipmi_root);
#endif /* CONFIG_PROC_FS */

	driver_unregister(&ipmidriver.driver);
+1 −1
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ static void delete_proc_files(void)
		for (p = proc_files; p->name; p++)
			if (p->entry)
				remove_proc_entry(p->name, proc_gru);
		remove_proc_entry("gru", proc_gru->parent);
		proc_remove(proc_gru);
	}
}

+1 −10
Original line number Diff line number Diff line
@@ -1452,16 +1452,7 @@ int of_attach_node(struct device_node *np)
#ifdef CONFIG_PROC_DEVICETREE
static void of_remove_proc_dt_entry(struct device_node *dn)
{
	struct device_node *parent = dn->parent;
	struct property *prop = dn->properties;

	while (prop) {
		remove_proc_entry(prop->name, dn->pde);
		prop = prop->next;
	}

	if (dn->pde)
		remove_proc_entry(dn->pde->name, parent->pde);
	proc_remove(dn->pde);
}
#else
static void of_remove_proc_dt_entry(struct device_node *dn)
+3 −9
Original line number Diff line number Diff line
@@ -427,20 +427,14 @@ int pci_proc_attach_device(struct pci_dev *dev)

int pci_proc_detach_device(struct pci_dev *dev)
{
	struct proc_dir_entry *e;

	if ((e = dev->procent)) {
		remove_proc_entry(e->name, dev->bus->procdir);
	proc_remove(dev->procent);
	dev->procent = NULL;
	}
	return 0;
}

int pci_proc_detach_bus(struct pci_bus* bus)
{
	struct proc_dir_entry *de = bus->procdir;
	if (de)
		remove_proc_entry(de->name, proc_bus_pci_dir);
	proc_remove(bus->procdir);
	return 0;
}

Loading