<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/mtd/devices/phram.c, branch linux-6.0.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-05-16T16:37:48+00:00</updated>
<entry>
<title>mtd: phram: Allow cached mappings</title>
<updated>2022-05-16T16:37:48+00:00</updated>
<author>
<name>Vincent Whitchurch</name>
<email>vincent.whitchurch@axis.com</email>
</author>
<published>2022-05-10T15:18:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9401911f2d9f89035f7acebab16e72d43d1282fb'/>
<id>urn:sha1:9401911f2d9f89035f7acebab16e72d43d1282fb</id>
<content type='text'>
Currently phram always uses ioremap(), but this is unnecessary when
normal memory is used.  If the reserved-memory node does not specify the
no-map property, indicating it should be mapped as system RAM and
ioremap() cannot be used on it, use a cached mapping using
memremap(MEMREMAP_WB) instead.

On one of my systems this improves read performance by ~70%.

(Note that this driver has always used normal memcpy/memset functions on
memory obtained from ioremap(), which sparse doesn't like.  There is no
memremap() variant which maps exactly to ioremap() on all architectures,
so that behaviour of the driver is not changed to avoid affecting
existing users, but the sparse warnings are suppressed in the moved code
with __force.)

Signed-off-by: Vincent Whitchurch &lt;vincent.whitchurch@axis.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20220510151822.1809278-1-vincent.whitchurch@axis.com
</content>
</entry>
<entry>
<title>mtd: phram: Allow probing via reserved-memory</title>
<updated>2022-04-25T08:37:49+00:00</updated>
<author>
<name>Vincent Whitchurch</name>
<email>vincent.whitchurch@axis.com</email>
</author>
<published>2022-04-12T13:53:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7090d2f1d66767928b6f24def05b715ed18e5c6f'/>
<id>urn:sha1:7090d2f1d66767928b6f24def05b715ed18e5c6f</id>
<content type='text'>
Allow phram to be probed from the devicetree.  It expects to be in a
reserved-memory node as documented by the bindings.  This allows things
like partitioning to be specified via the devicetree.

Signed-off-by: Vincent Whitchurch &lt;vincent.whitchurch@axis.com&gt;
Acked-by: Rob Herring &lt;robh@kernel.org&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20220412135302.1682890-4-vincent.whitchurch@axis.com
</content>
</entry>
<entry>
<title>mtd: phram: Prevent divide by zero bug in phram_setup()</title>
<updated>2022-01-25T09:32:07+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2022-01-21T11:55:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3e3765875b1b8864898603768fd5c93eeb552211'/>
<id>urn:sha1:3e3765875b1b8864898603768fd5c93eeb552211</id>
<content type='text'>
The problem is that "erasesize" is a uint64_t type so it might be
non-zero but the lower 32 bits are zero so when it's truncated,
"(uint32_t)erasesize", then that value is zero. This leads to a
divide by zero bug.

Avoid the bug by delaying the divide until after we have validated
that "erasesize" is non-zero and within the uint32_t range.

Fixes: dc2b3e5cbc80 ("mtd: phram: use div_u64_rem to stop overwrite len in phram_setup")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20220121115505.GI1978@kadam
</content>
</entry>
<entry>
<title>mtd: phram: Fix error return code in phram_setup()</title>
<updated>2021-05-10T08:44:34+00:00</updated>
<author>
<name>Yu Kuai</name>
<email>yukuai3@huawei.com</email>
</author>
<published>2021-04-08T13:38:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=da1e6fe563e62801fa033255f68c0bb9bf8c2c69'/>
<id>urn:sha1:da1e6fe563e62801fa033255f68c0bb9bf8c2c69</id>
<content type='text'>
Return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Yu Kuai &lt;yukuai3@huawei.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20210408133812.1209798-1-yukuai3@huawei.com
</content>
</entry>
<entry>
<title>mtd: phram: use div_u64_rem to stop overwrite len in phram_setup</title>
<updated>2021-01-27T12:45:51+00:00</updated>
<author>
<name>yangerkun</name>
<email>yangerkun@huawei.com</email>
</author>
<published>2021-01-25T12:49:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dc2b3e5cbc8087224fcd8698b0dc56131e0bf37d'/>
<id>urn:sha1:dc2b3e5cbc8087224fcd8698b0dc56131e0bf37d</id>
<content type='text'>
We now support user to set erase page size, and use do_div between len
and erase size to determine the reasonableness for the erase size.
However, do_div is a macro and will overwrite the value of len. Which
results a mtd device with unexcepted size. Fix it by use div_u64_rem.

Fixes: ffad560394de ("mtd: phram: Allow the user to set the erase page size.")
Signed-off-by: yangerkun &lt;yangerkun@huawei.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20210125124936.651812-1-yangerkun@huawei.com
</content>
</entry>
<entry>
<title>mtd: phram: Allow the user to set the erase page size.</title>
<updated>2020-12-07T11:29:19+00:00</updated>
<author>
<name>Patrick O'Grady</name>
<email>patrick@baymotion.com</email>
</author>
<published>2020-12-07T09:55:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ffad560394de3338f3c1c9680add65a84d87a7c4'/>
<id>urn:sha1:ffad560394de3338f3c1c9680add65a84d87a7c4</id>
<content type='text'>
Permit the user to specify the erase page size as a parameter.
This solves two problems:

