<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/drivers/of/of_private.h, branch v4.12-rc1</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v4.12-rc1</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v4.12-rc1'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2017-04-28T21:17:56+00:00</updated>
<entry>
<title>of: fix unittest build without CONFIG_OF_OVERLAY</title>
<updated>2017-04-28T21:17:56+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2017-04-28T09:44:12+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=5d4dd65b1e98ff640c3bdb546a169e397805831e'/>
<id>urn:sha1:5d4dd65b1e98ff640c3bdb546a169e397805831e</id>
<content type='text'>
We get a link error when the new tests are used by overlays
are not:

drivers/of/built-in.o: In function `unflatten_device_tree':
(.init.text+0x967): undefined reference to `unittest_unflatten_overlay_base'

This makes the #ifdef check match the symbols that lead to building
the unittest_unflatten_overlay_base function.

Fixes: 81d0848fc8d2 ("of: Add unit tests for applying overlays")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Reviewed-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Tested-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: Add unit tests for applying overlays</title>
<updated>2017-04-27T22:26:06+00:00</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@sony.com</email>
</author>
<published>2017-04-26T00:09:54+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=81d0848fc8d2058c4cc645d971435c889869433b'/>
<id>urn:sha1:81d0848fc8d2058c4cc645d971435c889869433b</id>
<content type='text'>
Existing overlay unit tests examine individual pieces of the overlay
code.  The new tests target the entire process of applying an overlay.

Signed-off-by: Frank Rowand &lt;frank.rowand@sony.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: fix memory leak related to safe_name()</title>
<updated>2016-06-24T20:16:10+00:00</updated>
<author>
<name>Frank Rowand</name>
<email>frank.rowand@am.sony.com</email>
</author>
<published>2016-06-16T17:51:46+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=d9fc880723321dbf16b2981e3f3e916b73942210'/>
<id>urn:sha1:d9fc880723321dbf16b2981e3f3e916b73942210</id>
<content type='text'>
Fix a memory leak resulting from memory allocation in safe_name().
This patch fixes all call sites of safe_name().

Mathieu Malaterre reported the memory leak on boot:

On my PowerMac device-tree would generate a duplicate name:

[    0.023043] device-tree: Duplicate name in PowerPC,G4@0, renamed to "l2-cache#1"

in this case a newly allocated name is generated by `safe_name`. However
in this case it is never deallocated.

The bug was found using kmemleak reported as:

unreferenced object 0xdf532e60 (size 32):
  comm "swapper", pid 1, jiffies 4294892300 (age 1993.532s)
  hex dump (first 32 bytes):
    6c 32 2d 63 61 63 68 65 23 31 00 dd e4 dd 1e c2  l2-cache#1......
    ec d4 ba ce 04 ec cc de 8e 85 e9 ca c4 ec cc 9e  ................
  backtrace:
    [&lt;c02d3350&gt;] kvasprintf+0x64/0xc8
    [&lt;c02d3400&gt;] kasprintf+0x4c/0x5c
    [&lt;c0453814&gt;] safe_name.isra.1+0x80/0xc4
    [&lt;c04545d8&gt;] __of_attach_node_sysfs+0x6c/0x11c
    [&lt;c075f21c&gt;] of_core_init+0x8c/0xf8
    [&lt;c0729594&gt;] kernel_init_freeable+0xd4/0x208
    [&lt;c00047e8&gt;] kernel_init+0x24/0x11c
    [&lt;c00158ec&gt;] ret_from_kernel_thread+0x5c/0x64

Link: https://bugzilla.kernel.org/show_bug.cgi?id=120331

Signed-off-by: Frank Rowand &lt;frank.rowand@am.sony.com&gt;
Reported-by: mathieu.malaterre@gmail.com
Tested-by: Mathieu Malaterre &lt;mathieu.malaterre@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>drivers/of: Export OF changeset functions</title>
<updated>2016-01-13T22:10:37+00:00</updated>
<author>
<name>Gavin Shan</name>
<email>gwshan@linux.vnet.ibm.com</email>
</author>
<published>2015-11-04T13:12:49+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=183223770ae8625df8966ed15811d1b3ee8720aa'/>
<id>urn:sha1:183223770ae8625df8966ed15811d1b3ee8720aa</id>
<content type='text'>
The PowerNV PCI hotplug driver is going to use the OF changeset
to manage the changed device sub-tree. This exports those OF
changeset functions for that.

Signed-off-by: Gavin Shan &lt;gwshan@linux.vnet.ibm.com&gt;
Acked-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Tested-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Signed-off-by: Rob Herring &lt;robh@kernel.org&gt;
</content>
</entry>
<entry>
<title>of: Refactor __of_node_alloc() into __of_node_dup()</title>
<updated>2014-11-24T22:24:41+00:00</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-11-17T22:31:32+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=e51795815ef1a7adc018cbaf05aac46e3d24eda8'/>
<id>urn:sha1:e51795815ef1a7adc018cbaf05aac46e3d24eda8</id>
<content type='text'>
Add a node argument to __of_node_alloc() and rename it to
__of_node_dup() so that it can also be used to duplicate a node with
its properties. This is important for the overlay code so that it can
create new nodes without using separate changeset items for every single
property.

