Skip to content

Commit 8357041

Browse files
committed
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>
1 parent 7e66c5c commit 8357041

File tree

7 files changed

+1
-322
lines changed

7 files changed

+1
-322
lines changed

drivers/of/Kconfig

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ config OF
77
menu "Device Tree and Open Firmware support"
88
depends on OF
99

10-
config PROC_DEVICETREE
11-
bool "Support for device tree in /proc"
12-
depends on PROC_FS && !SPARC
13-
help
14-
This option adds a device-tree directory under /proc which contains
15-
an image of the device tree that the kernel copies from Open
16-
Firmware or other boot firmware. If unsure, say Y here.
17-
1810
config OF_SELFTEST
1911
bool "Device Tree Runtime self tests"
2012
depends on OF_IRQ

drivers/of/base.c

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,9 @@ static int __init of_init(void)
281281
__of_node_add(np);
282282
mutex_unlock(&of_aliases_mutex);
283283

284-
#if !defined(CONFIG_PROC_DEVICETREE)
285-
/* Symlink to the new tree when PROC_DEVICETREE is disabled */
284+
/* Symlink in /proc as required by userspace ABI */
286285
if (of_allnodes)
287286
proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
288-
#endif /* CONFIG_PROC_DEVICETREE */
289287

290288
return 0;
291289
}
@@ -1690,12 +1688,6 @@ int of_add_property(struct device_node *np, struct property *prop)
16901688

16911689
__of_add_property_sysfs(np, prop);
16921690

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-
16991691
return rc;
17001692
}
17011693

@@ -1742,12 +1734,6 @@ int of_remove_property(struct device_node *np, struct property *prop)
17421734

17431735
sysfs_remove_bin_file(&np->kobj, &prop->attr);
17441736

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-
17511737
return 0;
17521738
}
17531739

@@ -1803,12 +1789,6 @@ int of_update_property(struct device_node *np, struct property *newprop)
18031789
if (!found)
18041790
return -ENODEV;
18051791

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-
18121792
return 0;
18131793
}
18141794

@@ -1843,22 +1823,6 @@ int of_reconfig_notify(unsigned long action, void *p)
18431823
return notifier_to_errno(rc);
18441824
}
18451825

1846-
#ifdef CONFIG_PROC_DEVICETREE
1847-
static 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
1856-
static void of_add_proc_dt_entry(struct device_node *dn)
1857-
{
1858-
return;
1859-
}
1860-
#endif
1861-
18621826
/**
18631827
* of_attach_node - Plug a device node into the tree and global list.
18641828
*/
@@ -1880,22 +1844,9 @@ int of_attach_node(struct device_node *np)
18801844
raw_spin_unlock_irqrestore(&devtree_lock, flags);
18811845

18821846
of_node_add(np);
1883-
of_add_proc_dt_entry(np);
18841847
return 0;
18851848
}
18861849

1887-
#ifdef CONFIG_PROC_DEVICETREE
1888-
static void of_remove_proc_dt_entry(struct device_node *dn)
1889-
{
1890-
proc_remove(dn->pde);
1891-
}
1892-
#else
1893-
static void of_remove_proc_dt_entry(struct device_node *dn)
1894-
{
1895-
return;
1896-
}
1897-
#endif
1898-
18991850
/**
19001851
* of_detach_node - "Unplug" a node from the device tree.
19011852
*
@@ -1951,7 +1902,6 @@ int of_detach_node(struct device_node *np)
19511902
of_node_set_flag(np, OF_DETACHED);
19521903
raw_spin_unlock_irqrestore(&devtree_lock, flags);
19531904

1954-
of_remove_proc_dt_entry(np);
19551905
of_node_remove(np);
19561906
return rc;
19571907
}

fs/proc/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o
2727
proc-$(CONFIG_NET) += proc_net.o
2828
proc-$(CONFIG_PROC_KCORE) += kcore.o
2929
proc-$(CONFIG_PROC_VMCORE) += vmcore.o
30-
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
3130
proc-$(CONFIG_PRINTK) += kmsg.o
3231
proc-$(CONFIG_PROC_PAGE_MONITOR) += page.o

fs/proc/internal.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,6 @@ extern struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry
210210
extern int proc_fill_super(struct super_block *);
211211
extern void proc_entry_rundown(struct proc_dir_entry *);
212212

213-
/*
214-
* proc_devtree.c
215-
*/
216-
#ifdef CONFIG_PROC_DEVICETREE
217-
extern void proc_device_tree_init(void);
218-
#endif
219-
220213
/*
221214
* proc_namespaces.c
222215
*/

fs/proc/proc_devtree.c

Lines changed: 0 additions & 241 deletions
This file was deleted.

fs/proc/root.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@ void __init proc_root_init(void)
183183
proc_mkdir("openprom", NULL);
184184
#endif
185185
proc_tty_init();
186-
#ifdef CONFIG_PROC_DEVICETREE
187-
proc_device_tree_init();
188-
#endif
189186
proc_mkdir("bus", NULL);
190187
proc_sys_init();
191188
}

0 commit comments

Comments
 (0)