Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: mmc_spi: Don't mention DMA direction

Since driver doesn't handle any DMA requests, drop any use of DMA bits,
such as DMA direction. Instead, use MMC_DATA_WRITE flag directly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240304184830.1319526-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Andy Shevchenko and committed by
Ulf Hansson
a5f372a1 67e90a7d

+14 -16
+14 -16
drivers/mmc/host/mmc_spi.c
··· 15 15 #include <linux/slab.h> 16 16 #include <linux/module.h> 17 17 #include <linux/bio.h> 18 - #include <linux/dma-direction.h> 19 18 #include <linux/crc7.h> 20 19 #include <linux/crc-itu-t.h> 21 20 #include <linux/scatterlist.h> ··· 509 510 * so we explicitly initialize it to all ones on RX paths. 510 511 */ 511 512 static void 512 - mmc_spi_setup_data_message( 513 - struct mmc_spi_host *host, 514 - bool multiple, 515 - enum dma_data_direction direction) 513 + mmc_spi_setup_data_message(struct mmc_spi_host *host, bool multiple, bool write) 516 514 { 517 515 struct spi_transfer *t; 518 516 struct scratch *scratch = host->data; ··· 519 523 /* for reads, readblock() skips 0xff bytes before finding 520 524 * the token; for writes, this transfer issues that token. 521 525 */ 522 - if (direction == DMA_TO_DEVICE) { 526 + if (write) { 523 527 t = &host->token; 524 528 memset(t, 0, sizeof(*t)); 525 529 t->len = 1; ··· 543 547 t = &host->crc; 544 548 memset(t, 0, sizeof(*t)); 545 549 t->len = 2; 546 - if (direction == DMA_TO_DEVICE) { 550 + if (write) { 547 551 /* the actual CRC may get written later */ 548 552 t->tx_buf = &scratch->crc_val; 549 553 } else { ··· 566 570 * the next token (next data block, or STOP_TRAN). We can try to 567 571 * minimize I/O ops by using a single read to collect end-of-busy. 568 572 */ 569 - if (multiple || direction == DMA_TO_DEVICE) { 573 + if (multiple || write) { 570 574 t = &host->early_status; 571 575 memset(t, 0, sizeof(*t)); 572 - t->len = (direction == DMA_TO_DEVICE) ? sizeof(scratch->status) : 1; 576 + t->len = write ? sizeof(scratch->status) : 1; 573 577 t->tx_buf = host->ones; 574 578 t->rx_buf = scratch->status; 575 579 t->cs_change = 1; ··· 773 777 { 774 778 struct spi_device *spi = host->spi; 775 779 struct spi_transfer *t; 776 - enum dma_data_direction direction = mmc_get_dma_dir(data); 777 780 struct scatterlist *sg; 778 781 unsigned n_sg; 779 782 bool multiple = (data->blocks > 1); 780 - const char *write_or_read = (direction == DMA_TO_DEVICE) ? "write" : "read"; 783 + bool write = (data->flags & MMC_DATA_WRITE); 784 + const char *write_or_read = write ? "write" : "read"; 781 785 u32 clock_rate; 782 786 unsigned long timeout; 783 787 784 - mmc_spi_setup_data_message(host, multiple, direction); 788 + mmc_spi_setup_data_message(host, multiple, write); 785 789 t = &host->t; 786 790 787 791 if (t->speed_hz) ··· 803 807 804 808 /* allow pio too; we don't allow highmem */ 805 809 kmap_addr = kmap(sg_page(sg)); 806 - if (direction == DMA_TO_DEVICE) 810 + if (write) 807 811 t->tx_buf = kmap_addr + sg->offset; 808 812 else 809 813 t->rx_buf = kmap_addr + sg->offset; ··· 814 818 815 819 dev_dbg(&spi->dev, " %s block, %d bytes\n", write_or_read, t->len); 816 820 817 - if (direction == DMA_TO_DEVICE) 821 + if (write) 818 822 status = mmc_spi_writeblock(host, t, timeout); 819 823 else 820 824 status = mmc_spi_readblock(host, t, timeout); ··· 829 833 } 830 834 831 835 /* discard mappings */ 832 - if (direction == DMA_FROM_DEVICE) 836 + if (write) 837 + /* nothing to do */; 838 + else 833 839 flush_dcache_page(sg_page(sg)); 834 840 kunmap(sg_page(sg)); 835 841 ··· 848 850 * that can affect the STOP_TRAN logic. Complete (and current) 849 851 * MMC specs should sort that out before Linux starts using CMD23. 850 852 */ 851 - if (direction == DMA_TO_DEVICE && multiple) { 853 + if (write && multiple) { 852 854 struct scratch *scratch = host->data; 853 855 int tmp; 854 856 const unsigned statlen = sizeof(scratch->status);