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

From: NamJae Jeon
Date: Wed Sep 28 2011 - 21:03:33 EST


2011/9/29 Andrei Warkentin <awarkentin@xxxxxxxxxx>:
> Hi Namjae,
>
> In general I think your approach is fine and solves the problem. See further inline
> comments.
>
> ----- Original Message -----
>> From: "Namjae Jeon" <linkinjeon@xxxxxxxxx>
>> To: cjb@xxxxxxxxxx, linux-mmc@xxxxxxxxxxxxxxx
>> Cc: linux-kernel@xxxxxxxxxxxxxxx, awarkentin@xxxxxxxxxx, "adrian hunter" <adrian.hunter@xxxxxxxxx>, "james p
>> freyensee" <james_p_freyensee@xxxxxxxxxxxxxxx>, "Namjae Jeon" <linkinjeon@xxxxxxxxx>
>> Sent: Saturday, September 24, 2011 1:07:00 AM
>> Subject: [PATCH v2] 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 mmcblk0gp4
>> Â Â Â Â Â 179 160 4096 mmcblk0gp3
>> Â Â Â Â Â 179 128 4096 mmcblk0gp2
>> Â Â Â Â Â 179 96 Â1052672 mmcblk0gp1
>> Â Â Â Â Â 179 64 Â1024 mmcblk0boot1
>> Â Â Â Â Â 179 32 Â1024 mmcblk0boot0
>>
>> Signed-off-by: Namjae Jeon <linkinjeon@xxxxxxxxx>
>
>> + Â Â Â Â Â Â if (ext_csd[EXT_CSD_BOOT_MULT]) {
>> + Â Â Â Â Â Â Â Â Â Â for (i = 0, boot_part_config = 0x1;
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â i < MMC_NUM_BOOT_PARTITION;
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â i++, boot_part_config++) {
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->part[i].size = ...
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->part[i].cookie = ...
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â sprintf(card->part[i].name, "boot%d", i);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->part[i].force_ro = ...
>> + Â Â Â Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â }
>> Â Â Â }
>>
>>
>> + Â Â Â Â Â Â if (ext_csd[EXT_CSD_PARTITION_SUPPORT] & 0x1) {
>> + Â Â Â Â Â Â Â Â Â Â ....
>> + Â Â Â Â Â Â Â Â Â Â int i, gp_num, gp_part_config, gp_size_mult;
>> + Â Â Â Â Â Â Â Â Â Â for (i = 2, gp_num = 1, gp_part_config = 0x4,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->part[i].size = ...
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->part[i].cookie = ...
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â sprintf(card->part[i].name,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "gp%d", gp_num);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â card->part[i].force_ro = ..
>> + Â Â Â Â Â Â Â Â Â Â }
>> + Â Â Â Â Â Â }
>>
>
> I feel that you should factor out a function that operates on the static part[] array and
> adds a new entry base name, index (i.e. the %d for gp%d), cookie, size, force.
> Otherwise you end up with these hidden mines like fixed indeces for
> particular parts (i = 2, etc...) which becomes indecipherable for others.
> Plus you're mostly doing the same thing.
>
Hi.
I think that factoring out a function will be not inefficient by many
agument and size calculation,. etc.
And I agree about readabiliby, readability is dropped by some fixed
value. so I will modify current patch.
plz review one more when I post new patch.
Thanks.
> Thanks,
> A
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/