linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libmtd: allow write operations when MEMWRITE is not supported
@ 2011-12-09 19:45 Brian Norris
  2011-12-12 21:26 ` Artem Bityutskiy
  2011-12-12 21:29 ` Artem Bityutskiy
  0 siblings, 2 replies; 9+ messages in thread
From: Brian Norris @ 2011-12-09 19:45 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Brian Norris, linux-mtd

MEMWRITE is a recently introduced write interface for MTD; however, it
is, for now, only supported on NAND flash. mtd-utils should fall back to
old write methods when either ENOTTY or EOPNOTSUPP are returned.

This is a showstopper when, for instance, using ubiformat on NOR, which
don't have a mtd->write_oob interface (and thus don't support MEMWRITE):

  ubiformat: formatting eraseblock 2 --  1 % complete  libmtd: error!: MEMWRITE ioctl failed for eraseblock 2 (mtd3)
          error 122 (Operation not supported)

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 lib/libmtd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/libmtd.c b/lib/libmtd.c
index 1b16de5..9b247ae 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -1151,7 +1151,7 @@ int mtd_write(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb,
 	ret = ioctl(fd, MEMWRITE, &ops);
 	if (ret == 0)
 		return 0;
-	else if (errno != ENOTTY)
+	else if (errno != ENOTTY && errno != EOPNOTSUPP)
 		return mtd_ioctl_error(mtd, eb, "MEMWRITE");
 
 	/* Fall back to old methods if necessary */
-- 
1.7.5.4

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

* Re: [PATCH] libmtd: allow write operations when MEMWRITE is not supported
  2011-12-09 19:45 [PATCH] libmtd: allow write operations when MEMWRITE is not supported Brian Norris
@ 2011-12-12 21:26 ` Artem Bityutskiy
  2011-12-12 21:40   ` Brian Norris
  2011-12-12 21:29 ` Artem Bityutskiy
  1 sibling, 1 reply; 9+ messages in thread
From: Artem Bityutskiy @ 2011-12-12 21:26 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd

On Fri, 2011-12-09 at 11:45 -0800, Brian Norris wrote:
> MEMWRITE is a recently introduced write interface for MTD; however, it
> is, for now, only supported on NAND flash. mtd-utils should fall back to
> old write methods when either ENOTTY or EOPNOTSUPP are returned.
> 
> This is a showstopper when, for instance, using ubiformat on NOR, which
> don't have a mtd->write_oob interface (and thus don't support MEMWRITE):
> 
>   ubiformat: formatting eraseblock 2 --  1 % complete  libmtd: error!: MEMWRITE ioctl failed for eraseblock 2 (mtd3)
>           error 122 (Operation not supported)
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>

I guess this require an urgent mtd-utils release.

Also, why you say 'for now', does even make-sense to implement this for
NOR?

I've also just pushed this patch, does it look OK to you?

>From a4699233f927738db633687a2276a9f3e127d799 Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Date: Mon, 12 Dec 2011 23:24:59 +0200
Subject: [PATCH] mtd: document that MEMWRITE ioctl is NAND-specific

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
---
 include/mtd/mtd-abi.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 1a7e1d2..36eace0 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -198,7 +198,8 @@ struct otp_info {
 #define MEMISLOCKED		_IOR('M', 23, struct erase_info_user)
 /*
  * Most generic write interface; can write in-band and/or out-of-band in various
- * modes (see "struct mtd_write_req")
+ * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes
+ * without OOB, e.g., NOR flash.
  */
 #define MEMWRITE		_IOWR('M', 24, struct mtd_write_req)
 
-- 
1.7.6.4

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

* Re: [PATCH] libmtd: allow write operations when MEMWRITE is not supported
  2011-12-09 19:45 [PATCH] libmtd: allow write operations when MEMWRITE is not supported Brian Norris
  2011-12-12 21:26 ` Artem Bityutskiy
@ 2011-12-12 21:29 ` Artem Bityutskiy
  1 sibling, 0 replies; 9+ messages in thread
From: Artem Bityutskiy @ 2011-12-12 21:29 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd

On Fri, 2011-12-09 at 11:45 -0800, Brian Norris wrote:
> MEMWRITE is a recently introduced write interface for MTD; however, it
> is, for now, only supported on NAND flash. mtd-utils should fall back to
> old write methods when either ENOTTY or EOPNOTSUPP are returned.

I've removed "for now, " because I am not sure it will ever be, and
pushed this to mtd-utils.git, thanks!

Artem.

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

* Re: [PATCH] libmtd: allow write operations when MEMWRITE is not supported
  2011-12-12 21:26 ` Artem Bityutskiy
@ 2011-12-12 21:40   ` Brian Norris
  2011-12-17 14:44     ` Artem Bityutskiy
  0 siblings, 1 reply; 9+ messages in thread
From: Brian Norris @ 2011-12-12 21:40 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

On Mon, Dec 12, 2011 at 1:26 PM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> On Fri, 2011-12-09 at 11:45 -0800, Brian Norris wrote:
>> MEMWRITE is a recently introduced write interface for MTD; however, it
>> is, for now, only supported on NAND flash. mtd-utils should fall back to
>> old write methods when either ENOTTY or EOPNOTSUPP are returned.
>>
>> This is a showstopper when, for instance, using ubiformat on NOR, which
>> don't have a mtd->write_oob interface (and thus don't support MEMWRITE):
>>
>>   ubiformat: formatting eraseblock 2 --  1 % complete  libmtd: error!: MEMWRITE ioctl failed for eraseblock 2 (mtd3)
>>           error 122 (Operation not supported)
>>
>> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
>
> I guess this require an urgent mtd-utils release.
>
> Also, why you say 'for now', does even make-sense to implement this for
> NOR?

