<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/base/regmap/regmap-debugfs.c, branch v5.10</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=v5.10</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.10'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-10-05T17:53:24Z</updated>
<entry>
<title>Merge remote-tracking branch 'regmap/for-5.10' into regmap-next</title>
<updated>2020-10-05T17:53:24Z</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2020-10-05T17:53:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6e0545c4f08368e67496111778a726f9a2031f26'/>
<id>urn:sha1:6e0545c4f08368e67496111778a726f9a2031f26</id>
<content type='text'>
</content>
</entry>
<entry>
<title>regmap: debugfs: use semicolons rather than commas to separate statements</title>
<updated>2020-09-28T17:16:12Z</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@inria.fr</email>
</author>
<published>2020-09-27T19:12:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7f4a122d0b50b40c64d24a5cf7aafe26dd9487ee'/>
<id>urn:sha1:7f4a122d0b50b40c64d24a5cf7aafe26dd9487ee</id>
<content type='text'>
Replace commas with semicolons.  What is done is essentially described by
the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):

// &lt;smpl&gt;
@@ expression e1,e2; @@
e1
-,
+;
e2
... when any
// &lt;/smpl&gt;

Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
Link: https://lore.kernel.org/r/1601233948-11629-15-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: debugfs: Fix handling of name string for debugfs init delays</title>
<updated>2020-09-17T17:54:20Z</updated>
<author>
<name>Charles Keepax</name>
<email>ckeepax@opensource.cirrus.com</email>
</author>
<published>2020-09-17T12:08:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=94cc89eb8fa5039fcb6e3e3d50f929ddcccee095'/>
<id>urn:sha1:94cc89eb8fa5039fcb6e3e3d50f929ddcccee095</id>
<content type='text'>
In regmap_debugfs_init the initialisation of the debugfs is delayed
if the root node isn't ready yet. Most callers of regmap_debugfs_init
pass the name from the regmap_config, which is considered temporary
ie. may be unallocated after the regmap_init call returns. This leads
to a potential use after free, where config-&gt;name has been freed by
the time it is used in regmap_debugfs_initcall.

This situation can be seen on Zynq, where the architecture init_irq
callback registers a syscon device, using a local variable for the
regmap_config. As init_irq is very early in the platform bring up the
regmap debugfs root isn't ready yet. Although this doesn't crash it
does result in the debugfs entry not having the correct name.

Regmap already sets map-&gt;name from config-&gt;name on the regmap_init
path and the fact that a separate field is used to pass the name
to regmap_debugfs_init appears to be an artifact of the debugfs
name being added before the map name. As such this patch updates
regmap_debugfs_init to use map-&gt;name, which is already duplicated from
the config avoiding the issue.

This does however leave two lose ends, both regmap_attach_dev and
regmap_reinit_cache can be called after a regmap is registered and
would have had the effect of applying a new name to the debugfs
entries. In both of these cases it was chosen to update the map
name. In the case of regmap_attach_dev there are 3 users that
currently use this function to update the name, thus doing so avoids
changes for those users and it seems reasonable that attaching
a device would want to set the name of the map. In the case of
regmap_reinit_cache the primary use-case appears to be devices that
need some register access to identify the device (for example devices
in the same family) and then update the cache to match the exact
hardware. Whilst no users do currently update the name here, given the
use-case it seemed reasonable the name might want to be updated once
the device is better identified.

Signed-off-by: Charles Keepax &lt;ckeepax@opensource.cirrus.com&gt;
Link: https://lore.kernel.org/r/20200917120828.12987-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'regmap-fix-v5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into master</title>
<updated>2020-07-17T16:58:18Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-07-17T16:58:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ee43695571c258c0945d4c456ea85b2af9aafdf4'/>
<id>urn:sha1:ee43695571c258c0945d4c456ea85b2af9aafdf4</id>
<content type='text'>
Pull regmap fixes from Mark Brown:
 "A couple of substantial fixes here, one from Doug which fixes the
  debugfs code for MMIO regmaps (fortunately not the common case) and
  one from Marc fixing lookups of multiple regmaps for the same device
  (a very unusual case).

  There's also a fix for Kconfig to ensure we enable SoundWire properly"

* tag 'regmap-fix-v5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
  regmap: debugfs: Don't sleep while atomic for fast_io regmaps
  regmap: add missing dependency on SoundWire
  regmap: dev_get_regmap_match(): fix string comparison
</content>
</entry>
<entry>
<title>regmap: debugfs: Don't sleep while atomic for fast_io regmaps</title>
<updated>2020-07-16T19:41:58Z</updated>
<author>
<name>Douglas Anderson</name>
<email>dianders@chromium.org</email>
</author>
<published>2020-07-15T23:46:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=299632e54b2e692d2830af84be51172480dc1e26'/>
<id>urn:sha1:299632e54b2e692d2830af84be51172480dc1e26</id>
<content type='text'>
If a regmap has "fast_io" set then its lock function uses a spinlock.
That doesn't work so well with the functions:
* regmap_cache_only_write_file()
* regmap_cache_bypass_write_file()

Both of the above functions have the pattern:
1. Lock the regmap.
2. Call:
   debugfs_write_file_bool()
     copy_from_user()
       __might_fault()
         __might_sleep()

Let's reorder things a bit so that we do all of our sleepable
functions before we grab the lock.

