Skip to content

Commit

Permalink
of: remove /proc/device-tree
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Grant Likely authored and Grant Likely committed Mar 11, 2014
1 parent 7e66c5c commit 8357041
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 322 deletions.
8 changes: 0 additions & 8 deletions drivers/of/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 1 addition & 51 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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.
*/
Expand All @@ -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.
*
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion fs/proc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o
proc-$(CONFIG_NET) += proc_net.o
proc-$(CONFIG_PROC_KCORE) += kcore.o
proc-$(CONFIG_PROC_VMCORE) += vmcore.o
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
proc-$(CONFIG_PRINTK) += kmsg.o
proc-$(CONFIG_PROC_PAGE_MONITOR) += page.o
7 changes: 0 additions & 7 deletions fs/proc/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,6 @@ extern struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry
extern int proc_fill_super(struct super_block *);
extern void proc_entry_rundown(struct proc_dir_entry *);

/*
* proc_devtree.c
*/
#ifdef CONFIG_PROC_DEVICETREE
extern void proc_device_tree_init(void);
#endif

/*
* proc_namespaces.c
*/
Expand Down
241 changes: 0 additions & 241 deletions fs/proc/proc_devtree.c

This file was deleted.

3 changes: 0 additions & 3 deletions fs/proc/root.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ void __init proc_root_init(void)
proc_mkdir("openprom", NULL);
#endif
proc_tty_init();
#ifdef CONFIG_PROC_DEVICETREE
proc_device_tree_init();
#endif
proc_mkdir("bus", NULL);
proc_sys_init();
}
Expand Down
Loading

0 comments on commit 8357041

Please sign in to comment.