I think when (somewhat hurriedly) writing this patch, I was
considering issues with the libmtd interface (mtd_write) and with the
ioctl (MEMWRITE). I kinda mixed them up and wrote something that
wasn't really applicable to either one. Deleting "for now" is good.

Another issue: there are strictly non-NAND flash with OOB as well, so
my statement ("only supported on NAND flash") isn't quite as good as
yours ("not supported for flashes without OOB, e.g., NOR flash"). Not
hugely important on a mtd-utils patch though.

> I've also just pushed this patch, does it look OK to you?

Yes, it looks fine.

Brian

P.S. FYI, I don't see the mtd-utils "push" yet.

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

* Re: [PATCH] libmtd: allow write operations when MEMWRITE is not supported
  2011-12-12 21:40   ` Brian Norris
@ 2011-12-17 14:44     ` Artem Bityutskiy
  2011-12-17 15:03       ` Peter Korsgaard
  2011-12-19 18:45       ` Brian Norris
  0 siblings, 2 replies; 9+ messages in thread
From: Artem Bityutskiy @ 2011-12-17 14:44 UTC (permalink / raw)
  To: Brian Norris, Peter Korsgaard; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 1175 bytes --]

On Mon, 2011-12-12 at 13:40 -0800, Brian Norris wrote:
> On Mon, Dec 12, 2011 at 1:26 PM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> > On Fri, 2011-12-09 at 11:45 -0800, Brian Norris wrote:
> >> MEMWRITE is a recently introduced write interface for MTD; however, it
> >> is, for now, only supported on NAND flash. mtd-utils should fall back to
> >> old write methods when either ENOTTY or EOPNOTSUPP are returned.
> >>
> >> This is a showstopper when, for instance, using ubiformat on NOR, which
> >> don't have a mtd->write_oob interface (and thus don't support MEMWRITE):
> >>
> >>   ubiformat: formatting eraseblock 2 --  1 % complete  libmtd: error!: MEMWRITE ioctl failed for eraseblock 2 (mtd3)
> >>           error 122 (Operation not supported)
> >>
> >> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> >
> > I guess this require an urgent mtd-utils release.

OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my
new script, so I hope nothing is forgotten.

Peter, please, update - this release fixes a bad bug which breaks NOR
erase operation in not-yet-released 3.2 kernel.


-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] libmtd: allow write operations when MEMWRITE is not supported
  2011-12-17 14:44     ` Artem Bityutskiy
@ 2011-12-17 15:03       ` Peter Korsgaard
  2011-12-17 15:11         ` Artem Bityutskiy
  2011-12-19 18:45       ` Brian Norris
  1 sibling, 1 reply; 9+ messages in thread
