<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/base/regmap/regmap.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-09-29T19:49:42Z</updated>
<entry>
<title>Merge remote-tracking branch 'regmap/topic/dt-endian' into regmap-next</title>
<updated>2014-09-29T19:49:42Z</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2014-09-29T19:49:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=45942c310da8eadc603e7d2332897909c1da4b70'/>
<id>urn:sha1:45942c310da8eadc603e7d2332897909c1da4b70</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'regmap/fix/core' into regmap-linus</title>
<updated>2014-09-29T19:49:40Z</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2014-09-29T19:49:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=25a948778759ad87d7b005522248cec97eaaa4c5'/>
<id>urn:sha1:25a948778759ad87d7b005522248cec97eaaa4c5</id>
<content type='text'>
</content>
</entry>
<entry>
<title>regmap: fix possible ZERO_SIZE_PTR pointer dereferencing error.</title>
<updated>2014-09-28T10:55:07Z</updated>
<author>
<name>Xiubo Li</name>
<email>Li.Xiubo@freescale.com</email>
</author>
<published>2014-09-28T09:09:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d6b41cb06044a7d895db82bdd54f6e4219970510'/>
<id>urn:sha1:d6b41cb06044a7d895db82bdd54f6e4219970510</id>
<content type='text'>
Since we cannot make sure the 'val_count' will always be none zero
here, and then if it equals to zero, the kmemdup() will return
ZERO_SIZE_PTR, which equals to ((void *)16).

So this patch fix this with just doing the zero check before calling
kmemdup().

Signed-off-by: Xiubo Li &lt;Li.Xiubo@freescale.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>regmap: fix NULL pointer dereference in _regmap_write/read</title>
<updated>2014-09-27T11:21:15Z</updated>
<author>
<name>Pankaj Dubey</name>
<email>pankaj.dubey@samsung.com</email>
</author>
<published>2014-09-27T04:17:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5336be8416a71b5568d2cf54a2f2066abe9f2a53'/>
<id>urn:sha1:5336be8416a71b5568d2cf54a2f2066abe9f2a53</id>
<content type='text'>
If LOG_DEVICE is defined and map-&gt;dev is NULL it will lead to NULL
pointer dereference. This patch fixes this issue by adding check for
dev-&gt;NULL in all such places in regmap.c

Signed-off-by: Pankaj Dubey &lt;pankaj.dubey@samsung.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>regmap: fix NULL pointer dereference in regmap_get_val_endian</title>
<updated>2014-09-18T17:55:31Z</updated>
<author>
<name>Pankaj Dubey</name>
<email>pankaj.dubey@samsung.com</email>
</author>
<published>2014-09-18T09:42:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6e64b6ccc1e46932768e3bb8974fc2e5589bca7a'/>
<id>urn:sha1:6e64b6ccc1e46932768e3bb8974fc2e5589bca7a</id>
<content type='text'>
Recents commits for getting reg endianness causing NULL pointer
dereference if dev is passed NULL in regmap_init_mmio. This patch
fixes this issue, and allows to parse reg endianness only if dev
and dev-&gt;of_node exist.

Signed-off-by: Pankaj Dubey &lt;pankaj.dubey@samsung.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: Split regmap_get_endian() in two functions</title>
<updated>2014-08-27T16:45:56Z</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2014-08-27T14:36:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cf673fbc6342b1c2310cdfdc4ed99f18f866b8e4'/>
<id>urn:sha1:cf673fbc6342b1c2310cdfdc4ed99f18f866b8e4</id>
<content type='text'>
Split regmap_get_endian() in two functions, regmap_get_reg_endian() and
regmap_get_val_endian().

This allows to:
  - Get rid of the three switch()es on "type", incl. error handling in
    three "default" cases,
  - Get rid of the regmap_endian_type enum,
  - Get rid of the non-NULL check of "config" (regmap_init() already
    checks for that),
  - Get rid of the "endian" output parameters, and just return the
    regmap_endian enum value, as the functions can no longer fail.

This saves 21 lines of code (despite the still-present
one-comment-per-line over-documentation), and 30 bytes of code on ARM
V7.

Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Reviewed-by: Stephen Warren &lt;swarren@nvidia.com&gt;
Signed-off-by: Mark Brown &lt;broonie@linaro.org&gt;
</content>
</entry>
<entry>
<title>regmap: Fix handling of volatile registers for format_write() chips</title>
<updated>2014-08-26T17:34:26Z</updated>
<author>
<name>Mark Brown</name>
<email>broonie@linaro.org</email>
</author>
<published>2014-08-26T11:12:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5844a8b9d98ec11ce1d77610daacf3f0a0e14715'/>
<id>urn:sha1:5844a8b9d98ec11ce1d77610daacf3f0a0e14715</id>
<content type='text'>
A previous over-zealous factorisation of code means that we only treat
registers as volatile if they are readable. For most devices this is fine
since normally most registers can be read and volatility implies
readability but for format_write() devices where there is no readback from
the hardware and we use volatility to mean simply uncacheability this means
that we end up treating all registers as cacheble.

A bigger refactoring of the code to clarify this is in order but as a fix
make a minimal change and only check readability when checking volatility
if there is no format_write() operation defined for the device.