At the same time rework the overlay code to use the new function and
drop the extra changeset items.

Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
<entry>
<title>of: Use vargs in __of_node_alloc</title>
<updated>2014-11-24T22:23:35+00:00</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-11-14T15:33:07+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=ef8bbd73a76197cf8362a2b43aaadc5717bd0746'/>
<id>urn:sha1:ef8bbd73a76197cf8362a2b43aaadc5717bd0746</id>
<content type='text'>
The overlay code needs to construct a new full_name from the parent name
and the node name, but the current method has to allocate and then free
an temporary string which is wasteful. Fix this problem by using vargs
to pass in a format and arguments into __of_node_alloc().

At the same time remove the allocflags argument to __of_node_alloc().
The only users all use GFP_KERNEL, so there is no need to provide it as
an option. If there is ever a need later it can be added back.

Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
<entry>
<title>of: Transactional DT support.</title>
<updated>2014-07-23T23:29:15+00:00</updated>
<author>
<name>Pantelis Antoniou</name>
<email>pantelis.antoniou@konsulko.com</email>
</author>
<published>2014-07-04T16:58:49+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=201c910bd6898d81d4ac6685d0f421b7e10f3c5d'/>
<id>urn:sha1:201c910bd6898d81d4ac6685d0f421b7e10f3c5d</id>
<content type='text'>
Introducing DT transactional support.

A DT transaction is a method which allows one to apply changes
in the live tree, in such a way that either the full set of changes
take effect, or the state of the tree can be rolled-back to the
state it was before it was attempted. An applied transaction
can be rolled-back at any time.

Documentation is in
	Documentation/devicetree/changesets.txt

Signed-off-by: Pantelis Antoniou &lt;pantelis.antoniou@konsulko.com&gt;
[glikely: Removed device notifiers and reworked to be more consistent]
Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
<entry>
<title>of: Reorder device tree changes and notifiers</title>
<updated>2014-07-23T23:08:13+00:00</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-07-16T18:48:23+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=259092a35c7e11f1d4616b0f5b3ba7b851fe4fa6'/>
<id>urn:sha1:259092a35c7e11f1d4616b0f5b3ba7b851fe4fa6</id>
<content type='text'>
Currently, devicetree reconfig notifiers get emitted before the change
is applied to the tree, but that behaviour is problematic if the
receiver wants the determine the new state of the tree. The current
users don't care, but the changeset code to follow will be making
multiple changes at once. Reorder notifiers to get emitted after the
change has been applied to the tree so that callbacks see the new tree
state.

At the same time, fixup the existing callbacks to expect the new order.
There are a few callbacks that compare the old and new values of a
changed property. Put both property pointers into the of_prop_reconfig
structure.

The current notifiers also allow the notifier callback to fail and
cancel the change to the tree, but that feature isn't actually used.
It really isn't valid to ignore a tree modification provided by firmware
anyway, so remove the ability to cancel a change to the tree.

Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
Cc: Nathan Fontenot &lt;nfont@austin.ibm.com&gt;
</content>
</entry>
<entry>
<title>of: Move dynamic node fixups out of powerpc and into common code</title>
<updated>2014-07-23T23:05:46+00:00</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-07-16T05:25:43+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=a25095d451ece23b1fef34474f3230100db7aa05'/>
<id>urn:sha1:a25095d451ece23b1fef34474f3230100db7aa05</id>
<content type='text'>
PowerPC does an odd thing with dynamic nodes. It uses a notifier to
catch new node additions and set some of the values like name and type.
This makes no sense since that same code can be put directly into
of_attach_node(). Besides, all dynamic node users need this, not just
powerpc. Fix this problem by moving the logic out of arch/powerpc and
into drivers/of/dynamic.c.

It is also important to remove this notifier because we want to move the
firing of notifiers from before the tree is modified to after so that
the receiver gets a consistent view of the tree, but that is
incompatible with notifiers that modify the node.

Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
Cc: Nathan Fontenot &lt;nfont@austin.ibm.com&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
</content>
</entry>
<entry>
<title>of: Make devicetree sysfs update functions consistent.</title>
<updated>2014-07-23T23:05:06+00:00</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-07-23T23:05:06+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=8a2b22a2595bf89d4396530edf8388159fad9d83'/>
<id>urn:sha1:8a2b22a2595bf89d4396530edf8388159fad9d83</id>
<content type='text'>
All of the DT modification functions are split into two parts, the first
part manipulates the DT data structure, and the second part updates
sysfs, but the code isn't very consistent about how the second half is
called. They don't all enforce the same rules about when it is valid to
update sysfs, and there isn't any clarity on locking.

The transactional DT modification feature that is coming also needs
access to these functions so that it can perform all the structure
changes together, and then all the sysfs updates as a second stage
instead of doing each one at a time.

Fix up the second have by creating a separate __of_*_sysfs() function
for each of the helpers. The new functions have consistent naming (ie.
of_node_add() becomes __of_attach_node_sysfs()) and all of them now
defer if of_init hasn't been called yet.

Callers of the new functions must hold the of_mutex to ensure there are
no race conditions with of_init(). The mutex ensures that there will
only ever be one writer to the tree at any given time. There can still
be any number of readers and the raw_spin_lock is still used to make
sure access to the data structure is still consistent.

Finally, put the function prototypes into of_private.h so they are
accessible to the transaction code.

Signed-off-by: Pantelis Antoniou &lt;pantelis.antoniou@konsulko.com&gt;
[grant.likely: Changed suffix from _post to _sysfs to match existing code]
[grant.likely: Reorganized to eliminate trivial wrappers]
Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
</feed>
