Re: [PATCH v3] mmc : general purpose partition support.

From: NamJae Jeon
Date: Thu Sep 29 2011 - 21:32:39 EST


2011/9/30 Andrei Warkentin <awarkentin@xxxxxxxxxx>:
> Namjae,
>
> ----- Original Message -----
>> From: "Namjae Jeon" <linkinjeon@xxxxxxxxx>
>> To: cjb@xxxxxxxxxx, linux-mmc@xxxxxxxxxxxxxxx
>> Cc: linux-kernel@xxxxxxxxxxxxxxx, awarkentin@xxxxxxxxxx, "adrian hunter" <adrian.hunter@xxxxxxxxx>, "linus walleij"
>> <linus.walleij@xxxxxxxxxx>, "james p freyensee" <james_p_freyensee@xxxxxxxxxxxxxxx>, sebras@xxxxxxxxx, "Ulf Hansson"
>> <Ulf.Hansson@xxxxxxxxxxxxxx>, "stefan xk nilsson" <stefan.xk.nilsson@xxxxxxxxxxxxxx>, "per forlin"
>> <per.forlin@xxxxxxxxxxxxxx>, "johan rudholm" <johan.rudholm@xxxxxxxxxxxxxx>, "Namjae Jeon" <linkinjeon@xxxxxxxxx>
>> Sent: Thursday, September 29, 2011 11:17:11 AM
>> Subject: [PATCH v3] mmc : general purpose partition support.
>>
>> It allows gerneral purpose partitions in MMC Device.
>> And I try to simpliy make mmc_blk_alloc_parts using mmc_part
>> structure suggested by Andrei Warkentin.
>> After patching, we can see general purpose partitions like this.
>> > cat /proc/partitions
>> Â Â Â Â Â Â Â 179 0 847872 mmcblk0
>> Â Â Â Â Â Â Â 179 192 4096 mmcblk0gp3
>> Â Â Â Â Â Â Â 179 160 4096 mmcblk0gp2
>> Â Â Â Â Â Â Â 179 128 4096 mmcblk0gp1
>> Â Â Â Â Â Â Â 179 96 Â1052672 mmcblk0gp0
>> Â Â Â Â Â Â Â 179 64 Â1024 mmcblk0boot1
>> Â Â Â Â Â Â Â 179 32 Â1024 mmcblk0boot0
>>
>> Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxx>
>
>> + Â Â Âfor (idx = 0; idx < MMC_NUM_BOOT_PARTITION; idx++) {
>> + Â Â Â Â Â Â if (card->boot_part[idx].size) {
>> + Â Â Â Â Â Â Â Â Â Â ret = mmc_blk_alloc_part(card, md,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->boot_part[idx].cookie,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->boot_part[idx].size >> 9,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->boot_part[idx].force_ro,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->boot_part[idx].name);
>> + Â Â Â Â Â Â Â Â Â Â if (ret)
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â return ret;
>> + Â Â Â Â Â Â }
>> + Â Â }
>> +
>> + Â Â for (idx = 0; idx < MMC_NUM_GP_PARTITION; idx++) {
>> + Â Â Â Â Â Â if (card->gp_part[idx].size) {
>> + Â Â Â Â Â Â Â Â Â Â ret = mmc_blk_alloc_part(card, md,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->gp_part[idx].cookie,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->gp_part[idx].size >> 9,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->gp_part[idx].force_ro,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->gp_part[idx].name);
>> + Â Â Â Â Â Â Â Â Â Â if (ret)
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â return ret;
>
> You were on a better track before. Why does the block drivre need to know about the partition types?
> You should parse one array.
>
>> - Â Â Â Â Â Â card->ext_csd.boot_size = ext_csd[EXT_CSD_BOOT_MULT] << 17;
>> + Â Â Â Â Â Â if (ext_csd[EXT_CSD_BOOT_MULT]) {
>> + Â Â Â Â Â Â Â Â Â Â part_cfg = EXT_CSD_PART_CONFIG_ACC_BOOT0;
>> + Â Â Â Â Â Â Â Â Â Â for (idx = 0; idx < MMC_NUM_BOOT_PARTITION; idx++) {
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->boot_part[idx].size =
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ext_csd[EXT_CSD_BOOT_MULT] << 17;
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->boot_part[idx].cookie = part_cfg++;
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â sprintf(card->boot_part[idx].name, "boot%d",
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â idx);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->boot_part[idx].force_ro = true;
>> + Â Â Â Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â }
>> Â Â Â }
>>
>
> My earlier comment still stands - make your code look something like -
>
> if (ext_csd[EXT_CSD_BOOT_MULT]) {
> Â Â Â Âpart_cfg = EXT_CSD_PART_CONFIG_ACC_BOOT0;
> Â Â Â Âfor (idx = 0; idx < MMC_NUM_BOOT_PARTITION; idx++) {
> Â Â Â Â Â Â Â Âmmc_part_add(card, size, part_cfg++, "boot%d", part_cfg++,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â"boot%d", idx, true)
> }
>
>> + Â Â struct mmc_part boot_part[MMC_NUM_BOOT_PARTITION]; Â Â Â/* mmc boot
>> partitions */
>> + Â Â struct mmc_part gp_part[MMC_NUM_GP_PARTITION]; Â/* mmc general
>> purpose partitions */
>
> struct mmc_part parts[MMC_NUM_BOOT_PARTITION + MMC_NUM_GP_PARTITION];
> unsigned nr_parts;
>

Your review will always inspire me.
I will post again.
plz review after..
Thanks.
> A
>
N‹§²æìr¸›yúèšØb²X¬¶ÇvØ^–)Þ{.nÇ+‰·¥Š{±‘êçzX§¶›¡Ü}©ž²ÆzÚ&j:+v‰¨¾«‘êçzZ+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹®w¥¢¸?™¨è­Ú&¢)ßf”ù^jÇy§m…á@A«a¶Úÿ 0¶ìh®å’i