From: Peter Korsgaard @ 2011-12-17 15:03 UTC (permalink / raw)
  To: dedekind1; +Cc: Brian Norris, linux-mtd

>>>>> "Artem" == Artem Bityutskiy <dedekind1@gmail.com> writes:

Hi,

 >> > I guess this require an urgent mtd-utils release.

 Artem> OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my
 Artem> new script, so I hope nothing is forgotten.

 Artem> Peter, please, update - this release fixes a bad bug which breaks NOR
 Artem> erase operation in not-yet-released 3.2 kernel.

Thanks for the heads up, I was just about to rebase a NOR-using platform
to 3.2.

Updated buildroot. It builds fine here, so it seems like the script is
working.

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH] libmtd: allow write operations when MEMWRITE is not supported
  2011-12-17 15:03       ` Peter Korsgaard
@ 2011-12-17 15:11         ` Artem Bityutskiy
  0 siblings, 0 replies; 9+ messages in thread
From: Artem Bityutskiy @ 2011-12-17 15:11 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Brian Norris, linux-mtd

[-- Attachment #1: Type: text/plain, Size: 827 bytes --]

On Sat, 2011-12-17 at 16:03 +0100, Peter Korsgaard wrote:
> >>>>> "Artem" == Artem Bityutskiy <dedekind1@gmail.com> writes:
> 
> Hi,
> 
>  >> > I guess this require an urgent mtd-utils release.
> 
>  Artem> OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my
>  Artem> new script, so I hope nothing is forgotten.
> 
>  Artem> Peter, please, update - this release fixes a bad bug which breaks NOR
>  Artem> erase operation in not-yet-released 3.2 kernel.
> 
> Thanks for the heads up, I was just about to rebase a NOR-using platform
> to 3.2.
> 
> Updated buildroot. It builds fine here, so it seems like the script is
> working.

Notice also than now we also provide the mtd-utils-1.4.9.tar.bz2.asc
tarball signature and we also sign the mtd-utils tags.

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] libmtd: allow write operations when MEMWRITE is not supported
  2011-12-17 14:44     ` Artem Bityutskiy
  2011-12-17 15:03       ` Peter Korsgaard
@ 2011-12-19 18:45       ` Brian Norris
  2011-12-19 20:38         ` Artem Bityutskiy
  1 sibling, 1 reply; 9+ messages in thread
From: Brian Norris @ 2011-12-19 18:45 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

On Sat, Dec 17, 2011 at 6:44 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my
> new script, so I hope nothing is forgotten.

Well, it seems like you didn't update the master branch; I had to `git
fetch --tags` to get to the v1.4.9 tag, which is ahead of master. I
don't know if that needs/requires an update to your release script to
ensure you don't miss it in the future?

Brian

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

* Re: [PATCH] libmtd: allow write operations when MEMWRITE is not supported
  2011-12-19 18:45       ` Brian Norris
@ 2011-12-19 20:38         ` Artem Bityutskiy
  0 siblings, 0 replies; 9+ messages in thread
From: Artem Bityutskiy @ 2011-12-19 20:38 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-mtd

On Mon, 2011-12-19 at 10:45 -0800, Brian Norris wrote:
> On Sat, Dec 17, 2011 at 6:44 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> > OK, I've cut mtd-utils-1.4.9 bug-fix release, this time with my
> > new script, so I hope nothing is forgotten.
> 
> Well, it seems like you didn't update the master branch; I had to `git
> fetch --tags` to get to the v1.4.9 tag, which is ahead of master. I
> don't know if that needs/requires an update to your release script to
> ensure you don't miss it in the future?

Oh, good point, I've pushed the tag but not the branch :-) Fixed,
thanks!

Artem.

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

end of thread, other threads:[~2011-12-19 20:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-09 19:45 [PATCH] libmtd: allow write operations when MEMWRITE is not supported Brian Norris
2011-12-12 21:26 ` Artem Bityutskiy
2011-12-12 21:40   ` Brian Norris
2011-12-17 14:44     ` Artem Bityutskiy
2011-12-17 15:03       ` Peter Korsgaard
2011-12-17 15:11         ` Artem Bityutskiy
2011-12-19 18:45       ` Brian Norris
2011-12-19 20:38         ` Artem Bityutskiy
2011-12-12 21:29 ` Artem Bityutskiy

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).