Re: [PATCH]: Fixing blksz_bits calling inside drivers/mmc/mmc.c and drivers/mmc/omap.c

Dirk Behme
2006-10-27T16:45:50Z

Felipe Balbi wrote:
>>> Index: linux-omap/drivers/mmc/omap.c
>>> ===================================================================
>>> --- linux-omap.orig/drivers/mmc/omap.c 2006-10-27
>>> 09:18:34.000000000 -0400
>>> +++ linux-omap/drivers/mmc/omap.c 2006-10-27 11:03:14.000000000 -0400
>>> @@ -633,10 +633,10 @@ mmc_omap_prepare_dma(struct mmc_omap_hos
>>> int sync_dev = 0;
>>>
>>> data_addr = host->phys_base + OMAP_MMC_REG_DATA;
>>> - frame = 1 << data->blksz_bits;
>>> + frame = 1 << data->blksz;
>>> count = sg_dma_len(sg);
>>>
>>> - if ((data->blocks == 1) && (count > (1 << data->blksz_bits)))
>>> + if ((data->blocks == 1) && (count > (1 << data->blksz)))
>>> count = frame;
>>>
>>> host->dma_len = count;
>>> @@ -825,7 +825,7 @@ mmc_omap_prepare_data(struct mmc_omap_ho
>>> }
>>>
>>>
>>> - block_size = 1 << data->blksz_bits;
>>> + block_size = 1 << data->blksz;
>>>
>>> OMAP_MMC_WRITE(host, NBLK, data->blocks - 1);
>>> OMAP_MMC_WRITE(host, BLEN, block_size - 1);
>>>
>>> --- linux-omap/drivers/mmc/mmc.c 2006-10-26 06:42:31.000000000 -0400
>>> +++ linux-omap-dev/drivers/mmc/mmc.c 2006-10-26 09:53:24.000000000
>>> -0400
>>> @@ -996,7 +996,7 @@
>>>
>>> mmc_set_data_timeout(&data, card, 0);
>>>
>>> - data.blksz = 1 << 3;
>>> + data.blksz_bits = 1 << 3;
>>> data.blocks = 1;
>>> data.flags = MMC_DATA_READ;
>>> data.sg = &sg;
>>
>>
>> This doesn't look correct to me (and compilation still
>> fails). Why do you add data.blksz_bits in mmc.c again? It
>> was removed by RMK at
>>
>> http://source.mvista.com/git/gitweb.cgi?p=linux-omap-2.6.git;a=blobdiff;h=5b9caa7978d34311839840243e38921255f6da4b;hp=74eaaee66de0e59532ba5655fddac5aaeea5ba08;hb=132919ba80ad207755fe271277bfefff865a54fe;f=drivers/mmc/mmc.c
>>
>>
>> Whats about the attachment instead? It additionally
>> removes warning
>>
>> drivers/mmc/omap.c:587: warning: 'mmc_omap_switch_callback'
>> defined but not used
>>
>> too.
>>
>> Signed-off-by: Dirk Behme <dirk.behme_at_gmail.com>
>> ------------------------------------------------------------------------
>>
>> Index: linux-osk/drivers/mmc/omap.c
>> ===================================================================
>> --- linux-osk.orig/drivers/mmc/omap.c
>> +++ linux-osk/drivers/mmc/omap.c
>> @@ -581,12 +581,6 @@ static void mmc_omap_switch_timer(unsign
>> schedule_work(&host->switch_work);
>> }
>>
>> -/* FIXME: Handle card insertion and removal properly. Maybe use a mask
>> - * for MMC state? */
>> -static void mmc_omap_switch_callback(unsigned long data, u8 mmc_mask)
>> -{
>> -}
>> -
>> static void mmc_omap_switch_handler(void *data)
>> {
>> struct mmc_omap_host *host = (struct mmc_omap_host *) data;
>> @@ -633,10 +627,10 @@ mmc_omap_prepare_dma(struct mmc_omap_hos
>> int sync_dev = 0;
>>
>> data_addr = host->phys_base + OMAP_MMC_REG_DATA;
>> - frame = 1 << data->blksz_bits;
>> + frame = data->blksz;
>> count = sg_dma_len(sg);
>>
>> - if ((data->blocks == 1) && (count > (1 << data->blksz_bits)))
>> + if ((data->blocks == 1) && (count > (data->blksz)))
>> count = frame;
>>
>> host->dma_len = count;
>> @@ -825,7 +819,7 @@ mmc_omap_prepare_data(struct mmc_omap_ho
>> }
>>
>>
>> - block_size = 1 << data->blksz_bits;
>> + block_size = data->blksz;
>>
>> OMAP_MMC_WRITE(host, NBLK, data->blocks - 1);
>> OMAP_MMC_WRITE(host, BLEN, block_size - 1);
>>
>>
>>
>
> But then you will need to modify the struct mmc_data...

Mmh, why? Above patch compiles for me.

blksz is part of the global struct mmc_data, isn't it?

http://source.mvista.com/git/gitweb.cgi?p=linux-omap-2.6.git;a=commitdiff;h=132919ba80ad207755fe271277bfefff865a54fe

http://source.mvista.com/git/gitweb.cgi?p=linux-omap-2.6.git;a=commit;h=132919ba80ad207755fe271277bfefff865a54fe

Do we both talk about recent git? Or do you use an other or
locally modified version?

Best regards

Dirk