Fixes: d3dc5430d68f ("regmap: debugfs: Allow writes to cache state settings")
Signed-off-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Link: https://lore.kernel.org/r/20200715164611.1.I35b3533e8a80efde0cec1cc70f71e1e74b2fa0da@changeid
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: debugfs: check count when read regmap file</title>
<updated>2020-03-13T16:33:58Z</updated>
<author>
<name>Peng Fan</name>
<email>peng.fan@nxp.com</email>
</author>
<published>2020-03-13T01:58:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=74edd08a4fbf51d65fd8f4c7d8289cd0f392bd91'/>
<id>urn:sha1:74edd08a4fbf51d65fd8f4c7d8289cd0f392bd91</id>
<content type='text'>
When executing the following command, we met kernel dump.
dmesg -c &gt; /dev/null; cd /sys;
for i in `ls /sys/kernel/debug/regmap/* -d`; do
	echo "Checking regmap in $i";
	cat $i/registers;
done &amp;&amp; grep -ri "0x02d0" *;

It is because the count value is too big, and kmalloc fails. So add an
upper bound check to allow max size `PAGE_SIZE &lt;&lt; (MAX_ORDER - 1)`.

Signed-off-by: Peng Fan &lt;peng.fan@nxp.com&gt;
Link: https://lore.kernel.org/r/1584064687-12964-1-git-send-email-peng.fan@nxp.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: no need to check return value of debugfs_create functions</title>
<updated>2019-08-01T13:06:56Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2019-07-31T13:29:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d52a35ebd4bb6e495ab06e4ce1f568daa0f70e1'/>
<id>urn:sha1:9d52a35ebd4bb6e495ab06e4ce1f568daa0f70e1</id>
<content type='text'>
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

The debugfs core will warn if a file or directory can not be created, so
there's no need to duplicate the warning, nor really do anything else.

Cc: Mark Brown &lt;broonie@kernel.org&gt;
Cc: "Rafael J. Wysocki" &lt;rafael@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Link: https://lore.kernel.org/r/20190731132923.GA13829@kroah.com
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: debugfs: Fix memory leak in regmap_debugfs_init</title>
<updated>2019-05-20T14:23:29Z</updated>
<author>
<name>Daniel Baluta</name>
<email>daniel.baluta@nxp.com</email>
</author>
<published>2019-05-17T13:23:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2899872b627e99b7586fe3b6c9f861da1b4d5072'/>
<id>urn:sha1:2899872b627e99b7586fe3b6c9f861da1b4d5072</id>
<content type='text'>
As detected by kmemleak running on i.MX6ULL board:

nreferenced object 0xd8366600 (size 64):
  comm "swapper/0", pid 1, jiffies 4294937370 (age 933.220s)
  hex dump (first 32 bytes):
    64 75 6d 6d 79 2d 69 6f 6d 75 78 63 2d 67 70 72  dummy-iomuxc-gpr
    40 32 30 65 34 30 30 30 00 e3 f3 ab fe d1 1b dd  @20e4000........
  backtrace:
    [&lt;b0402aec&gt;] kasprintf+0x2c/0x54
    [&lt;a6fbad2c&gt;] regmap_debugfs_init+0x7c/0x31c
    [&lt;9c8d91fa&gt;] __regmap_init+0xb5c/0xcf4
    [&lt;5b1c3d2a&gt;] of_syscon_register+0x164/0x2c4
    [&lt;596a5d80&gt;] syscon_node_to_regmap+0x64/0x90
    [&lt;49bd597b&gt;] imx6ul_init_machine+0x34/0xa0
    [&lt;250a4dac&gt;] customize_machine+0x1c/0x30
    [&lt;2d19fdaf&gt;] do_one_initcall+0x7c/0x398
    [&lt;e6084469&gt;] kernel_init_freeable+0x328/0x448
    [&lt;168c9101&gt;] kernel_init+0x8/0x114
    [&lt;913268aa&gt;] ret_from_fork+0x14/0x20
    [&lt;ce7b131a&gt;] 0x0

Root cause is that map-&gt;debugfs_name is allocated using kasprintf
and then the pointer is lost by assigning it other memory address.

Reported-by: Stefan Wahren &lt;stefan.wahren@i2se.com&gt;
Signed-off-by: Daniel Baluta &lt;daniel.baluta@nxp.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: add proper SPDX identifiers on files that did not have them.</title>
<updated>2019-04-25T19:22:15Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2019-04-25T18:06:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=37613fa5b762a73073de3c2e23baa4a1da337e71'/>
<id>urn:sha1:37613fa5b762a73073de3c2e23baa4a1da337e71</id>
<content type='text'>
There were a few files in the regmap code that did not have SPDX
identifiers on them, so fix that up.  At the same time, remove the "free
form" text that specified the license of the file, as that is impossible
for any tool to properly parse.

Also, as Mark loves // comment markers, convert all of the headers to be
the same to make things look consistent :)

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>regmap: debugfs: Jump to the next readable register</title>
<updated>2019-03-20T17:13:31Z</updated>
<author>
<name>Lucas Tanure</name>
<email>tanureal@opensource.cirrus.com</email>
</author>
<published>2019-03-19T09:41:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cc6a8d69ba624f0ad7a09ed095b7bd4b86476489'/>
<id>urn:sha1:cc6a8d69ba624f0ad7a09ed095b7bd4b86476489</id>
<content type='text'>
Improve the speed of the loop jumping to the next
available register

Signed-off-by: Lucas Tanure &lt;tanureal@opensource.cirrus.com&gt;
Reviewed-by: Charles Keepax &lt;ckeepax@opensource.cirrus.com&gt;
Tested-by: Charles Keepax &lt;ckeepax@opensource.cirrus.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
</feed>
