of: remove /proc/device-tree

The same data is now available in sysfs, so we can remove the code
that exports it in /proc and replace it with a symlink to the sysfs
version.

Tested on versatile qemu model and mpc5200 eval board. More testing
would be appreciated.

v5: Fixed up conflicts with mainline changes

Signed-off-by: Grant Likely <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Nathan Fontenot <[email protected]>
Cc: Pantelis Antoniou <[email protected]>
This commit is contained in:
Grant Likely 2012-11-06 21:03:27 +00:00 • committed by Grant Likely
commit 8357041a69
7 changed files with 1 additions and 322 deletions

View file

@ -7,14 +7,6 @@ config OF
menu "Device Tree and Open Firmware support"
depends on OF
config PROC_DEVICETREE
bool "Support for device tree in /proc"
depends on PROC_FS && !SPARC
help
This option adds a device-tree directory under /proc which contains
an image of the device tree that the kernel copies from Open
Firmware or other boot firmware. If unsure, say Y here.
config OF_SELFTEST
bool "Device Tree Runtime self tests"
depends on OF_IRQ

View file

@ -281,11 +281,9 @@ static int __init of_init(void)
__of_node_add(np);
mutex_unlock(&of_aliases_mutex);
#if !defined(CONFIG_PROC_DEVICETREE)
/* Symlink to the new tree when PROC_DEVICETREE is disabled */
/* Symlink in /proc as required by userspace ABI */
if (of_allnodes)
proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
#endif /* CONFIG_PROC_DEVICETREE */
return 0;
}
@ -1690,12 +1688,6 @@ int of_add_property(struct device_node *np, struct property *prop)
__of_add_property_sysfs(np, prop);
#ifdef CONFIG_PROC_DEVICETREE
/* try to add to proc as well if it was initialized */
if (!rc && np->pde)
proc_device_tree_add_prop(np->pde, prop);
#endif /* CONFIG_PROC_DEVICETREE */
return rc;
}
@ -1742,12 +1734,6 @@ int of_remove_property(struct device_node *np, struct property *prop)
sysfs_remove_bin_file(&np->kobj, &prop->attr);
#ifdef CONFIG_PROC_DEVICETREE
/* try to remove the proc node as well */
if (np->pde)
proc_device_tree_remove_prop(np->pde, prop);
#endif /* CONFIG_PROC_DEVICETREE */
return 0;
}
@ -1803,12 +1789,6 @@ int of_update_property(struct device_node *np, struct property *newprop)
if (!found)
return -ENODEV;
#ifdef CONFIG_PROC_DEVICETREE
/* try to add to proc as well if it was initialized */
if (np->pde)
proc_device_tree_update_prop(np->pde, newprop, oldprop);
#endif /* CONFIG_PROC_DEVICETREE */
return 0;
}
@ -1843,22 +1823,6 @@ int of_reconfig_notify(unsigned long action, void *p)
return notifier_to_errno(rc);
}
#ifdef CONFIG_PROC_DEVICETREE
static void of_add_proc_dt_entry(struct device_node *dn)
{
struct proc_dir_entry *ent;
ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
if (ent)
proc_device_tree_add_node(dn, ent);
}
#else
static void of_add_proc_dt_entry(struct device_node *dn)
{
return;
}
#endif
/**
* of_attach_node - Plug a device node into the tree and global list.
*/
@ -1880,22 +1844,9 @@ int of_attach_node(struct device_node *np)
raw_spin_unlock_irqrestore(&devtree_lock, flags);
of_node_add(np);
of_add_proc_dt_entry(np);
return 0;
}
#ifdef CONFIG_PROC_DEVICETREE
static void of_remove_proc_dt_entry(struct device_node *dn)
{
proc_remove(dn->pde);
}
#else
static void of_remove_proc_dt_entry(struct device_node *dn)
{
return;
}
#endif
/**
* of_detach_node - "Unplug" a node from the device tree.
*
@ -1951,7 +1902,6 @@ int of_detach_node(struct device_node *np)
of_node_set_flag(np, OF_DETACHED);
raw_spin_unlock_irqrestore(&devtree_lock, flags);
of_remove_proc_dt_entry(np);
of_node_remove(np);
return rc;
}