linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: dedekind1@gmail.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH v3] mtd/docg3: fixes and cleanups
Date: Fri, 09 Dec 2011 17:13:46 +0100	[thread overview]
Message-ID: <877h2590zp.fsf@free.fr> (raw)
In-Reply-To: <1323066682.2316.18.camel@koala> (Artem Bityutskiy's message of "Mon, 05 Dec 2011 08:31:19 +0200")

Artem Bityutskiy <dedekind1@gmail.com> writes:

> On Fri, 2011-12-02 at 20:00 +0100, Robert Jarzmik wrote:
>> This patch takes into account checkpatch, sparse and ECC
>> comments.
>> 
>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>
> Pushed to l2-mtd-2.6.git, thanks. But I still see this warning when
> I compile on x86_64:
>
> drivers/mtd/devices/docg3.c:1050:12: warning: ‘doc_get_erase_count’ defined
> but not used [-Wunused-function]

Hi Artem,

I have found no clean and good way to handle the erase count.  As a fallback,
please accept the following patch which removes the unused function. It's kind
of a "looser" approach, but that's the best I can do by now.

The patch is based on your current l2-tree (commit
af64b37f63189cef7575fb3f8e670df767c3e15b "mtdoops: fix the oops_page_used array
size").

Cheers.

--
Robert

>From c87ece988e535905702b40460c6685984f08db88 Mon Sep 17 00:00:00 2001
From: Robert Jarzmik <robert.jarzmik@free.fr>
Date: Fri, 9 Dec 2011 17:02:49 +0100
Subject: [PATCH] mtd: docg3: remove unused function

As the MTD api has no use for the number of erase cycles
each block has endured, remove the function which calculated
that value.

If one day MTD api finds it usefull for wear levelling
algorithms to have this information, the function should be
put back in place.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/mtd/devices/docg3.c |   42 ------------------------------------------
 1 files changed, 0 insertions(+), 42 deletions(-)

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 2a32072..f05c5bc 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1038,48 +1038,6 @@ static int doc_block_isbad(struct mtd_info *mtd, loff_t from)
 }
 
 /**
- * doc_get_erase_count - Get block erase count
- * @docg3: the device
- * @from: the offset in which the block is.
- *
- * Get the number of times a block was erased. The number is the maximum of
- * erase times between first and second plane (which should be equal normally).
- *
- * Returns The number of erases, or -EINVAL or -EIO on error.
- */
-static int doc_get_erase_count(struct docg3 *docg3, loff_t from)
-{
-	u8 buf[DOC_LAYOUT_WEAR_SIZE];
-	int ret, plane1_erase_count, plane2_erase_count;
-	int block0, block1, page, ofs;
-
-	doc_dbg("doc_get_erase_count(from=%lld, buf=%p)\n", from, buf);
-	if (from % DOC_LAYOUT_PAGE_SIZE)
-		return -EINVAL;
-	calc_block_sector(from, &block0, &block1, &page, &ofs, docg3->reliable);
-	if (block1 > docg3->max_block)
-		return -EINVAL;
-
-	ret = doc_reset_seq(docg3);
-	if (!ret)
-		ret = doc_read_page_prepare(docg3, block0, block1, page,
-					    ofs + DOC_LAYOUT_WEAR_OFFSET);
-	if (!ret)
-		ret = doc_read_page_getbytes(docg3, DOC_LAYOUT_WEAR_SIZE,
-					     buf, 1);
-	doc_read_page_finish(docg3);
-
-	if (ret || (buf[0] != DOC_ERASE_MARK) || (buf[2] != DOC_ERASE_MARK))
-		return -EIO;
-	plane1_erase_count = (u8)(~buf[1]) | ((u8)(~buf[4]) << 8)
-		| ((u8)(~buf[5]) << 16);
-	plane2_erase_count = (u8)(~buf[3]) | ((u8)(~buf[6]) << 8)
-		| ((u8)(~buf[7]) << 16);
-
-	return max(plane1_erase_count, plane2_erase_count);
-}
-
-/**
  * doc_get_op_status - get erase/write operation status
  * @docg3: the device
  *
-- 
1.7.5.4

  parent reply	other threads:[~2011-12-09 16:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29 22:09 [PATCH v2] mtd/docg3: fixes and cleanups Robert Jarzmik
2011-12-01  8:05 ` Artem Bityutskiy
2011-12-02 18:57   ` Robert Jarzmik
2011-12-02 19:00   ` [PATCH v3] " Robert Jarzmik
2011-12-05  6:31     ` Artem Bityutskiy
2011-12-07 20:45       ` Robert Jarzmik
2011-12-09 16:13       ` Robert Jarzmik [this message]
2011-12-12 21:13         ` Artem Bityutskiy
2011-12-12 22:03           ` Robert Jarzmik
2011-12-13  4:16             ` Mike Dunn
2011-12-16 22:25             ` Robert Jarzmik
2011-12-17 15:08               ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877h2590zp.fsf@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=dedekind1@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).