<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/of/base.c, branch v3.18</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.18</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.18'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2014-11-04T10:19:48Z</updated>
<entry>
<title>of: Fix overflow bug in string property parsing functions</title>
<updated>2014-11-04T10:19:48Z</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-11-03T15:15:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a87fa1d81a9fb5e9adca9820e16008c40ad09f33'/>
<id>urn:sha1:a87fa1d81a9fb5e9adca9820e16008c40ad09f33</id>
<content type='text'>
The string property read helpers will run off the end of the buffer if
it is handed a malformed string property. Rework the parsers to make
sure that doesn't happen. At the same time add new test cases to make
sure the functions behave themselves.

The original implementations of of_property_read_string_index() and
of_property_count_strings() both open-coded the same block of parsing
code, each with it's own subtly different bugs. The fix here merges
functions into a single helper and makes the original functions static
inline wrappers around the helper.

One non-bugfix aspect of this patch is the addition of a new wrapper,
of_property_read_string_array(). The new wrapper is needed by the
device_properties feature that Rafael is working on and planning to
merge for v3.19. The implementation is identical both with and without
the new static inline wrapper, so it just got left in to reduce the
churn on the header file.

Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
Cc: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Cc: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Cc: Rob Herring &lt;robh+dt@kernel.org&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Darren Hart &lt;darren.hart@intel.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;  # v3.3+: Drop selftest hunks that don't apply
</content>
</entry>
<entry>
<title>of: Don't try to search when phandle == 0</title>
<updated>2014-10-04T20:20:18Z</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-10-02T12:08:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fc59b4479c172e413df615cea1635247265e07a0'/>
<id>urn:sha1:fc59b4479c172e413df615cea1635247265e07a0</id>
<content type='text'>
A value of '0' isn't a valid phandle, so searching for a node with that
phandle is pointless. It will result in nothing but false positives.

Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
<entry>
<title>of: make sure of_alias is initialized before accessing it</title>
<updated>2014-09-08T14:57:26Z</updated>
<author>
<name>Laurentiu Tudor</name>
<email>b10716@freescale.com</email>
</author>
<published>2014-08-27T14:09:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7dbe5849fb50fc9b5b77a8f590c87a577ddc9bb6'/>
<id>urn:sha1:7dbe5849fb50fc9b5b77a8f590c87a577ddc9bb6</id>
<content type='text'>
Simply swap of_alias and of_chosen initialization so
that of_alias ends up read first. This must be done
because it is accessed couple of lines below when
trying to initialize the of_stdout using the alias
based legacy method.

[Fixes a752ee5 - tty: Update hypervisor tty drivers to
use core stdout parsing code]

Signed-off-by: Laurentiu Tudor &lt;Laurentiu.Tudor@freescale.com&gt;
[glikely: Don't move the 'if (!of_aliases)' test]
Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
<entry>
<title>of: Disabling OF functions that use sysfs if CONFIG_SYSFS disabled</title>
<updated>2014-09-08T14:57:25Z</updated>
<author>
<name>Gaurav Minocha</name>
<email>gaurav.minocha.os@gmail.com</email>
</author>
<published>2014-09-05T16:56:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ef69d74035befbddd7c2b7e86120e49191107acc'/>
<id>urn:sha1:ef69d74035befbddd7c2b7e86120e49191107acc</id>
<content type='text'>
This patch is to the fix the recent runtime bug in kernel reported by
&lt;fengguang.wu@intel.com&gt;. The bug was exposed by commit b951f9dc,
"Enabling OF selftest to run without machine's devicetree" and is
exposed when CONFIG_OF_SELFTEST is enabled and CONFIG_SYSFS is
disabled.

Mail Subject: [OF test] BUG: unable to handle kernel NULL pointer
dereference at 00000038

Tested on x86 and arm architecture

Signed-off-by: Gaurav Minocha &lt;gaurav.minocha.os@gmail.com&gt;
Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
<entry>
<title>of: correct of_console_check()'s return value</title>
<updated>2014-09-08T14:57:24Z</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2014-09-03T18:06:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5f74d8b7b8546255db6af45b017e9cbb18aed609'/>
<id>urn:sha1:5f74d8b7b8546255db6af45b017e9cbb18aed609</id>
<content type='text'>
The comments above of_console_check() say that it will return TRUE if it
registers a preferred console, but add_preferred_console() uses a
0-equals-success convention, so this leaves of_console_check() with an
inconsistent policy for its return values.

Fortunately, nobody was actually checking the return value of
of_console_check(), so this isn't significant at the moment.

But let's match the comments, so we're doing what we say.

Fixes: 3482f2c52b77 ('of: Create of_console_check() for selecting a console specified in /chosen')
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'devicetree/next-overlay' into devicetree/next</title>
<updated>2014-08-11T13:06:23Z</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-08-11T13:06:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=663d3f7c2e5e1b018a4c53277ccfde40329d98ca'/>
<id>urn:sha1:663d3f7c2e5e1b018a4c53277ccfde40329d98ca</id>
<content type='text'>
Conflicts:
	drivers/of/testcase-data/testcases.dts
</content>
</entry>
<entry>
<title>of: Reorder device tree changes and notifiers</title>
<updated>2014-07-23T23:08:13Z</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-07-16T18:48:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:46Z</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-07-16T05:25:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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:06Z</updated>
<author>
<name>Grant Likely</name>
<email>grant.likely@linaro.org</email>
</author>
<published>2014-07-23T23:05:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/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>
<entry>
<title>of: Create unlocked versions of node and property add/remove functions</title>
<updated>2014-07-16T14:16:52Z</updated>
<author>
<name>Pantelis Antoniou</name>
<email>pantelis.antoniou@konsulko.com</email>
</author>
<published>2014-07-04T16:58:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d8c50088417ebf61ad8b132caad20d10f7736034'/>
<id>urn:sha1:d8c50088417ebf61ad8b132caad20d10f7736034</id>
<content type='text'>
The DT overlay code will need to manipulate nodes and properties while
already holding the devicetree lock, or on nodes that are not yet
attached to the tree, but the current helper functions don't allow that.
Extract the core behaviour from the accessors and create the following
unlocked variants.

The unlocked variants require either the lock to already be held or for
the nodes to be detached from the tree. Changes to live nodes will not
get updated in sysfs, so the caller must arrange for housekeeping to
take place after dropping the lock.

The new functions are: __of_add_property(), __of_remove_property(),
__of_update_property(), __of_attach_node() and __of_detach_node().

Signed-off-by: Pantelis Antoniou &lt;pantelis.antoniou@konsulko.com&gt;
[Remove unnecessary diff hunks and rewrite commit text]
Signed-off-by: Grant Likely &lt;grant.likely@linaro.org&gt;
</content>
</entry>
</feed>
