of: Make device nodes kobjects so they show up in sysfs
authorGrant Likely <grant.likely@linaro.org>
Thu, 20 Feb 2014 18:02:11 +0000 (18:02 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 16 Feb 2015 04:33:08 +0000 (13:33 +0900)
commitf57a8e20bfaa9ed2530f206c06a994072ca4ad88
tree57dd995e0b9df44e1f60e7ab01cb68ca00b7b3c2
parenta317907a68af5f1509b1b38e3bf378a5178f1c3a
of: Make device nodes kobjects so they show up in sysfs

Device tree nodes are already treated as objects, and we already want to
expose them to userspace which is done using the /proc filesystem today.
Right now the kernel has to do a lot of work to keep the /proc view in
sync with the in-kernel representation. If device_nodes are switched to
be kobjects then the device tree code can be a whole lot simpler. It
also turns out that switching to using /sysfs from /proc results in
smaller code and data size, and the userspace ABI won't change if
/proc/device-tree symlinks to /sys/firmware/devicetree/base.

v7: Add missing sysfs_bin_attr_init()
v6: Add __of_add_property() early init fixes from Pantelis
v5: Rename firmware/ofw to firmware/devicetree
    Fix updating property values in sysfs
v4: Fixed build error on Powerpc
    Fixed handling of dynamic nodes on powerpc
v3: Fixed handling of duplicate attribute and child node names
v2: switch to using sysfs bin_attributes which solve the problem of
    reporting incorrect property size.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
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>
(cherry picked from commit 75b57ecf9d1d1e17d099ab13b8f48e6e038676be)
Signed-off-by: Mark Brown <broonie@kernel.org>
Conflicts:
arch/powerpc/platforms/pseries/dlpar.c
Documentation/ABI/testing/sysfs-firmware-ofw [new file with mode: 0644]
arch/arm/boot/dts/testcases/tests-phandle.dtsi
arch/powerpc/platforms/pseries/dlpar.c
arch/powerpc/platforms/pseries/reconfig.c
arch/powerpc/sysdev/msi_bitmap.c
drivers/of/base.c
drivers/of/fdt.c
drivers/of/pdt.c
include/linux/of.h