- phram can access images made by mkfs.jffs2.  mkfs.jffs2 won't
create images with erase sizes less than 8KiB; many architectures
define PAGE_SIZE as 4KiB.

- Allows more effective use of small capacity devices.  JFFS2
needs somewhere between 2 and 5 empty pages for garbage collection;
and for an NVRAM part with only 32KiB of space, a smaller erase page
allows much better utilization in applications where garbage collection
is important.

Signed-off-by: Patrick O'Grady &lt;patrick@baymotion.com&gt;
Reviewed-by: Joern Engel &lt;joern@logfs.org&gt;
Link: https://lore.kernel.org/lkml/CAJ7m5OqYv_=JB9NhHsqBsa8YU0DFRoP7C+W10PY22wonAGJK=A@mail.gmail.com/
[Guohua Zhong: fix token array index out of bounds and update patch for kernel master branch]
Signed-off-by: Guohua Zhong &lt;zhongguohua1@huawei.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20201207095529.20896-1-zhongguohua1@huawei.com
</content>
</entry>
<entry>
<title>mtd: devices: phram: File headers are not good candidates for kernel-doc</title>
<updated>2020-11-20T11:37:29+00:00</updated>
<author>
<name>Lee Jones</name>
<email>lee.jones@linaro.org</email>
</author>
<published>2020-11-09T18:21:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5fddeda7d3a87b5bb945cc756875d6adc7e77389'/>
<id>urn:sha1:5fddeda7d3a87b5bb945cc756875d6adc7e77389</id>
<content type='text'>
Fixes the following W=1 kernel build warning(s):

 drivers/mtd/devices/phram.c:19: warning: Function parameter or member 'fmt' not described in 'pr_fmt'

Cc: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Cc: Richard Weinberger &lt;richard@nod.at&gt;
Cc: Vignesh Raghavendra &lt;vigneshr@ti.com&gt;
Cc: "Jochen Schäuble" &lt;psionic@psionic.de&gt;
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Lee Jones &lt;lee.jones@linaro.org&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20201109182206.3037326-3-lee.jones@linaro.org
</content>
</entry>
<entry>
<title>mtd: Convert fallthrough comments into statements</title>
<updated>2020-03-30T08:14:54+00:00</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2020-03-25T21:21:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=025a06c1104cd8995646b761d117816b5f28c873'/>
<id>urn:sha1:025a06c1104cd8995646b761d117816b5f28c873</id>
<content type='text'>
Use Joe Perches cvt_fallthrough.pl script to convert

	/* fallthrough */

comments (and its derivatives) into a

	fallthrough;

statement. This automatically drops useless ones.

Do it MTD-wide.

Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Acked-by: Vignesh Raghavendra &lt;vigneshr@ti.com&gt;
Acked-by: Tudor Ambarus &lt;tudor.ambarus@microchip.com&gt;
Acked-by: Richard Weinberger &lt;richard@nod.at&gt;
Link: https://lore.kernel.org/linux-mtd/20200325212115.14170-1-miquel.raynal@bootlin.com
</content>
</entry>
<entry>
<title>mtd: phram: fix a double free issue in error path</title>
<updated>2020-03-24T22:01:36+00:00</updated>
<author>
<name>Wen Yang</name>
<email>wenyang@linux.alibaba.com</email>
</author>
<published>2020-03-18T15:31:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=49c64df880570034308e4a9a49c4bc95cf8cdb33'/>
<id>urn:sha1:49c64df880570034308e4a9a49c4bc95cf8cdb33</id>
<content type='text'>
The variable 'name' is released multiple times in the error path,
which may cause double free issues.
This problem is avoided by adding a goto label to release the memory
uniformly. And this change also makes the code a bit more cleaner.

Fixes: 4f678a58d335 ("mtd: fix memory leaks in phram_setup")
Signed-off-by: Wen Yang &lt;wenyang@linux.alibaba.com&gt;
Cc: Joern Engel &lt;joern@lazybastard.org&gt;
Cc: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Cc: Richard Weinberger &lt;richard@nod.at&gt;
Cc: Vignesh Raghavendra &lt;vigneshr@ti.com&gt;
Cc: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Link: https://lore.kernel.org/linux-mtd/20200318153156.25612-1-wenyang@linux.alibaba.com
</content>
</entry>
<entry>
<title>mtd: phram: Module parameters add writable permissions</title>
<updated>2019-09-15T21:50:38+00:00</updated>
<author>
<name>Xiaoming Ni</name>
<email>nixiaoming@huawei.com</email>
</author>
<published>2019-07-14T03:57:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f3d45ac21e464f24cb97b3f6cc68be8eef7f7b56'/>
<id>urn:sha1:f3d45ac21e464f24cb97b3f6cc68be8eef7f7b56</id>
<content type='text'>
The phram code implements managing multiple devices through a linked
list.
However, due to the module parameter permission of 0, the
/sys/module/phram/parameters/phram interface is missing.
The command line arguments in insmod can only create one device.

Therefore, add writable permissions to the module parameters, create
/sys/module/phram/parameters/phram interface, and create multi-device
support.

Signed-off-by: Xiaoming Ni &lt;nixiaoming@huawei.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
</entry>
</feed>
