RE: [PATCH v2] mmc: block: avoid multiblock reads for the last sector in SPI mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> @@ -1370,6 +1370,16 @@ static void mmc_blk_data_prep(struct mmc_queue
> *mq, struct mmc_queue_req *mqrq,
>  		brq->data.blocks = card->host->max_blk_count;
> 
>  	if (brq->data.blocks > 1) {
> +		/*
> +		 * Some SD cards in SPI mode return a CRC error or even lock
> up
> +		 * completely when trying to read the last block using a
> +		 * multiblock read command.
> +		 */
> +		if (mmc_host_is_spi(card->host) && (rq_data_dir(req) ==
> READ) &&
> +		    (blk_rq_pos(req) + blk_rq_sectors(req) ==
> +		     get_capacity(md->disk)))
> +			brq->data.blocks--;
> +
data.blocks is being assigned about 4 times in this function.
Maybe do all that in a small wrapper, which might do that more effectively,
And document its logic?

Thanks,
Avri




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux