aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/base.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2012-11-06 16:03:27 -0500
committerGrant Likely <grant.likely@linaro.org>2014-03-11 16:48:32 -0400
commit8357041a69b368991d1b04d9f1d297f8d71e1314 (patch)
tree54bc523897eb6c72a95d06efea5c64833fbb51a4 /drivers/of/base.c
parent7e66c5c74f7348a96d5a3671f8cda4a478242679 (diff)
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 <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David S. Miller <davem@davemloft.net> Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r--drivers/of/base.c52
1 files changed, 1 insertions, 51 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 3b70a468c8ab..ed3e70b84957 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -281,11 +281,9 @@ static int __init of_init(void)
281 __of_node_add(np); 281 __of_node_add(np);
282 mutex_unlock(&of_aliases_mutex); 282 mutex_unlock(&of_aliases_mutex);
283 283
284#if !defined(CONFIG_PROC_DEVICETREE) 284 /* Symlink in /proc as required by userspace ABI */
285 /* Symlink to the new tree when PROC_DEVICETREE is disabled */
286 if (of_allnodes) 285 if (of_allnodes)
287 proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base"); 286 proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
288#endif /* CONFIG_PROC_DEVICETREE */
289 287
290 return 0; 288 return 0;
291} 289}
@@ -1690,12 +1688,6 @@ int of_add_property(struct device_node *np, struct property *prop)
1690 1688
1691 __of_add_property_sysfs(np, prop); 1689 __of_add_property_sysfs(np, prop);
1692 1690
1693#ifdef CONFIG_PROC_DEVICETREE
1694 /* try to add to proc as well if it was initialized */
1695 if (!rc && np->pde)
1696 proc_device_tree_add_prop(np->pde, prop);
1697#endif /* CONFIG_PROC_DEVICETREE */
1698
1699 return rc; 1691 return rc;
1700} 1692}
1701 1693
@@ -1742,12 +1734,6 @@ int of_remove_property(struct device_node *np, struct property *prop)
1742 1734
1743 sysfs_remove_bin_file(&np->kobj, &prop->attr); 1735 sysfs_remove_bin_file(&np->kobj, &prop->attr);
1744 1736
1745#ifdef CONFIG_PROC_DEVICETREE
1746 /* try to remove the proc node as well */
1747 if (np->pde)
1748 proc_device_tree_remove_prop(np->pde, prop);
1749#endif /* CONFIG_PROC_DEVICETREE */
1750
1751 return 0; 1737 return 0;
1752} 1738}
1753 1739
@@ -1803,12 +1789,6 @@ int of_update_property(struct device_node *np, struct property *newprop)
1803 if (!found) 1789 if (!found)
1804 return -ENODEV; 1790 return -ENODEV;
1805 1791
1806#ifdef CONFIG_PROC_DEVICETREE
1807 /* try to add to proc as well if it was initialized */
1808 if (np->pde)
1809 proc_device_tree_update_prop(np->pde, newprop, oldprop);
1810#endif /* CONFIG_PROC_DEVICETREE */
1811
1812 return 0; 1792 return 0;
1813} 1793}
1814 1794
@@ -1843,22 +1823,6 @@ int of_reconfig_notify(unsigned long action, void *p)
1843 return notifier_to_errno(rc); 1823 return notifier_to_errno(rc);
1844} 1824}
1845 1825
1846#ifdef CONFIG_PROC_DEVICETREE
1847static void of_add_proc_dt_entry(struct device_node *dn)
1848{
1849 struct proc_dir_entry *ent;
1850
1851 ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
1852 if (ent)
1853 proc_device_tree_add_node(dn, ent);
1854}
1855#else
1856static void of_add_proc_dt_entry(struct device_node *dn)
1857{
1858 return;
1859}
1860#endif
1861
1862/** 1826/**
1863 * of_attach_node - Plug a device node into the tree and global list. 1827 * of_attach_node - Plug a device node into the tree and global list.
1864 */ 1828 */
@@ -1880,22 +1844,9 @@ int of_attach_node(struct device_node *np)
1880 raw_spin_unlock_irqrestore(&devtree_lock, flags); 1844 raw_spin_unlock_irqrestore(&devtree_lock, flags);
1881 1845
1882 of_node_add(np); 1846 of_node_add(np);
1883 of_add_proc_dt_entry(np);
1884 return 0; 1847 return 0;
1885} 1848}
1886 1849
1887#ifdef CONFIG_PROC_DEVICETREE
1888static void of_remove_proc_dt_entry(struct device_node *dn)
1889{
1890 proc_remove(dn->pde);
1891}
1892#else
1893static void of_remove_proc_dt_entry(struct device_node *dn)
1894{
1895 return;
1896}
1897#endif
1898
1899/** 1850/**
1900 * of_detach_node - "Unplug" a node from the device tree. 1851 * of_detach_node - "Unplug" a node from the device tree.
1901 * 1852 *
@@ -1951,7 +1902,6 @@ int of_detach_node(struct device_node *np)
1951 of_node_set_flag(np, OF_DETACHED); 1902 of_node_set_flag(np, OF_DETACHED);
1952 raw_spin_unlock_irqrestore(&devtree_lock, flags); 1903 raw_spin_unlock_irqrestore(&devtree_lock, flags);
1953 1904
1954 of_remove_proc_dt_entry(np);
1955 of_node_remove(np); 1905 of_node_remove(np);
1956 return rc; 1906 return rc;
1957} 1907}