Re: [PATCHv2 1/1] ANDROID: mmc: core: export emmc revision

From: Linus Walleij
Date: Thu Oct 12 2017 - 03:32:13 EST


On Wed, Oct 11, 2017 at 10:51 PM, Jin Qian <jinqian@xxxxxxxxxxx> wrote:

> From: Jin Qian <jinqian@xxxxxxxxxx>
>
> Expose emmc revision as part of device attributes.
>
> Signed-off-by: Jin Qian <jinqian@xxxxxxxxxxx>

So have you tried and seen what happens with an MMC that
is not an eMMC, i.e. a good old MMC card from back in the days?

Does it display all zeroes or something?

I think it is by far a better idea that Android start to read out these
things using the ioctl() operation and cut this sysfs business.

Example, see:
https://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git/tree/mmc_cmds.c
there is int read_extcsd() immediately in the top of the file.
The ioctl()s are a much better way to do this.

The ioctl() will read the extcsd
on the fly from the card, and what you see in sysfs is just read
when the card is initialized and then kept static.

Since the extcsd is not static but can change at runtime, I think
what you want to to is ioctl()s.

If we start to support reading extcsd from sysfs, the implementation
cannot just use the static copy of ext_csd like this, it needs to
ask the card for it using MMC_DRV_OP_GET_EXT_CSD
see
commit 627c3ccfb46ada2583eac434127ad5d75e1ac33c
"mmc: debugfs: Move block debugfs into block module"

Yours,
Linus Walleij