Signed-off-by: Mark Brown &lt;broonie@linaro.org&gt;
Tested-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>regmap: of_regmap_get_endian() cleanup</title>
<updated>2014-08-19T21:16:51Z</updated>
<author>
<name>Stephen Warren</name>
<email>swarren@nvidia.com</email>
</author>
<published>2014-08-19T16:49:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=45e1a279ce1d2ff9b2b2fedf4cdced10c7ca3ab5'/>
<id>urn:sha1:45e1a279ce1d2ff9b2b2fedf4cdced10c7ca3ab5</id>
<content type='text'>
Commit d647c199510c ("regmap: add DT endianness binding support") had
some issues. Commit ba1b53feb8ca ("regmap: Fix DT endianess parsing
logic") fixed the main problem. This patch fixes the other.

Specifically, restore the overall default of REGMAP_ENDIAN_BIG if none of
the config, DT, or the bus specify any endianness. Without this,
of_regmap_get_endian() could return REGMAP_ENDIAN_DEFAULT, which the
calling code can't handle. Since all busses do specify an endianness in
the current code, this makes no difference right now, but I saw no
justification in the patch description for removing this final default.

Also, clean up the code a bit:

* s/of_regmap_get_endian/regmap_get_endian/ since the function isn't DT-
  specific, even if the reason it was originally added was to add some
  DT-specific features.
* After potentially reading an endianess specification from DT, the code
  checks whether DT did specify an endianness, and if so, returns it. Move
  this test outside the whole switch statement so that if the
  REGMAP_ENDIAN_REG case ever modifies *endian, this check will pick that
  up. This partially reverts part of commit ba1b53feb8ca ("regmap: Fix DT
  endianess parsing logic"), while maintaining the bug-fix that commit
  made to this code.
* Make the comments briefer, and only refer to the specific action taken
  at their location. This makes most of the comments independent of DT,
  and easier to follow.

Cc: Xiubo Li &lt;Li.Xiubo@freescale.com&gt;
Cc: Javier Martinez Canillas &lt;javier.martinez@collabora.co.uk&gt;
Cc: Thierry Reding &lt;treding@nvidia.com&gt;
Fixes: d647c199510c ("regmap: add DT endianness binding support")
Signed-off-by: Stephen Warren &lt;swarren@nvidia.com&gt;
Signed-off-by: Mark Brown &lt;broonie@linaro.org&gt;
</content>
</entry>
<entry>
<title>regmap: Fix DT endianess parsing logic</title>
<updated>2014-08-18T16:39:27Z</updated>
<author>
<name>Javier Martinez Canillas</name>
<email>javier.martinez@collabora.co.uk</email>
</author>
<published>2014-08-18T13:09:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ba1b53feb8cacbd84bcf0e48925e30ad29e141a6'/>
<id>urn:sha1:ba1b53feb8cacbd84bcf0e48925e30ad29e141a6</id>
<content type='text'>
Commit d647c199510c ("regmap: add DT endianness binding support.")
added support to parse the device endianness from the device tree
but unfortunately the added logic doesn't have the same semantics
than the old code. This leads to a NULL dereference pointer error
when these properties are not provided by the Device Tree:

Unable to handle kernel NULL pointer dereference at virtual address 00000044
pgd = c0004000
[00000044] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 5 PID: 1 Comm: swapper/0 Not tainted 3.17.0-rc1-next-20140818ccu #671
task: ea412800 ti: ea484000 task.ti: ea484000
PC is at regmap_update_bits+0xc/0x5c

The problem is that platforms that rely on the default value now
gets different values due two related issues in the current code:

a) It only parses the endianness from DT for the regmap registers
   and not for the regmap values but it checks unconditionally in
   both cases if the resulting endiannes is REGMAP_ENDIAN_NATIVE.

b) REGMAP_ENDIAN_NATIVE is not even a valid DT property according
   to the regmap DT binding documentation so it shouldn't be set.

Signed-off-by: Javier Martinez Canillas &lt;javier.martinez@collabora.co.uk&gt;
Signed-off-by: Mark Brown &lt;broonie@linaro.org&gt;
</content>
</entry>
<entry>
<title>regmap: add DT endianness binding support.</title>
<updated>2014-08-16T21:56:23Z</updated>
<author>
<name>Xiubo Li</name>
<email>Li.Xiubo@freescale.com</email>
</author>
<published>2014-07-15T04:23:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d647c199510c2c126ac03ecbea51086e10126a40'/>
<id>urn:sha1:d647c199510c2c126ac03ecbea51086e10126a40</id>
<content type='text'>
For many drivers which will support rich endianness of Devices
need define DT properties by itself with the binding support.

The endianness using regmap:
Index      Device     Properties if needs bytes-swap,
                      or just ignore it
-------------------------------------------------------------
1          BE         'big-endian'
2          LE         'little-endian'

The properties include all the register values and the buffers.
And these properties are very usful for the MMIO devices:

Such as: a memory-mapped device, on one SoC is in BE mode, while
in another SoC will be in LE mode, and the CPU will always in LE
mode.

For the first case, we must use cpu_to_be32/be32_to_cpu for
32-bit registers accessing, so the 'big-endian' property is needed.

For the second case, we can just ignore the bytes-swap
functions like cpu_to_le32/le32_to_cpu, so the 'little-endian'
property could be abscent.

And vice versa...

Signed-off-by: Xiubo Li &lt;Li.Xiubo@freescale.com&gt;
Signed-off-by: Mark Brown &lt;broonie@linaro.org&gt;
</content>
</entry>
</feed>
