All of lore.kernel.org
 help / color / mirror / Atom feed
From: <tomas.melin@vaisala.com>
To: linux-mmc@vger.kernel.org
Cc: tomas.melin@vaisala.com
Subject: [PATCH] mmc-utils: Fix reported offset for enhanced user area start address
Date: Thu, 25 Aug 2016 04:23:05 +0000	[thread overview]
Message-ID: <fbed5a25-65a0-47f1-e4b4-839149973441@vaisala.com> (raw)

Block-addressed devices should have address multiplied with sector size.

Clarify with comment how is_blockaddressed() is calculated.

Signed-off-by: Tomas Melin<tomas.melin@vaisala.com>
---
  mmc_cmds.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mmc_cmds.c b/mmc_cmds.c
index 295d505..21ddd55 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -794,7 +794,7 @@ unsigned int get_sector_count(__u8 *ext_csd)
  int is_blockaddresed(__u8 *ext_csd)
  {
      unsigned int sectors = get_sector_count(ext_csd);
-
+        /* over 2GiB devices are block-addressed */
      return (sectors > (2u * 1024 * 1024 * 1024) / 512);
  }

@@ -1659,7 +1659,7 @@ int do_read_extcsd(int nargs, char **argv)
          printf("Enhanced User Data Start Address"
              " [ENH_START_ADDR]: 0x%06x\n", regl);
          printf(" i.e. %lu bytes offset\n", (is_blockaddresed(ext_csd) ?
-                1l : 512l) * regl);
+                512l : 1l) * regl);

          /* A441]: reserved [135] */
          printf("Bad Block Management mode"
-- 
2.1.4

             reply	other threads:[~2016-08-25  4:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25  4:23 tomas.melin [this message]
2016-08-25  7:05 ` [PATCH] mmc-utils: Fix reported offset for enhanced user area start address Ulf Hansson
     [not found]   ` <CAG=SpYEaoOk7Wr1oqPvuSGQePods1TUcZazF928We3+5uz5rFw@mail.gmail.com>
2016-09-01  5:56     ` tomas.melin

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=fbed5a25-65a0-47f1-e4b4-839149973441@vaisala.com \
    --to=tomas.melin@vaisala.com \
    --cc=linux-mmc@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.