linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mtd: adapt misleading comment in mtd_oob_ops structure
@ 2018-07-18 20:33 Miquel Raynal
  2018-07-19 21:16 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Miquel Raynal @ 2018-07-18 20:33 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, David Woodhouse,
	Brian Norris, Marek Vasut
  Cc: linux-mtd, Miquel Raynal

A comment in the kernel doc of the mtd_oob_ops structure tells that it
is not possible to write more than one page with OOB. This is actually
true for only a few MTD devices like 'onenand' but it is definitely not
a general limitation. While this would benefit to be handled elsewhere
either by the MTD layer or by the limited drivers, let's update this
comment to reflect the reality.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---

Changes since v1:
=================
* Boris pointed out that this comment was not entirely false but rather
  too much restrictive compared to the reality and proposed an
  alternative that I simply copied there.


 include/linux/mtd/mtd.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a86c4fa93115..cd0be91bdefa 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -67,9 +67,11 @@ struct mtd_erase_region_info {
  * @datbuf:	data buffer - if NULL only oob data are read/written
  * @oobbuf:	oob data buffer
  *
- * Note, it is allowed to read more than one OOB area at one go, but not write.
- * The interface assumes that the OOB write requests program only one page's
- * OOB area.
+ * Note, some MTD drivers do not allow you to write more than one OOB area at
+ * one go. If you try to do that on such an MTD device, -EINVAL will be
+ * returned. If you want to make your implementation portable on all kind of MTD
+ * devices you should split the write request into several sub-requests when the
+ * request crosses a page boundary.
  */
 struct mtd_oob_ops {
 	unsigned int	mode;
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mtd: adapt misleading comment in mtd_oob_ops structure
  2018-07-18 20:33 [PATCH v2] mtd: adapt misleading comment in mtd_oob_ops structure Miquel Raynal
@ 2018-07-19 21:16 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2018-07-19 21:16 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	linux-mtd

On Wed, 18 Jul 2018 22:33:02 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> A comment in the kernel doc of the mtd_oob_ops structure tells that it
> is not possible to write more than one page with OOB. This is actually
> true for only a few MTD devices like 'onenand' but it is definitely not
> a general limitation. While this would benefit to be handled elsewhere
> either by the MTD layer or by the limited drivers, let's update this
> comment to reflect the reality.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Applied.

Thanks,

Boris

> ---
> 
> Changes since v1:
> =================
> * Boris pointed out that this comment was not entirely false but rather
>   too much restrictive compared to the reality and proposed an
>   alternative that I simply copied there.
> 
> 
>  include/linux/mtd/mtd.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index a86c4fa93115..cd0be91bdefa 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -67,9 +67,11 @@ struct mtd_erase_region_info {
>   * @datbuf:	data buffer - if NULL only oob data are read/written
>   * @oobbuf:	oob data buffer
>   *
> - * Note, it is allowed to read more than one OOB area at one go, but not write.
> - * The interface assumes that the OOB write requests program only one page's
> - * OOB area.
> + * Note, some MTD drivers do not allow you to write more than one OOB area at
> + * one go. If you try to do that on such an MTD device, -EINVAL will be
> + * returned. If you want to make your implementation portable on all kind of MTD
> + * devices you should split the write request into several sub-requests when the
> + * request crosses a page boundary.
>   */
>  struct mtd_oob_ops {
>  	unsigned int	mode;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-19 21:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-18 20:33 [PATCH v2] mtd: adapt misleading comment in mtd_oob_ops structure Miquel Raynal
2018-07-19 21:16 ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).